~thomas-voss/platform-api/add-package-config

« back to all changes in this revision

Viewing changes to src/hybris/hybris_bridge.cpp

  • Committer: Thomas Voß
  • Date: 2013-06-20 12:26:40 UTC
  • mfrom: (67.1.1 fix-cmake-setup)
  • Revision ID: thomas.voss@canonical.com-20130620122640-ytzwepxb9qiijzgq
[ Gerry Boland ]
* Add mir suport.
[ Robert Carr ]
* Add mir suport.
[ Ubuntu daily release ]
* Automatic snapshot from revision 69
[ Ricardo Mendoza ]
* Allow remote App Manager to take care of signalling processes.
[ Ubuntu daily release ]
* Automatic snapshot from revision 67

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2013 Canonical Ltd
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify
 
5
 * it under the terms of the GNU Lesser General Public License version 3 as
 
6
 * published by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authored by: Thomas Voss <thomas.voss@canonical.com>
 
17
 *              Ricardo Mendoza <ricardo.mendoza@canonical.com>
 
18
 */
 
19
 
 
20
#include "hybris_bridge.h"
 
21
 
 
22
#include <dlfcn.h>
 
23
#include <assert.h>
 
24
 
 
25
namespace uh = ubuntu::hybris;
 
26
 
 
27
extern "C" {
 
28
 
 
29
extern void *android_dlopen(const char *filename, int flag);
 
30
extern void *android_dlsym(void *handle, const char *symbol);
 
31
 
 
32
}
 
33
 
 
34
const char* uh::Bridge::path_to_library()
 
35
{
 
36
    return "/system/lib/libubuntu_application_api.so";
 
37
}
 
38
 
 
39
uh::Bridge& uh::Bridge::instance()
 
40
{
 
41
    static uh::Bridge bridge;
 
42
    return bridge;
 
43
}
 
44
 
 
45
uh::Bridge::Bridge()
 
46
    : lib_handle(android_dlopen(path_to_library(), RTLD_LAZY))
 
47
{
 
48
    assert(lib_handle && "Error loading ubuntu_application_api");
 
49
}
 
50
 
 
51
uh::Bridge::~Bridge()
 
52
{
 
53
    // TODO android_dlclose(libcamera_handle);
 
54
}
 
55
 
 
56
void* uh::Bridge::resolve_symbol(const char* symbol) const
 
57
{
 
58
    return android_dlsym(lib_handle, symbol);
 
59
}