Merge lp:~ricmm/platform-api/v2-dynamic-refactor into lp:platform-api
- v2-dynamic-refactor
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Sebastien Bacher |
Approved revision: | 264 |
Merged at revision: | 224 |
Proposed branch: | lp:~ricmm/platform-api/v2-dynamic-refactor |
Merge into: | lp:platform-api |
Diff against target: |
5504 lines (+3027/-1672) 75 files modified
CMakeLists.txt (+12/-31) debian/changelog (+10/-0) debian/control (+117/-82) debian/libplatform-api1-hybris-tests.install (+0/-7) debian/libubuntu-application-api-dev.install (+0/-2) debian/libubuntu-application-api-doc.install (+1/-1) debian/libubuntu-application-api-headers.install (+1/-0) debian/libubuntu-application-api-mirclient1.install (+0/-1) debian/libubuntu-application-api-mirclient1.symbols (+0/-126) debian/libubuntu-application-api-mirserver1.install (+0/-1) debian/libubuntu-application-api-mirserver1.symbols (+0/-128) debian/libubuntu-application-api2.symbols (+22/-27) debian/libubuntu-platform-hardware-api2.symbols (+1/-1) debian/rules (+0/-3) debian/ubuntu-application-api2-desktop.install (+2/-0) debian/ubuntu-application-api2-examples.install (+7/-0) debian/ubuntu-application-api2-test.docs (+1/-1) debian/ubuntu-application-api2-touch.install (+2/-0) examples/CMakeLists.txt (+29/-0) examples/test_c_api.cpp (+4/-4) examples/test_haptic_device.cpp (+44/-0) examples/test_location_api.cpp (+5/-5) examples/test_multiple_surfaces_event_delivery.cpp (+5/-5) examples/test_sensors_api.cpp (+4/-4) examples/test_session_c_api.cpp (+4/-4) include/ubuntu/application/CMakeLists.txt (+1/-0) include/ubuntu/application/init.h (+63/-0) include/ubuntu/application/sensors/CMakeLists.txt (+2/-1) include/ubuntu/application/sensors/haptic.h (+98/-0) src/bridge/bridge.h (+63/-0) src/bridge/bridge_defs.h (+136/-0) src/ubuntu/CMakeLists.txt (+2/-0) src/ubuntu/application/CMakeLists.txt (+37/-29) src/ubuntu/application/base_module.h (+107/-0) src/ubuntu/application/common/CMakeLists.txt (+8/-0) src/ubuntu/application/common/application/CMakeLists.txt (+1/-0) src/ubuntu/application/common/application/sensors/CMakeLists.txt (+21/-0) src/ubuntu/application/common/application/sensors/sensors_p.h (+43/-0) src/ubuntu/application/common/application/sensors/service.cpp (+103/-0) src/ubuntu/application/common/application/sensors/usensord_service.h (+80/-0) src/ubuntu/application/common/mirclient/CMakeLists.txt (+8/-15) src/ubuntu/application/common/mirclient/ubuntu_application_api_mirclient.cpp (+10/-5) src/ubuntu/application/common/mircommon/CMakeLists.txt (+0/-14) src/ubuntu/application/common/mirserver/CMakeLists.txt (+8/-20) src/ubuntu/application/common/mirserver/ubuntu_application_api_mirserver.cpp (+16/-8) src/ubuntu/application/desktop/CMakeLists.txt (+66/-0) src/ubuntu/application/desktop/module.cpp (+28/-0) src/ubuntu/application/desktop/module_version.h (+3/-0) src/ubuntu/application/testbackend/CMakeLists.txt (+11/-1) src/ubuntu/application/testbackend/module.cpp (+28/-0) src/ubuntu/application/testbackend/module_version.h (+3/-0) src/ubuntu/application/testbackend/test_stubs.cpp (+463/-0) src/ubuntu/application/touch/CMakeLists.txt (+68/-0) src/ubuntu/application/touch/hybris/CMakeLists.txt (+7/-53) src/ubuntu/application/touch/hybris/hybris_module.h (+24/-190) src/ubuntu/application/touch/hybris/ubuntu_application_api_hybris.cpp (+1/-1) src/ubuntu/application/touch/hybris/ubuntu_application_sensors_hybris.cpp (+1/-1) src/ubuntu/application/touch/module.cpp (+28/-0) src/ubuntu/application/touch/module_version.h (+3/-0) src/ubuntu/application/ubuntu_application_api.cpp (+222/-0) src/ubuntu/hardware/CMakeLists.txt (+45/-0) src/ubuntu/hardware/android_hw_module.h (+61/-0) src/ubuntu/hardware/tests/CMakeLists.txt (+17/-0) src/ubuntu/hardware/tests/test_alarms_api.cpp (+62/-0) src/ubuntu/hardware/tests/test_gps_api.cpp (+287/-0) src/ubuntu/hardware/ubuntu_platform_hardware_api.cpp (+103/-0) src/ubuntu/hybris/tests/CMakeLists.txt (+0/-33) src/ubuntu/hybris/tests/test_alarms_api.cpp (+0/-74) src/ubuntu/hybris/tests/test_gps_api.cpp (+0/-286) src/ubuntu/hybris/ubuntu_platform_hardware_api.cpp (+0/-103) src/ubuntu/mirserver/ubuntu_application_api_mirserver_priv.h (+0/-43) tests/CMakeLists.txt (+36/-17) tests/test_ua_sensors_mock.cpp (+268/-0) tests/test_ua_sensors_real.cpp (+114/-0) tests/test_ubuntu_application_sensors.cpp (+0/-345) |
To merge this branch: | bzr merge lp:~ricmm/platform-api/v2-dynamic-refactor |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sebastien Bacher | Approve | ||
Thomas Voß (community) | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Ricardo Salveti (community) | Needs Fixing | ||
Alexander Sack (community) | Needs Information | ||
Review via email: mp+220721@code.launchpad.net |
Commit message
Ver2 Platform-API
* Structure changes
* Dynamic backend loading
* Flexible testing providers
Description of the change
The following branches are needed to make use of whats provided here:
https:/
https:/
https:/
The main functionality introduced here is dynamic loading. All linkage should now happen against lubuntu_
Options are: touch_mirclient, touch_mirserver, desktop_mirclient, desktop_mirserver, test
There's also included support for usensord's haptic interface.
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:244
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:247
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Thomas Voß (thomas-voss) wrote : | # |
Hey Ricardo,
thanks for the massive cleanup effort here :) Looks good so far, a minor niggle:
* l. 1804: Commented out, please remove.
For MODULE_VERSION: I was thinking if we should resort to MODULE_
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:248
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:249
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:250
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:251
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:252
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:253
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:255
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ricardo Salveti (rsalveti) : | # |
Ricardo Salveti (rsalveti) : | # |
Alexander Sack (asac) wrote : | # |
What are we doing with v1? Will that stay on the image and supported?
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:256
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:257
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alexander Sack (asac) wrote : | # |
> What are we doing with v1? Will that stay on the image and supported?
"lets discuss this"...
Ricardo Salveti (rsalveti) wrote : | # |
> > What are we doing with v1? Will that stay on the image and supported?
The idea is to kill v1 and migrate everything to v2. v1 is not officially supported by our SDK at this point, and we don't yet have external costumers for it.
We know we need to stabilize it before RTM, and that will happen once it get officially included in the SDK (frameworks).
Ricardo Salveti (rsalveti) : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:258
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:260
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:261
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:262
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:263
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Sebastien Bacher (seb128) wrote : | # |
Some review comments
* libubuntu-
* same for libubuntu-
* Not sure why you are creating dummy transitionnal packages for all binaries, that's usually needed to make upgrades easier to calculate for packages with reverse depends, it's not likely needed for e.g examples or documentation binaries though...
*
examples/
examples/
examples/
examples/
examples/
examples/
src/ubuntu/
src/ubuntu/
The debian/copyright claims that all sources, out of the android ones, are LGPL ... either those files need to be changed or the copyright needs to be updated
* you versioned some new symbols "2.0.0-0ubuntu1", please either drop the revision or use the replace tag
Sebastien Bacher (seb128) wrote : | # |
thanks for the update, looks good now!
Preview Diff
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2014-05-22 15:12:16 +0000 |
3 | +++ CMakeLists.txt 2014-06-11 12:19:49 +0000 |
4 | @@ -2,8 +2,8 @@ |
5 | |
6 | project(ubuntu-platform-api) |
7 | |
8 | -set(UBUNTU_PLATFORM_API_VERSION_MAJOR 1) |
9 | -set(UBUNTU_PLATFORM_API_VERSION_MINOR 2) |
10 | +set(UBUNTU_PLATFORM_API_VERSION_MAJOR 2) |
11 | +set(UBUNTU_PLATFORM_API_VERSION_MINOR 0) |
12 | set(UBUNTU_PLATFORM_API_VERSION_PATCH 0) |
13 | |
14 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") |
15 | @@ -57,37 +57,17 @@ |
16 | ON |
17 | ) |
18 | |
19 | -option( |
20 | - ENABLE_MIRSERVER_IMPLEMENTATION |
21 | - "Enable mirserver based platorm API implementation" |
22 | - OFF |
23 | -) |
24 | - |
25 | -if(ENABLE_MIRSERVER_IMPLEMENTATION) |
26 | - find_package(PkgConfig) |
27 | - pkg_check_modules(MIRSERVER REQUIRED mirserver) |
28 | -endif(ENABLE_MIRSERVER_IMPLEMENTATION) |
29 | - |
30 | -option( |
31 | - ENABLE_MIRCLIENT_IMPLEMENTATION |
32 | - "Enable mirclient based platform API implementation" |
33 | - OFF |
34 | -) |
35 | - |
36 | -if(ENABLE_MIRCLIENT_IMPLEMENTATION) |
37 | - find_package(PkgConfig) |
38 | - pkg_check_modules(MIRCLIENT REQUIRED mirclient) |
39 | - |
40 | - find_package(Protobuf REQUIRED) |
41 | - if(PROTOBUF_PROTOC_EXECUTABLE STREQUAL "PROTOBUF_PROTOC_EXECUTABLE-NOTFOUND") |
42 | - message(SEND_ERROR "protoc executable not found! Missing protobuf-compiler package?") |
43 | - endif() |
44 | -endif(ENABLE_MIRCLIENT_IMPLEMENTATION) |
45 | - |
46 | -if(ENABLE_MIRCLIENT_IMPLEMENTATION OR ENABLE_MIRSERVER_IMPLEMENTATION) |
47 | - pkg_check_modules(MIRCOMMON REQUIRED mircommon) |
48 | +find_package(PkgConfig) |
49 | +pkg_check_modules(MIRSERVER REQUIRED mirserver) |
50 | +pkg_check_modules(MIRCLIENT REQUIRED mirclient) |
51 | + |
52 | +find_package(Protobuf REQUIRED) |
53 | +if(PROTOBUF_PROTOC_EXECUTABLE STREQUAL "PROTOBUF_PROTOC_EXECUTABLE-NOTFOUND") |
54 | + message(SEND_ERROR "protoc executable not found! Missing protobuf-compiler package?") |
55 | endif() |
56 | |
57 | +pkg_check_modules(MIRCOMMON REQUIRED mircommon) |
58 | + |
59 | # Try to find hybris, and disable hybris from build if not found |
60 | find_library(Hybris |
61 | NAMES hybris-common |
62 | @@ -105,6 +85,7 @@ |
63 | add_subdirectory(doc/) |
64 | add_subdirectory(include/) |
65 | add_subdirectory(src/) |
66 | +add_subdirectory(examples/) |
67 | |
68 | #### Enable tests |
69 | include(CTest) |
70 | |
71 | === modified file 'debian/changelog' |
72 | --- debian/changelog 2014-06-05 14:08:48 +0000 |
73 | +++ debian/changelog 2014-06-11 12:19:49 +0000 |
74 | @@ -1,3 +1,13 @@ |
75 | +platform-api (2.0.0-0ubuntu1) UNRELEASED; urgency=medium |
76 | + |
77 | + * Bump API version to 2.0 |
78 | + * Introduce support for dynamic backend loading |
79 | + * Package naming changes |
80 | + * Further support for test backend |
81 | + * Unified bridge |
82 | + |
83 | + -- Ricardo Mendoza <ricardo.mendoza@canonical.com> Mon, 19 May 2014 16:53:45 +0200 |
84 | + |
85 | platform-api (1.2.0+14.10.20140605-0ubuntu1) utopic; urgency=low |
86 | |
87 | [ Ubuntu daily release ] |
88 | |
89 | === modified file 'debian/control' |
90 | --- debian/control 2014-06-02 21:32:54 +0000 |
91 | +++ debian/control 2014-06-11 12:19:49 +0000 |
92 | @@ -27,9 +27,11 @@ |
93 | # just go ahead. ~phablet-team will notice and sync up the code again. |
94 | Vcs-Browser: https://code.launchpad.net/platform-api |
95 | |
96 | -Package: libplatform-api-headers |
97 | +Package: libubuntu-application-api-headers |
98 | Section: libdevel |
99 | Architecture: any |
100 | +Replaces: libplatform-api-headers (<< 2.0.0) |
101 | +Breaks: libplatform-api-headers (<< 2.0.0) |
102 | Pre-Depends: ${misc:Pre-Depends}, |
103 | Multi-Arch: same |
104 | Depends: ${misc:Depends}, |
105 | @@ -40,9 +42,11 @@ |
106 | should build depend on the libplatform-api-dev package instead, which |
107 | will pull this package as well. |
108 | |
109 | -Package: libplatform-hardware-api-headers |
110 | +Package: libubuntu-platform-hardware-api-headers |
111 | Section: libdevel |
112 | Architecture: any |
113 | +Replaces: libplatform-hardware-api-headers (<< 2.0.0) |
114 | +Breaks: libplatform-hardware-api-headers (<< 2.0.0) |
115 | Pre-Depends: ${misc:Pre-Depends}, |
116 | Multi-Arch: same |
117 | Depends: ${misc:Depends}, |
118 | @@ -51,75 +55,81 @@ |
119 | This package provides the library headers for the hw-access parts of the Platform API. |
120 | . |
121 | Unless a new backend for the Platform API is developed, packages |
122 | - should build depend on the libplatform-hardware-api-dev package instead, which |
123 | + should build depend on the libubuntu-platform-hardware-api-dev package instead, which |
124 | will pull this package as well. |
125 | |
126 | -Package: libplatform-api1-dev |
127 | +Package: libubuntu-application-api-dev |
128 | Section: libdevel |
129 | Architecture: any |
130 | +Replaces: libplatform-api1-dev (<< 2.0.0) |
131 | +Breaks: libplatform-api1-dev (<< 2.0.0) |
132 | Pre-Depends: ${misc:Pre-Depends}, |
133 | Multi-Arch: same |
134 | Depends: ${misc:Depends}, |
135 | libgles2-mesa-dev, |
136 | - libplatform-api-headers (= ${binary:Version}), |
137 | - libubuntu-application-api1 | libplatform-api1, |
138 | - libubuntu-application-api-mirserver1 (= ${binary:Version}), |
139 | - libubuntu-application-api-mirclient1 (= ${binary:Version}), |
140 | + libubuntu-application-api-headers (= ${binary:Version}), |
141 | + libubuntu-application-api2, |
142 | + ubuntu-application-api2-touch (= ${binary:Version}), |
143 | + ubuntu-application-api2-desktop (= ${binary:Version}), |
144 | ${misc:Depends}, |
145 | -Suggests: libplatform-api1-doc, |
146 | -Description: Platform API for system level capabilities (development) |
147 | +Suggests: libubuntu-application-api-doc, |
148 | +Description: Ubuntu Application API for system level capabilities (development) |
149 | This package provides the development library and headers (via |
150 | - dependency) for the Platform API. |
151 | - |
152 | -Package: libubuntu-application-api-mirserver1 |
153 | -Section: libs |
154 | -Pre-Depends: ${misc:Pre-Depends}, |
155 | -Multi-Arch: same |
156 | -Architecture: any |
157 | -Depends: ${misc:Depends}, |
158 | - ${shlibs:Depends}, |
159 | -Description: Implementation of the Platform API for a Mir server |
160 | - This package provides the implementation of the Platform API to |
161 | - provide a server instance of Mir. |
162 | - |
163 | -Package: libubuntu-application-api-mirclient1 |
164 | -Section: libs |
165 | -Pre-Depends: ${misc:Pre-Depends}, |
166 | -Multi-Arch: same |
167 | -Architecture: any |
168 | -Depends: ${misc:Depends}, |
169 | - ${shlibs:Depends}, |
170 | -Description: Implementation of the Platform API for a Mir client |
171 | - This package provides the implementation of the Platform API to |
172 | - allow a client to connect to a Mir server. |
173 | - |
174 | -Package: libplatform-hardware-api1-dev |
175 | + dependency) for the Ubuntu Application API. |
176 | + |
177 | +Package: ubuntu-application-api2-touch |
178 | +Section: libs |
179 | +Pre-Depends: ${misc:Pre-Depends}, |
180 | +Multi-Arch: same |
181 | +Architecture: any |
182 | +Depends: ${misc:Depends}, |
183 | + ${shlibs:Depends}, |
184 | + libubuntu-application-api2 (= ${binary:Version}), |
185 | +Description: Implementation of the Platform API for Ubuntu Touch |
186 | + This package provides the implementation of the Platform API to |
187 | + bring up an Ubuntu Touch system. |
188 | + |
189 | +Package: ubuntu-application-api2-desktop |
190 | +Section: libs |
191 | +Pre-Depends: ${misc:Pre-Depends}, |
192 | +Multi-Arch: same |
193 | +Architecture: any |
194 | +Depends: ${misc:Depends}, |
195 | + ${shlibs:Depends}, |
196 | + libubuntu-application-api2 (= ${binary:Version}), |
197 | +Description: Implementation of the Platform API for Ubuntu Desktop |
198 | + This package provides the implementation of the Platform API to |
199 | + bring up an Ubuntu Desktop system. |
200 | + |
201 | +Package: libubuntu-platform-hardware-api-dev |
202 | Section: libdevel |
203 | Architecture: any |
204 | +Replaces: libplatform-hardware-api1-dev (<< 2.0.0) |
205 | +Breaks: libplatform-hardware-api1-dev (<< 2.0.0) |
206 | Pre-Depends: ${misc:Pre-Depends}, |
207 | Multi-Arch: same |
208 | Depends: ${misc:Depends}, |
209 | libgles2-mesa-dev, |
210 | - libplatform-hardware-api-headers (= ${binary:Version}), |
211 | - libubuntu-platform-hardware-api1 | libplatform-hardware-api1, |
212 | -Suggests: libplatform-api1-doc, |
213 | + libubuntu-platform-hardware-api-headers (= ${binary:Version}), |
214 | + libubuntu-platform-hardware-api2 |
215 | +Suggests: libubuntu-application-api-doc, |
216 | Description: Platform API for system level capabilities (development) |
217 | This package provides the development library and headers (via |
218 | dependency) for the hw-access portions of the Platform API. |
219 | |
220 | -Package: libplatform-api1-doc |
221 | +Package: libubuntu-application-api-doc |
222 | Section: doc |
223 | Architecture: all |
224 | +Replaces: libplatform-api1-doc (<< 2.0.0) |
225 | +Breaks: libplatform-api1-doc (<< 2.0.0) |
226 | Depends: ${misc:Depends}, |
227 | - libplatform-api1-dev, |
228 | + libubuntu-application-api-dev, |
229 | Description: Platform API for system level capabilities (development) |
230 | This package provides the developer documentation for the Platform API. |
231 | |
232 | -Package: libubuntu-platform-hardware-api1 |
233 | +Package: libubuntu-platform-hardware-api2 |
234 | Section: libs |
235 | Architecture: any |
236 | -Replaces: libplatform-hardware-api1-hybris (<< 0.18.3) |
237 | -Breaks: libplatform-hardware-api1-hybris (<< 0.18.3) |
238 | Pre-Depends: ${misc:Pre-Depends}, |
239 | Multi-Arch: same |
240 | Depends: ${misc:Depends}, |
241 | @@ -130,11 +140,9 @@ |
242 | The produced library should be used via libhybris, to communicate with the |
243 | Android userspace, which is where the device drivers live. |
244 | |
245 | -Package: libubuntu-application-api1 |
246 | +Package: libubuntu-application-api2 |
247 | Section: libs |
248 | Architecture: any |
249 | -Replaces: libplatform-api1-hybris (<< 0.18.3) |
250 | -Breaks: libplatform-api1-hybris (<< 0.18.3) |
251 | Pre-Depends: ${misc:Pre-Depends}, |
252 | Multi-Arch: same |
253 | Depends: ${misc:Depends}, |
254 | @@ -145,13 +153,14 @@ |
255 | The produced library should be used via libhybris, to communicate with the |
256 | Android userspace, which is where the Ubuntu Application Manager lives. |
257 | |
258 | -Package: libubuntu-application-api-test1 |
259 | +Package: ubuntu-application-api2-test |
260 | Section: libs |
261 | Architecture: any |
262 | Pre-Depends: ${misc:Pre-Depends}, |
263 | Multi-Arch: same |
264 | Depends: ${misc:Depends}, |
265 | ${shlibs:Depends}, |
266 | + libubuntu-application-api2 (= ${binary:Version}), |
267 | Description: test implementation of the Platform API |
268 | This package provides an implementation of the Platform API for testing. It |
269 | does not communicate with actual hardware, but reads input from a text file. |
270 | @@ -161,40 +170,66 @@ |
271 | . |
272 | For now this provides simulated sensors. |
273 | |
274 | +Package: ubuntu-application-api2-examples |
275 | +Architecture: any |
276 | +Replaces: libplatform-api1-hybris-tests (<< 2.0.0) |
277 | +Breaks: libplatform-api1-hybris-tests (<< 2.0.0) |
278 | +Depends: ${misc:Depends}, |
279 | + ${shlibs:Depends}, |
280 | + ubuntu-application-api2-test, |
281 | + ubuntu-application-api2-touch | ubuntu-application-api2-desktop, |
282 | +Description: Binary examples for Ubuntu Application API |
283 | + This package provides a set of example programs that excercise most the |
284 | + set of APIs provided by the Application API. |
285 | + |
286 | +Package: libplatform-api-headers |
287 | +Section: oldlibs |
288 | +Architecture: all |
289 | +Depends: libubuntu-application-api-headers, |
290 | + ${misc:Depends}, |
291 | +Description: dummy transitional package for libplatform-api-headers |
292 | + This is a dummy transitional package, please use libubuntu-application-api-headers |
293 | + instead. |
294 | + |
295 | +Package: libplatform-hardware-api-headers |
296 | +Section: oldlibs |
297 | +Architecture: all |
298 | +Depends: libubuntu-platform-hardware-api-headers, |
299 | + ${misc:Depends}, |
300 | +Description: dummy transitional package for libplatform-hardware-api-headers |
301 | + This is a dummy transitional package, please use libubuntu-platform-hardware-api-headers |
302 | + instead. |
303 | + |
304 | +Package: libplatform-api1-dev |
305 | +Section: oldlibs |
306 | +Architecture: all |
307 | +Depends: libubuntu-application-api-dev, |
308 | + ${misc:Depends}, |
309 | +Description: dummy transitional package for libplatform-api1-dev |
310 | + This is a dummy transitional package, please use libubuntu-application-api-dev |
311 | + |
312 | +Package: libplatform-hardware-api1-dev |
313 | +Section: oldlibs |
314 | +Architecture: all |
315 | +Depends: libubuntu-platform-hardware-api-dev, |
316 | + ${misc:Depends}, |
317 | +Description: dummy transitional package for libplatform-hardware-api1-dev |
318 | + This is a dummy transitional package, please use libubuntu-platform-hardware-api-dev |
319 | + instead. |
320 | + |
321 | Package: libplatform-api1-hybris-tests |
322 | -Architecture: any |
323 | -Depends: ${misc:Depends}, |
324 | - ${shlibs:Depends}, |
325 | - libubuntu-application-api1 (= ${binary:Version}), |
326 | -Description: Hybris implementation of the Platform API (tests) |
327 | - This package provides the test cases for the hybris implementation |
328 | - of the Platform API. |
329 | - |
330 | -Package: libubuntu-platform-api1-dev |
331 | -Section: oldlibs |
332 | -Architecture: all |
333 | -Depends: ${misc:Depends}, |
334 | - libplatform-api1-dev (= ${binary:Version}), |
335 | -Description: dummy transitional package for libplatform-api1-dev |
336 | - This is dummy transitional package, please use libplatform-api1-dev instead. |
337 | - . |
338 | - This package can be safely removed. |
339 | - |
340 | -Package: libplatform-api1-hybris |
341 | -Section: oldlibs |
342 | -Architecture: all |
343 | -Depends: libubuntu-application-api1, |
344 | - ${misc:Depends}, |
345 | -Description: dummy transitional package for libplatform-api1-hybris |
346 | - This is a dummy transitional package, please use libubuntu-application-api1 |
347 | - instead. |
348 | - |
349 | -Package: libplatform-hardware-api1-hybris |
350 | -Section: oldlibs |
351 | -Architecture: all |
352 | -Depends: libubuntu-platform-hardware-api1, |
353 | - ${misc:Depends}, |
354 | -Description: dummy transitional package for libplatform-hardware-api1-hybris |
355 | - This is a dummy transitional package, please use libubuntu-platform-hardware-api1 |
356 | - instead. |
357 | +Section: oldlibs |
358 | +Architecture: all |
359 | +Depends: ubuntu-application-api2-examples, |
360 | + ${misc:Depends}, |
361 | +Description: dummy transitional package for libplatform-api1-hybris-tests |
362 | + This is a dummy transitional package, please use ubuntu-application-api2-examples |
363 | + |
364 | +Package: libplatform-api1-doc |
365 | +Section: oldlibs |
366 | +Architecture: all |
367 | +Depends: libubuntu-application-api-doc, |
368 | + ${misc:Depends}, |
369 | +Description: dummy transitional package for libplatform-api1-doc |
370 | + This is a dummy transitional package, please use libubuntu-application-api-doc |
371 | |
372 | |
373 | === removed file 'debian/libplatform-api1-hybris-tests.install' |
374 | --- debian/libplatform-api1-hybris-tests.install 2014-04-04 15:27:22 +0000 |
375 | +++ debian/libplatform-api1-hybris-tests.install 1970-01-01 00:00:00 +0000 |
376 | @@ -1,7 +0,0 @@ |
377 | -usr/bin/test_android_gps_api |
378 | -usr/bin/test_android_sensors_api |
379 | -usr/bin/test_android_ubuntu_app_api |
380 | -usr/bin/test_android_ubuntu_app_api_multiple_surfaces |
381 | -usr/bin/test_android_ubuntu_session_api |
382 | -usr/bin/test_ubuntu_app_api_location_service |
383 | -usr/bin/test_hardware_alarms_api |
384 | |
385 | === renamed file 'debian/libplatform-api1-dev.install' => 'debian/libubuntu-application-api-dev.install' |
386 | --- debian/libplatform-api1-dev.install 2013-08-23 13:53:42 +0000 |
387 | +++ debian/libubuntu-application-api-dev.install 2014-06-11 12:19:49 +0000 |
388 | @@ -1,4 +1,2 @@ |
389 | usr/lib/*/libubuntu_application_api.so |
390 | -usr/lib/*/libubuntu_application_api_mirclient.so |
391 | -usr/lib/*/libubuntu_application_api_mirserver.so |
392 | usr/lib/*/pkgconfig/ubuntu-platform-api.pc |
393 | |
394 | === renamed file 'debian/libplatform-api1-doc.doc-base' => 'debian/libubuntu-application-api-doc.doc-base' |
395 | === renamed file 'debian/libplatform-api1-doc.install' => 'debian/libubuntu-application-api-doc.install' |
396 | --- debian/libplatform-api1-doc.install 2013-07-05 13:50:50 +0000 |
397 | +++ debian/libubuntu-application-api-doc.install 2014-06-11 12:19:49 +0000 |
398 | @@ -1,1 +1,1 @@ |
399 | -usr/share/doc/ubuntu-platform-api |
400 | \ No newline at end of file |
401 | +usr/share/doc/ubuntu-platform-api |
402 | |
403 | === renamed file 'debian/libplatform-api-headers.install' => 'debian/libubuntu-application-api-headers.install' |
404 | --- debian/libplatform-api-headers.install 2014-01-09 18:47:45 +0000 |
405 | +++ debian/libubuntu-application-api-headers.install 2014-06-11 12:19:49 +0000 |
406 | @@ -2,6 +2,7 @@ |
407 | usr/include/ubuntu/unit.h |
408 | usr/include/ubuntu/visibility.h |
409 | usr/include/ubuntu/application |
410 | +usr/include/ubuntu/application/init.h |
411 | usr/include/ubuntu/ui |
412 | usr/include/ubuntu/application/location |
413 | usr/include/ubuntu/application/url_dispatcher |
414 | |
415 | === removed file 'debian/libubuntu-application-api-mirclient1.install' |
416 | --- debian/libubuntu-application-api-mirclient1.install 2013-08-08 17:41:19 +0000 |
417 | +++ debian/libubuntu-application-api-mirclient1.install 1970-01-01 00:00:00 +0000 |
418 | @@ -1,1 +0,0 @@ |
419 | -usr/lib/*/libubuntu_application_api_mirclient.so.* |
420 | |
421 | === removed file 'debian/libubuntu-application-api-mirclient1.symbols' |
422 | --- debian/libubuntu-application-api-mirclient1.symbols 2013-09-23 05:39:42 +0000 |
423 | +++ debian/libubuntu-application-api-mirclient1.symbols 1970-01-01 00:00:00 +0000 |
424 | @@ -1,126 +0,0 @@ |
425 | -libubuntu_application_api_mirclient.so.1 libubuntu-application-api-mirclient1 #MINVER# |
426 | - u_application_description_destroy@Base 0.18.3+13.10.20130813 |
427 | - u_application_description_get_application_id@Base 0.18.3+13.10.20130813 |
428 | - u_application_description_get_application_lifecycle_delegate@Base 0.18.3+13.10.20130813 |
429 | - u_application_description_new@Base 0.18.3+13.10.20130813 |
430 | - u_application_description_set_application_id@Base 0.18.3+13.10.20130813 |
431 | - u_application_description_set_application_lifecycle_delegate@Base 0.18.3+13.10.20130813 |
432 | - u_application_id_compare@Base 0.18.3+13.10.20130813 |
433 | - u_application_id_destroy@Base 0.18.3+13.10.20130813 |
434 | - u_application_id_new_from_stringn@Base 0.18.3+13.10.20130813 |
435 | - u_application_instance_destroy@Base 0.18.3+13.10.20130813 |
436 | - u_application_instance_new_from_description_with_options@Base 0.18.3+13.10.20130813 |
437 | - u_application_instance_ref@Base 0.18.3+13.10.20130813 |
438 | - u_application_instance_run@Base 0.18.3+13.10.20130813 |
439 | - u_application_instance_unref@Base 0.18.3+13.10.20130813 |
440 | - u_application_lifecycle_delegate_destroy@Base 0.18.3+13.10.20130813 |
441 | - u_application_lifecycle_delegate_get_application_about_to_stop_cb@Base 0.18.3+13.10.20130813 |
442 | - u_application_lifecycle_delegate_get_application_resumed_cb@Base 0.18.3+13.10.20130813 |
443 | - u_application_lifecycle_delegate_get_context@Base 0.18.3+13.10.20130813 |
444 | - u_application_lifecycle_delegate_new@Base 0.18.3+13.10.20130813 |
445 | - u_application_lifecycle_delegate_ref@Base 0.18.3+13.10.20130813 |
446 | - u_application_lifecycle_delegate_set_application_about_to_stop_cb@Base 0.18.3+13.10.20130813 |
447 | - u_application_lifecycle_delegate_set_application_resumed_cb@Base 0.18.3+13.10.20130813 |
448 | - u_application_lifecycle_delegate_set_context@Base 0.18.3+13.10.20130813 |
449 | - u_application_lifecycle_delegate_unref@Base 0.18.3+13.10.20130813 |
450 | - u_application_options_destroy@Base 0.18.3+13.10.20130813 |
451 | - u_application_options_get_form_factor@Base 0.18.3+13.10.20130813 |
452 | - u_application_options_get_operation_mode@Base 0.18.3+13.10.20130813 |
453 | - u_application_options_get_stage@Base 0.18.3+13.10.20130813 |
454 | - u_application_options_new_from_cmd_line@Base 0.18.3+13.10.20130813 |
455 | - ua_sensors_accelerometer_disable@Base 0.18.3+13.10.20130813 |
456 | - ua_sensors_accelerometer_enable@Base 0.18.3+13.10.20130813 |
457 | - ua_sensors_accelerometer_get_max_value@Base 0.18.3+13.10.20130813 |
458 | - ua_sensors_accelerometer_get_min_delay@Base 0.18.3+13.10.20130813 |
459 | - ua_sensors_accelerometer_get_min_value@Base 0.18.3+13.10.20130813 |
460 | - ua_sensors_accelerometer_get_resolution@Base 0.18.3+13.10.20130813 |
461 | - ua_sensors_accelerometer_new@Base 0.18.3+13.10.20130813 |
462 | - ua_sensors_accelerometer_set_reading_cb@Base 0.18.3+13.10.20130813 |
463 | - ua_sensors_light_disable@Base 0.18.3+13.10.20130813 |
464 | - ua_sensors_light_enable@Base 0.18.3+13.10.20130813 |
465 | - ua_sensors_light_get_max_value@Base 0.18.3+13.10.20130813 |
466 | - ua_sensors_light_get_min_delay@Base 0.18.3+13.10.20130813 |
467 | - ua_sensors_light_get_min_value@Base 0.18.3+13.10.20130813 |
468 | - ua_sensors_light_get_resolution@Base 0.18.3+13.10.20130813 |
469 | - ua_sensors_light_new@Base 0.18.3+13.10.20130813 |
470 | - ua_sensors_light_set_reading_cb@Base 0.18.3+13.10.20130813 |
471 | - ua_sensors_proximity_disable@Base 0.18.3+13.10.20130813 |
472 | - ua_sensors_proximity_enable@Base 0.18.3+13.10.20130813 |
473 | - ua_sensors_proximity_get_max_value@Base 0.18.3+13.10.20130813 |
474 | - ua_sensors_proximity_get_min_delay@Base 0.18.3+13.10.20130813 |
475 | - ua_sensors_proximity_get_min_value@Base 0.18.3+13.10.20130813 |
476 | - ua_sensors_proximity_get_resolution@Base 0.18.3+13.10.20130813 |
477 | - ua_sensors_proximity_new@Base 0.18.3+13.10.20130813 |
478 | - ua_sensors_proximity_set_reading_cb@Base 0.18.3+13.10.20130813 |
479 | - ua_ui_display_destroy@Base 0.18.3+13.10.20130813 |
480 | - ua_ui_display_get_native_type@Base 0.18.3+13.10.20130813 |
481 | - ua_ui_display_new_with_index@Base 0.18.3+13.10.20130813 |
482 | - ua_ui_display_query_horizontal_res@Base 0.18.3+13.10.20130813 |
483 | - ua_ui_display_query_vertical_res@Base 0.18.3+13.10.20130813 |
484 | - ua_ui_get_clipboard_content@Base 0.18.3+13.10.20130813 |
485 | - ua_ui_session_new_with_properties@Base 0.18.3+13.10.20130813 |
486 | - ua_ui_session_properties_new@Base 0.18.3+13.10.20130813 |
487 | - ua_ui_session_properties_set_remote_pid@Base 0.18.3+13.10.20130813 |
488 | - ua_ui_session_properties_set_type@Base 0.18.3+13.10.20130813 |
489 | - ua_ui_set_clipboard_content@Base 0.18.3+13.10.20130813 |
490 | - ua_ui_window_destroy@Base 0.18.3+13.10.20130813 |
491 | - ua_ui_window_get_native_type@Base 0.18.3+13.10.20130813 |
492 | - ua_ui_window_hide@Base 0.18.3+13.10.20130813 |
493 | - ua_ui_window_move@Base 0.18.3+13.10.20130813 |
494 | - ua_ui_window_new_for_application_with_properties@Base 0.18.3+13.10.20130813 |
495 | - ua_ui_window_properties_destroy@Base 0.18.3+13.10.20130813 |
496 | - ua_ui_window_properties_get_title@Base 0.18.3+13.10.20130813 |
497 | - ua_ui_window_properties_new_for_normal_window@Base 0.18.3+13.10.20130813 |
498 | - ua_ui_window_properties_set_input_cb_and_ctx@Base 0.18.3+13.10.20130813 |
499 | - ua_ui_window_properties_set_role@Base 0.18.3+13.10.20130813 |
500 | - ua_ui_window_properties_set_titlen@Base 0.18.3+13.10.20130813 |
501 | - ua_ui_window_request_fullscreen@Base 0.18.3+13.10.20130813 |
502 | - ua_ui_window_resize@Base 0.18.3+13.10.20130813 |
503 | - ua_ui_window_show@Base 0.18.3+13.10.20130813 |
504 | - uas_accelerometer_event_get_acceleration_x@Base 0.18.3+13.10.20130813 |
505 | - uas_accelerometer_event_get_acceleration_y@Base 0.18.3+13.10.20130813 |
506 | - uas_accelerometer_event_get_acceleration_z@Base 0.18.3+13.10.20130813 |
507 | - uas_accelerometer_event_get_timestamp@Base 0.18.3+13.10.20130813 |
508 | - uas_light_event_get_light@Base 0.18.3+13.10.20130813 |
509 | - uas_light_event_get_timestamp@Base 0.18.3+13.10.20130813 |
510 | - uas_proximity_event_get_distance@Base 0.18.3+13.10.20130813 |
511 | - uas_proximity_event_get_timestamp@Base 0.18.3+13.10.20130813 |
512 | - ua_location_heading_update_get_heading_in_degree@Base 0.19+13.10.20130919.3 |
513 | - ua_location_heading_update_get_timestamp@Base 0.19+13.10.20130919.3 |
514 | - ua_location_heading_update_ref@Base 0.19+13.10.20130919.3 |
515 | - ua_location_heading_update_unref@Base 0.19+13.10.20130919.3 |
516 | - ua_location_position_update_get_altitude_in_meter@Base 0.19+13.10.20130919.3 |
517 | - ua_location_position_update_get_latitude_in_degree@Base 0.19+13.10.20130919.3 |
518 | - ua_location_position_update_get_longitude_in_degree@Base 0.19+13.10.20130919.3 |
519 | - ua_location_position_update_get_timestamp@Base 0.19+13.10.20130919.3 |
520 | - ua_location_position_update_has_altitude@Base 0.19+13.10.20130919.3 |
521 | - ua_location_position_update_ref@Base 0.19+13.10.20130919.3 |
522 | - ua_location_position_update_unref@Base 0.19+13.10.20130919.3 |
523 | - ua_location_service_controller_disable_gps@Base 0.19+13.10.20130919.3 |
524 | - ua_location_service_controller_disable_service@Base 0.19+13.10.20130919.3 |
525 | - ua_location_service_controller_enable_gps@Base 0.19+13.10.20130919.3 |
526 | - ua_location_service_controller_enable_service@Base 0.19+13.10.20130919.3 |
527 | - ua_location_service_controller_query_status@Base 0.19+13.10.20130919.3 |
528 | - ua_location_service_controller_ref@Base 0.19+13.10.20130919.3 |
529 | - ua_location_service_controller_set_status_changed_handler@Base 0.19+13.10.20130919.3 |
530 | - ua_location_service_controller_unref@Base 0.19+13.10.20130919.3 |
531 | - ua_location_service_create_controller@Base 0.19+13.10.20130919.3 |
532 | - ua_location_service_create_session_for_high_accuracy@Base 0.19+13.10.20130919.3 |
533 | - ua_location_service_create_session_for_low_accuracy@Base 0.19+13.10.20130919.3 |
534 | - ua_location_service_session_ref@Base 0.19+13.10.20130919.3 |
535 | - ua_location_service_session_set_heading_updates_handler@Base 0.19+13.10.20130919.3 |
536 | - ua_location_service_session_set_position_updates_handler@Base 0.19+13.10.20130919.3 |
537 | - ua_location_service_session_set_velocity_updates_handler@Base 0.19+13.10.20130919.3 |
538 | - ua_location_service_session_start_heading_updates@Base 0.19+13.10.20130919.3 |
539 | - ua_location_service_session_start_position_updates@Base 0.19+13.10.20130919.3 |
540 | - ua_location_service_session_start_velocity_updates@Base 0.19+13.10.20130919.3 |
541 | - ua_location_service_session_stop_heading_updates@Base 0.19+13.10.20130919.3 |
542 | - ua_location_service_session_stop_position_updates@Base 0.19+13.10.20130919.3 |
543 | - ua_location_service_session_stop_velocity_updates@Base 0.19+13.10.20130919.3 |
544 | - ua_location_service_session_unref@Base 0.19+13.10.20130919.3 |
545 | - ua_location_velocity_update_get_timestamp@Base 0.19+13.10.20130919.3 |
546 | - ua_location_velocity_update_get_velocity_in_meters_per_second@Base 0.19+13.10.20130919.3 |
547 | - ua_location_velocity_update_ref@Base 0.19+13.10.20130919.3 |
548 | - ua_location_velocity_update_unref@Base 0.19+13.10.20130919.3 |
549 | - ua_url_dispatcher_session@Base 0.19+13.10.20130919.3 |
550 | - ua_url_dispatcher_session_open@Base 0.19+13.10.20130919.3 |
551 | \ No newline at end of file |
552 | |
553 | === removed file 'debian/libubuntu-application-api-mirserver1.install' |
554 | --- debian/libubuntu-application-api-mirserver1.install 2013-08-08 17:41:19 +0000 |
555 | +++ debian/libubuntu-application-api-mirserver1.install 1970-01-01 00:00:00 +0000 |
556 | @@ -1,1 +0,0 @@ |
557 | -usr/lib/*/libubuntu_application_api_mirserver.so.* |
558 | |
559 | === removed file 'debian/libubuntu-application-api-mirserver1.symbols' |
560 | --- debian/libubuntu-application-api-mirserver1.symbols 2013-09-23 05:39:42 +0000 |
561 | +++ debian/libubuntu-application-api-mirserver1.symbols 1970-01-01 00:00:00 +0000 |
562 | @@ -1,128 +0,0 @@ |
563 | -libubuntu_application_api_mirserver.so.1 libubuntu-application-api-mirserver1 #MINVER# |
564 | - u_application_description_destroy@Base 0.18.3+13.10.20130813 |
565 | - u_application_description_get_application_id@Base 0.18.3+13.10.20130813 |
566 | - u_application_description_get_application_lifecycle_delegate@Base 0.18.3+13.10.20130813 |
567 | - u_application_description_new@Base 0.18.3+13.10.20130813 |
568 | - u_application_description_set_application_id@Base 0.18.3+13.10.20130813 |
569 | - u_application_description_set_application_lifecycle_delegate@Base 0.18.3+13.10.20130813 |
570 | - u_application_id_compare@Base 0.18.3+13.10.20130813 |
571 | - u_application_id_destroy@Base 0.18.3+13.10.20130813 |
572 | - u_application_id_new_from_stringn@Base 0.18.3+13.10.20130813 |
573 | - u_application_instance_destroy@Base 0.18.3+13.10.20130813 |
574 | - u_application_instance_new_from_description_with_options@Base 0.18.3+13.10.20130813 |
575 | - u_application_instance_ref@Base 0.18.3+13.10.20130813 |
576 | - u_application_instance_run@Base 0.18.3+13.10.20130813 |
577 | - u_application_instance_unref@Base 0.18.3+13.10.20130813 |
578 | - u_application_lifecycle_delegate_destroy@Base 0.18.3+13.10.20130813 |
579 | - u_application_lifecycle_delegate_get_application_about_to_stop_cb@Base 0.18.3+13.10.20130813 |
580 | - u_application_lifecycle_delegate_get_application_resumed_cb@Base 0.18.3+13.10.20130813 |
581 | - u_application_lifecycle_delegate_get_context@Base 0.18.3+13.10.20130813 |
582 | - u_application_lifecycle_delegate_new@Base 0.18.3+13.10.20130813 |
583 | - u_application_lifecycle_delegate_ref@Base 0.18.3+13.10.20130813 |
584 | - u_application_lifecycle_delegate_set_application_about_to_stop_cb@Base 0.18.3+13.10.20130813 |
585 | - u_application_lifecycle_delegate_set_application_resumed_cb@Base 0.18.3+13.10.20130813 |
586 | - u_application_lifecycle_delegate_set_context@Base 0.18.3+13.10.20130813 |
587 | - u_application_lifecycle_delegate_unref@Base 0.18.3+13.10.20130813 |
588 | - u_application_options_destroy@Base 0.18.3+13.10.20130813 |
589 | - u_application_options_get_form_factor@Base 0.18.3+13.10.20130813 |
590 | - u_application_options_get_operation_mode@Base 0.18.3+13.10.20130813 |
591 | - u_application_options_get_stage@Base 0.18.3+13.10.20130813 |
592 | - u_application_options_new_from_cmd_line@Base 0.18.3+13.10.20130813 |
593 | - ua_sensors_accelerometer_disable@Base 0.18.3+13.10.20130813 |
594 | - ua_sensors_accelerometer_enable@Base 0.18.3+13.10.20130813 |
595 | - ua_sensors_accelerometer_get_max_value@Base 0.18.3+13.10.20130813 |
596 | - ua_sensors_accelerometer_get_min_delay@Base 0.18.3+13.10.20130813 |
597 | - ua_sensors_accelerometer_get_min_value@Base 0.18.3+13.10.20130813 |
598 | - ua_sensors_accelerometer_get_resolution@Base 0.18.3+13.10.20130813 |
599 | - ua_sensors_accelerometer_new@Base 0.18.3+13.10.20130813 |
600 | - ua_sensors_accelerometer_set_reading_cb@Base 0.18.3+13.10.20130813 |
601 | - ua_sensors_light_disable@Base 0.18.3+13.10.20130813 |
602 | - ua_sensors_light_enable@Base 0.18.3+13.10.20130813 |
603 | - ua_sensors_light_get_max_value@Base 0.18.3+13.10.20130813 |
604 | - ua_sensors_light_get_min_delay@Base 0.18.3+13.10.20130813 |
605 | - ua_sensors_light_get_min_value@Base 0.18.3+13.10.20130813 |
606 | - ua_sensors_light_get_resolution@Base 0.18.3+13.10.20130813 |
607 | - ua_sensors_light_new@Base 0.18.3+13.10.20130813 |
608 | - ua_sensors_light_set_reading_cb@Base 0.18.3+13.10.20130813 |
609 | - ua_sensors_proximity_disable@Base 0.18.3+13.10.20130813 |
610 | - ua_sensors_proximity_enable@Base 0.18.3+13.10.20130813 |
611 | - ua_sensors_proximity_get_max_value@Base 0.18.3+13.10.20130813 |
612 | - ua_sensors_proximity_get_min_delay@Base 0.18.3+13.10.20130813 |
613 | - ua_sensors_proximity_get_min_value@Base 0.18.3+13.10.20130813 |
614 | - ua_sensors_proximity_get_resolution@Base 0.18.3+13.10.20130813 |
615 | - ua_sensors_proximity_new@Base 0.18.3+13.10.20130813 |
616 | - ua_sensors_proximity_set_reading_cb@Base 0.18.3+13.10.20130813 |
617 | - ua_ui_display_destroy@Base 0.18.3+13.10.20130813 |
618 | - ua_ui_display_get_native_type@Base 0.18.3+13.10.20130813 |
619 | - ua_ui_display_new_with_index@Base 0.18.3+13.10.20130813 |
620 | - ua_ui_display_query_horizontal_res@Base 0.18.3+13.10.20130813 |
621 | - ua_ui_display_query_vertical_res@Base 0.18.3+13.10.20130813 |
622 | - ua_ui_get_clipboard_content@Base 0.18.3+13.10.20130813 |
623 | - ua_ui_mirserver_finish@Base 0.18.3+13.10.20130823 |
624 | - ua_ui_mirserver_init@Base 0.18.3+13.10.20130823 |
625 | - ua_ui_session_new_with_properties@Base 0.18.3+13.10.20130813 |
626 | - ua_ui_session_properties_new@Base 0.18.3+13.10.20130813 |
627 | - ua_ui_session_properties_set_remote_pid@Base 0.18.3+13.10.20130813 |
628 | - ua_ui_session_properties_set_type@Base 0.18.3+13.10.20130813 |
629 | - ua_ui_set_clipboard_content@Base 0.18.3+13.10.20130813 |
630 | - ua_ui_window_destroy@Base 0.18.3+13.10.20130813 |
631 | - ua_ui_window_get_native_type@Base 0.18.3+13.10.20130813 |
632 | - ua_ui_window_hide@Base 0.18.3+13.10.20130813 |
633 | - ua_ui_window_move@Base 0.18.3+13.10.20130813 |
634 | - ua_ui_window_new_for_application_with_properties@Base 0.18.3+13.10.20130813 |
635 | - ua_ui_window_properties_destroy@Base 0.18.3+13.10.20130813 |
636 | - ua_ui_window_properties_get_title@Base 0.18.3+13.10.20130813 |
637 | - ua_ui_window_properties_new_for_normal_window@Base 0.18.3+13.10.20130813 |
638 | - ua_ui_window_properties_set_input_cb_and_ctx@Base 0.18.3+13.10.20130813 |
639 | - ua_ui_window_properties_set_role@Base 0.18.3+13.10.20130813 |
640 | - ua_ui_window_properties_set_titlen@Base 0.18.3+13.10.20130813 |
641 | - ua_ui_window_request_fullscreen@Base 0.18.3+13.10.20130813 |
642 | - ua_ui_window_resize@Base 0.18.3+13.10.20130813 |
643 | - ua_ui_window_show@Base 0.18.3+13.10.20130813 |
644 | - uas_accelerometer_event_get_acceleration_x@Base 0.18.3+13.10.20130813 |
645 | - uas_accelerometer_event_get_acceleration_y@Base 0.18.3+13.10.20130813 |
646 | - uas_accelerometer_event_get_acceleration_z@Base 0.18.3+13.10.20130813 |
647 | - uas_accelerometer_event_get_timestamp@Base 0.18.3+13.10.20130813 |
648 | - uas_light_event_get_light@Base 0.18.3+13.10.20130813 |
649 | - uas_light_event_get_timestamp@Base 0.18.3+13.10.20130813 |
650 | - uas_proximity_event_get_distance@Base 0.18.3+13.10.20130813 |
651 | - uas_proximity_event_get_timestamp@Base 0.18.3+13.10.20130813 |
652 | - ua_location_heading_update_get_heading_in_degree@Base 0.19+13.10.20130919.3 |
653 | - ua_location_heading_update_get_timestamp@Base 0.19+13.10.20130919.3 |
654 | - ua_location_heading_update_ref@Base 0.19+13.10.20130919.3 |
655 | - ua_location_heading_update_unref@Base 0.19+13.10.20130919.3 |
656 | - ua_location_position_update_get_altitude_in_meter@Base 0.19+13.10.20130919.3 |
657 | - ua_location_position_update_get_latitude_in_degree@Base 0.19+13.10.20130919.3 |
658 | - ua_location_position_update_get_longitude_in_degree@Base 0.19+13.10.20130919.3 |
659 | - ua_location_position_update_get_timestamp@Base 0.19+13.10.20130919.3 |
660 | - ua_location_position_update_has_altitude@Base 0.19+13.10.20130919.3 |
661 | - ua_location_position_update_ref@Base 0.19+13.10.20130919.3 |
662 | - ua_location_position_update_unref@Base 0.19+13.10.20130919.3 |
663 | - ua_location_service_controller_disable_gps@Base 0.19+13.10.20130919.3 |
664 | - ua_location_service_controller_disable_service@Base 0.19+13.10.20130919.3 |
665 | - ua_location_service_controller_enable_gps@Base 0.19+13.10.20130919.3 |
666 | - ua_location_service_controller_enable_service@Base 0.19+13.10.20130919.3 |
667 | - ua_location_service_controller_query_status@Base 0.19+13.10.20130919.3 |
668 | - ua_location_service_controller_ref@Base 0.19+13.10.20130919.3 |
669 | - ua_location_service_controller_set_status_changed_handler@Base 0.19+13.10.20130919.3 |
670 | - ua_location_service_controller_unref@Base 0.19+13.10.20130919.3 |
671 | - ua_location_service_create_controller@Base 0.19+13.10.20130919.3 |
672 | - ua_location_service_create_session_for_high_accuracy@Base 0.19+13.10.20130919.3 |
673 | - ua_location_service_create_session_for_low_accuracy@Base 0.19+13.10.20130919.3 |
674 | - ua_location_service_session_ref@Base 0.19+13.10.20130919.3 |
675 | - ua_location_service_session_set_heading_updates_handler@Base 0.19+13.10.20130919.3 |
676 | - ua_location_service_session_set_position_updates_handler@Base 0.19+13.10.20130919.3 |
677 | - ua_location_service_session_set_velocity_updates_handler@Base 0.19+13.10.20130919.3 |
678 | - ua_location_service_session_start_heading_updates@Base 0.19+13.10.20130919.3 |
679 | - ua_location_service_session_start_position_updates@Base 0.19+13.10.20130919.3 |
680 | - ua_location_service_session_start_velocity_updates@Base 0.19+13.10.20130919.3 |
681 | - ua_location_service_session_stop_heading_updates@Base 0.19+13.10.20130919.3 |
682 | - ua_location_service_session_stop_position_updates@Base 0.19+13.10.20130919.3 |
683 | - ua_location_service_session_stop_velocity_updates@Base 0.19+13.10.20130919.3 |
684 | - ua_location_service_session_unref@Base 0.19+13.10.20130919.3 |
685 | - ua_location_velocity_update_get_timestamp@Base 0.19+13.10.20130919.3 |
686 | - ua_location_velocity_update_get_velocity_in_meters_per_second@Base 0.19+13.10.20130919.3 |
687 | - ua_location_velocity_update_ref@Base 0.19+13.10.20130919.3 |
688 | - ua_location_velocity_update_unref@Base 0.19+13.10.20130919.3 |
689 | - ua_url_dispatcher_session@Base 0.19+13.10.20130919.3 |
690 | - ua_url_dispatcher_session_open@Base 0.19+13.10.20130919.3 |
691 | \ No newline at end of file |
692 | |
693 | === renamed file 'debian/libubuntu-application-api1.install' => 'debian/libubuntu-application-api2.install' |
694 | === renamed file 'debian/libubuntu-application-api1.symbols' => 'debian/libubuntu-application-api2.symbols' |
695 | --- debian/libubuntu-application-api1.symbols 2013-08-26 18:07:34 +0000 |
696 | +++ debian/libubuntu-application-api2.symbols 2014-06-11 12:19:49 +0000 |
697 | @@ -1,11 +1,13 @@ |
698 | -libubuntu_application_api.so.1 libubuntu-application-api1 #MINVER# |
699 | +libubuntu_application_api.so.2 libubuntu-application-api2 #MINVER# |
700 | u_application_description_destroy@Base 0.18.1daily13.06.21 |
701 | u_application_description_new@Base 0.18.1daily13.06.21 |
702 | u_application_description_set_application_id@Base 0.18.1daily13.06.21 |
703 | u_application_description_set_application_lifecycle_delegate@Base 0.18.1daily13.06.21 |
704 | + u_application_finish@Base 0replaceme |
705 | u_application_id_compare@Base 0.18.1daily13.06.21 |
706 | u_application_id_destroy@Base 0.18.1daily13.06.21 |
707 | u_application_id_new_from_stringn@Base 0.18.1daily13.06.21 |
708 | + u_application_init@Base 0replaceme |
709 | u_application_instance_new_from_description_with_options@Base 0.18.1daily13.06.21 |
710 | u_application_lifecycle_delegate_new@Base 0.18.1daily13.06.21 |
711 | u_application_lifecycle_delegate_ref@Base 0.18.1daily13.06.21 |
712 | @@ -13,14 +15,15 @@ |
713 | u_application_lifecycle_delegate_set_application_resumed_cb@Base 0.18.1daily13.06.21 |
714 | u_application_lifecycle_delegate_set_context@Base 0.18.1daily13.06.21 |
715 | u_application_lifecycle_delegate_unref@Base 0.18.1daily13.06.21 |
716 | + u_application_module_version@Base 0replaceme |
717 | u_application_options_destroy@Base 0.18.1daily13.06.21 |
718 | u_application_options_get_form_factor@Base 0.18.1daily13.06.21 |
719 | u_application_options_get_stage@Base 0.18.1daily13.06.21 |
720 | u_application_options_new_from_cmd_line@Base 0.18.1daily13.06.21 |
721 | + ua_location_heading_update_get_heading_in_degree@Base 0.18.3+13.10.20130815.1 |
722 | ua_location_heading_update_get_timestamp@Base 0.18.3+13.10.20130807 |
723 | ua_location_heading_update_ref@Base 0.18.3+13.10.20130807 |
724 | ua_location_heading_update_unref@Base 0.18.3+13.10.20130807 |
725 | - ua_location_heading_update_get_heading_in_degree@Base 0.18.3+13.10.20130815.1 |
726 | ua_location_position_update_get_altitude_in_meter@Base 0.18.3+13.10.20130807 |
727 | ua_location_position_update_get_latitude_in_degree@Base 0.18.3+13.10.20130807 |
728 | ua_location_position_update_get_longitude_in_degree@Base 0.18.3+13.10.20130807 |
729 | @@ -28,9 +31,17 @@ |
730 | ua_location_position_update_has_altitude@Base 0.18.3+13.10.20130807 |
731 | ua_location_position_update_ref@Base 0.18.3+13.10.20130807 |
732 | ua_location_position_update_unref@Base 0.18.3+13.10.20130807 |
733 | + ua_location_service_controller_disable_gps@Base 0.18.3+13.10.20130826 |
734 | + ua_location_service_controller_disable_service@Base 0.18.3+13.10.20130826 |
735 | + ua_location_service_controller_enable_gps@Base 0.18.3+13.10.20130826 |
736 | + ua_location_service_controller_enable_service@Base 0.18.3+13.10.20130826 |
737 | + ua_location_service_controller_query_status@Base 0.18.3+13.10.20130826 |
738 | + ua_location_service_controller_ref@Base 0.18.3+13.10.20130826 |
739 | + ua_location_service_controller_set_status_changed_handler@Base 0.18.3+13.10.20130826 |
740 | + ua_location_service_controller_unref@Base 0.18.3+13.10.20130826 |
741 | + ua_location_service_create_controller@Base 0.18.3+13.10.20130826.3 |
742 | ua_location_service_create_session_for_high_accuracy@Base 0.18.3+13.10.20130807 |
743 | ua_location_service_create_session_for_low_accuracy@Base 0.18.3+13.10.20130807 |
744 | - ua_location_service_create_controller@Base 0.18.3+13.10.20130826.3 |
745 | ua_location_service_session_ref@Base 0.18.3+13.10.20130807 |
746 | ua_location_service_session_set_heading_updates_handler@Base 0.18.3+13.10.20130807 |
747 | ua_location_service_session_set_position_updates_handler@Base 0.18.3+13.10.20130807 |
748 | @@ -54,8 +65,13 @@ |
749 | ua_sensors_accelerometer_get_resolution@Base 0.18.1daily13.06.21 |
750 | ua_sensors_accelerometer_new@Base 0.18.1daily13.06.21 |
751 | ua_sensors_accelerometer_set_reading_cb@Base 0.18.1daily13.06.21 |
752 | + ua_sensors_haptic_disable@Base 0replaceme |
753 | + ua_sensors_haptic_enable@Base 0replaceme |
754 | + ua_sensors_haptic_new@Base 0replaceme |
755 | + ua_sensors_haptic_vibrate_once@Base 0replaceme |
756 | + ua_sensors_haptic_vibrate_with_pattern@Base 0replaceme |
757 | + ua_sensors_light_disable@Base 0.18.2+13.10.20130708 |
758 | ua_sensors_light_enable@Base 0.18.1daily13.06.21 |
759 | - ua_sensors_light_disable@Base 0.18.2+13.10.20130708 |
760 | ua_sensors_light_get_max_value@Base 0.18.1daily13.06.21 |
761 | ua_sensors_light_get_min_delay@Base 0.18.1daily13.06.21 |
762 | ua_sensors_light_get_min_value@Base 0.18.1daily13.06.21 |
763 | @@ -83,12 +99,14 @@ |
764 | ua_ui_set_clipboard_content@Base 0.18.1daily13.06.21 |
765 | ua_ui_window_destroy@Base 0.18.1daily13.06.21 |
766 | ua_ui_window_get_native_type@Base 0.18.1daily13.06.21 |
767 | + ua_ui_window_get_size@Base 0replaceme |
768 | ua_ui_window_hide@Base 0.18.1daily13.06.21 |
769 | ua_ui_window_move@Base 0.18.1daily13.06.21 |
770 | ua_ui_window_new_for_application_with_properties@Base 0.18.1daily13.06.21 |
771 | ua_ui_window_properties_destroy@Base 0.18.1daily13.06.21 |
772 | ua_ui_window_properties_get_title@Base 0.18.1daily13.06.21 |
773 | ua_ui_window_properties_new_for_normal_window@Base 0.18.1daily13.06.21 |
774 | + ua_ui_window_properties_set_dimensions@Base 0replaceme |
775 | ua_ui_window_properties_set_input_cb_and_ctx@Base 0.18.1daily13.06.21 |
776 | ua_ui_window_properties_set_role@Base 0.18.1daily13.06.21 |
777 | ua_ui_window_properties_set_titlen@Base 0.18.1daily13.06.21 |
778 | @@ -105,26 +123,3 @@ |
779 | uas_light_event_get_timestamp@Base 0.18.1daily13.06.21 |
780 | uas_proximity_event_get_distance@Base 0.18.1daily13.06.21 |
781 | uas_proximity_event_get_timestamp@Base 0.18.1daily13.06.21 |
782 | - ubuntu_ui_install_task_controller@Base 0.18.1daily13.06.21 |
783 | - ubuntu_ui_report_notification_invisible@Base 0.18.1daily13.06.21 |
784 | - ubuntu_ui_report_notification_visible@Base 0.18.1daily13.06.21 |
785 | - ubuntu_ui_report_osk_invisible@Base 0.18.1daily13.06.21 |
786 | - ubuntu_ui_report_osk_visible@Base 0.18.1daily13.06.21 |
787 | - ubuntu_ui_session_focus_running_session_with_id@Base 0.18.1daily13.06.21 |
788 | - ubuntu_ui_session_install_session_lifecycle_observer@Base 0.18.1daily13.06.21 |
789 | - ubuntu_ui_session_properties_get_application_instance_id@Base 0.18.1daily13.06.21 |
790 | - ubuntu_ui_session_properties_get_application_stage_hint@Base 0.18.1daily13.06.21 |
791 | - ubuntu_ui_session_properties_get_desktop_file_hint@Base 0.18.1daily13.06.21 |
792 | - ubuntu_ui_session_snapshot_running_session_with_id@Base 0.18.1daily13.06.21 |
793 | - ubuntu_ui_session_trigger_switch_to_well_known_application@Base 0.18.1daily13.06.21 |
794 | - ubuntu_ui_session_unfocus_running_sessions@Base 0.18.1daily13.06.21 |
795 | - ubuntu_ui_set_surface_trap@Base 0.18.1daily13.06.21 |
796 | - ubuntu_ui_unset_surface_trap@Base 0.18.1daily13.06.21 |
797 | - ua_location_service_controller_disable_gps@Base 0.18.3+13.10.20130826 |
798 | - ua_location_service_controller_disable_service@Base 0.18.3+13.10.20130826 |
799 | - ua_location_service_controller_enable_gps@Base 0.18.3+13.10.20130826 |
800 | - ua_location_service_controller_enable_service@Base 0.18.3+13.10.20130826 |
801 | - ua_location_service_controller_query_status@Base 0.18.3+13.10.20130826 |
802 | - ua_location_service_controller_ref@Base 0.18.3+13.10.20130826 |
803 | - ua_location_service_controller_set_status_changed_handler@Base 0.18.3+13.10.20130826 |
804 | - ua_location_service_controller_unref@Base 0.18.3+13.10.20130826 |
805 | |
806 | === renamed file 'debian/libplatform-hardware-api1-dev.install' => 'debian/libubuntu-platform-hardware-api-dev.install' |
807 | === renamed file 'debian/libplatform-hardware-api-headers.install' => 'debian/libubuntu-platform-hardware-api-headers.install' |
808 | === renamed file 'debian/libubuntu-platform-hardware-api1.install' => 'debian/libubuntu-platform-hardware-api2.install' |
809 | === renamed file 'debian/libubuntu-platform-hardware-api1.symbols' => 'debian/libubuntu-platform-hardware-api2.symbols' |
810 | --- debian/libubuntu-platform-hardware-api1.symbols 2014-05-22 15:29:45 +0000 |
811 | +++ debian/libubuntu-platform-hardware-api2.symbols 2014-06-11 12:19:49 +0000 |
812 | @@ -1,4 +1,4 @@ |
813 | -libubuntu_platform_hardware_api.so.1 libubuntu-platform-hardware-api1 #MINVER# |
814 | +libubuntu_platform_hardware_api.so.2 libubuntu-platform-hardware-api2 #MINVER# |
815 | u_hardware_alarm_create@Base 1.2.0+14.10.20140522.1 |
816 | u_hardware_alarm_get_elapsed_real_time@Base 1.2.0+14.10.20140522.1 |
817 | u_hardware_alarm_ref@Base 1.2.0+14.10.20140522.1 |
818 | |
819 | === modified file 'debian/rules' |
820 | --- debian/rules 2014-02-13 14:12:28 +0000 |
821 | +++ debian/rules 2014-06-11 12:19:49 +0000 |
822 | @@ -5,9 +5,6 @@ |
823 | %: |
824 | dh $@ |
825 | |
826 | -override_dh_auto_configure: |
827 | - dh_auto_configure -- -DENABLE_MIRCLIENT_IMPLEMENTATION=true -DENABLE_MIRSERVER_IMPLEMENTATION=true |
828 | - |
829 | override_dh_install: |
830 | dh_install --fail-missing |
831 | |
832 | |
833 | === added file 'debian/ubuntu-application-api2-desktop.install' |
834 | --- debian/ubuntu-application-api2-desktop.install 1970-01-01 00:00:00 +0000 |
835 | +++ debian/ubuntu-application-api2-desktop.install 2014-06-11 12:19:49 +0000 |
836 | @@ -0,0 +1,2 @@ |
837 | +usr/lib/*/libubuntu_application_api_desktop_mirclient.so.* |
838 | +usr/lib/*/libubuntu_application_api_desktop_mirserver.so.* |
839 | |
840 | === added file 'debian/ubuntu-application-api2-examples.install' |
841 | --- debian/ubuntu-application-api2-examples.install 1970-01-01 00:00:00 +0000 |
842 | +++ debian/ubuntu-application-api2-examples.install 2014-06-11 12:19:49 +0000 |
843 | @@ -0,0 +1,7 @@ |
844 | +usr/bin/test_android_gps_api |
845 | +usr/bin/test_android_sensors_api |
846 | +usr/bin/test_android_ubuntu_app_api |
847 | +usr/bin/test_android_ubuntu_app_api_multiple_surfaces |
848 | +usr/bin/test_ubuntu_app_api_location_service |
849 | +usr/bin/test_hardware_alarms_api |
850 | +usr/bin/test_ubuntu_haptic_device |
851 | |
852 | === renamed file 'debian/libubuntu-application-api-test1.docs' => 'debian/ubuntu-application-api2-test.docs' |
853 | --- debian/libubuntu-application-api-test1.docs 2014-01-08 15:17:41 +0000 |
854 | +++ debian/ubuntu-application-api2-test.docs 2014-06-11 12:19:49 +0000 |
855 | @@ -1,1 +1,1 @@ |
856 | -src/ubuntu/testbackend/README.md |
857 | +src/ubuntu/application/testbackend/README.md |
858 | |
859 | === renamed file 'debian/libubuntu-application-api-test1.install' => 'debian/ubuntu-application-api2-test.install' |
860 | === added file 'debian/ubuntu-application-api2-touch.install' |
861 | --- debian/ubuntu-application-api2-touch.install 1970-01-01 00:00:00 +0000 |
862 | +++ debian/ubuntu-application-api2-touch.install 2014-06-11 12:19:49 +0000 |
863 | @@ -0,0 +1,2 @@ |
864 | +usr/lib/*/libubuntu_application_api_touch_mirserver.so.* |
865 | +usr/lib/*/libubuntu_application_api_touch_mirclient.so.* |
866 | |
867 | === added directory 'examples' |
868 | === added file 'examples/CMakeLists.txt' |
869 | --- examples/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
870 | +++ examples/CMakeLists.txt 2014-06-11 12:19:49 +0000 |
871 | @@ -0,0 +1,29 @@ |
872 | +include_directories( |
873 | + ${CMAKE_BINARY_DIR}/include |
874 | +) |
875 | + |
876 | +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -fPIC") |
877 | + |
878 | +add_executable(test_android_ubuntu_app_api test_c_api.cpp) |
879 | +target_link_libraries(test_android_ubuntu_app_api ubuntu_application_api EGL GLESv2) |
880 | + |
881 | +add_executable(test_android_ubuntu_app_api_multiple_surfaces test_multiple_surfaces_event_delivery.cpp) |
882 | +target_link_libraries(test_android_ubuntu_app_api_multiple_surfaces ubuntu_application_api EGL GLESv2) |
883 | + |
884 | +add_executable(test_android_sensors_api test_sensors_api.cpp) |
885 | +target_link_libraries(test_android_sensors_api ubuntu_application_api) |
886 | + |
887 | +add_executable(test_ubuntu_app_api_location_service test_location_api.cpp) |
888 | +target_link_libraries(test_ubuntu_app_api_location_service ubuntu_application_api) |
889 | + |
890 | +add_executable(test_ubuntu_haptic_device test_haptic_device.cpp) |
891 | +target_link_libraries(test_ubuntu_haptic_device ubuntu_application_api) |
892 | + |
893 | +install(TARGETS |
894 | + test_android_ubuntu_app_api |
895 | + test_android_ubuntu_app_api_multiple_surfaces |
896 | + test_android_sensors_api |
897 | + test_ubuntu_app_api_location_service |
898 | + test_ubuntu_haptic_device |
899 | + DESTINATION bin |
900 | +) |
901 | |
902 | === renamed file 'src/ubuntu/hybris/tests/test_c_api.cpp' => 'examples/test_c_api.cpp' |
903 | --- src/ubuntu/hybris/tests/test_c_api.cpp 2013-05-21 22:14:40 +0000 |
904 | +++ examples/test_c_api.cpp 2014-06-11 12:19:49 +0000 |
905 | @@ -1,16 +1,16 @@ |
906 | /* |
907 | - * Copyright © 2012 Canonical Ltd. |
908 | + * Copyright © 2014 Canonical Ltd. |
909 | * |
910 | * This program is free software: you can redistribute it and/or modify |
911 | - * it under the terms of the GNU General Public License version 3 as |
912 | + * it under the terms of the GNU Lesser General Public License version 3 as |
913 | * published by the Free Software Foundation. |
914 | * |
915 | * This program is distributed in the hope that it will be useful, |
916 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
917 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
918 | - * GNU General Public License for more details. |
919 | + * GNU Lesser General Public License for more details. |
920 | * |
921 | - * You should have received a copy of the GNU General Public License |
922 | + * You should have received a copy of the GNU Lesser General Public License |
923 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
924 | * |
925 | * Authored by: Thomas Voß <thomas.voss@canonical.com> |
926 | |
927 | === added file 'examples/test_haptic_device.cpp' |
928 | --- examples/test_haptic_device.cpp 1970-01-01 00:00:00 +0000 |
929 | +++ examples/test_haptic_device.cpp 2014-06-11 12:19:49 +0000 |
930 | @@ -0,0 +1,44 @@ |
931 | +/* |
932 | + * Copyright © 2014 Canonical Ltd. |
933 | + * |
934 | + * This program is free software: you can redistribute it and/or modify |
935 | + * it under the terms of the GNU Lesser General Public License version 3 as |
936 | + * published by the Free Software Foundation. |
937 | + * |
938 | + * This program is distributed in the hope that it will be useful, |
939 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
940 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
941 | + * GNU Lesser General Public License for more details. |
942 | + * |
943 | + * You should have received a copy of the GNU Lesser General Public License |
944 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
945 | + * |
946 | + * Authored by: Ricardo Mendoza <ricardo.mendoza@canonical.com> |
947 | + */ |
948 | + |
949 | +#include <stdio.h> |
950 | +#include <stdlib.h> |
951 | +#include <unistd.h> |
952 | + |
953 | +#include <ubuntu/application/sensors/haptic.h> |
954 | + |
955 | +int main(int argc, char *argv[]) |
956 | +{ |
957 | + UASensorsHaptic *sensor = ua_sensors_haptic_new(); |
958 | + |
959 | + if (!sensor) { |
960 | + printf("Haptic device unavailable\n"); |
961 | + return 1; |
962 | + } |
963 | + |
964 | + printf("Vibrating once for 1500ms\n"); |
965 | + ua_sensors_haptic_vibrate_once(sensor, 1500); |
966 | + |
967 | + sleep(3); |
968 | + |
969 | + printf("Vibrating with pattern 6*1500, repeat twice.\n"); |
970 | + uint32_t pattern[MAX_PATTERN_SIZE] = {1500, 1500, 1500, 1500, 1500, 1500}; |
971 | + ua_sensors_haptic_vibrate_with_pattern(sensor, pattern, 2); |
972 | + |
973 | + return 0; |
974 | +} |
975 | |
976 | === renamed file 'src/ubuntu/hybris/tests/test_location_api.cpp' => 'examples/test_location_api.cpp' |
977 | --- src/ubuntu/hybris/tests/test_location_api.cpp 2013-12-03 07:10:43 +0000 |
978 | +++ examples/test_location_api.cpp 2014-06-11 12:19:49 +0000 |
979 | @@ -1,19 +1,19 @@ |
980 | /* |
981 | - * Copyright © 2012 Canonical Ltd. |
982 | + * Copyright © 2014 Canonical Ltd. |
983 | * |
984 | * This program is free software: you can redistribute it and/or modify |
985 | - * it under the terms of the GNU General Public License version 3 as |
986 | + * it under the terms of the GNU Lesser General Public License version 3 as |
987 | * published by the Free Software Foundation. |
988 | * |
989 | * This program is distributed in the hope that it will be useful, |
990 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
991 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
992 | - * GNU General Public License for more details. |
993 | + * GNU Lesser General Public License for more details. |
994 | * |
995 | - * You should have received a copy of the GNU General Public License |
996 | + * You should have received a copy of the GNU Lesser General Public License |
997 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
998 | * |
999 | - * Authored by: Thomas Voß <thomas.voss@canonical.com> |
1000 | + * Authored by: Thomas Voss <thomas.voss@canonical.com> |
1001 | */ |
1002 | |
1003 | #include <ubuntu/application/location/service.h> |
1004 | |
1005 | === renamed file 'src/ubuntu/hybris/tests/test_multiple_surfaces_event_delivery.cpp' => 'examples/test_multiple_surfaces_event_delivery.cpp' |
1006 | --- src/ubuntu/hybris/tests/test_multiple_surfaces_event_delivery.cpp 2013-05-21 22:14:40 +0000 |
1007 | +++ examples/test_multiple_surfaces_event_delivery.cpp 2014-06-11 12:19:49 +0000 |
1008 | @@ -1,19 +1,19 @@ |
1009 | /* |
1010 | - * Copyright © 2012 Canonical Ltd. |
1011 | + * Copyright © 2014 Canonical Ltd. |
1012 | * |
1013 | * This program is free software: you can redistribute it and/or modify |
1014 | - * it under the terms of the GNU General Public License version 3 as |
1015 | + * it under the terms of the GNU Lesser General Public License version 3 as |
1016 | * published by the Free Software Foundation. |
1017 | * |
1018 | * This program is distributed in the hope that it will be useful, |
1019 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1020 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1021 | - * GNU General Public License for more details. |
1022 | + * GNU Lesser General Public License for more details. |
1023 | * |
1024 | - * You should have received a copy of the GNU General Public License |
1025 | + * You should have received a copy of the GNU Lesser General Public License |
1026 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1027 | * |
1028 | - * Authored by: Thomas Voß <thomas.voss@canonical.com> |
1029 | + * Authored by: Thomas Voss <thomas.voss@canonical.com> |
1030 | */ |
1031 | |
1032 | #include <ubuntu/application/ui/window.h> |
1033 | |
1034 | === renamed file 'src/ubuntu/hybris/tests/test_sensors_api.cpp' => 'examples/test_sensors_api.cpp' |
1035 | --- src/ubuntu/hybris/tests/test_sensors_api.cpp 2014-02-13 13:12:41 +0000 |
1036 | +++ examples/test_sensors_api.cpp 2014-06-11 12:19:49 +0000 |
1037 | @@ -1,16 +1,16 @@ |
1038 | /* |
1039 | - * Copyright © 2012 Canonical Ltd. |
1040 | + * Copyright © 2014 Canonical Ltd. |
1041 | * |
1042 | * This program is free software: you can redistribute it and/or modify |
1043 | - * it under the terms of the GNU General Public License version 3 as |
1044 | + * it under the terms of the GNU Lesser General Public License version 3 as |
1045 | * published by the Free Software Foundation. |
1046 | * |
1047 | * This program is distributed in the hope that it will be useful, |
1048 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1049 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1050 | - * GNU General Public License for more details. |
1051 | + * GNU Lesser General Public License for more details. |
1052 | * |
1053 | - * You should have received a copy of the GNU General Public License |
1054 | + * You should have received a copy of the GNU Lesser General Public License |
1055 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1056 | * |
1057 | * Authored by: Ricardo Mendoza <ricardo.mendoza@canonical.com> |
1058 | |
1059 | === renamed file 'src/ubuntu/hybris/tests/test_session_c_api.cpp' => 'examples/test_session_c_api.cpp' |
1060 | --- src/ubuntu/hybris/tests/test_session_c_api.cpp 2013-02-13 23:09:01 +0000 |
1061 | +++ examples/test_session_c_api.cpp 2014-06-11 12:19:49 +0000 |
1062 | @@ -1,16 +1,16 @@ |
1063 | /* |
1064 | - * Copyright © 2012 Canonical Ltd. |
1065 | + * Copyright © 2014 Canonical Ltd. |
1066 | * |
1067 | * This program is free software: you can redistribute it and/or modify |
1068 | - * it under the terms of the GNU General Public License version 3 as |
1069 | + * it under the terms of the GNU Lesser General Public License version 3 as |
1070 | * published by the Free Software Foundation. |
1071 | * |
1072 | * This program is distributed in the hope that it will be useful, |
1073 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1074 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1075 | - * GNU General Public License for more details. |
1076 | + * GNU Lesser General Public License for more details. |
1077 | * |
1078 | - * You should have received a copy of the GNU General Public License |
1079 | + * You should have received a copy of the GNU Lesser General Public License |
1080 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1081 | * |
1082 | * Authored by: Thomas Voß <thomas.voss@canonical.com> |
1083 | |
1084 | === modified file 'include/ubuntu/application/CMakeLists.txt' |
1085 | --- include/ubuntu/application/CMakeLists.txt 2013-08-22 10:54:28 +0000 |
1086 | +++ include/ubuntu/application/CMakeLists.txt 2014-06-11 12:19:49 +0000 |
1087 | @@ -7,6 +7,7 @@ |
1088 | lifecycle_delegate.h |
1089 | operation_mode.h |
1090 | options.h |
1091 | + init.h |
1092 | ) |
1093 | |
1094 | install( |
1095 | |
1096 | === added file 'include/ubuntu/application/init.h' |
1097 | --- include/ubuntu/application/init.h 1970-01-01 00:00:00 +0000 |
1098 | +++ include/ubuntu/application/init.h 2014-06-11 12:19:49 +0000 |
1099 | @@ -0,0 +1,63 @@ |
1100 | +/* |
1101 | + * Copyright © 2013 Canonical Ltd. |
1102 | + * |
1103 | + * This program is free software: you can redistribute it and/or modify |
1104 | + * it under the terms of the GNU Lesser General Public License version 3 as |
1105 | + * published by the Free Software Foundation. |
1106 | + * |
1107 | + * This program is distributed in the hope that it will be useful, |
1108 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1109 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1110 | + * GNU Lesser General Public License for more details. |
1111 | + * |
1112 | + * You should have received a copy of the GNU Lesser General Public License |
1113 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1114 | + * |
1115 | + * Authored by: Ricardo Mendoza <ricardo.mendoza@canonical.com> |
1116 | + */ |
1117 | + |
1118 | +#ifndef UBUNTU_APPLICATION_INIT_H_ |
1119 | +#define UBUNTU_APPLICATION_INIT_H_ |
1120 | + |
1121 | +#include <ubuntu/visibility.h> |
1122 | + |
1123 | +#include <stdint.h> |
1124 | + |
1125 | +#ifdef __cplusplus |
1126 | +extern "C" { |
1127 | +#endif |
1128 | + |
1129 | + /** |
1130 | + * \brief Queries the Module Version that is currently loaded. |
1131 | + * \ingroup application_support |
1132 | + * \param[out] major Major version. |
1133 | + * \param[out] minor Minor version. |
1134 | + * \param[out] patch Patch version. |
1135 | + */ |
1136 | + UBUNTU_DLL_PUBLIC void |
1137 | + u_application_module_version( |
1138 | + uint32_t *major, |
1139 | + uint32_t *minor, |
1140 | + uint32_t *patch); |
1141 | + |
1142 | + /** |
1143 | + * \brief Initializes the Ubuntu Application API backend with args. |
1144 | + * \ingroup application_support |
1145 | + * \param[in] args Opaque initialization arguments. |
1146 | + */ |
1147 | + UBUNTU_DLL_PUBLIC void |
1148 | + u_application_init( |
1149 | + void *args); |
1150 | + |
1151 | + /** |
1152 | + * \brief Signal termination to the Application backend instance. |
1153 | + * \ingroup application_support |
1154 | + */ |
1155 | + UBUNTU_DLL_PUBLIC void |
1156 | + u_application_finish(); |
1157 | + |
1158 | +#ifdef __cplusplus |
1159 | +} |
1160 | +#endif |
1161 | + |
1162 | +#endif /* UBUNTU_APPLICATION_INIT_H_ */ |
1163 | |
1164 | === modified file 'include/ubuntu/application/sensors/CMakeLists.txt' |
1165 | --- include/ubuntu/application/sensors/CMakeLists.txt 2013-07-18 09:08:17 +0000 |
1166 | +++ include/ubuntu/application/sensors/CMakeLists.txt 2014-06-11 12:19:49 +0000 |
1167 | @@ -3,6 +3,7 @@ |
1168 | accelerometer.h |
1169 | light.h |
1170 | proximity.h |
1171 | + haptic.h |
1172 | ubuntu_application_sensors.h |
1173 | ) |
1174 | |
1175 | @@ -11,4 +12,4 @@ |
1176 | DESTINATION include/ubuntu/application/sensors |
1177 | ) |
1178 | |
1179 | -add_subdirectory(event) |
1180 | \ No newline at end of file |
1181 | +add_subdirectory(event) |
1182 | |
1183 | === added file 'include/ubuntu/application/sensors/haptic.h' |
1184 | --- include/ubuntu/application/sensors/haptic.h 1970-01-01 00:00:00 +0000 |
1185 | +++ include/ubuntu/application/sensors/haptic.h 2014-06-11 12:19:49 +0000 |
1186 | @@ -0,0 +1,98 @@ |
1187 | +/* |
1188 | + * Copyright © 2014 Canonical Ltd. |
1189 | + * |
1190 | + * This program is free software: you can redistribute it and/or modify |
1191 | + * it under the terms of the GNU Lesser General Public License version 3 as |
1192 | + * published by the Free Software Foundation. |
1193 | + * |
1194 | + * This program is distributed in the hope that it will be useful, |
1195 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1196 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1197 | + * GNU Lesser General Public License for more details. |
1198 | + * |
1199 | + * You should have received a copy of the GNU Lesser General Public License |
1200 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1201 | + * |
1202 | + * Authored by: Ricardo Mendoza <ricardo.mendoza@canonical.com> |
1203 | + */ |
1204 | + |
1205 | +#ifndef UBUNTU_APPLICATION_SENSORS_HAPTIC_H_ |
1206 | +#define UBUNTU_APPLICATION_SENSORS_HAPTIC_H_ |
1207 | + |
1208 | +#include <ubuntu/status.h> |
1209 | +#include <ubuntu/visibility.h> |
1210 | + |
1211 | +#include <stdint.h> |
1212 | + |
1213 | +#ifdef __cplusplus |
1214 | +extern "C" { |
1215 | +#endif |
1216 | + |
1217 | + /** |
1218 | + * \brief Opaque type that models the haptics device. |
1219 | + * \ingroup sensor_access |
1220 | + */ |
1221 | + typedef void UASensorsHaptic; |
1222 | + |
1223 | + /** |
1224 | + * \brief Create a new object for accessing the haptics device. |
1225 | + * \ingroup sensor_access |
1226 | + * \returns A new instance or NULL in case of errors. |
1227 | + */ |
1228 | + UBUNTU_DLL_PUBLIC UASensorsHaptic* |
1229 | + ua_sensors_haptic_new(); |
1230 | + |
1231 | + /** |
1232 | + * \brief Enables the supplied haptics device. |
1233 | + * \ingroup sensor_access |
1234 | + * \returns U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured. |
1235 | + * \param[in] sensor The sensor instance to be enabled. |
1236 | + */ |
1237 | + UBUNTU_DLL_PUBLIC UStatus |
1238 | + ua_sensors_haptic_enable( |
1239 | + UASensorsHaptic* sensor); |
1240 | + |
1241 | + /** |
1242 | + * \brief Disables the supplied haptics device. |
1243 | + * \ingroup sensor_access |
1244 | + * \returns U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured. |
1245 | + * \param[in] sensor The sensor instance to be disabled. |
1246 | + */ |
1247 | + UBUNTU_DLL_PUBLIC UStatus |
1248 | + ua_sensors_haptic_disable( |
1249 | + UASensorsHaptic* sensor); |
1250 | + |
1251 | + /** |
1252 | + * \brief Run the vibrator for a fixed duration. |
1253 | + * \ingroup sensor_access |
1254 | + * \returns U_STATUS_SUCCESS if pushed correctly, U_STATUS_ERROR if the pattern limit is invalid or the actuator cannot be activated. |
1255 | + * \param[in] sensor Haptic device to activate. |
1256 | + * \param[in] duration How long should the vibrator stay on. |
1257 | + */ |
1258 | + UBUNTU_DLL_PUBLIC UStatus |
1259 | + ua_sensors_haptic_vibrate_once( |
1260 | + UASensorsHaptic* sensor, |
1261 | + uint32_t duration); |
1262 | + |
1263 | + #define MAX_PATTERN_SIZE 6 |
1264 | + |
1265 | + /** |
1266 | + * \brief Run the vibrator with a pattern and repeat a precise number of times. |
1267 | + * \ingroup sensor_access |
1268 | + * \returns U_STATUS_SUCCESS if pushed correctly, U_STATUS_ERROR if the pattern limit is invalid or the actuator cannot be activated. |
1269 | + * \param[in] sensor Haptic device to activate. |
1270 | + * \param[in] pattern An array of uint32_t durations for which to keep the vibrator on or off. The first value indicates how long to keep the vibrator on for, the second value how long to keep it off for, and so on until the end of the array. |
1271 | + * \param[in] repeat How many times to repeat the whole pattern for. |
1272 | + */ |
1273 | + |
1274 | + UBUNTU_DLL_PUBLIC UStatus |
1275 | + ua_sensors_haptic_vibrate_with_pattern( |
1276 | + UASensorsHaptic* sensor, |
1277 | + uint32_t pattern[MAX_PATTERN_SIZE], |
1278 | + uint32_t repeat); |
1279 | + |
1280 | +#ifdef __cplusplus |
1281 | +} |
1282 | +#endif |
1283 | + |
1284 | +#endif /* UBUNTU_APPLICATION_SENSORS_HAPTIC_H_ */ |
1285 | |
1286 | === added directory 'src/bridge' |
1287 | === added file 'src/bridge/bridge.h' |
1288 | --- src/bridge/bridge.h 1970-01-01 00:00:00 +0000 |
1289 | +++ src/bridge/bridge.h 2014-06-11 12:19:49 +0000 |
1290 | @@ -0,0 +1,63 @@ |
1291 | +/* |
1292 | + * Copyright (C) 2012 Canonical Ltd |
1293 | + * |
1294 | + * This program is free software: you can redistribute it and/or modify |
1295 | + * it under the terms of the GNU Lesser General Public License version 3 as |
1296 | + * published by the Free Software Foundation. |
1297 | + * |
1298 | + * This program is distributed in the hope that it will be useful, |
1299 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1300 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1301 | + * GNU Lesser General Public License for more details. |
1302 | + * |
1303 | + * You should have received a copy of the GNU Lesser General Public License |
1304 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1305 | + * |
1306 | + * Authored by: Thomas Voss <thomas.voss@canonical.com> |
1307 | + * Ricardo Mendoza <ricardo.mendoza@canonical.com> |
1308 | + */ |
1309 | +#ifndef BASE_BRIDGE_H_ |
1310 | +#define BASE_BRIDGE_H_ |
1311 | + |
1312 | +#include <assert.h> |
1313 | +#include <dlfcn.h> |
1314 | +#include <stddef.h> |
1315 | +#include <stdlib.h> |
1316 | +#include <stdio.h> |
1317 | +#include <string.h> |
1318 | + |
1319 | +#define MAX_MODULE_NAME 32 |
1320 | + |
1321 | +#define HIDDEN_SYMBOL __attribute__ ((visibility ("hidden"))) |
1322 | + |
1323 | +namespace internal |
1324 | +{ |
1325 | +template<typename Scope> |
1326 | +class HIDDEN_SYMBOL Bridge |
1327 | +{ |
1328 | + public: |
1329 | + static Bridge<Scope>& instance() |
1330 | + { |
1331 | + static Bridge<Scope> bridge; |
1332 | + return bridge; |
1333 | + } |
1334 | + |
1335 | + void* resolve_symbol(const char* symbol) const |
1336 | + { |
1337 | + return Scope::dlsym_fn(lib_handle, symbol); |
1338 | + } |
1339 | + |
1340 | + protected: |
1341 | + Bridge() : lib_handle(Scope::dlopen_fn(Scope::path(), RTLD_LAZY)) |
1342 | + { |
1343 | + } |
1344 | + |
1345 | + ~Bridge() |
1346 | + { |
1347 | + } |
1348 | + |
1349 | + void* lib_handle; |
1350 | +}; |
1351 | +} |
1352 | + |
1353 | +#endif // BRIDGE_H_ |
1354 | |
1355 | === added file 'src/bridge/bridge_defs.h' |
1356 | --- src/bridge/bridge_defs.h 1970-01-01 00:00:00 +0000 |
1357 | +++ src/bridge/bridge_defs.h 2014-06-11 12:19:49 +0000 |
1358 | @@ -0,0 +1,136 @@ |
1359 | +/* |
1360 | + * Copyright (C) 2012 Canonical Ltd |
1361 | + * |
1362 | + * This program is free software: you can redistribute it and/or modify |
1363 | + * it under the terms of the GNU Lesser General Public License version 3 as |
1364 | + * published by the Free Software Foundation. |
1365 | + * |
1366 | + * This program is distributed in the hope that it will be useful, |
1367 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1368 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1369 | + * GNU Lesser General Public License for more details. |
1370 | + * |
1371 | + * You should have received a copy of the GNU Lesser General Public License |
1372 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1373 | + * |
1374 | + * Authored by: Thomas Voss <thomas.voss@canonical.com> |
1375 | + * Ricardo Mendoza <ricardo.mendoza@canonical.com> |
1376 | + */ |
1377 | +#ifndef BRIDGE_DEFS_H_ |
1378 | +#define BRIDGE_DEFS_H_ |
1379 | + |
1380 | +// Must be included afterthe Bridge class is defined |
1381 | + |
1382 | +#ifdef __cplusplus |
1383 | +extern "C" { |
1384 | +#endif |
1385 | + |
1386 | +/**********************************************************/ |
1387 | +/*********** Implementation starts here *******************/ |
1388 | +/**********************************************************/ |
1389 | + |
1390 | +// this allows DLSYM to return NULL (happens if the backend is not available), |
1391 | +// and returns NULL in that case; return_type must be a pointer! |
1392 | +#define IMPLEMENT_CTOR0(return_type, symbol) \ |
1393 | + return_type symbol() \ |
1394 | + { \ |
1395 | + static return_type (*f)() = NULL; \ |
1396 | + DLSYM(&f, #symbol); \ |
1397 | + return f ? f() : NULL;} |
1398 | + |
1399 | +#define IMPLEMENT_FUNCTION0(return_type, symbol) \ |
1400 | + return_type symbol() \ |
1401 | + { \ |
1402 | + static return_type (*f)() = NULL; \ |
1403 | + DLSYM(&f, #symbol); \ |
1404 | + return f();} |
1405 | + |
1406 | +#define IMPLEMENT_VOID_FUNCTION0(symbol) \ |
1407 | + void symbol() \ |
1408 | + { \ |
1409 | + static void (*f)() = NULL; \ |
1410 | + DLSYM(&f, #symbol); \ |
1411 | + f();} |
1412 | + |
1413 | +#define IMPLEMENT_FUNCTION1(return_type, symbol, arg1) \ |
1414 | + return_type symbol(arg1 _1) \ |
1415 | + { \ |
1416 | + static return_type (*f)(arg1) = NULL; \ |
1417 | + DLSYM(&f, #symbol); \ |
1418 | + return f(_1); } |
1419 | + |
1420 | +#define IMPLEMENT_VOID_FUNCTION1(symbol, arg1) \ |
1421 | + void symbol(arg1 _1) \ |
1422 | + { \ |
1423 | + static void (*f)(arg1) = NULL; \ |
1424 | + DLSYM(&f, #symbol); \ |
1425 | + f(_1); } |
1426 | + |
1427 | +#define IMPLEMENT_FUNCTION2(return_type, symbol, arg1, arg2) \ |
1428 | + return_type symbol(arg1 _1, arg2 _2) \ |
1429 | + { \ |
1430 | + static return_type (*f)(arg1, arg2) = NULL; \ |
1431 | + DLSYM(&f, #symbol); \ |
1432 | + return f(_1, _2); } |
1433 | + |
1434 | +#define IMPLEMENT_VOID_FUNCTION2(symbol, arg1, arg2) \ |
1435 | + void symbol(arg1 _1, arg2 _2) \ |
1436 | + { \ |
1437 | + static void (*f)(arg1, arg2) = NULL; \ |
1438 | + DLSYM(&f, #symbol); \ |
1439 | + f(_1, _2); } |
1440 | + |
1441 | +#define IMPLEMENT_FUNCTION3(return_type, symbol, arg1, arg2, arg3) \ |
1442 | + return_type symbol(arg1 _1, arg2 _2, arg3 _3) \ |
1443 | + { \ |
1444 | + static return_type (*f)(arg1, arg2, arg3) = NULL; \ |
1445 | + DLSYM(&f, #symbol); \ |
1446 | + return f(_1, _2, _3); } |
1447 | + |
1448 | +#define IMPLEMENT_VOID_FUNCTION3(symbol, arg1, arg2, arg3) \ |
1449 | + void symbol(arg1 _1, arg2 _2, arg3 _3) \ |
1450 | + { \ |
1451 | + static void (*f)(arg1, arg2, arg3) = NULL; \ |
1452 | + DLSYM(&f, #symbol); \ |
1453 | + f(_1, _2, _3); } |
1454 | + |
1455 | +#define IMPLEMENT_VOID_FUNCTION4(symbol, arg1, arg2, arg3, arg4) \ |
1456 | + void symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4) \ |
1457 | + { \ |
1458 | + static void (*f)(arg1, arg2, arg3, arg4) = NULL; \ |
1459 | + DLSYM(&f, #symbol); \ |
1460 | + f(_1, _2, _3, _4); } |
1461 | + |
1462 | +#define IMPLEMENT_FUNCTION4(return_type, symbol, arg1, arg2, arg3, arg4) \ |
1463 | + return_type symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4) \ |
1464 | + { \ |
1465 | + static return_type (*f)(arg1, arg2, arg3, arg4) = NULL; \ |
1466 | + DLSYM(&f, #symbol); \ |
1467 | + return f(_1, _2, _3, _4); } |
1468 | + |
1469 | +#define IMPLEMENT_FUNCTION6(return_type, symbol, arg1, arg2, arg3, arg4, arg5, arg6) \ |
1470 | + return_type symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4, arg5 _5, arg6 _6) \ |
1471 | + { \ |
1472 | + static return_type (*f)(arg1, arg2, arg3, arg4, arg5, arg6) = NULL; \ |
1473 | + DLSYM(&f, #symbol); \ |
1474 | + return f(_1, _2, _3, _4, _5, _6); } |
1475 | + |
1476 | +#define IMPLEMENT_VOID_FUNCTION7(symbol, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ |
1477 | + void symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4, arg5 _5, arg6 _6, arg7 _7) \ |
1478 | + { \ |
1479 | + static void (*f)(arg1, arg2, arg3, arg4, arg5, arg6, arg7) = NULL; \ |
1480 | + DLSYM(&f, #symbol); \ |
1481 | + f(_1, _2, _3, _4, _5, _6, _7); } |
1482 | + |
1483 | +#define IMPLEMENT_VOID_FUNCTION8(symbol, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \ |
1484 | + void symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4, arg5 _5, arg6 _6, arg7 _7, arg8 _8) \ |
1485 | + { \ |
1486 | + static void (*f)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) = NULL; \ |
1487 | + DLSYM(&f, #symbol); \ |
1488 | + f(_1, _2, _3, _4, _5, _6, _7, _8); } |
1489 | + |
1490 | +#ifdef __cplusplus |
1491 | +} |
1492 | +#endif |
1493 | + |
1494 | +#endif // BRIDGE_DEFS_H_ |
1495 | |
1496 | === added file 'src/ubuntu/CMakeLists.txt' |
1497 | --- src/ubuntu/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
1498 | +++ src/ubuntu/CMakeLists.txt 2014-06-11 12:19:49 +0000 |
1499 | @@ -0,0 +1,2 @@ |
1500 | +add_subdirectory(application) |
1501 | +add_subdirectory(hardware) |
1502 | |
1503 | === added directory 'src/ubuntu/application' |
1504 | === renamed file 'src/ubuntu/CMakeLists.txt' => 'src/ubuntu/application/CMakeLists.txt' |
1505 | --- src/ubuntu/CMakeLists.txt 2014-05-21 07:15:34 +0000 |
1506 | +++ src/ubuntu/application/CMakeLists.txt 2014-06-11 12:19:49 +0000 |
1507 | @@ -1,36 +1,44 @@ |
1508 | -include_directories( |
1509 | - ${CMAKE_CURRENT_SOURCE_DIR} |
1510 | -) |
1511 | - |
1512 | -add_subdirectory(application) |
1513 | -add_subdirectory(hardware) |
1514 | -add_subdirectory(testbackend) |
1515 | - |
1516 | set( |
1517 | UBUNTU_APPLICATION_API_LINK_LIBRARIES |
1518 | - |
1519 | + |
1520 | + ubuntu_application_sensors_haptic |
1521 | ubuntu_application_location |
1522 | ubuntu_application_url_dispatcher |
1523 | ) |
1524 | |
1525 | -set( |
1526 | - UBUNTU_HARDWARE_API_LINK_LIBRARIES |
1527 | +include_directories( |
1528 | + ${CMAKE_BINARY_DIR}/include |
1529 | +) |
1530 | + |
1531 | +include_directories(../../bridge) |
1532 | + |
1533 | +add_subdirectory(common) |
1534 | +add_subdirectory(desktop) |
1535 | +add_subdirectory(touch) |
1536 | +add_subdirectory(testbackend) |
1537 | + |
1538 | +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -fPIC") |
1539 | + |
1540 | +add_library( |
1541 | + ubuntu_application_api SHARED |
1542 | |
1543 | - ubuntu_hardware_alarm |
1544 | -) |
1545 | - |
1546 | -if(ENABLE_HYBRIS_IMPLEMENTATION) |
1547 | - add_subdirectory(hybris/) |
1548 | -endif() |
1549 | - |
1550 | -if(ENABLE_MIRSERVER_IMPLEMENTATION OR ENABLE_MIRCLIENT_IMPLEMENTATION) |
1551 | - add_subdirectory(mircommon/) |
1552 | -endif() |
1553 | - |
1554 | -if(ENABLE_MIRSERVER_IMPLEMENTATION) |
1555 | - add_subdirectory(mirserver/) |
1556 | -endif() |
1557 | - |
1558 | -if(ENABLE_MIRCLIENT_IMPLEMENTATION) |
1559 | - add_subdirectory(mirclient/) |
1560 | -endif() |
1561 | + ubuntu_application_api.cpp |
1562 | +) |
1563 | + |
1564 | +target_link_libraries( |
1565 | + ubuntu_application_api |
1566 | + |
1567 | + dl |
1568 | +) |
1569 | + |
1570 | +set_target_properties( |
1571 | + ubuntu_application_api |
1572 | + PROPERTIES |
1573 | + VERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR}.${UBUNTU_PLATFORM_API_VERSION_MINOR}.${UBUNTU_PLATFORM_API_VERSION_PATCH} |
1574 | + SOVERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR} |
1575 | +) |
1576 | + |
1577 | +install( |
1578 | + TARGETS ubuntu_application_api |
1579 | + ${INSTALL_TARGETS_DEFAULT_ARGS} |
1580 | +) |
1581 | |
1582 | === added file 'src/ubuntu/application/base_module.h' |
1583 | --- src/ubuntu/application/base_module.h 1970-01-01 00:00:00 +0000 |
1584 | +++ src/ubuntu/application/base_module.h 2014-06-11 12:19:49 +0000 |
1585 | @@ -0,0 +1,107 @@ |
1586 | +/* |
1587 | + * Copyright (C) 2012 Canonical Ltd |
1588 | + * |
1589 | + * This program is free software: you can redistribute it and/or modify |
1590 | + * it under the terms of the GNU Lesser General Public License version 3 as |
1591 | + * published by the Free Software Foundation. |
1592 | + * |
1593 | + * This program is distributed in the hope that it will be useful, |
1594 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1595 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1596 | + * GNU Lesser General Public License for more details. |
1597 | + * |
1598 | + * You should have received a copy of the GNU Lesser General Public License |
1599 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1600 | + * |
1601 | + * Authored by: Thomas Voss <thomas.voss@canonical.com> |
1602 | + * Ricardo Mendoza <ricardo.mendoza@canonical.com> |
1603 | + */ |
1604 | +#ifndef BASE_MODULE_H_ |
1605 | +#define BASE_MODULE_H_ |
1606 | + |
1607 | +#include <bridge.h> |
1608 | +#include <stdio.h> |
1609 | +#include <unistd.h> |
1610 | + |
1611 | +/* |
1612 | + * This is the base backend loader for the Platform API |
1613 | + */ |
1614 | + |
1615 | +#define API_VERSION_MAJOR "2" |
1616 | +#define API_VERSION_MINOR "0" |
1617 | +#define API_VERSION_PATCH "0" |
1618 | +#define SO_SUFFIX ".so." API_VERSION_MAJOR "." API_VERSION_MINOR "." API_VERSION_PATCH |
1619 | + |
1620 | +namespace internal |
1621 | +{ |
1622 | +/* Programs can select a backend with $UBUNTU_PLATFORM_API_BACKEND, |
1623 | + * which either needs to be a full path or just the file name (then it will be |
1624 | + * looked up in the usual library search path, see dlopen(3)). |
1625 | + */ |
1626 | +struct HIDDEN_SYMBOL ToBackend |
1627 | +{ |
1628 | + static const char* path() |
1629 | + { |
1630 | + static char* cache = NULL; |
1631 | + static char path[64]; |
1632 | + char module_name[32]; |
1633 | + |
1634 | + if (cache == NULL) { |
1635 | + cache = secure_getenv("UBUNTU_PLATFORM_API_BACKEND"); |
1636 | + if (cache == NULL) { |
1637 | + FILE *conf; |
1638 | + conf = fopen("/etc/ubuntu-platform-api/application.conf", "r"); |
1639 | + if (conf == NULL) { |
1640 | + exit_module("Unable to find module configuration file"); |
1641 | + } else { |
1642 | + if (fgets(module_name, 32, conf)) |
1643 | + cache = module_name; |
1644 | + else |
1645 | + exit_module("Error reading module name from file"); |
1646 | + } |
1647 | + // Null terminate module blob |
1648 | + cache[strlen(cache)-1] = '\0'; |
1649 | + fclose(conf); |
1650 | + } |
1651 | + if (cache == NULL) |
1652 | + exit_module("Unable to determine backend"); |
1653 | + |
1654 | + strcpy(path, "libubuntu_application_api_"); |
1655 | + |
1656 | + if (strlen(cache) > MAX_MODULE_NAME) |
1657 | + exit_module("Selected module is invalid"); |
1658 | + |
1659 | + strcat(path, cache); |
1660 | + strcat(path, SO_SUFFIX); |
1661 | + } |
1662 | + |
1663 | + return path; |
1664 | + } |
1665 | + |
1666 | + static void exit_module(const char* msg) |
1667 | + { |
1668 | + printf("Ubuntu Platform API: %s -- Aborting\n", msg); |
1669 | + abort(); |
1670 | + } |
1671 | + |
1672 | + static void* dlopen_fn(const char* path, int flags) |
1673 | + { |
1674 | + void *handle = dlopen(path, flags); |
1675 | + if (handle == NULL) |
1676 | + exit_module("Unable to load selected module."); |
1677 | + |
1678 | + return handle; |
1679 | + } |
1680 | + |
1681 | + static void* dlsym_fn(void* handle, const char* symbol) |
1682 | + { |
1683 | + return dlsym(handle, symbol); |
1684 | + } |
1685 | +}; |
1686 | +} |
1687 | + |
1688 | +#define DLSYM(fptr, sym) if (*(fptr) == NULL) { *((void**)fptr) = (void *) internal::Bridge<internal::ToBackend>::instance().resolve_symbol(sym); } |
1689 | + |
1690 | +#include <bridge_defs.h> |
1691 | + |
1692 | +#endif // BASE_MODULE_H_ |
1693 | |
1694 | === added directory 'src/ubuntu/application/common' |
1695 | === added file 'src/ubuntu/application/common/CMakeLists.txt' |
1696 | --- src/ubuntu/application/common/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
1697 | +++ src/ubuntu/application/common/CMakeLists.txt 2014-06-11 12:19:49 +0000 |
1698 | @@ -0,0 +1,8 @@ |
1699 | +include_directories( |
1700 | + ${CMAKE_CURRENT_SOURCE_DIR} |
1701 | +) |
1702 | + |
1703 | +add_subdirectory(application) |
1704 | +add_subdirectory(mircommon) |
1705 | +add_subdirectory(mirclient) |
1706 | +add_subdirectory(mirserver) |
1707 | |
1708 | === renamed directory 'src/ubuntu/application' => 'src/ubuntu/application/common/application' |
1709 | === modified file 'src/ubuntu/application/common/application/CMakeLists.txt' |
1710 | --- src/ubuntu/application/CMakeLists.txt 2013-08-22 10:54:28 +0000 |
1711 | +++ src/ubuntu/application/common/application/CMakeLists.txt 2014-06-11 12:19:49 +0000 |
1712 | @@ -1,2 +1,3 @@ |
1713 | +add_subdirectory(sensors) |
1714 | add_subdirectory(location) |
1715 | add_subdirectory(url_dispatcher) |
1716 | |
1717 | === added directory 'src/ubuntu/application/common/application/sensors' |
1718 | === added file 'src/ubuntu/application/common/application/sensors/CMakeLists.txt' |
1719 | --- src/ubuntu/application/common/application/sensors/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
1720 | +++ src/ubuntu/application/common/application/sensors/CMakeLists.txt 2014-06-11 12:19:49 +0000 |
1721 | @@ -0,0 +1,21 @@ |
1722 | +find_package(PkgConfig) |
1723 | +find_package(Threads) |
1724 | +pkg_check_modules(DBUS_CPP REQUIRED dbus-cpp) |
1725 | + |
1726 | +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -fPIC") |
1727 | + |
1728 | +include_directories( |
1729 | + ${DBUS_CPP_INCLUDE_DIRS} |
1730 | + ) |
1731 | + |
1732 | +add_library( |
1733 | + ubuntu_application_sensors_haptic |
1734 | + |
1735 | + service.cpp |
1736 | +) |
1737 | + |
1738 | +target_link_libraries( |
1739 | + ubuntu_application_sensors_haptic |
1740 | + |
1741 | + ${DBUS_CPP_LIBRARIES} |
1742 | +) |
1743 | |
1744 | === added file 'src/ubuntu/application/common/application/sensors/sensors_p.h' |
1745 | --- src/ubuntu/application/common/application/sensors/sensors_p.h 1970-01-01 00:00:00 +0000 |
1746 | +++ src/ubuntu/application/common/application/sensors/sensors_p.h 2014-06-11 12:19:49 +0000 |
1747 | @@ -0,0 +1,43 @@ |
1748 | +/* |
1749 | + * Copyright (C) 2014 Canonical Ltd |
1750 | + * |
1751 | + * This program is free software: you can redistribute it and/or modify |
1752 | + * it under the terms of the GNU Lesser General Public License version 3 as |
1753 | + * published by the Free Software Foundation. |
1754 | + * |
1755 | + * This program is distributed in the hope that it will be useful, |
1756 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1757 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1758 | + * GNU Lesser General Public License for more details. |
1759 | + * |
1760 | + * You should have received a copy of the GNU Lesser General Public License |
1761 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1762 | + * |
1763 | + * Author: Ricardo Mendoza <ricardo.mendoza@canonical.com> |
1764 | + */ |
1765 | + |
1766 | +#include <core/dbus/dbus.h> |
1767 | +#include <core/dbus/fixture.h> |
1768 | +#include <core/dbus/object.h> |
1769 | +#include <core/dbus/property.h> |
1770 | +#include <core/dbus/service.h> |
1771 | +#include <core/dbus/interfaces/properties.h> |
1772 | +#include <core/dbus/types/stl/tuple.h> |
1773 | +#include <core/dbus/types/stl/vector.h> |
1774 | + |
1775 | +#include <core/dbus/asio/executor.h> |
1776 | + |
1777 | +#include <vector> |
1778 | +#include <memory> |
1779 | + |
1780 | +namespace dbus = core::dbus; |
1781 | + |
1782 | +struct UbuntuApplicationSensorsHaptic |
1783 | +{ |
1784 | + UbuntuApplicationSensorsHaptic(std::shared_ptr<dbus::Object> session) |
1785 | + : session(session) |
1786 | + { |
1787 | + } |
1788 | + |
1789 | + std::shared_ptr<dbus::Object> session; |
1790 | +}; |
1791 | |
1792 | === added file 'src/ubuntu/application/common/application/sensors/service.cpp' |
1793 | --- src/ubuntu/application/common/application/sensors/service.cpp 1970-01-01 00:00:00 +0000 |
1794 | +++ src/ubuntu/application/common/application/sensors/service.cpp 2014-06-11 12:19:49 +0000 |
1795 | @@ -0,0 +1,103 @@ |
1796 | +/* |
1797 | + * Copyright (C) 2013 Canonical Ltd |
1798 | + * |
1799 | + * This program is free software: you can redistribute it and/or modify |
1800 | + * it under the terms of the GNU Lesser General Public License version 3 as |
1801 | + * published by the Free Software Foundation. |
1802 | + * |
1803 | + * This program is distributed in the hope that it will be useful, |
1804 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1805 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1806 | + * GNU Lesser General Public License for more details. |
1807 | + * |
1808 | + * You should have received a copy of the GNU Lesser General Public License |
1809 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1810 | + * |
1811 | + * Author: Ricardo Mendoza <ricardo.mendoza@canonical.com> |
1812 | + */ |
1813 | + |
1814 | +#include "ubuntu/application/sensors/haptic.h" |
1815 | +#include "usensord_service.h" |
1816 | +#include "sensors_p.h" |
1817 | + |
1818 | +#include <stdlib.h> |
1819 | + |
1820 | +template<typename T> |
1821 | +struct Holder |
1822 | +{ |
1823 | + Holder(const T&value = T()) : value(value) |
1824 | + { |
1825 | + } |
1826 | + |
1827 | + T value; |
1828 | +}; |
1829 | + |
1830 | +template<typename T> |
1831 | +Holder<T>* make_holder(const T& value) |
1832 | +{ |
1833 | + return new Holder<T>(value); |
1834 | +} |
1835 | + |
1836 | +namespace dbus = core::dbus; |
1837 | +namespace uas = ubuntu::application::sensors; |
1838 | + |
1839 | +UASensorsHaptic* |
1840 | +ua_sensors_haptic_new() |
1841 | +{ |
1842 | + auto bus = std::shared_ptr<dbus::Bus>(new dbus::Bus(core::dbus::WellKnownBus::session)); |
1843 | + bus->install_executor(dbus::asio::make_executor(bus)); |
1844 | + |
1845 | + auto stub_service = dbus::Service::use_service(bus, dbus::traits::Service<uas::USensorD>::interface_name()); |
1846 | + auto stub = stub_service->object_for_path(dbus::types::ObjectPath("/com/canonical/usensord/haptic")); |
1847 | + |
1848 | + return make_holder(new UbuntuApplicationSensorsHaptic(stub)); |
1849 | +} |
1850 | + |
1851 | +UStatus |
1852 | +ua_sensors_haptic_vibrate_once( |
1853 | + UASensorsHaptic* sensor, |
1854 | + uint32_t duration) |
1855 | +{ |
1856 | + if (sensor == nullptr) |
1857 | + return U_STATUS_ERROR; |
1858 | + |
1859 | + auto s = static_cast<Holder<UbuntuApplicationSensorsHaptic*>*>(sensor); |
1860 | + |
1861 | + try |
1862 | + { |
1863 | + s->value->session->invoke_method_synchronously<uas::USensorD::Haptic::Vibrate, void>(duration); |
1864 | + } |
1865 | + catch (const std::runtime_error& e) |
1866 | + { |
1867 | + std::cout << e.what() << std::endl; |
1868 | + return U_STATUS_ERROR; |
1869 | + } |
1870 | + |
1871 | + return U_STATUS_SUCCESS; |
1872 | +} |
1873 | + |
1874 | +UStatus |
1875 | +ua_sensors_haptic_vibrate_with_pattern( |
1876 | + UASensorsHaptic* sensor, |
1877 | + uint32_t pattern[MAX_PATTERN_SIZE], |
1878 | + uint32_t repeat) |
1879 | +{ |
1880 | + if (sensor == nullptr) |
1881 | + return U_STATUS_ERROR; |
1882 | + |
1883 | + auto s = static_cast<Holder<UbuntuApplicationSensorsHaptic*>*>(sensor); |
1884 | + |
1885 | + std::vector<uint32_t> p_arg (pattern, pattern + MAX_PATTERN_SIZE); |
1886 | + |
1887 | + try |
1888 | + { |
1889 | + s->value->session->invoke_method_synchronously<uas::USensorD::Haptic::VibratePattern, void>(p_arg, repeat); |
1890 | + } |
1891 | + catch (const std::runtime_error& e) |
1892 | + { |
1893 | + std::cout << e.what() << std::endl; |
1894 | + return U_STATUS_ERROR; |
1895 | + } |
1896 | + |
1897 | + return U_STATUS_SUCCESS; |
1898 | +} |
1899 | |
1900 | === added file 'src/ubuntu/application/common/application/sensors/usensord_service.h' |
1901 | --- src/ubuntu/application/common/application/sensors/usensord_service.h 1970-01-01 00:00:00 +0000 |
1902 | +++ src/ubuntu/application/common/application/sensors/usensord_service.h 2014-06-11 12:19:49 +0000 |
1903 | @@ -0,0 +1,80 @@ |
1904 | +/* |
1905 | + * Copyright (C) 2013 Canonical Ltd |
1906 | + * |
1907 | + * This program is free software: you can redistribute it and/or modify |
1908 | + * it under the terms of the GNU Lesser General Public License version 3 as |
1909 | + * published by the Free Software Foundation. |
1910 | + * |
1911 | + * This program is distributed in the hope that it will be useful, |
1912 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1913 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1914 | + * GNU Lesser General Public License for more details. |
1915 | + * |
1916 | + * You should have received a copy of the GNU Lesser General Public License |
1917 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1918 | + * |
1919 | + * Author: Ricardo Mendoza <ricardo.mendoza@canonical.com> |
1920 | + */ |
1921 | + |
1922 | +#include <string> |
1923 | +#include <vector> |
1924 | +#include <chrono> |
1925 | + |
1926 | +namespace ubuntu |
1927 | +{ |
1928 | +namespace application |
1929 | +{ |
1930 | +namespace sensors |
1931 | +{ |
1932 | + |
1933 | +struct USensorD |
1934 | +{ |
1935 | + static std::string& name() |
1936 | + { |
1937 | + static std::string s = "com.canonical.usensord"; |
1938 | + return s; |
1939 | + } |
1940 | + |
1941 | + struct Haptic |
1942 | + { |
1943 | + static std::string name() |
1944 | + { |
1945 | + static std::string s = "com.canonical.usensord.haptic"; |
1946 | + return s; |
1947 | + } |
1948 | + |
1949 | + struct Vibrate |
1950 | + { |
1951 | + static std::string name() |
1952 | + { |
1953 | + static std::string s = "Vibrate"; |
1954 | + return s; |
1955 | + } |
1956 | + |
1957 | + static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; } |
1958 | + |
1959 | + typedef Haptic Interface; |
1960 | + typedef void ResultType; |
1961 | + typedef std::uint32_t ArgumentType; |
1962 | + }; |
1963 | + |
1964 | + struct VibratePattern |
1965 | + { |
1966 | + static std::string name() |
1967 | + { |
1968 | + static std::string s = "VibratePattern"; |
1969 | + return s; |
1970 | + } |
1971 | + |
1972 | + static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; } |
1973 | + |
1974 | + typedef Haptic Interface; |
1975 | + typedef void ResultType; |
1976 | + typedef std::tuple<std::vector<std::uint32_t>, std::uint32_t> ArgumentType; |
1977 | + }; |
1978 | + }; |
1979 | +}; |
1980 | + |
1981 | +} |
1982 | +} |
1983 | +} |
1984 | |
1985 | === renamed directory 'src/ubuntu/mirclient' => 'src/ubuntu/application/common/mirclient' |
1986 | === modified file 'src/ubuntu/application/common/mirclient/CMakeLists.txt' |
1987 | --- src/ubuntu/mirclient/CMakeLists.txt 2014-02-07 14:32:44 +0000 |
1988 | +++ src/ubuntu/application/common/mirclient/CMakeLists.txt 2014-06-11 12:19:49 +0000 |
1989 | @@ -13,11 +13,6 @@ |
1990 | |
1991 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -fPIC") |
1992 | |
1993 | -add_library( |
1994 | - ubuntu_application_api_mirclient SHARED |
1995 | - ${SOURCES} |
1996 | -) |
1997 | - |
1998 | include_directories( |
1999 | ${CMAKE_BINARY_DIR}/include |
2000 | ${MIRCLIENT_INCLUDE_DIRS} |
2001 | @@ -25,18 +20,16 @@ |
2002 | ${CMAKE_CURRENT_BINARY_DIR} |
2003 | ) |
2004 | |
2005 | +add_library( |
2006 | + ubuntu_application_api_mirclient STATIC |
2007 | + ${SOURCES} |
2008 | +) |
2009 | + |
2010 | +SET(MIRCOMMON_LINK -Wl,--whole-archive ubuntu_application_api_mircommon -Wl,--no-whole-archive) |
2011 | + |
2012 | target_link_libraries( |
2013 | ubuntu_application_api_mirclient |
2014 | + |
2015 | ${MIRCLIENT_LDFLAGS} ${MIRCLIENT_LIBRARIES} |
2016 | - -Wl,--whole-archive ubuntu_application_api_mircommon ${UBUNTU_APPLICATION_API_LINK_LIBRARIES} -Wl,--no-whole-archive |
2017 | ${PROTOBUF_LIBRARIES} |
2018 | ) |
2019 | - |
2020 | -set_target_properties( |
2021 | - ubuntu_application_api_mirclient |
2022 | - PROPERTIES |
2023 | - VERSION 1.0 |
2024 | - SOVERSION 1 |
2025 | -) |
2026 | - |
2027 | -install(TARGETS ubuntu_application_api_mirclient ${INSTALL_TARGETS_DEFAULT_ARGS}) |
2028 | |
2029 | === modified file 'src/ubuntu/application/common/mirclient/ubuntu_application_api_mirclient.cpp' |
2030 | --- src/ubuntu/mirclient/ubuntu_application_api_mirclient.cpp 2014-05-07 12:21:22 +0000 |
2031 | +++ src/ubuntu/application/common/mirclient/ubuntu_application_api_mirclient.cpp 2014-06-11 12:19:49 +0000 |
2032 | @@ -86,6 +86,15 @@ |
2033 | extern "C" |
2034 | { |
2035 | |
2036 | +void u_application_init(void *args) |
2037 | +{ |
2038 | + (void) args; |
2039 | +} |
2040 | + |
2041 | +void u_application_finish() |
2042 | +{ |
2043 | +} |
2044 | + |
2045 | // TODO<papi>: Eliminate global instance by adding Instance to some functions (i.e. display queries) |
2046 | // TODO: We can't take ownership of description and options until we get rid of the global instance |
2047 | // so we leak them. |
2048 | @@ -311,11 +320,7 @@ |
2049 | delete window; |
2050 | } |
2051 | |
2052 | -void |
2053 | -ua_ui_window_get_size( |
2054 | - UAUiWindow *u_window, |
2055 | - uint32_t *width, |
2056 | - uint32_t *height) |
2057 | +void ua_ui_window_get_size(UAUiWindow* u_window, uint32_t *width, uint32_t *height) |
2058 | { |
2059 | auto window = uamc::Window::from_u_window(u_window); |
2060 | window->get_size(width, height); |
2061 | |
2062 | === renamed directory 'src/ubuntu/mircommon' => 'src/ubuntu/application/common/mircommon' |
2063 | === modified file 'src/ubuntu/application/common/mircommon/CMakeLists.txt' |
2064 | --- src/ubuntu/mircommon/CMakeLists.txt 2014-02-17 22:40:09 +0000 |
2065 | +++ src/ubuntu/application/common/mircommon/CMakeLists.txt 2014-06-11 12:19:49 +0000 |
2066 | @@ -7,19 +7,6 @@ |
2067 | lifecycle_delegate_mir.cpp |
2068 | ) |
2069 | |
2070 | -if(ENABLE_HYBRIS_IMPLEMENTATION) |
2071 | - list(APPEND SOURCES |
2072 | - ../hybris/ubuntu_application_sensors_hybris.cpp |
2073 | - ) |
2074 | - list(APPEND LINK_LIBRARIES |
2075 | - ${Hybris} |
2076 | - ) |
2077 | -else() |
2078 | - list(APPEND SOURCES |
2079 | - ubuntu_application_sensors_desktop.cpp |
2080 | - ) |
2081 | -endif() |
2082 | - |
2083 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC --std=c++11") |
2084 | |
2085 | include_directories( |
2086 | @@ -34,6 +21,5 @@ |
2087 | target_link_libraries( |
2088 | ubuntu_application_api_mircommon |
2089 | |
2090 | - ${UBUNTU_APPLICATION_API_LINK_LIBRARIES} |
2091 | ${LINK_LIBRARIES} |
2092 | ) |
2093 | |
2094 | === renamed directory 'src/ubuntu/mirserver' => 'src/ubuntu/application/common/mirserver' |
2095 | === modified file 'src/ubuntu/application/common/mirserver/CMakeLists.txt' |
2096 | --- src/ubuntu/mirserver/CMakeLists.txt 2014-01-09 18:47:45 +0000 |
2097 | +++ src/ubuntu/application/common/mirserver/CMakeLists.txt 2014-06-11 12:19:49 +0000 |
2098 | @@ -7,30 +7,18 @@ |
2099 | |
2100 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -fPIC") |
2101 | |
2102 | -add_library( |
2103 | - ubuntu_application_api_mirserver SHARED |
2104 | - ${SOURCES} |
2105 | -) |
2106 | - |
2107 | include_directories( |
2108 | ${CMAKE_BINARY_DIR}/include |
2109 | ${MIRSERVER_INCLUDE_DIRS} |
2110 | ) |
2111 | |
2112 | +add_library( |
2113 | + ubuntu_application_api_mirserver STATIC |
2114 | + ${SOURCES} |
2115 | +) |
2116 | + |
2117 | target_link_libraries( |
2118 | ubuntu_application_api_mirserver |
2119 | - ${MIRSERVER_LDFLAGS} ${MIRSERVER_LIBRARIES} |
2120 | - -Wl,--whole-archive ubuntu_application_api_mircommon ${UBUNTU_APPLICATION_API_LINK_LIBRARIES} |
2121 | - -Wl,--no-whole-archive |
2122 | -) |
2123 | - |
2124 | - |
2125 | -set_target_properties( |
2126 | - ubuntu_application_api_mirserver |
2127 | - PROPERTIES |
2128 | - VERSION 1.0 |
2129 | - SOVERSION 1 |
2130 | -) |
2131 | - |
2132 | -install(TARGETS ubuntu_application_api_mirserver ${INSTALL_TARGETS_DEFAULT_ARGS}) |
2133 | -install(FILES ubuntu_application_api_mirserver_priv.h DESTINATION include/ubuntu/application) |
2134 | + |
2135 | + ${MIRSERVER_LDFLAGS} ${MIRSERVER_LIBRARIES} |
2136 | +) |
2137 | |
2138 | === modified file 'src/ubuntu/application/common/mirserver/ubuntu_application_api_mirserver.cpp' |
2139 | --- src/ubuntu/mirserver/ubuntu_application_api_mirserver.cpp 2014-04-15 20:23:07 +0000 |
2140 | +++ src/ubuntu/application/common/mirserver/ubuntu_application_api_mirserver.cpp 2014-06-11 12:19:49 +0000 |
2141 | @@ -16,7 +16,6 @@ |
2142 | * Authored by: Robert Carr <robert.carr@canonical.com> |
2143 | */ |
2144 | |
2145 | -#include "ubuntu_application_api_mirserver_priv.h" |
2146 | #include "application_instance_mirserver_priv.h" |
2147 | #include "window_properties_mirserver_priv.h" |
2148 | #include "window_mirserver_priv.h" |
2149 | @@ -27,6 +26,7 @@ |
2150 | #include "mircommon/mir/geometry/rectangles.h" |
2151 | |
2152 | // C APIs |
2153 | +#include <ubuntu/application/init.h> |
2154 | #include <ubuntu/application/lifecycle_delegate.h> |
2155 | #include <ubuntu/application/ui/window.h> |
2156 | #include <ubuntu/application/ui/options.h> |
2157 | @@ -77,19 +77,20 @@ |
2158 | |
2159 | extern "C" |
2160 | { |
2161 | -void ua_ui_mirserver_init(mir::DefaultServerConfiguration& config) |
2162 | +void u_application_init(void *args) |
2163 | { |
2164 | auto context = global_mirserver_context(); |
2165 | + mir::DefaultServerConfiguration* config = reinterpret_cast<mir::DefaultServerConfiguration*>(args); |
2166 | |
2167 | - context->display = config.the_display(); |
2168 | - context->buffer_allocator = config.the_buffer_allocator(); |
2169 | - context->surface_coordinator = config.the_surface_coordinator(); |
2170 | - context->session_listener = config.the_session_listener(); |
2171 | + context->surface_coordinator = config->the_surface_coordinator(); |
2172 | + context->buffer_allocator = config->the_buffer_allocator(); |
2173 | + context->display = config->the_display(); |
2174 | + context->session_listener = config->the_session_listener(); |
2175 | context->input_platform = mir::input::receiver::InputPlatform::create(); |
2176 | - context->egl_client = config.the_graphics_platform()->create_internal_client(); |
2177 | + context->egl_client = config->the_graphics_platform()->create_internal_client(); |
2178 | } |
2179 | |
2180 | -void ua_ui_mirserver_finish() |
2181 | +void u_application_finish() |
2182 | { |
2183 | auto context = global_mirserver_context(); |
2184 | |
2185 | @@ -290,6 +291,13 @@ |
2186 | delete window; |
2187 | } |
2188 | |
2189 | +void ua_ui_window_get_size(UAUiWindow* u_window, uint32_t *width, uint32_t *height) |
2190 | +{ |
2191 | + (void) u_window; |
2192 | + (void) width; |
2193 | + (void) height; |
2194 | +} |
2195 | + |
2196 | UStatus ua_ui_window_move(UAUiWindow* window, uint32_t x, uint32_t y) |
2197 | { |
2198 | // TODO<mir,papi>: Implement. But should this exist? |
2199 | |
2200 | === added directory 'src/ubuntu/application/desktop' |
2201 | === added file 'src/ubuntu/application/desktop/CMakeLists.txt' |
2202 | --- src/ubuntu/application/desktop/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
2203 | +++ src/ubuntu/application/desktop/CMakeLists.txt 2014-06-11 12:19:49 +0000 |
2204 | @@ -0,0 +1,66 @@ |
2205 | +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11") |
2206 | + |
2207 | +add_library( |
2208 | + ubuntu_application_api_desktop_mirclient MODULE |
2209 | + |
2210 | + module.cpp |
2211 | + module_version.h |
2212 | +) |
2213 | + |
2214 | +add_library( |
2215 | + ubuntu_application_api_desktop_mirserver MODULE |
2216 | + |
2217 | + module.cpp |
2218 | + module_version.h |
2219 | +) |
2220 | + |
2221 | +target_link_libraries( |
2222 | + ubuntu_application_api_desktop_mirclient |
2223 | + |
2224 | + "-Wl,--whole-archive" |
2225 | + ubuntu_application_api_mirclient |
2226 | + ubuntu_application_api_mircommon |
2227 | + #TODO: ubuntu_application_api_d_sensors |
2228 | + ${UBUNTU_APPLICATION_API_LINK_LIBRARIES} |
2229 | + "-Wl,--no-whole-archive" |
2230 | + #TODO: Alarms |
2231 | +) |
2232 | + |
2233 | +target_link_libraries( |
2234 | + ubuntu_application_api_desktop_mirserver |
2235 | + |
2236 | + "-Wl,--whole-archive" |
2237 | + ubuntu_application_api_mirserver |
2238 | + ubuntu_application_api_mircommon |
2239 | + #TODO: ubuntu_application_api_d_sensors |
2240 | + ${UBUNTU_APPLICATION_API_LINK_LIBRARIES} |
2241 | + "-Wl,--no-whole-archive" |
2242 | + #TODO: Alarms |
2243 | +) |
2244 | + |
2245 | +set_target_properties( |
2246 | + ubuntu_application_api_desktop_mirclient |
2247 | + PROPERTIES |
2248 | + VERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR}.${UBUNTU_PLATFORM_API_VERSION_MINOR}.${UBUNTU_PLATFORM_API_VERSION_PATCH} |
2249 | + SOVERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR} |
2250 | +) |
2251 | + |
2252 | +set_target_properties( |
2253 | + ubuntu_application_api_desktop_mirserver |
2254 | + PROPERTIES |
2255 | + VERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR}.${UBUNTU_PLATFORM_API_VERSION_MINOR}.${UBUNTU_PLATFORM_API_VERSION_PATCH} |
2256 | + SOVERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR} |
2257 | +) |
2258 | +install( |
2259 | + TARGETS ubuntu_application_api_desktop_mirclient |
2260 | + # this is not a development library to compile against, users should always |
2261 | + # specify the SONAME; so don't build a *.so |
2262 | + LIBRARY DESTINATION "${LIB_INSTALL_DIR}" NAMELINK_SKIP |
2263 | +) |
2264 | + |
2265 | +install( |
2266 | + TARGETS ubuntu_application_api_desktop_mirserver |
2267 | + # this is not a development library to compile against, users should always |
2268 | + # specify the SONAME; so don't build a *.so |
2269 | + LIBRARY DESTINATION "${LIB_INSTALL_DIR}" NAMELINK_SKIP |
2270 | +) |
2271 | |
2272 | === added file 'src/ubuntu/application/desktop/module.cpp' |
2273 | --- src/ubuntu/application/desktop/module.cpp 1970-01-01 00:00:00 +0000 |
2274 | +++ src/ubuntu/application/desktop/module.cpp 2014-06-11 12:19:49 +0000 |
2275 | @@ -0,0 +1,28 @@ |
2276 | +/* |
2277 | + * Copyright (C) 2014 Canonical Ltd |
2278 | + * |
2279 | + * This program is free software: you can redistribute it and/or modify |
2280 | + * it under the terms of the GNU Lesser General Public License version 3 as |
2281 | + * published by the Free Software Foundation. |
2282 | + * |
2283 | + * This program is distributed in the hope that it will be useful, |
2284 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2285 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2286 | + * GNU Lesser General Public License for more details. |
2287 | + * |
2288 | + * You should have received a copy of the GNU Lesser General Public License |
2289 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2290 | + * |
2291 | + * Authored by: Ricardo Mendoza <ricardo.mendoza@canonical.com> |
2292 | + */ |
2293 | + |
2294 | +#include <ubuntu/application/init.h> |
2295 | + |
2296 | +#include "module_version.h" |
2297 | + |
2298 | +void u_application_module_version(uint32_t *major, uint32_t *minor, uint32_t *patch) |
2299 | +{ |
2300 | + *major = (uint32_t) MODULE_VERSION_MAJOR; |
2301 | + *minor = (uint32_t) MODULE_VERSION_MINOR; |
2302 | + *patch = (uint32_t) MODULE_VERSION_PATCH; |
2303 | +} |
2304 | |
2305 | === added file 'src/ubuntu/application/desktop/module_version.h' |
2306 | --- src/ubuntu/application/desktop/module_version.h 1970-01-01 00:00:00 +0000 |
2307 | +++ src/ubuntu/application/desktop/module_version.h 2014-06-11 12:19:49 +0000 |
2308 | @@ -0,0 +1,3 @@ |
2309 | +#define MODULE_VERSION_MAJOR 2 |
2310 | +#define MODULE_VERSION_MINOR 0 |
2311 | +#define MODULE_VERSION_PATCH 0 |
2312 | |
2313 | === renamed directory 'src/ubuntu/testbackend' => 'src/ubuntu/application/testbackend' |
2314 | === modified file 'src/ubuntu/application/testbackend/CMakeLists.txt' |
2315 | --- src/ubuntu/testbackend/CMakeLists.txt 2014-01-08 15:17:41 +0000 |
2316 | +++ src/ubuntu/application/testbackend/CMakeLists.txt 2014-06-11 12:19:49 +0000 |
2317 | @@ -1,8 +1,18 @@ |
2318 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11") |
2319 | |
2320 | add_library( |
2321 | - ubuntu_application_api_test SHARED |
2322 | + ubuntu_application_api_test MODULE |
2323 | + |
2324 | ubuntu_application_sensors.cpp |
2325 | + module.cpp |
2326 | + test_stubs.cpp |
2327 | + module_version.h |
2328 | +) |
2329 | + |
2330 | +target_link_libraries( |
2331 | + ubuntu_application_api_test |
2332 | + |
2333 | + rt |
2334 | ) |
2335 | |
2336 | set_target_properties( |
2337 | |
2338 | === added file 'src/ubuntu/application/testbackend/module.cpp' |
2339 | --- src/ubuntu/application/testbackend/module.cpp 1970-01-01 00:00:00 +0000 |
2340 | +++ src/ubuntu/application/testbackend/module.cpp 2014-06-11 12:19:49 +0000 |
2341 | @@ -0,0 +1,28 @@ |
2342 | +/* |
2343 | + * Copyright (C) 2014 Canonical Ltd |
2344 | + * |
2345 | + * This program is free software: you can redistribute it and/or modify |
2346 | + * it under the terms of the GNU Lesser General Public License version 3 as |
2347 | + * published by the Free Software Foundation. |
2348 | + * |
2349 | + * This program is distributed in the hope that it will be useful, |
2350 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2351 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2352 | + * GNU Lesser General Public License for more details. |
2353 | + * |
2354 | + * You should have received a copy of the GNU Lesser General Public License |
2355 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2356 | + * |
2357 | + * Authored by: Ricardo Mendoza <ricardo.mendoza@canonical.com> |
2358 | + */ |
2359 | + |
2360 | +#include <ubuntu/application/init.h> |
2361 | + |
2362 | +#include "module_version.h" |
2363 | + |
2364 | +void u_application_module_version(uint32_t *major, uint32_t *minor, uint32_t *patch) |
2365 | +{ |
2366 | + *major = (uint32_t) MODULE_VERSION_MAJOR; |
2367 | + *minor = (uint32_t) MODULE_VERSION_MINOR; |
2368 | + *patch = (uint32_t) MODULE_VERSION_PATCH; |
2369 | +} |
2370 | |
2371 | === added file 'src/ubuntu/application/testbackend/module_version.h' |
2372 | --- src/ubuntu/application/testbackend/module_version.h 1970-01-01 00:00:00 +0000 |
2373 | +++ src/ubuntu/application/testbackend/module_version.h 2014-06-11 12:19:49 +0000 |
2374 | @@ -0,0 +1,3 @@ |
2375 | +#define MODULE_VERSION_MAJOR 2 |
2376 | +#define MODULE_VERSION_MINOR 0 |
2377 | +#define MODULE_VERSION_PATCH 0 |
2378 | |
2379 | === added file 'src/ubuntu/application/testbackend/test_stubs.cpp' |
2380 | --- src/ubuntu/application/testbackend/test_stubs.cpp 1970-01-01 00:00:00 +0000 |
2381 | +++ src/ubuntu/application/testbackend/test_stubs.cpp 2014-06-11 12:19:49 +0000 |
2382 | @@ -0,0 +1,463 @@ |
2383 | +/* |
2384 | + * Copyright (C) 2014 Canonical Ltd |
2385 | + * |
2386 | + * This program is free software: you can redistribute it and/or modify |
2387 | + * it under the terms of the GNU Lesser General Public License version 3 as |
2388 | + * published by the Free Software Foundation. |
2389 | + * |
2390 | + * This program is distributed in the hope that it will be useful, |
2391 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2392 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2393 | + * GNU Lesser General Public License for more details. |
2394 | + * |
2395 | + * You should have received a copy of the GNU Lesser General Public License |
2396 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2397 | + * |
2398 | + * Authored by: Ricardo Mendoza <ricardo.mendoza@canonical.com> |
2399 | + */ |
2400 | + |
2401 | +#include <ubuntu/application/lifecycle_delegate.h> |
2402 | +#include <ubuntu/application/ui/window.h> |
2403 | +#include <ubuntu/application/ui/options.h> |
2404 | +#include <ubuntu/application/ui/session.h> |
2405 | +#include <ubuntu/application/ui/clipboard.h> |
2406 | +#include <ubuntu/application/ui/display.h> |
2407 | +#include <ubuntu/application/sensors/haptic.h> |
2408 | + |
2409 | +#include <ubuntu/application/location/service.h> |
2410 | +#include <ubuntu/application/location/heading_update.h> |
2411 | +#include <ubuntu/application/location/position_update.h> |
2412 | +#include <ubuntu/application/location/velocity_update.h> |
2413 | + |
2414 | +#include <ubuntu/application/url_dispatcher/service.h> |
2415 | + |
2416 | +#include <ubuntu/application/init.h> |
2417 | + |
2418 | +// Application Module Config |
2419 | +void u_application_init(void*) |
2420 | +{ |
2421 | +} |
2422 | + |
2423 | +void u_application_finish() |
2424 | +{ |
2425 | +} |
2426 | + |
2427 | +// Session helpers |
2428 | +UAUiSessionProperties* ua_ui_session_properties_new() |
2429 | +{ |
2430 | + return NULL; |
2431 | +} |
2432 | + |
2433 | +void ua_ui_session_properties_set_type(UAUiSessionProperties*, UAUiSessionType) |
2434 | +{ |
2435 | +} |
2436 | + |
2437 | +void ua_ui_session_properties_set_remote_pid(UAUiSessionProperties*, uint32_t) |
2438 | +{ |
2439 | +} |
2440 | + |
2441 | +UAUiSession* ua_ui_session_new_with_properties(UAUiSessionProperties*) |
2442 | +{ |
2443 | + return NULL; |
2444 | +} |
2445 | + |
2446 | +// Lifecycle helpers |
2447 | +UApplicationLifecycleDelegate* u_application_lifecycle_delegate_new() |
2448 | +{ |
2449 | + return NULL; |
2450 | +} |
2451 | + |
2452 | +void u_application_lifecycle_delegate_set_context (UApplicationLifecycleDelegate*, void*) |
2453 | +{ |
2454 | +} |
2455 | + |
2456 | +void u_application_lifecycle_delegate_ref (UApplicationLifecycleDelegate*) |
2457 | +{ |
2458 | +} |
2459 | + |
2460 | +void u_application_lifecycle_delegate_unref (UApplicationLifecycleDelegate*) |
2461 | +{ |
2462 | +} |
2463 | + |
2464 | +void u_application_lifecycle_delegate_set_application_resumed_cb (UApplicationLifecycleDelegate*, u_on_application_resumed) |
2465 | +{ |
2466 | +} |
2467 | + |
2468 | +void u_application_lifecycle_delegate_set_application_about_to_stop_cb (UApplicationLifecycleDelegate*, u_on_application_about_to_stop) |
2469 | +{ |
2470 | +} |
2471 | + |
2472 | +// Application Helpers |
2473 | + |
2474 | +// UApplicationId |
2475 | +UApplicationId* u_application_id_new_from_stringn(const char*, size_t) |
2476 | +{ |
2477 | + return NULL; |
2478 | +} |
2479 | + |
2480 | +void u_application_id_destroy(UApplicationId*) |
2481 | +{ |
2482 | +} |
2483 | + |
2484 | +int u_application_id_compare(UApplicationId*, UApplicationId*) |
2485 | +{ |
2486 | +} |
2487 | + |
2488 | +// UApplicationDescription |
2489 | +UApplicationDescription* u_application_description_new() |
2490 | +{ |
2491 | + return NULL; |
2492 | +} |
2493 | + |
2494 | +void u_application_description_destroy (UApplicationDescription*) |
2495 | +{ |
2496 | +} |
2497 | + |
2498 | +void u_application_description_set_application_id (UApplicationDescription*, UApplicationId*) |
2499 | +{ |
2500 | +} |
2501 | + |
2502 | +void u_application_description_set_application_lifecycle_delegate (UApplicationDescription*, UApplicationLifecycleDelegate*) |
2503 | +{ |
2504 | +} |
2505 | + |
2506 | +// UApplicationOptions |
2507 | +UApplicationOptions* u_application_options_new_from_cmd_line(int, char**) |
2508 | +{ |
2509 | + return NULL; |
2510 | +} |
2511 | + |
2512 | +void u_application_options_destroy(UApplicationOptions*) |
2513 | +{ |
2514 | +} |
2515 | + |
2516 | +UAUiFormFactor u_application_options_get_form_factor(UApplicationOptions*) |
2517 | +{ |
2518 | + return U_DESKTOP; |
2519 | +} |
2520 | + |
2521 | +UAUiStage u_application_options_get_stage(UApplicationOptions*) |
2522 | +{ |
2523 | + return U_MAIN_STAGE; |
2524 | +} |
2525 | + |
2526 | +// UApplicationInstance |
2527 | +UApplicationInstance* u_application_instance_new_from_description_with_options(UApplicationDescription*, UApplicationOptions*) |
2528 | +{ |
2529 | + return NULL; |
2530 | +} |
2531 | + |
2532 | +// Application Ui Helpers |
2533 | + |
2534 | +// Clipboard |
2535 | +void ua_ui_set_clipboard_content(void*, size_t) |
2536 | +{ |
2537 | +} |
2538 | + |
2539 | +void ua_ui_get_clipboard_content(void**, size_t*) |
2540 | +{ |
2541 | +} |
2542 | + |
2543 | +// UAUiDisplay |
2544 | +UAUiDisplay* ua_ui_display_new_with_index(size_t) |
2545 | +{ |
2546 | + return NULL; |
2547 | +} |
2548 | + |
2549 | +void ua_ui_display_destroy(UAUiDisplay*) |
2550 | +{ |
2551 | +} |
2552 | + |
2553 | +uint32_t ua_ui_display_query_horizontal_res(UAUiDisplay*) |
2554 | +{ |
2555 | + return 0; |
2556 | +} |
2557 | + |
2558 | +uint32_t ua_ui_display_query_vertical_res(UAUiDisplay*) |
2559 | +{ |
2560 | + return 0; |
2561 | +} |
2562 | + |
2563 | +EGLNativeDisplayType ua_ui_display_get_native_type(UAUiDisplay*) |
2564 | +{ |
2565 | + return 0; |
2566 | +} |
2567 | + |
2568 | +// UAUiWindowProperties |
2569 | +UAUiWindowProperties* ua_ui_window_properties_new_for_normal_window() |
2570 | +{ |
2571 | + return NULL; |
2572 | +} |
2573 | + |
2574 | +void ua_ui_window_properties_destroy(UAUiWindowProperties*) |
2575 | +{ |
2576 | +} |
2577 | + |
2578 | +void ua_ui_window_properties_set_titlen(UAUiWindowProperties*, const char*, size_t) |
2579 | +{ |
2580 | +} |
2581 | + |
2582 | +const char* ua_ui_window_properties_get_title(UAUiWindowProperties*) |
2583 | +{ |
2584 | + return "INVALID"; |
2585 | +} |
2586 | + |
2587 | +void ua_ui_window_properties_set_role(UAUiWindowProperties*, UAUiWindowRole) |
2588 | +{ |
2589 | +} |
2590 | + |
2591 | +void ua_ui_window_properties_set_input_cb_and_ctx(UAUiWindowProperties*, UAUiWindowInputEventCb, void*) |
2592 | +{ |
2593 | +} |
2594 | + |
2595 | +void ua_ui_window_properties_set_dimensions(UAUiWindowProperties*, uint32_t, uint32_t) |
2596 | +{ |
2597 | +} |
2598 | + |
2599 | +// UAUiWindow |
2600 | +UAUiWindow* ua_ui_window_new_for_application_with_properties(UApplicationInstance*, UAUiWindowProperties*) |
2601 | +{ |
2602 | + return NULL; |
2603 | +} |
2604 | + |
2605 | +void ua_ui_window_destroy(UAUiWindow*) |
2606 | +{ |
2607 | +} |
2608 | + |
2609 | +void ua_ui_window_get_size(UAUiWindow*, uint32_t*, uint32_t*) |
2610 | +{ |
2611 | +} |
2612 | + |
2613 | +UStatus ua_ui_window_move(UAUiWindow*, uint32_t, uint32_t) |
2614 | +{ |
2615 | + return U_STATUS_ERROR; |
2616 | +} |
2617 | + |
2618 | +UStatus ua_ui_window_resize(UAUiWindow*, uint32_t, uint32_t) |
2619 | +{ |
2620 | + return U_STATUS_ERROR; |
2621 | +} |
2622 | + |
2623 | +UStatus ua_ui_window_hide(UAUiWindow*) |
2624 | +{ |
2625 | + return U_STATUS_ERROR; |
2626 | +} |
2627 | + |
2628 | +UStatus ua_ui_window_show(UAUiWindow*) |
2629 | +{ |
2630 | + return U_STATUS_ERROR; |
2631 | +} |
2632 | + |
2633 | +void ua_ui_window_request_fullscreen(UAUiWindow*) |
2634 | +{ |
2635 | +} |
2636 | + |
2637 | +EGLNativeWindowType ua_ui_window_get_native_type(UAUiWindow*) |
2638 | +{ |
2639 | + return NULL; |
2640 | +} |
2641 | + |
2642 | +UASensorsHaptic* ua_sensors_haptic_new() |
2643 | +{ |
2644 | + return NULL; |
2645 | +} |
2646 | + |
2647 | +UStatus ua_sensors_haptic_enable(UASensorsHaptic*) |
2648 | +{ |
2649 | + return U_STATUS_ERROR; |
2650 | +} |
2651 | + |
2652 | +UStatus ua_sensors_haptic_disable(UASensorsHaptic*) |
2653 | +{ |
2654 | + return U_STATUS_ERROR; |
2655 | +} |
2656 | + |
2657 | +UStatus ua_sensors_haptic_vibrate_once(UASensorsHaptic*, uint32_t) |
2658 | +{ |
2659 | + return U_STATUS_ERROR; |
2660 | +} |
2661 | + |
2662 | +UStatus ua_sensors_haptic_vibrate_with_pattern(UASensorsHaptic*, uint32_t*, uint32_t) |
2663 | +{ |
2664 | + return U_STATUS_ERROR; |
2665 | +} |
2666 | + |
2667 | +// Location |
2668 | +void ua_location_service_controller_ref(UALocationServiceController*) |
2669 | +{ |
2670 | +} |
2671 | + |
2672 | +void ua_location_service_controller_unref(UALocationServiceController*) |
2673 | +{ |
2674 | +} |
2675 | + |
2676 | +void ua_location_service_controller_set_status_changed_handler(UALocationServiceController*, UALocationServiceStatusChangedHandler, void*) |
2677 | +{ |
2678 | +} |
2679 | + |
2680 | +UStatus ua_location_service_controller_query_status(UALocationServiceController*, UALocationServiceStatusFlags*) |
2681 | +{ |
2682 | + return U_STATUS_ERROR; |
2683 | +} |
2684 | + |
2685 | +UStatus ua_location_service_controller_enable_service(UALocationServiceController*) |
2686 | +{ |
2687 | + return U_STATUS_ERROR; |
2688 | +} |
2689 | + |
2690 | +UStatus ua_location_service_controller_disable_service(UALocationServiceController*) |
2691 | +{ |
2692 | + return U_STATUS_ERROR; |
2693 | +} |
2694 | + |
2695 | +UStatus ua_location_service_controller_enable_gps(UALocationServiceController*) |
2696 | +{ |
2697 | + return U_STATUS_ERROR; |
2698 | +} |
2699 | + |
2700 | +UStatus ua_location_service_controller_disable_gps(UALocationServiceController*) |
2701 | +{ |
2702 | + return U_STATUS_ERROR; |
2703 | +} |
2704 | + |
2705 | +void ua_location_heading_update_ref(UALocationHeadingUpdate*) |
2706 | +{ |
2707 | +} |
2708 | + |
2709 | +void ua_location_heading_update_unref(UALocationHeadingUpdate*) |
2710 | +{ |
2711 | +} |
2712 | + |
2713 | +uint64_t ua_location_heading_update_get_timestamp(UALocationHeadingUpdate*) |
2714 | +{ |
2715 | + return 0; |
2716 | +} |
2717 | + |
2718 | +double ua_location_heading_update_get_heading_in_degree(UALocationHeadingUpdate*) |
2719 | +{ |
2720 | + return 0; |
2721 | +} |
2722 | + |
2723 | +void ua_location_position_update_ref(UALocationPositionUpdate*) |
2724 | +{ |
2725 | +} |
2726 | + |
2727 | +void ua_location_position_update_unref(UALocationPositionUpdate*) |
2728 | +{ |
2729 | +} |
2730 | + |
2731 | +uint64_t ua_location_position_update_get_timestamp(UALocationPositionUpdate*) |
2732 | +{ |
2733 | + return 0; |
2734 | +} |
2735 | + |
2736 | +double ua_location_position_update_get_latitude_in_degree(UALocationPositionUpdate*) |
2737 | +{ |
2738 | + return 0; |
2739 | +} |
2740 | + |
2741 | +double ua_location_position_update_get_longitude_in_degree(UALocationPositionUpdate*) |
2742 | +{ |
2743 | + return 0; |
2744 | +} |
2745 | + |
2746 | +bool ua_location_position_update_has_altitude(UALocationPositionUpdate*) |
2747 | +{ |
2748 | + return 0; |
2749 | +} |
2750 | + |
2751 | +double ua_location_position_update_get_altitude_in_meter(UALocationPositionUpdate*) |
2752 | +{ |
2753 | + return 0; |
2754 | +} |
2755 | + |
2756 | +UALocationServiceSession* ua_location_service_create_session_for_low_accuracy(UALocationServiceRequirementsFlags) |
2757 | +{ |
2758 | + return NULL; |
2759 | +} |
2760 | + |
2761 | +UALocationServiceSession* ua_location_service_create_session_for_high_accuracy(UALocationServiceRequirementsFlags) |
2762 | +{ |
2763 | + return NULL; |
2764 | +} |
2765 | + |
2766 | +UALocationServiceController* ua_location_service_create_controller() |
2767 | +{ |
2768 | + return NULL; |
2769 | +} |
2770 | + |
2771 | +void ua_location_service_session_ref(UALocationServiceSession*) |
2772 | +{ |
2773 | +} |
2774 | + |
2775 | +void ua_location_service_session_unref(UALocationServiceSession*) |
2776 | +{ |
2777 | +} |
2778 | + |
2779 | +void ua_location_service_session_set_position_updates_handler(UALocationServiceSession*, UALocationServiceSessionPositionUpdatesHandler, void*) |
2780 | +{ |
2781 | +} |
2782 | + |
2783 | +void ua_location_service_session_set_heading_updates_handler(UALocationServiceSession*, UALocationServiceSessionHeadingUpdatesHandler, void*) |
2784 | +{ |
2785 | +} |
2786 | + |
2787 | +void ua_location_service_session_set_velocity_updates_handler(UALocationServiceSession*, UALocationServiceSessionVelocityUpdatesHandler, void*) |
2788 | +{ |
2789 | +} |
2790 | + |
2791 | +UStatus ua_location_service_session_start_position_updates(UALocationServiceSession*) |
2792 | +{ |
2793 | + return U_STATUS_ERROR; |
2794 | +} |
2795 | + |
2796 | +void ua_location_service_session_stop_position_updates(UALocationServiceSession*) |
2797 | +{ |
2798 | +} |
2799 | + |
2800 | +UStatus ua_location_service_session_start_heading_updates(UALocationServiceSession*) |
2801 | +{ |
2802 | + return U_STATUS_ERROR; |
2803 | +} |
2804 | + |
2805 | +void ua_location_service_session_stop_heading_updates(UALocationServiceSession*) |
2806 | +{ |
2807 | +} |
2808 | + |
2809 | +UStatus ua_location_service_session_start_velocity_updates(UALocationServiceSession*) |
2810 | +{ |
2811 | + return U_STATUS_ERROR; |
2812 | +} |
2813 | + |
2814 | +void ua_location_service_session_stop_velocity_updates(UALocationServiceSession*) |
2815 | +{ |
2816 | +} |
2817 | + |
2818 | +void ua_location_velocity_update_ref(UALocationVelocityUpdate*) |
2819 | +{ |
2820 | +} |
2821 | + |
2822 | +void ua_location_velocity_update_unref(UALocationVelocityUpdate*) |
2823 | +{ |
2824 | +} |
2825 | + |
2826 | +uint64_t ua_location_velocity_update_get_timestamp(UALocationVelocityUpdate*) |
2827 | +{ |
2828 | + return 0; |
2829 | +} |
2830 | + |
2831 | +double ua_location_velocity_update_get_velocity_in_meters_per_second(UALocationVelocityUpdate*) |
2832 | +{ |
2833 | + return 0; |
2834 | +} |
2835 | + |
2836 | +// URL Dispatcher |
2837 | + |
2838 | +UAUrlDispatcherSession* ua_url_dispatcher_session() |
2839 | +{ |
2840 | + return NULL; |
2841 | +} |
2842 | + |
2843 | +void ua_url_dispatcher_session_open(UAUrlDispatcherSession*, const char*, UAUrlDispatcherSessionDispatchHandler, void*) |
2844 | +{ |
2845 | +} |
2846 | |
2847 | === added directory 'src/ubuntu/application/touch' |
2848 | === added file 'src/ubuntu/application/touch/CMakeLists.txt' |
2849 | --- src/ubuntu/application/touch/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
2850 | +++ src/ubuntu/application/touch/CMakeLists.txt 2014-06-11 12:19:49 +0000 |
2851 | @@ -0,0 +1,68 @@ |
2852 | +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11") |
2853 | + |
2854 | +add_subdirectory(hybris) |
2855 | + |
2856 | +add_library( |
2857 | + ubuntu_application_api_touch_mirclient MODULE |
2858 | + |
2859 | + module.cpp |
2860 | + module_version.h |
2861 | +) |
2862 | + |
2863 | +add_library( |
2864 | + ubuntu_application_api_touch_mirserver MODULE |
2865 | + |
2866 | + module.cpp |
2867 | + module_version.h |
2868 | +) |
2869 | + |
2870 | +target_link_libraries( |
2871 | + ubuntu_application_api_touch_mirclient |
2872 | + |
2873 | + "-Wl,--whole-archive" |
2874 | + ubuntu_application_api_mirclient |
2875 | + ubuntu_application_api_mircommon |
2876 | + ubuntu_application_api_hybris |
2877 | + ${UBUNTU_APPLICATION_API_LINK_LIBRARIES} |
2878 | + "-Wl,--no-whole-archive" |
2879 | + #TODO: Alarms |
2880 | +) |
2881 | + |
2882 | +target_link_libraries( |
2883 | + ubuntu_application_api_touch_mirserver |
2884 | + |
2885 | + "-Wl,--whole-archive" |
2886 | + ubuntu_application_api_mirserver |
2887 | + ubuntu_application_api_mircommon |
2888 | + ubuntu_application_api_hybris |
2889 | + ${UBUNTU_APPLICATION_API_LINK_LIBRARIES} |
2890 | + "-Wl,--no-whole-archive" |
2891 | + #TODO: Alarms |
2892 | +) |
2893 | + |
2894 | +set_target_properties( |
2895 | + ubuntu_application_api_touch_mirclient |
2896 | + PROPERTIES |
2897 | + VERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR}.${UBUNTU_PLATFORM_API_VERSION_MINOR}.${UBUNTU_PLATFORM_API_VERSION_PATCH} |
2898 | + SOVERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR} |
2899 | +) |
2900 | + |
2901 | +set_target_properties( |
2902 | + ubuntu_application_api_touch_mirserver |
2903 | + PROPERTIES |
2904 | + VERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR}.${UBUNTU_PLATFORM_API_VERSION_MINOR}.${UBUNTU_PLATFORM_API_VERSION_PATCH} |
2905 | + SOVERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR} |
2906 | +) |
2907 | +install( |
2908 | + TARGETS ubuntu_application_api_touch_mirclient |
2909 | + # this is not a development library to compile against, users should always |
2910 | + # specify the SONAME; so don't build a *.so |
2911 | + LIBRARY DESTINATION "${LIB_INSTALL_DIR}" NAMELINK_SKIP |
2912 | +) |
2913 | + |
2914 | +install( |
2915 | + TARGETS ubuntu_application_api_touch_mirserver |
2916 | + # this is not a development library to compile against, users should always |
2917 | + # specify the SONAME; so don't build a *.so |
2918 | + LIBRARY DESTINATION "${LIB_INSTALL_DIR}" NAMELINK_SKIP |
2919 | +) |
2920 | |
2921 | === renamed directory 'src/ubuntu/hybris' => 'src/ubuntu/application/touch/hybris' |
2922 | === modified file 'src/ubuntu/application/touch/hybris/CMakeLists.txt' |
2923 | --- src/ubuntu/hybris/CMakeLists.txt 2014-05-21 07:15:34 +0000 |
2924 | +++ src/ubuntu/application/touch/hybris/CMakeLists.txt 2014-06-11 12:19:49 +0000 |
2925 | @@ -1,63 +1,17 @@ |
2926 | -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11") |
2927 | +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -fPIC") |
2928 | |
2929 | add_library( |
2930 | - ubuntu_application_api SHARED |
2931 | - |
2932 | - ubuntu_application_api_hybris.cpp |
2933 | + ubuntu_application_api_hybris STATIC |
2934 | + |
2935 | ubuntu_application_sensors_hybris.cpp |
2936 | ) |
2937 | |
2938 | -add_library( |
2939 | - ubuntu_platform_hardware_api SHARED |
2940 | - ubuntu_platform_hardware_api.cpp |
2941 | -) |
2942 | - |
2943 | include_directories( |
2944 | ${CMAKE_BINARY_DIR}/include |
2945 | ) |
2946 | |
2947 | target_link_libraries( |
2948 | - ubuntu_application_api |
2949 | - |
2950 | - "-Wl,--whole-archive" |
2951 | - ${UBUNTU_APPLICATION_API_LINK_LIBRARIES} |
2952 | - "-Wl,--no-whole-archive" |
2953 | - ${Hybris} |
2954 | -) |
2955 | - |
2956 | -target_link_libraries( |
2957 | - ubuntu_platform_hardware_api |
2958 | - |
2959 | - "-Wl,--whole-archive" |
2960 | - ${UBUNTU_HARDWARE_API_LINK_LIBRARIES} |
2961 | - "-Wl,--no-whole-archive" |
2962 | - |
2963 | - dl |
2964 | - ${Hybris} |
2965 | -) |
2966 | - |
2967 | -set_target_properties( |
2968 | - ubuntu_application_api |
2969 | - PROPERTIES |
2970 | - VERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR}.${UBUNTU_PLATFORM_API_VERSION_MINOR}.${UBUNTU_PLATFORM_API_VERSION_PATCH} |
2971 | - SOVERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR} |
2972 | -) |
2973 | - |
2974 | -set_target_properties( |
2975 | - ubuntu_platform_hardware_api |
2976 | - PROPERTIES |
2977 | - VERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR}.${UBUNTU_PLATFORM_API_VERSION_MINOR}.${UBUNTU_PLATFORM_API_VERSION_PATCH} |
2978 | - SOVERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR} |
2979 | -) |
2980 | - |
2981 | -install( |
2982 | - TARGETS ubuntu_application_api |
2983 | - ${INSTALL_TARGETS_DEFAULT_ARGS} |
2984 | -) |
2985 | - |
2986 | -install( |
2987 | - TARGETS ubuntu_platform_hardware_api |
2988 | - ${INSTALL_TARGETS_DEFAULT_ARGS} |
2989 | -) |
2990 | - |
2991 | -add_subdirectory(tests/) |
2992 | + ubuntu_application_api_hybris |
2993 | + |
2994 | + ${Hybris} |
2995 | +) |
2996 | |
2997 | === renamed file 'src/ubuntu/hybris/bridge.h' => 'src/ubuntu/application/touch/hybris/hybris_module.h' |
2998 | --- src/ubuntu/hybris/bridge.h 2014-05-08 10:20:53 +0000 |
2999 | +++ src/ubuntu/application/touch/hybris/hybris_module.h 2014-06-11 12:19:49 +0000 |
3000 | @@ -16,16 +16,10 @@ |
3001 | * Authored by: Thomas Voss <thomas.voss@canonical.com> |
3002 | * Ricardo Mendoza <ricardo.mendoza@canonical.com> |
3003 | */ |
3004 | -#ifndef BRIDGE_H_ |
3005 | -#define BRIDGE_H_ |
3006 | - |
3007 | -#include <assert.h> |
3008 | -#include <dlfcn.h> |
3009 | -#include <stddef.h> |
3010 | -#include <stdlib.h> |
3011 | -#include <string.h> |
3012 | - |
3013 | -#define HIDDEN_SYMBOL __attribute__ ((visibility ("hidden"))) |
3014 | +#ifndef HYBRIS_MODULE_H_ |
3015 | +#define HYBRIS_MODULE_H_ |
3016 | + |
3017 | +#include <bridge.h> |
3018 | |
3019 | #ifdef __cplusplus |
3020 | extern "C" { |
3021 | @@ -40,188 +34,28 @@ |
3022 | |
3023 | namespace internal |
3024 | { |
3025 | - |
3026 | -/* By default we load the backend from /system/lib/libubuntu_application_api.so |
3027 | - * Programs can select a different backend with $UBUNTU_PLATFORM_API_BACKEND, |
3028 | - * which either needs to be a full path or just the file name (then it will be |
3029 | - * looked up in the usual library search path, see dlopen(3)). |
3030 | - */ |
3031 | -struct HIDDEN_SYMBOL ToApplication |
3032 | +struct HIDDEN_SYMBOL ToHybris |
3033 | { |
3034 | static const char* path() |
3035 | { |
3036 | - static const char* cache = NULL; |
3037 | - |
3038 | - if (cache == NULL) { |
3039 | - cache = secure_getenv("UBUNTU_PLATFORM_API_BACKEND"); |
3040 | - if (cache == NULL) |
3041 | - cache = "/system/lib/libubuntu_application_api.so"; |
3042 | - } |
3043 | - |
3044 | + static const char* cache = "/system/lib/libubuntu_application_api.so"; |
3045 | return cache; |
3046 | } |
3047 | -}; |
3048 | - |
3049 | -template<typename Scope = ToApplication> |
3050 | -class HIDDEN_SYMBOL Bridge |
3051 | -{ |
3052 | - public: |
3053 | - static Bridge<Scope>& instance() |
3054 | - { |
3055 | - static Bridge<Scope> bridge; |
3056 | - return bridge; |
3057 | - } |
3058 | - |
3059 | - void* resolve_symbol(const char* symbol) const |
3060 | - { |
3061 | - return dlsym_fn(lib_handle, symbol); |
3062 | - } |
3063 | - |
3064 | - protected: |
3065 | - Bridge() : lib_handle(android_dlopen(Scope::path(), RTLD_LAZY)) |
3066 | - { |
3067 | - const char* path = Scope::path(); |
3068 | - /* use Android dl functions for Android libs in /system/, glibc dl |
3069 | - * functions for others */ |
3070 | - if (strncmp(path, "/system/", 8) == 0) { |
3071 | - lib_handle = android_dlopen(path, RTLD_LAZY); |
3072 | - dlsym_fn = android_dlsym; |
3073 | - } else { |
3074 | - lib_handle = dlopen(path, RTLD_LAZY); |
3075 | - dlsym_fn = dlsym; |
3076 | - } |
3077 | - } |
3078 | - |
3079 | - ~Bridge() |
3080 | - { |
3081 | - // TODO android_dlclose(libcamera_handle); |
3082 | - } |
3083 | - |
3084 | - void* lib_handle; |
3085 | - void* (*dlsym_fn) (void*, const char*); |
3086 | -}; |
3087 | - |
3088 | -} |
3089 | - |
3090 | -#ifdef __cplusplus |
3091 | -extern "C" { |
3092 | -#endif |
3093 | - |
3094 | -/**********************************************************/ |
3095 | -/*********** Implementation starts here *******************/ |
3096 | -/**********************************************************/ |
3097 | - |
3098 | -#define DLSYM(fptr, sym) if (*(fptr) == NULL) { *((void**)fptr) = (void *) internal::Bridge<>::instance().resolve_symbol(sym); } |
3099 | - |
3100 | -// this allows DLSYM to return NULL (happens if the backend is not available), |
3101 | -// and returns NULL in that case; return_type must be a pointer! |
3102 | -#define IMPLEMENT_CTOR0(return_type, symbol) \ |
3103 | - return_type symbol() \ |
3104 | - { \ |
3105 | - static return_type (*f)() = NULL; \ |
3106 | - DLSYM(&f, #symbol); \ |
3107 | - return f ? f() : NULL;} |
3108 | - |
3109 | -#define IMPLEMENT_FUNCTION0(return_type, symbol) \ |
3110 | - return_type symbol() \ |
3111 | - { \ |
3112 | - static return_type (*f)() = NULL; \ |
3113 | - DLSYM(&f, #symbol); \ |
3114 | - return f();} |
3115 | - |
3116 | -#define IMPLEMENT_VOID_FUNCTION0(symbol) \ |
3117 | - void symbol() \ |
3118 | - { \ |
3119 | - static void (*f)() = NULL; \ |
3120 | - DLSYM(&f, #symbol); \ |
3121 | - f();} |
3122 | - |
3123 | -#define IMPLEMENT_FUNCTION1(return_type, symbol, arg1) \ |
3124 | - return_type symbol(arg1 _1) \ |
3125 | - { \ |
3126 | - static return_type (*f)(arg1) = NULL; \ |
3127 | - DLSYM(&f, #symbol); \ |
3128 | - return f(_1); } |
3129 | - |
3130 | -#define IMPLEMENT_VOID_FUNCTION1(symbol, arg1) \ |
3131 | - void symbol(arg1 _1) \ |
3132 | - { \ |
3133 | - static void (*f)(arg1) = NULL; \ |
3134 | - DLSYM(&f, #symbol); \ |
3135 | - f(_1); } |
3136 | - |
3137 | -#define IMPLEMENT_FUNCTION2(return_type, symbol, arg1, arg2) \ |
3138 | - return_type symbol(arg1 _1, arg2 _2) \ |
3139 | - { \ |
3140 | - static return_type (*f)(arg1, arg2) = NULL; \ |
3141 | - DLSYM(&f, #symbol); \ |
3142 | - return f(_1, _2); } |
3143 | - |
3144 | -#define IMPLEMENT_VOID_FUNCTION2(symbol, arg1, arg2) \ |
3145 | - void symbol(arg1 _1, arg2 _2) \ |
3146 | - { \ |
3147 | - static void (*f)(arg1, arg2) = NULL; \ |
3148 | - DLSYM(&f, #symbol); \ |
3149 | - f(_1, _2); } |
3150 | - |
3151 | -#define IMPLEMENT_FUNCTION3(return_type, symbol, arg1, arg2, arg3) \ |
3152 | - return_type symbol(arg1 _1, arg2 _2, arg3 _3) \ |
3153 | - { \ |
3154 | - static return_type (*f)(arg1, arg2, arg3) = NULL; \ |
3155 | - DLSYM(&f, #symbol); \ |
3156 | - return f(_1, _2, _3); } |
3157 | - |
3158 | -#define IMPLEMENT_VOID_FUNCTION3(symbol, arg1, arg2, arg3) \ |
3159 | - void symbol(arg1 _1, arg2 _2, arg3 _3) \ |
3160 | - { \ |
3161 | - static void (*f)(arg1, arg2, arg3) = NULL; \ |
3162 | - DLSYM(&f, #symbol); \ |
3163 | - f(_1, _2, _3); } |
3164 | - |
3165 | -#define IMPLEMENT_VOID_FUNCTION4(symbol, arg1, arg2, arg3, arg4) \ |
3166 | - void symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4) \ |
3167 | - { \ |
3168 | - static void (*f)(arg1, arg2, arg3, arg4) = NULL; \ |
3169 | - DLSYM(&f, #symbol); \ |
3170 | - f(_1, _2, _3, _4); } |
3171 | - |
3172 | -#define IMPLEMENT_VOID_SF_FUNCTION4(symbol, arg1, arg2, arg3, arg4) \ |
3173 | - void symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4) \ |
3174 | - { \ |
3175 | - static void (*f)(arg1, arg2, arg3, arg4) = NULL; \ |
3176 | - DLSYM(&f, #symbol); \ |
3177 | - f(_1, _2, _3, _4); } |
3178 | - |
3179 | -#define IMPLEMENT_FUNCTION4(return_type, symbol, arg1, arg2, arg3, arg4) \ |
3180 | - return_type symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4) \ |
3181 | - { \ |
3182 | - static return_type (*f)(arg1, arg2, arg3, arg4) = NULL; \ |
3183 | - DLSYM(&f, #symbol); \ |
3184 | - return f(_1, _2, _3, _4); } |
3185 | - |
3186 | -#define IMPLEMENT_FUNCTION6(return_type, symbol, arg1, arg2, arg3, arg4, arg5, arg6) \ |
3187 | - return_type symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4, arg5 _5, arg6 _6) \ |
3188 | - { \ |
3189 | - static return_type (*f)(arg1, arg2, arg3, arg4, arg5, arg6) = NULL; \ |
3190 | - DLSYM(&f, #symbol); \ |
3191 | - return f(_1, _2, _3, _4, _5, _6); } |
3192 | - |
3193 | -#define IMPLEMENT_VOID_FUNCTION7(symbol, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ |
3194 | - void symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4, arg5 _5, arg6 _6, arg7 _7) \ |
3195 | - { \ |
3196 | - static void (*f)(arg1, arg2, arg3, arg4, arg5, arg6, arg7) = NULL; \ |
3197 | - DLSYM(&f, #symbol); \ |
3198 | - f(_1, _2, _3, _4, _5, _6, _7); } |
3199 | - |
3200 | -#define IMPLEMENT_VOID_FUNCTION8(symbol, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \ |
3201 | - void symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4, arg5 _5, arg6 _6, arg7 _7, arg8 _8) \ |
3202 | - { \ |
3203 | - static void (*f)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) = NULL; \ |
3204 | - DLSYM(&f, #symbol); \ |
3205 | - f(_1, _2, _3, _4, _5, _6, _7, _8); } |
3206 | - |
3207 | -#ifdef __cplusplus |
3208 | -} |
3209 | -#endif |
3210 | - |
3211 | -#endif // BRIDGE_H_ |
3212 | + |
3213 | + static void* dlopen_fn(const char* path, int flags) |
3214 | + { |
3215 | + return android_dlopen(path, flags); |
3216 | + } |
3217 | + |
3218 | + static void* dlsym_fn(void* handle, const char* symbol) |
3219 | + { |
3220 | + return android_dlsym(handle, symbol); |
3221 | + } |
3222 | +}; |
3223 | +} |
3224 | + |
3225 | +#define DLSYM(fptr, sym) if (*(fptr) == NULL) { *((void**)fptr) = (void *) internal::Bridge<internal::ToHybris>::instance().resolve_symbol(sym); } |
3226 | + |
3227 | +#include <bridge_defs.h> |
3228 | + |
3229 | +#endif // HYBRIS_MODULE_H_ |
3230 | |
3231 | === modified file 'src/ubuntu/application/touch/hybris/ubuntu_application_api_hybris.cpp' |
3232 | --- src/ubuntu/hybris/ubuntu_application_api_hybris.cpp 2013-12-11 02:20:26 +0000 |
3233 | +++ src/ubuntu/application/touch/hybris/ubuntu_application_api_hybris.cpp 2014-06-11 12:19:49 +0000 |
3234 | @@ -29,7 +29,7 @@ |
3235 | #include <ubuntu/application/ui/clipboard.h> |
3236 | #include <ubuntu/application/ui/display.h> |
3237 | |
3238 | -#include "bridge.h" |
3239 | +#include "hybris_module.h" |
3240 | |
3241 | #ifdef __cplusplus |
3242 | extern "C" { |
3243 | |
3244 | === modified file 'src/ubuntu/application/touch/hybris/ubuntu_application_sensors_hybris.cpp' |
3245 | --- src/ubuntu/hybris/ubuntu_application_sensors_hybris.cpp 2014-02-13 13:12:41 +0000 |
3246 | +++ src/ubuntu/application/touch/hybris/ubuntu_application_sensors_hybris.cpp 2014-06-11 12:19:49 +0000 |
3247 | @@ -21,7 +21,7 @@ |
3248 | #include <ubuntu/application/sensors/proximity.h> |
3249 | #include <ubuntu/application/sensors/light.h> |
3250 | |
3251 | -#include "bridge.h" |
3252 | +#include "hybris_module.h" |
3253 | |
3254 | // Ubuntu Application Sensors |
3255 | |
3256 | |
3257 | === added file 'src/ubuntu/application/touch/module.cpp' |
3258 | --- src/ubuntu/application/touch/module.cpp 1970-01-01 00:00:00 +0000 |
3259 | +++ src/ubuntu/application/touch/module.cpp 2014-06-11 12:19:49 +0000 |
3260 | @@ -0,0 +1,28 @@ |
3261 | +/* |
3262 | + * Copyright (C) 2014 Canonical Ltd |
3263 | + * |
3264 | + * This program is free software: you can redistribute it and/or modify |
3265 | + * it under the terms of the GNU Lesser General Public License version 3 as |
3266 | + * published by the Free Software Foundation. |
3267 | + * |
3268 | + * This program is distributed in the hope that it will be useful, |
3269 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3270 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3271 | + * GNU Lesser General Public License for more details. |
3272 | + * |
3273 | + * You should have received a copy of the GNU Lesser General Public License |
3274 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3275 | + * |
3276 | + * Authored by: Ricardo Mendoza <ricardo.mendoza@canonical.com> |
3277 | + */ |
3278 | + |
3279 | +#include <ubuntu/application/init.h> |
3280 | + |
3281 | +#include "module_version.h" |
3282 | + |
3283 | +void u_application_module_version(uint32_t *major, uint32_t *minor, uint32_t *patch) |
3284 | +{ |
3285 | + *major = (uint32_t) MODULE_VERSION_MAJOR; |
3286 | + *minor = (uint32_t) MODULE_VERSION_MINOR; |
3287 | + *patch = (uint32_t) MODULE_VERSION_PATCH; |
3288 | +} |
3289 | |
3290 | === added file 'src/ubuntu/application/touch/module_version.h' |
3291 | --- src/ubuntu/application/touch/module_version.h 1970-01-01 00:00:00 +0000 |
3292 | +++ src/ubuntu/application/touch/module_version.h 2014-06-11 12:19:49 +0000 |
3293 | @@ -0,0 +1,3 @@ |
3294 | +#define MODULE_VERSION_MAJOR 2 |
3295 | +#define MODULE_VERSION_MINOR 0 |
3296 | +#define MODULE_VERSION_PATCH 0 |
3297 | |
3298 | === added file 'src/ubuntu/application/ubuntu_application_api.cpp' |
3299 | --- src/ubuntu/application/ubuntu_application_api.cpp 1970-01-01 00:00:00 +0000 |
3300 | +++ src/ubuntu/application/ubuntu_application_api.cpp 2014-06-11 12:19:49 +0000 |
3301 | @@ -0,0 +1,222 @@ |
3302 | +/* |
3303 | + * Copyright (C) 2014 Canonical Ltd |
3304 | + * |
3305 | + * This program is free software: you can redistribute it and/or modify |
3306 | + * it under the terms of the GNU Lesser General Public License version 3 as |
3307 | + * published by the Free Software Foundation. |
3308 | + * |
3309 | + * This program is distributed in the hope that it will be useful, |
3310 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3311 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3312 | + * GNU Lesser General Public License for more details. |
3313 | + * |
3314 | + * You should have received a copy of the GNU Lesser General Public License |
3315 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3316 | + * |
3317 | + * Authored by: Thomas Voss <thomas.voss@canonical.com> |
3318 | + * Ricardo Mendoza <ricardo.mendoza@canonical.com> |
3319 | + */ |
3320 | + |
3321 | +// C APIs |
3322 | +#include <ubuntu/application/lifecycle_delegate.h> |
3323 | +#include <ubuntu/application/ui/window.h> |
3324 | +#include <ubuntu/application/ui/options.h> |
3325 | +#include <ubuntu/application/ui/session.h> |
3326 | +#include <ubuntu/application/ui/clipboard.h> |
3327 | +#include <ubuntu/application/ui/display.h> |
3328 | +#include <ubuntu/application/sensors/accelerometer.h> |
3329 | +#include <ubuntu/application/sensors/proximity.h> |
3330 | +#include <ubuntu/application/sensors/light.h> |
3331 | +#include <ubuntu/application/sensors/haptic.h> |
3332 | + |
3333 | +#include <ubuntu/application/location/service.h> |
3334 | +#include <ubuntu/application/location/heading_update.h> |
3335 | +#include <ubuntu/application/location/position_update.h> |
3336 | +#include <ubuntu/application/location/velocity_update.h> |
3337 | + |
3338 | +#include <ubuntu/application/url_dispatcher/service.h> |
3339 | + |
3340 | +#include <ubuntu/application/init.h> |
3341 | + |
3342 | +#include "base_module.h" |
3343 | + |
3344 | +#ifdef __cplusplus |
3345 | +extern "C" { |
3346 | +#endif |
3347 | + |
3348 | +// Application Module Config |
3349 | +IMPLEMENT_VOID_FUNCTION3(u_application_module_version, uint32_t*, uint32_t*, uint32_t*); |
3350 | +IMPLEMENT_VOID_FUNCTION1(u_application_init, void*); |
3351 | +IMPLEMENT_VOID_FUNCTION0(u_application_finish); |
3352 | + |
3353 | +// Session helpers |
3354 | +IMPLEMENT_FUNCTION0(UAUiSessionProperties*, ua_ui_session_properties_new); |
3355 | +IMPLEMENT_VOID_FUNCTION2(ua_ui_session_properties_set_type, UAUiSessionProperties*, UAUiSessionType); |
3356 | +IMPLEMENT_VOID_FUNCTION2(ua_ui_session_properties_set_remote_pid, UAUiSessionProperties*, uint32_t); |
3357 | +IMPLEMENT_FUNCTION1(UAUiSession*, ua_ui_session_new_with_properties, UAUiSessionProperties*); |
3358 | + |
3359 | +// Lifecycle helpers |
3360 | +IMPLEMENT_FUNCTION0(UApplicationLifecycleDelegate*, u_application_lifecycle_delegate_new); |
3361 | +IMPLEMENT_VOID_FUNCTION2(u_application_lifecycle_delegate_set_context, UApplicationLifecycleDelegate*, void*); |
3362 | +IMPLEMENT_VOID_FUNCTION1(u_application_lifecycle_delegate_ref, UApplicationLifecycleDelegate*); |
3363 | +IMPLEMENT_VOID_FUNCTION1(u_application_lifecycle_delegate_unref, UApplicationLifecycleDelegate*); |
3364 | +IMPLEMENT_VOID_FUNCTION2(u_application_lifecycle_delegate_set_application_resumed_cb, UApplicationLifecycleDelegate*, u_on_application_resumed); |
3365 | +IMPLEMENT_VOID_FUNCTION2(u_application_lifecycle_delegate_set_application_about_to_stop_cb, UApplicationLifecycleDelegate*, u_on_application_about_to_stop); |
3366 | + |
3367 | +// Application Helpers |
3368 | + |
3369 | +// UApplicationId |
3370 | +IMPLEMENT_FUNCTION2(UApplicationId*, u_application_id_new_from_stringn, const char*, size_t); |
3371 | +IMPLEMENT_VOID_FUNCTION1(u_application_id_destroy, UApplicationId*); |
3372 | +IMPLEMENT_FUNCTION2(int, u_application_id_compare, UApplicationId*, UApplicationId*); |
3373 | + |
3374 | +// UApplicationDescription |
3375 | +IMPLEMENT_FUNCTION0(UApplicationDescription*, u_application_description_new); |
3376 | +IMPLEMENT_VOID_FUNCTION1(u_application_description_destroy, UApplicationDescription*); |
3377 | +IMPLEMENT_VOID_FUNCTION2(u_application_description_set_application_id, UApplicationDescription*, UApplicationId*); |
3378 | +IMPLEMENT_VOID_FUNCTION2(u_application_description_set_application_lifecycle_delegate, UApplicationDescription*, UApplicationLifecycleDelegate*); |
3379 | + |
3380 | +// UApplicationOptions |
3381 | +IMPLEMENT_FUNCTION2(UApplicationOptions*, u_application_options_new_from_cmd_line, int, char**); |
3382 | +IMPLEMENT_VOID_FUNCTION1(u_application_options_destroy, UApplicationOptions*); |
3383 | +IMPLEMENT_FUNCTION1(UAUiFormFactor, u_application_options_get_form_factor, UApplicationOptions*); |
3384 | +IMPLEMENT_FUNCTION1(UAUiStage, u_application_options_get_stage, UApplicationOptions*); |
3385 | + |
3386 | +// UApplicationInstance |
3387 | +IMPLEMENT_FUNCTION2(UApplicationInstance*, u_application_instance_new_from_description_with_options, UApplicationDescription*, UApplicationOptions*); |
3388 | + |
3389 | +// Application Ui Helpers |
3390 | + |
3391 | +// Clipboard |
3392 | +IMPLEMENT_VOID_FUNCTION2(ua_ui_set_clipboard_content, void*, size_t); |
3393 | +IMPLEMENT_VOID_FUNCTION2(ua_ui_get_clipboard_content, void**, size_t*); |
3394 | + |
3395 | +// UAUiDisplay |
3396 | +IMPLEMENT_FUNCTION1(UAUiDisplay*, ua_ui_display_new_with_index, size_t); |
3397 | +IMPLEMENT_VOID_FUNCTION1(ua_ui_display_destroy, UAUiDisplay*); |
3398 | +IMPLEMENT_FUNCTION1(uint32_t, ua_ui_display_query_horizontal_res, UAUiDisplay*); |
3399 | +IMPLEMENT_FUNCTION1(uint32_t, ua_ui_display_query_vertical_res, UAUiDisplay*); |
3400 | +IMPLEMENT_FUNCTION1(EGLNativeDisplayType, ua_ui_display_get_native_type, UAUiDisplay*); |
3401 | + |
3402 | + |
3403 | +// UAUiWindowProperties |
3404 | +IMPLEMENT_FUNCTION0(UAUiWindowProperties*, ua_ui_window_properties_new_for_normal_window); |
3405 | +IMPLEMENT_VOID_FUNCTION1(ua_ui_window_properties_destroy, UAUiWindowProperties*); |
3406 | +IMPLEMENT_VOID_FUNCTION3(ua_ui_window_properties_set_titlen, UAUiWindowProperties*, const char*, size_t); |
3407 | +IMPLEMENT_FUNCTION1(const char*, ua_ui_window_properties_get_title, UAUiWindowProperties*); |
3408 | +IMPLEMENT_VOID_FUNCTION2(ua_ui_window_properties_set_role, UAUiWindowProperties*, UAUiWindowRole); |
3409 | +IMPLEMENT_VOID_FUNCTION3(ua_ui_window_properties_set_input_cb_and_ctx, UAUiWindowProperties*, UAUiWindowInputEventCb, void*); |
3410 | +IMPLEMENT_VOID_FUNCTION3(ua_ui_window_properties_set_dimensions, UAUiWindowProperties*, uint32_t, uint32_t); |
3411 | + |
3412 | +// UAUiWindow |
3413 | +IMPLEMENT_FUNCTION2(UAUiWindow*, ua_ui_window_new_for_application_with_properties, UApplicationInstance*, UAUiWindowProperties*); |
3414 | +IMPLEMENT_VOID_FUNCTION1(ua_ui_window_destroy, UAUiWindow*); |
3415 | +IMPLEMENT_VOID_FUNCTION3(ua_ui_window_get_size, UAUiWindow*, uint32_t*, uint32_t*); |
3416 | +IMPLEMENT_FUNCTION3(UStatus, ua_ui_window_move, UAUiWindow*, uint32_t, uint32_t); |
3417 | +IMPLEMENT_FUNCTION3(UStatus, ua_ui_window_resize, UAUiWindow*, uint32_t, uint32_t); |
3418 | +IMPLEMENT_FUNCTION1(UStatus, ua_ui_window_hide, UAUiWindow*); |
3419 | +IMPLEMENT_FUNCTION1(UStatus, ua_ui_window_show, UAUiWindow*); |
3420 | +IMPLEMENT_VOID_FUNCTION1(ua_ui_window_request_fullscreen, UAUiWindow*); |
3421 | +IMPLEMENT_FUNCTION1(EGLNativeWindowType, ua_ui_window_get_native_type, UAUiWindow*); |
3422 | + |
3423 | +// Ubuntu Application Sensors |
3424 | + |
3425 | +// Acceleration Sensor |
3426 | +IMPLEMENT_CTOR0(UASensorsAccelerometer*, ua_sensors_accelerometer_new); |
3427 | +IMPLEMENT_FUNCTION1(UStatus, ua_sensors_accelerometer_enable, UASensorsAccelerometer*); |
3428 | +IMPLEMENT_FUNCTION1(UStatus, ua_sensors_accelerometer_disable, UASensorsAccelerometer*); |
3429 | +IMPLEMENT_FUNCTION1(uint32_t, ua_sensors_accelerometer_get_min_delay, UASensorsAccelerometer*); |
3430 | +IMPLEMENT_FUNCTION2(UStatus, ua_sensors_accelerometer_get_min_value, UASensorsAccelerometer*, float*); |
3431 | +IMPLEMENT_FUNCTION2(UStatus, ua_sensors_accelerometer_get_max_value, UASensorsAccelerometer*, float*); |
3432 | +IMPLEMENT_FUNCTION2(UStatus, ua_sensors_accelerometer_get_resolution, UASensorsAccelerometer*, float*); |
3433 | +IMPLEMENT_VOID_FUNCTION3(ua_sensors_accelerometer_set_reading_cb, UASensorsAccelerometer*, on_accelerometer_event_cb, void*); |
3434 | + |
3435 | +// Acceleration Sensor Event |
3436 | +IMPLEMENT_FUNCTION1(uint64_t, uas_accelerometer_event_get_timestamp, UASAccelerometerEvent*); |
3437 | +IMPLEMENT_FUNCTION2(UStatus, uas_accelerometer_event_get_acceleration_x, UASAccelerometerEvent*, float*); |
3438 | +IMPLEMENT_FUNCTION2(UStatus, uas_accelerometer_event_get_acceleration_y, UASAccelerometerEvent*, float*); |
3439 | +IMPLEMENT_FUNCTION2(UStatus, uas_accelerometer_event_get_acceleration_z, UASAccelerometerEvent*, float*); |
3440 | + |
3441 | +// Proximity Sensor |
3442 | +IMPLEMENT_CTOR0(UASensorsProximity*, ua_sensors_proximity_new); |
3443 | +IMPLEMENT_FUNCTION1(UStatus, ua_sensors_proximity_enable, UASensorsProximity*); |
3444 | +IMPLEMENT_FUNCTION1(UStatus, ua_sensors_proximity_disable, UASensorsProximity*); |
3445 | +IMPLEMENT_FUNCTION1(uint32_t, ua_sensors_proximity_get_min_delay, UASensorsProximity*); |
3446 | +IMPLEMENT_FUNCTION2(UStatus, ua_sensors_proximity_get_min_value, UASensorsProximity*, float*); |
3447 | +IMPLEMENT_FUNCTION2(UStatus, ua_sensors_proximity_get_max_value, UASensorsProximity*, float*); |
3448 | +IMPLEMENT_FUNCTION2(UStatus, ua_sensors_proximity_get_resolution, UASensorsProximity*, float*); |
3449 | +IMPLEMENT_VOID_FUNCTION3(ua_sensors_proximity_set_reading_cb, UASensorsProximity*, on_proximity_event_cb, void*); |
3450 | + |
3451 | +// Proximity Sensor Event |
3452 | +IMPLEMENT_FUNCTION1(uint64_t, uas_proximity_event_get_timestamp, UASProximityEvent*); |
3453 | +IMPLEMENT_FUNCTION1(UASProximityDistance, uas_proximity_event_get_distance, UASProximityEvent*); |
3454 | + |
3455 | +// Ambient Light Sensor |
3456 | +IMPLEMENT_CTOR0(UASensorsLight*, ua_sensors_light_new); |
3457 | +IMPLEMENT_FUNCTION1(UStatus, ua_sensors_light_enable, UASensorsLight*); |
3458 | +IMPLEMENT_FUNCTION1(UStatus, ua_sensors_light_disable, UASensorsLight*); |
3459 | +IMPLEMENT_FUNCTION1(uint32_t, ua_sensors_light_get_min_delay, UASensorsLight*); |
3460 | +IMPLEMENT_FUNCTION2(UStatus, ua_sensors_light_get_min_value, UASensorsLight*, float*); |
3461 | +IMPLEMENT_FUNCTION2(UStatus, ua_sensors_light_get_max_value, UASensorsLight*, float*); |
3462 | +IMPLEMENT_FUNCTION2(UStatus, ua_sensors_light_get_resolution, UASensorsLight*, float*); |
3463 | +IMPLEMENT_VOID_FUNCTION3(ua_sensors_light_set_reading_cb, UASensorsLight*, on_light_event_cb, void*); |
3464 | + |
3465 | +// Ambient Light Sensor Event |
3466 | +IMPLEMENT_FUNCTION1(uint64_t, uas_light_event_get_timestamp, UASLightEvent*); |
3467 | +IMPLEMENT_FUNCTION2(UStatus, uas_light_event_get_light, UASLightEvent*, float*); |
3468 | + |
3469 | +// Haptic Sensor |
3470 | +IMPLEMENT_CTOR0(UASensorsHaptic*, ua_sensors_haptic_new); |
3471 | +IMPLEMENT_FUNCTION1(UStatus, ua_sensors_haptic_enable, UASensorsHaptic*); |
3472 | +IMPLEMENT_FUNCTION1(UStatus, ua_sensors_haptic_disable, UASensorsHaptic*); |
3473 | +IMPLEMENT_FUNCTION2(UStatus, ua_sensors_haptic_vibrate_once, UASensorsHaptic*, uint32_t); |
3474 | +IMPLEMENT_FUNCTION3(UStatus, ua_sensors_haptic_vibrate_with_pattern, UASensorsHaptic*, uint32_t*, uint32_t); |
3475 | + |
3476 | +// Location |
3477 | + |
3478 | +IMPLEMENT_VOID_FUNCTION1(ua_location_service_controller_ref, UALocationServiceController*); |
3479 | +IMPLEMENT_VOID_FUNCTION1(ua_location_service_controller_unref, UALocationServiceController*); |
3480 | +IMPLEMENT_VOID_FUNCTION3(ua_location_service_controller_set_status_changed_handler, UALocationServiceController*, UALocationServiceStatusChangedHandler, void*); |
3481 | +IMPLEMENT_FUNCTION2(UStatus, ua_location_service_controller_query_status, UALocationServiceController*, UALocationServiceStatusFlags*); |
3482 | +IMPLEMENT_FUNCTION1(UStatus, ua_location_service_controller_enable_service, UALocationServiceController*); |
3483 | +IMPLEMENT_FUNCTION1(UStatus, ua_location_service_controller_disable_service, UALocationServiceController*); |
3484 | +IMPLEMENT_FUNCTION1(UStatus, ua_location_service_controller_enable_gps, UALocationServiceController*); |
3485 | +IMPLEMENT_FUNCTION1(UStatus, ua_location_service_controller_disable_gps, UALocationServiceController*); |
3486 | +IMPLEMENT_VOID_FUNCTION1(ua_location_heading_update_ref, UALocationHeadingUpdate*); |
3487 | +IMPLEMENT_VOID_FUNCTION1(ua_location_heading_update_unref, UALocationHeadingUpdate*); |
3488 | +IMPLEMENT_FUNCTION1(uint64_t, ua_location_heading_update_get_timestamp, UALocationHeadingUpdate*); |
3489 | +IMPLEMENT_FUNCTION1(double, ua_location_heading_update_get_heading_in_degree, UALocationHeadingUpdate*); |
3490 | +IMPLEMENT_VOID_FUNCTION1(ua_location_position_update_ref, UALocationPositionUpdate*); |
3491 | +IMPLEMENT_VOID_FUNCTION1(ua_location_position_update_unref, UALocationPositionUpdate*); |
3492 | +IMPLEMENT_FUNCTION1(uint64_t, ua_location_position_update_get_timestamp, UALocationPositionUpdate*); |
3493 | +IMPLEMENT_FUNCTION1(double, ua_location_position_update_get_latitude_in_degree, UALocationPositionUpdate*); |
3494 | +IMPLEMENT_FUNCTION1(double, ua_location_position_update_get_longitude_in_degree, UALocationPositionUpdate*); |
3495 | +IMPLEMENT_FUNCTION1(bool, ua_location_position_update_has_altitude, UALocationPositionUpdate*); |
3496 | +IMPLEMENT_FUNCTION1(double, ua_location_position_update_get_altitude_in_meter, UALocationPositionUpdate*); |
3497 | +IMPLEMENT_FUNCTION1(UALocationServiceSession*, ua_location_service_create_session_for_low_accuracy, UALocationServiceRequirementsFlags); |
3498 | +IMPLEMENT_FUNCTION1(UALocationServiceSession*, ua_location_service_create_session_for_high_accuracy, UALocationServiceRequirementsFlags); |
3499 | +IMPLEMENT_CTOR0(UALocationServiceController*, ua_location_service_create_controller); |
3500 | +IMPLEMENT_VOID_FUNCTION1(ua_location_service_session_ref, UALocationServiceSession*); |
3501 | +IMPLEMENT_VOID_FUNCTION1(ua_location_service_session_unref, UALocationServiceSession*); |
3502 | +IMPLEMENT_VOID_FUNCTION3(ua_location_service_session_set_position_updates_handler, UALocationServiceSession*, UALocationServiceSessionPositionUpdatesHandler, void*); |
3503 | +IMPLEMENT_VOID_FUNCTION3(ua_location_service_session_set_heading_updates_handler, UALocationServiceSession*, UALocationServiceSessionHeadingUpdatesHandler, void*); |
3504 | +IMPLEMENT_VOID_FUNCTION3(ua_location_service_session_set_velocity_updates_handler, UALocationServiceSession*, UALocationServiceSessionVelocityUpdatesHandler, void*); |
3505 | +IMPLEMENT_FUNCTION1(UStatus, ua_location_service_session_start_position_updates, UALocationServiceSession*); |
3506 | +IMPLEMENT_VOID_FUNCTION1(ua_location_service_session_stop_position_updates, UALocationServiceSession*); |
3507 | +IMPLEMENT_FUNCTION1(UStatus, ua_location_service_session_start_heading_updates, UALocationServiceSession*); |
3508 | +IMPLEMENT_VOID_FUNCTION1(ua_location_service_session_stop_heading_updates, UALocationServiceSession*); |
3509 | +IMPLEMENT_FUNCTION1(UStatus, ua_location_service_session_start_velocity_updates, UALocationServiceSession*); |
3510 | +IMPLEMENT_VOID_FUNCTION1(ua_location_service_session_stop_velocity_updates, UALocationServiceSession*); |
3511 | +IMPLEMENT_VOID_FUNCTION1(ua_location_velocity_update_ref, UALocationVelocityUpdate*); |
3512 | +IMPLEMENT_VOID_FUNCTION1(ua_location_velocity_update_unref, UALocationVelocityUpdate*); |
3513 | +IMPLEMENT_FUNCTION1(uint64_t, ua_location_velocity_update_get_timestamp, UALocationVelocityUpdate*); |
3514 | +IMPLEMENT_FUNCTION1(double, ua_location_velocity_update_get_velocity_in_meters_per_second, UALocationVelocityUpdate*); |
3515 | + |
3516 | +// URL Dispatcher |
3517 | + |
3518 | +IMPLEMENT_CTOR0(UAUrlDispatcherSession*, ua_url_dispatcher_session); |
3519 | +IMPLEMENT_VOID_FUNCTION4(ua_url_dispatcher_session_open, UAUrlDispatcherSession*, const char*, UAUrlDispatcherSessionDispatchHandler, void*); |
3520 | + |
3521 | +#ifdef __cplusplus |
3522 | +} |
3523 | +#endif |
3524 | |
3525 | === added file 'src/ubuntu/hardware/CMakeLists.txt' |
3526 | --- src/ubuntu/hardware/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
3527 | +++ src/ubuntu/hardware/CMakeLists.txt 2014-06-11 12:19:49 +0000 |
3528 | @@ -0,0 +1,45 @@ |
3529 | +set( |
3530 | + UBUNTU_HARDWARE_API_LINK_LIBRARIES |
3531 | + |
3532 | + ubuntu_hardware_alarm |
3533 | +) |
3534 | + |
3535 | +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -fPIC") |
3536 | + |
3537 | +include_directories( |
3538 | + ${CMAKE_BINARY_DIR}/include |
3539 | +) |
3540 | + |
3541 | +include_directories(../../bridge) |
3542 | + |
3543 | +add_subdirectory(alarms/) |
3544 | + |
3545 | +add_library( |
3546 | + ubuntu_platform_hardware_api SHARED |
3547 | + ubuntu_platform_hardware_api.cpp |
3548 | +) |
3549 | + |
3550 | +target_link_libraries( |
3551 | + ubuntu_platform_hardware_api |
3552 | + |
3553 | + "-Wl,--whole-archive" |
3554 | + ${UBUNTU_HARDWARE_API_LINK_LIBRARIES} |
3555 | + "-Wl,--no-whole-archive" |
3556 | + |
3557 | + dl |
3558 | + ${Hybris} |
3559 | +) |
3560 | + |
3561 | +set_target_properties( |
3562 | + ubuntu_platform_hardware_api |
3563 | + PROPERTIES |
3564 | + VERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR}.${UBUNTU_PLATFORM_API_VERSION_MINOR}.${UBUNTU_PLATFORM_API_VERSION_PATCH} |
3565 | + SOVERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR} |
3566 | +) |
3567 | + |
3568 | +install( |
3569 | + TARGETS ubuntu_platform_hardware_api |
3570 | + ${INSTALL_TARGETS_DEFAULT_ARGS} |
3571 | +) |
3572 | + |
3573 | +add_subdirectory(tests/) |
3574 | |
3575 | === added directory 'src/ubuntu/hardware/alarms' |
3576 | === renamed file 'src/ubuntu/hardware/CMakeLists.txt' => 'src/ubuntu/hardware/alarms/CMakeLists.txt' |
3577 | === renamed file 'src/ubuntu/hardware/alarm.cpp' => 'src/ubuntu/hardware/alarms/alarm.cpp' |
3578 | === added file 'src/ubuntu/hardware/android_hw_module.h' |
3579 | --- src/ubuntu/hardware/android_hw_module.h 1970-01-01 00:00:00 +0000 |
3580 | +++ src/ubuntu/hardware/android_hw_module.h 2014-06-11 12:19:49 +0000 |
3581 | @@ -0,0 +1,61 @@ |
3582 | +/* |
3583 | + * Copyright (C) 2012 Canonical Ltd |
3584 | + * |
3585 | + * This program is free software: you can redistribute it and/or modify |
3586 | + * it under the terms of the GNU Lesser General Public License version 3 as |
3587 | + * published by the Free Software Foundation. |
3588 | + * |
3589 | + * This program is distributed in the hope that it will be useful, |
3590 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3591 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3592 | + * GNU Lesser General Public License for more details. |
3593 | + * |
3594 | + * You should have received a copy of the GNU Lesser General Public License |
3595 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3596 | + * |
3597 | + * Authored by: Thomas Voss <thomas.voss@canonical.com> |
3598 | + * Ricardo Mendoza <ricardo.mendoza@canonical.com> |
3599 | + */ |
3600 | +#ifndef ANDROID_HW_MODULE_H_ |
3601 | +#define ANDROID_HW_MODULE_H_ |
3602 | + |
3603 | +#include <bridge.h> |
3604 | + |
3605 | +#ifdef __cplusplus |
3606 | +extern "C" { |
3607 | +#endif |
3608 | + |
3609 | +extern void *android_dlopen(const char *filename, int flag); |
3610 | +extern void *android_dlsym(void *handle, const char *symbol); |
3611 | + |
3612 | +#ifdef __cplusplus |
3613 | +} |
3614 | +#endif |
3615 | + |
3616 | +namespace internal |
3617 | +{ |
3618 | +struct HIDDEN_SYMBOL ToHybris |
3619 | +{ |
3620 | + static const char* path() |
3621 | + { |
3622 | + static const char* cache = "/system/lib/libubuntu_application_api.so"; |
3623 | + return cache; |
3624 | + } |
3625 | + |
3626 | + static void* dlopen_fn(const char* path, int flags) |
3627 | + { |
3628 | + return android_dlopen(path, flags); |
3629 | + } |
3630 | + |
3631 | + static void* dlsym_fn(void* handle, const char* symbol) |
3632 | + { |
3633 | + return android_dlsym(handle, symbol); |
3634 | + } |
3635 | +}; |
3636 | +} |
3637 | + |
3638 | +#define DLSYM(fptr, sym) if (*(fptr) == NULL) { *((void**)fptr) = (void *) internal::Bridge<internal::ToHybris>::instance().resolve_symbol(sym); } |
3639 | + |
3640 | +#include <bridge_defs.h> |
3641 | + |
3642 | +#endif // ANDROID_HW_MODULE_H_ |
3643 | |
3644 | === added directory 'src/ubuntu/hardware/tests' |
3645 | === added file 'src/ubuntu/hardware/tests/CMakeLists.txt' |
3646 | --- src/ubuntu/hardware/tests/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
3647 | +++ src/ubuntu/hardware/tests/CMakeLists.txt 2014-06-11 12:19:49 +0000 |
3648 | @@ -0,0 +1,17 @@ |
3649 | +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -fPIC") |
3650 | + |
3651 | +include_directories( |
3652 | + ${CMAKE_BINARY_DIR}/include |
3653 | +) |
3654 | + |
3655 | +add_executable(test_android_gps_api test_gps_api.cpp) |
3656 | +target_link_libraries(test_android_gps_api ubuntu_platform_hardware_api) |
3657 | + |
3658 | +add_executable(test_hardware_alarms_api test_alarms_api.cpp) |
3659 | +target_link_libraries(test_hardware_alarms_api ubuntu_platform_hardware_api) |
3660 | + |
3661 | +install(TARGETS |
3662 | + test_android_gps_api |
3663 | + test_hardware_alarms_api |
3664 | + DESTINATION bin |
3665 | +) |
3666 | |
3667 | === added file 'src/ubuntu/hardware/tests/test_alarms_api.cpp' |
3668 | --- src/ubuntu/hardware/tests/test_alarms_api.cpp 1970-01-01 00:00:00 +0000 |
3669 | +++ src/ubuntu/hardware/tests/test_alarms_api.cpp 2014-06-11 12:19:49 +0000 |
3670 | @@ -0,0 +1,62 @@ |
3671 | +/* |
3672 | + * Copyright © 2014 Canonical Ltd. |
3673 | + * |
3674 | + * This program is free software: you can redistribute it and/or modify |
3675 | + * it under the terms of the GNU Lesser General Public License version 3 as |
3676 | + * published by the Free Software Foundation. |
3677 | + * |
3678 | + * This program is distributed in the hope that it will be useful, |
3679 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3680 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3681 | + * GNU Lesser General Public License for more details. |
3682 | + * |
3683 | + * You should have received a copy of the GNU Lesser General Public License |
3684 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3685 | + * |
3686 | + * Authored by: Thomas Voß <thomas.voss@canonical.com> |
3687 | + */ |
3688 | + |
3689 | +#include <ubuntu/hardware/alarm.h> |
3690 | + |
3691 | +#include <cstdio> |
3692 | +#include <ctime> |
3693 | + |
3694 | +int main(int argc, char** argv) |
3695 | +{ |
3696 | + UHardwareAlarm alarm = u_hardware_alarm_create(); |
3697 | + |
3698 | + if (!alarm) |
3699 | + { |
3700 | + printf("Error creating handle to hardware alarms.\n"); |
3701 | + return 1; |
3702 | + } |
3703 | + |
3704 | + // Alarm in two seconds. |
3705 | + timespec ts { 2, 0 }; |
3706 | + |
3707 | + |
3708 | + UStatus rc = u_hardware_alarm_set_relative_to_with_behavior( |
3709 | + alarm, |
3710 | + U_HARDWARE_ALARM_TIME_REFERENCE_RTC, |
3711 | + U_HARDWARE_ALARM_SLEEP_BEHAVIOR_WAKEUP_DEVICE, |
3712 | + &ts); |
3713 | + |
3714 | + if (rc != U_STATUS_SUCCESS) |
3715 | + { |
3716 | + printf("Problem setting hardware alarm.\n"); |
3717 | + return 1; |
3718 | + } |
3719 | + |
3720 | + UHardwareAlarmWaitResult wait_result; |
3721 | + rc = u_hardware_alarm_wait_for_next_alarm(alarm, &wait_result); |
3722 | + |
3723 | + if (rc != U_STATUS_SUCCESS) |
3724 | + { |
3725 | + printf("Problem waiting for hardware alarm to go off.\n"); |
3726 | + return 1; |
3727 | + } |
3728 | + |
3729 | + printf("Successfully created and waited for a hw alarm.\n"); |
3730 | + |
3731 | + return 0; |
3732 | +} |
3733 | |
3734 | === added file 'src/ubuntu/hardware/tests/test_gps_api.cpp' |
3735 | --- src/ubuntu/hardware/tests/test_gps_api.cpp 1970-01-01 00:00:00 +0000 |
3736 | +++ src/ubuntu/hardware/tests/test_gps_api.cpp 2014-06-11 12:19:49 +0000 |
3737 | @@ -0,0 +1,287 @@ |
3738 | +/* |
3739 | + * Copyright © 2014 Canonical Ltd. |
3740 | + * |
3741 | + * This program is free software: you can redistribute it and/or modify |
3742 | + * it under the terms of the GNU Lesser General Public License version 3 as |
3743 | + * published by the Free Software Foundation. |
3744 | + * |
3745 | + * This program is distributed in the hope that it will be useful, |
3746 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3747 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3748 | + * GNU Lesser General Public License for more details. |
3749 | + * |
3750 | + * You should have received a copy of the GNU Lesser General Public License |
3751 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3752 | + * |
3753 | + * Authored by: Daniel d'Andrada <daniel.dandrada@canonical.com> |
3754 | + */ |
3755 | + |
3756 | +#include <ubuntu/hardware/gps.h> |
3757 | + |
3758 | +#include <ctime> |
3759 | +#include <signal.h> |
3760 | +#include <stdio.h> |
3761 | +#include <stdlib.h> |
3762 | +#include <string.h> |
3763 | +#include <unistd.h> |
3764 | + |
3765 | +namespace ubuntu |
3766 | +{ |
3767 | +class GPSTest |
3768 | +{ |
3769 | + public: |
3770 | + GPSTest(); |
3771 | + ~GPSTest(); |
3772 | + bool init_and_start(const char* server, uint16_t port); |
3773 | + bool stop(); |
3774 | + void inject_time(); |
3775 | + void inject_reference_location(float lat, float lon, float accuracy); |
3776 | + UHardwareGps u_hardware_gps; |
3777 | +}; |
3778 | + |
3779 | +void gps_location_cb(UHardwareGpsLocation* location, void* context) |
3780 | +{ |
3781 | + printf("gps_location_cb() called.\n"); |
3782 | +} |
3783 | + |
3784 | +void gps_status_cb(uint16_t status, void* context) |
3785 | +{ |
3786 | + switch(status) |
3787 | + { |
3788 | + case U_HARDWARE_GPS_STATUS_NONE: |
3789 | + printf("status: None\n"); |
3790 | + break; |
3791 | + case U_HARDWARE_GPS_STATUS_SESSION_BEGIN: |
3792 | + printf("status: Session Begin\n"); |
3793 | + break; |
3794 | + case U_HARDWARE_GPS_STATUS_SESSION_END: |
3795 | + printf("status: Session End\n"); |
3796 | + break; |
3797 | + case U_HARDWARE_GPS_STATUS_ENGINE_ON: |
3798 | + printf("status: Engine On\n"); |
3799 | + break; |
3800 | + case U_HARDWARE_GPS_STATUS_ENGINE_OFF: |
3801 | + printf("status: Engine Off\n"); |
3802 | + default: |
3803 | + break; |
3804 | + }; |
3805 | +} |
3806 | + |
3807 | +void gps_sb_status_cb(UHardwareGpsSvStatus* sv_info, void* context) |
3808 | +{ |
3809 | + printf("gps_sb_status_cb() called, listing %d space vehicles\n", sv_info->num_svs); |
3810 | +} |
3811 | + |
3812 | +void gps_nmea_cb(int64_t timestamp, const char* nmea, int length, void* context) |
3813 | +{ |
3814 | + char str[length+1]; |
3815 | + memcpy(str, nmea, length); |
3816 | + str[length] = 0; |
3817 | + printf("gps_nmea_cb() - %s\n", str); |
3818 | +} |
3819 | + |
3820 | +void gps_set_cabapilities_cb(uint32_t capabilities, void* context) |
3821 | +{ |
3822 | + printf("gps_set_cabapilities_cb() -"); |
3823 | + |
3824 | + if (capabilities & U_HARDWARE_GPS_CAPABILITY_SCHEDULING) |
3825 | + printf(" scheduling"); |
3826 | + if (capabilities & U_HARDWARE_GPS_CAPABILITY_MSB) |
3827 | + printf(" MSB"); |
3828 | + if (capabilities & U_HARDWARE_GPS_CAPABILITY_MSA) |
3829 | + printf(" MSA"); |
3830 | + if (capabilities & U_HARDWARE_GPS_CAPABILITY_SINGLE_SHOT) |
3831 | + printf(" 'single shot'"); |
3832 | + if (capabilities & U_HARDWARE_GPS_CAPABILITY_ON_DEMAND_TIME) |
3833 | + printf(" 'on demand time'"); |
3834 | + |
3835 | + printf("\n"); |
3836 | +} |
3837 | + |
3838 | +void gps_request_utc_time_cb(void* context) |
3839 | +{ |
3840 | + printf("gps_request_utc_time_cb() called.\n"); |
3841 | + ((GPSTest*)context)->inject_time(); |
3842 | +} |
3843 | + |
3844 | +void gps_xtra_download_request_cb(void* context) |
3845 | +{ |
3846 | + printf("gps_xtra_download_request_cb() called.\n"); |
3847 | +} |
3848 | + |
3849 | +void agps_status_cb(UHardwareGpsAGpsStatus* status, void* context) |
3850 | +{ |
3851 | + printf("agps status -"); |
3852 | + |
3853 | + if (status->type == U_HARDWARE_GPS_AGPS_TYPE_SUPL) |
3854 | + printf(" SUPL"); |
3855 | + else |
3856 | + printf(" C2K"); |
3857 | + |
3858 | + switch (status->status) |
3859 | + { |
3860 | + case U_HARDWARE_GPS_REQUEST_AGPS_DATA_CONN: |
3861 | + printf(", request AGPS data connection"); |
3862 | + break; |
3863 | + case U_HARDWARE_GPS_RELEASE_AGPS_DATA_CONN: |
3864 | + printf(", release AGPS data connection"); |
3865 | + break; |
3866 | + case U_HARDWARE_GPS_AGPS_DATA_CONNECTED: |
3867 | + printf(", request AGPS data connected"); |
3868 | + break; |
3869 | + case U_HARDWARE_GPS_AGPS_DATA_CONN_DONE: |
3870 | + printf(", AGPS data connection done"); |
3871 | + break; |
3872 | + default: |
3873 | + case U_HARDWARE_GPS_AGPS_DATA_CONN_FAILED: |
3874 | + printf(", AGPS data connection failed"); |
3875 | + break; |
3876 | + } |
3877 | + |
3878 | + printf(" ipaddr=%u\n", status->ipaddr); |
3879 | +} |
3880 | + |
3881 | +void gps_notify_cb(UHardwareGpsNiNotification *notification, void* context) |
3882 | +{ |
3883 | + printf("gps_notify_cb() called.\n"); |
3884 | +} |
3885 | + |
3886 | +void agps_ril_request_set_id_cb(uint32_t flags, void* context) |
3887 | +{ |
3888 | + printf("agps_ril_request_set_id_cb() called.\n"); |
3889 | +} |
3890 | + |
3891 | +void agps_ril_request_refloc_cb(uint32_t flags, void* context) |
3892 | +{ |
3893 | + printf("agps_ril_request_refloc_cb() called.\n"); |
3894 | +} |
3895 | + |
3896 | +GPSTest::GPSTest() |
3897 | + : u_hardware_gps(NULL) |
3898 | +{ |
3899 | +} |
3900 | + |
3901 | +GPSTest::~GPSTest() |
3902 | +{ |
3903 | + if (u_hardware_gps) |
3904 | + u_hardware_gps_delete(u_hardware_gps); |
3905 | +} |
3906 | + |
3907 | +void GPSTest::inject_time() |
3908 | +{ |
3909 | + // A real implementation would inject time from some NTP server. |
3910 | + time_t t = time(0); |
3911 | + int64_t time_millis = (int64_t)t * (int64_t)1000; |
3912 | + u_hardware_gps_inject_time(u_hardware_gps, |
3913 | + time_millis /*NTP time would go here*/, |
3914 | + time_millis /*internal time when that NTP time was taken*/, |
3915 | + 10 /* possible deviation, in milliseconds*/); |
3916 | +} |
3917 | + |
3918 | +void GPSTest::inject_reference_location(float lat, float lon, float accuracy) |
3919 | +{ |
3920 | + UHardwareGpsLocation location; |
3921 | + location.latitude = lat; |
3922 | + location.longitude = lon; |
3923 | + location.accuracy = accuracy; |
3924 | + u_hardware_gps_inject_location(u_hardware_gps, location); |
3925 | +} |
3926 | + |
3927 | +bool GPSTest::init_and_start(const char* supl_server, uint16_t port) |
3928 | +{ |
3929 | + UHardwareGpsParams gps_params; |
3930 | + |
3931 | + gps_params.location_cb = gps_location_cb; |
3932 | + gps_params.status_cb = gps_status_cb; |
3933 | + gps_params.sv_status_cb = gps_sb_status_cb; |
3934 | + gps_params.nmea_cb = gps_nmea_cb; |
3935 | + gps_params.set_capabilities_cb = gps_set_cabapilities_cb; |
3936 | + gps_params.request_utc_time_cb = gps_request_utc_time_cb; |
3937 | + gps_params.xtra_download_request_cb = gps_xtra_download_request_cb; |
3938 | + gps_params.agps_status_cb = agps_status_cb; |
3939 | + gps_params.gps_ni_notify_cb = gps_notify_cb; |
3940 | + gps_params.request_setid_cb = agps_ril_request_set_id_cb; |
3941 | + gps_params.request_refloc_cb = agps_ril_request_refloc_cb; |
3942 | + gps_params.context = this; |
3943 | + |
3944 | + UHardwareGps u_hardware_gps = u_hardware_gps_new(&gps_params); |
3945 | + if (!u_hardware_gps) |
3946 | + { |
3947 | + printf("GPS creation failed!\n"); |
3948 | + return false; |
3949 | + } |
3950 | + |
3951 | + bool ok = u_hardware_gps_start(u_hardware_gps); |
3952 | + if (!ok) |
3953 | + { |
3954 | + printf("GPS start up failed!\n"); |
3955 | + return false; |
3956 | + } |
3957 | + |
3958 | + u_hardware_gps_delete_aiding_data(u_hardware_gps, |
3959 | + U_HARDWARE_GPS_DELETE_ALL); |
3960 | + |
3961 | + u_hardware_gps_agps_set_server_for_type( |
3962 | + u_hardware_gps, |
3963 | + U_HARDWARE_GPS_AGPS_TYPE_SUPL, |
3964 | + supl_server, |
3965 | + port); |
3966 | + |
3967 | + return true; |
3968 | +} |
3969 | + |
3970 | +bool GPSTest::stop() |
3971 | +{ |
3972 | + bool ok = u_hardware_gps_stop(u_hardware_gps); |
3973 | + if (!ok) |
3974 | + printf("failed when stopping GPS!\n"); |
3975 | + |
3976 | + return ok; |
3977 | +} |
3978 | +} |
3979 | + |
3980 | +void wait_for_sigint() |
3981 | +{ |
3982 | + sigset_t signals; |
3983 | + sigemptyset(&signals); |
3984 | + sigaddset(&signals, SIGINT); |
3985 | + |
3986 | + int sig; |
3987 | + int result = sigwait(&signals, &sig); |
3988 | + if (result != 0) |
3989 | + printf("sigwait failed!\n"); |
3990 | +} |
3991 | + |
3992 | +int main(int argc, char** argv) |
3993 | +{ |
3994 | + if (argc != 6) |
3995 | + { |
3996 | + printf("Usage: test_gps supl_server supl_server_port lat lon accuracy\n"); |
3997 | + return 1; |
3998 | + } |
3999 | + |
4000 | + const char* supl_server = argv[1]; |
4001 | + uint16_t port = atoi(argv[2]); |
4002 | + |
4003 | + double lat = atof(argv[3]); |
4004 | + double lon = atof(argv[4]); |
4005 | + float accuracy = atof(argv[5]); |
4006 | + |
4007 | + int return_value = 0; |
4008 | + ubuntu::GPSTest test; |
4009 | + |
4010 | + if (!test.init_and_start(supl_server, port)) |
4011 | + return 1; |
4012 | + |
4013 | + printf("GPS initialized and started. Injecting reference location: %f %f %f.\n", lat, lon, accuracy); |
4014 | + test.inject_reference_location(lat, lon, accuracy); |
4015 | + printf("Now waiting for callbacks or SIGINT (to quit).\n"); |
4016 | + wait_for_sigint(); |
4017 | + printf("Exiting...\n"); |
4018 | + |
4019 | + if (!test.stop()) |
4020 | + return 1; |
4021 | + |
4022 | + printf("GPS stopped.\n"); |
4023 | + return 0; |
4024 | +} |
4025 | |
4026 | === added file 'src/ubuntu/hardware/ubuntu_platform_hardware_api.cpp' |
4027 | --- src/ubuntu/hardware/ubuntu_platform_hardware_api.cpp 1970-01-01 00:00:00 +0000 |
4028 | +++ src/ubuntu/hardware/ubuntu_platform_hardware_api.cpp 2014-06-11 12:19:49 +0000 |
4029 | @@ -0,0 +1,103 @@ |
4030 | +/* |
4031 | + * Copyright (C) 2012 Canonical Ltd |
4032 | + * |
4033 | + * This program is free software: you can redistribute it and/or modify |
4034 | + * it under the terms of the GNU Lesser General Public License version 3 as |
4035 | + * published by the Free Software Foundation. |
4036 | + * |
4037 | + * This program is distributed in the hope that it will be useful, |
4038 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4039 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4040 | + * GNU Lesser General Public License for more details. |
4041 | + * |
4042 | + * You should have received a copy of the GNU Lesser General Public License |
4043 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4044 | + * |
4045 | + * Authored by: Thomas Voss <thomas.voss@canonical.com> |
4046 | + * Ricardo Mendoza <ricardo.mendoza@canonical.com> |
4047 | + */ |
4048 | + |
4049 | +// C APIs |
4050 | +#include <ubuntu/hardware/alarm.h> |
4051 | +#include <ubuntu/hardware/gps.h> |
4052 | + |
4053 | +#include "android_hw_module.h" |
4054 | + |
4055 | +// Hardware - GPS |
4056 | +IMPLEMENT_FUNCTION1( |
4057 | +UHardwareGps, |
4058 | +u_hardware_gps_new, |
4059 | +UHardwareGpsParams*); |
4060 | + |
4061 | +IMPLEMENT_VOID_FUNCTION1( |
4062 | +u_hardware_gps_delete, |
4063 | +UHardwareGps); |
4064 | + |
4065 | +IMPLEMENT_FUNCTION1( |
4066 | +bool, |
4067 | +u_hardware_gps_start, |
4068 | +UHardwareGps); |
4069 | + |
4070 | +IMPLEMENT_FUNCTION1( |
4071 | +bool, |
4072 | +u_hardware_gps_stop, |
4073 | +UHardwareGps); |
4074 | + |
4075 | +IMPLEMENT_VOID_FUNCTION4( |
4076 | +u_hardware_gps_inject_time, |
4077 | +UHardwareGps, |
4078 | +int64_t, |
4079 | +int64_t, |
4080 | +int); |
4081 | + |
4082 | +IMPLEMENT_VOID_FUNCTION2( |
4083 | +u_hardware_gps_inject_location, |
4084 | +UHardwareGps, |
4085 | +UHardwareGpsLocation); |
4086 | + |
4087 | +IMPLEMENT_VOID_FUNCTION2( |
4088 | +u_hardware_gps_delete_aiding_data, |
4089 | +UHardwareGps, |
4090 | +UHardwareGpsAidingData); |
4091 | + |
4092 | +IMPLEMENT_VOID_FUNCTION3( |
4093 | +u_hardware_gps_agps_set_reference_location, |
4094 | +UHardwareGps, |
4095 | +UHardwareGpsAGpsRefLocation*, |
4096 | +size_t); |
4097 | + |
4098 | +IMPLEMENT_VOID_FUNCTION2( |
4099 | +u_hardware_gps_agps_notify_connection_is_open, |
4100 | +UHardwareGps, |
4101 | +const char *); |
4102 | + |
4103 | +IMPLEMENT_VOID_FUNCTION1( |
4104 | +u_hardware_gps_agps_notify_connection_is_closed, |
4105 | +UHardwareGps); |
4106 | + |
4107 | +IMPLEMENT_VOID_FUNCTION1( |
4108 | +u_hardware_gps_agps_notify_connection_not_available, |
4109 | +UHardwareGps); |
4110 | + |
4111 | +IMPLEMENT_VOID_FUNCTION4( |
4112 | +u_hardware_gps_agps_set_server_for_type, |
4113 | +UHardwareGps, |
4114 | +UHardwareGpsAGpsType, |
4115 | +const char*, |
4116 | +uint16_t); |
4117 | + |
4118 | +IMPLEMENT_FUNCTION6( |
4119 | +bool, |
4120 | +u_hardware_gps_set_position_mode, |
4121 | +UHardwareGps, |
4122 | +uint32_t, |
4123 | +uint32_t, |
4124 | +uint32_t, |
4125 | +uint32_t, |
4126 | +uint32_t); |
4127 | + |
4128 | +IMPLEMENT_VOID_FUNCTION3( |
4129 | +u_hardware_gps_inject_xtra_data, |
4130 | +UHardwareGps, |
4131 | +char*, |
4132 | +int); |
4133 | |
4134 | === removed directory 'src/ubuntu/hybris/tests' |
4135 | === removed file 'src/ubuntu/hybris/tests/CMakeLists.txt' |
4136 | --- src/ubuntu/hybris/tests/CMakeLists.txt 2014-04-03 16:06:54 +0000 |
4137 | +++ src/ubuntu/hybris/tests/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
4138 | @@ -1,33 +0,0 @@ |
4139 | -set(SOURCES ubuntu_application_api_hybris.cpp) |
4140 | - |
4141 | -add_executable(test_android_ubuntu_app_api test_c_api.cpp) |
4142 | -target_link_libraries(test_android_ubuntu_app_api ubuntu_application_api EGL GLESv2) |
4143 | - |
4144 | -add_executable(test_android_gps_api test_gps_api.cpp) |
4145 | -target_link_libraries(test_android_gps_api ubuntu_platform_hardware_api) |
4146 | - |
4147 | -add_executable(test_android_ubuntu_app_api_multiple_surfaces test_multiple_surfaces_event_delivery.cpp) |
4148 | -target_link_libraries(test_android_ubuntu_app_api_multiple_surfaces ubuntu_application_api EGL GLESv2) |
4149 | - |
4150 | -add_executable(test_android_sensors_api test_sensors_api.cpp) |
4151 | -target_link_libraries(test_android_sensors_api ubuntu_application_api) |
4152 | - |
4153 | -add_executable(test_android_ubuntu_session_api test_session_c_api.cpp) |
4154 | -target_link_libraries(test_android_ubuntu_session_api ubuntu_application_api) |
4155 | - |
4156 | -add_executable(test_ubuntu_app_api_location_service test_location_api.cpp) |
4157 | -target_link_libraries(test_ubuntu_app_api_location_service ubuntu_application_api) |
4158 | - |
4159 | -add_executable(test_hardware_alarms_api test_alarms_api.cpp) |
4160 | -target_link_libraries(test_hardware_alarms_api ubuntu_platform_hardware_api) |
4161 | - |
4162 | -install(TARGETS |
4163 | - test_android_ubuntu_app_api |
4164 | - test_android_gps_api |
4165 | - test_android_ubuntu_app_api_multiple_surfaces |
4166 | - test_android_sensors_api |
4167 | - test_android_ubuntu_session_api |
4168 | - test_ubuntu_app_api_location_service |
4169 | - test_hardware_alarms_api |
4170 | - DESTINATION bin |
4171 | -) |
4172 | |
4173 | === removed file 'src/ubuntu/hybris/tests/test_alarms_api.cpp' |
4174 | --- src/ubuntu/hybris/tests/test_alarms_api.cpp 2014-05-16 08:49:10 +0000 |
4175 | +++ src/ubuntu/hybris/tests/test_alarms_api.cpp 1970-01-01 00:00:00 +0000 |
4176 | @@ -1,74 +0,0 @@ |
4177 | -/* |
4178 | - * Copyright © 2013 Canonical Ltd. |
4179 | - * |
4180 | - * This program is free software: you can redistribute it and/or modify |
4181 | - * it under the terms of the GNU General Public License version 3 as |
4182 | - * published by the Free Software Foundation. |
4183 | - * |
4184 | - * This program is distributed in the hope that it will be useful, |
4185 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4186 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4187 | - * GNU General Public License for more details. |
4188 | - * |
4189 | - * You should have received a copy of the GNU General Public License |
4190 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4191 | - * |
4192 | - * Authored by: Thomas Voß <thomas.voss@canonicalcom> |
4193 | - */ |
4194 | - |
4195 | -#include <ubuntu/hardware/alarm.h> |
4196 | - |
4197 | -#include <cstdio> |
4198 | -#include <cstdlib> |
4199 | -#include <ctime> |
4200 | - |
4201 | -int main(int argc, char** argv) |
4202 | -{ |
4203 | - UHardwareAlarm alarm = u_hardware_alarm_create(); |
4204 | - |
4205 | - if (!alarm) |
4206 | - { |
4207 | - printf("Error creating handle to hardware alarms.\n"); |
4208 | - return 1; |
4209 | - } |
4210 | - |
4211 | - // Alarm in two seconds. |
4212 | - timespec ts { 0, 0 }; |
4213 | - clock_gettime(CLOCK_REALTIME, &ts); |
4214 | - |
4215 | - int timeout_in_seconds = 5; |
4216 | - |
4217 | - // Let's see if a timeout has been specified on the command line |
4218 | - if (argc > 1) |
4219 | - { |
4220 | - timeout_in_seconds = atoi(argv[1]); |
4221 | - } |
4222 | - |
4223 | - // Alarm in two seconds. |
4224 | - ts.tv_sec += timeout_in_seconds; |
4225 | - |
4226 | - UStatus rc = u_hardware_alarm_set_relative_to_with_behavior( |
4227 | - alarm, |
4228 | - U_HARDWARE_ALARM_TIME_REFERENCE_RTC, |
4229 | - U_HARDWARE_ALARM_SLEEP_BEHAVIOR_WAKEUP_DEVICE, |
4230 | - &ts); |
4231 | - |
4232 | - if (rc != U_STATUS_SUCCESS) |
4233 | - { |
4234 | - printf("Problem setting hardware alarm.\n"); |
4235 | - return 1; |
4236 | - } |
4237 | - |
4238 | - UHardwareAlarmWaitResult wait_result; |
4239 | - rc = u_hardware_alarm_wait_for_next_alarm(alarm, &wait_result); |
4240 | - |
4241 | - if (rc != U_STATUS_SUCCESS) |
4242 | - { |
4243 | - printf("Problem waiting for hardware alarm to go off.\n"); |
4244 | - return 1; |
4245 | - } |
4246 | - |
4247 | - printf("Successfully created and waited for a hw alarm.\n"); |
4248 | - |
4249 | - return 0; |
4250 | -} |
4251 | |
4252 | === removed file 'src/ubuntu/hybris/tests/test_gps_api.cpp' |
4253 | --- src/ubuntu/hybris/tests/test_gps_api.cpp 2014-05-13 10:00:55 +0000 |
4254 | +++ src/ubuntu/hybris/tests/test_gps_api.cpp 1970-01-01 00:00:00 +0000 |
4255 | @@ -1,286 +0,0 @@ |
4256 | -/* |
4257 | - * Copyright © 2013 Canonical Ltd. |
4258 | - * |
4259 | - * This program is free software: you can redistribute it and/or modify |
4260 | - * it under the terms of the GNU General Public License version 3 as |
4261 | - * published by the Free Software Foundation. |
4262 | - * |
4263 | - * This program is distributed in the hope that it will be useful, |
4264 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4265 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4266 | - * GNU General Public License for more details. |
4267 | - * |
4268 | - * You should have received a copy of the GNU General Public License |
4269 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4270 | - * |
4271 | - * Authored by: Daniel d'Andrada <daniel.dandrada@canonical.com> |
4272 | - */ |
4273 | -#include <ubuntu/hardware/gps.h> |
4274 | - |
4275 | -#include <ctime> |
4276 | -#include <signal.h> |
4277 | -#include <stdio.h> |
4278 | -#include <stdlib.h> |
4279 | -#include <string.h> |
4280 | -#include <unistd.h> |
4281 | - |
4282 | -namespace ubuntu |
4283 | -{ |
4284 | -class GPSTest |
4285 | -{ |
4286 | - public: |
4287 | - GPSTest(); |
4288 | - ~GPSTest(); |
4289 | - bool init_and_start(const char* server, uint16_t port); |
4290 | - bool stop(); |
4291 | - void inject_time(); |
4292 | - void inject_reference_location(float lat, float lon, float accuracy); |
4293 | - UHardwareGps u_hardware_gps; |
4294 | -}; |
4295 | - |
4296 | -void gps_location_cb(UHardwareGpsLocation* location, void* context) |
4297 | -{ |
4298 | - printf("gps_location_cb() called.\n"); |
4299 | -} |
4300 | - |
4301 | -void gps_status_cb(uint16_t status, void* context) |
4302 | -{ |
4303 | - switch(status) |
4304 | - { |
4305 | - case U_HARDWARE_GPS_STATUS_NONE: |
4306 | - printf("status: None\n"); |
4307 | - break; |
4308 | - case U_HARDWARE_GPS_STATUS_SESSION_BEGIN: |
4309 | - printf("status: Session Begin\n"); |
4310 | - break; |
4311 | - case U_HARDWARE_GPS_STATUS_SESSION_END: |
4312 | - printf("status: Session End\n"); |
4313 | - break; |
4314 | - case U_HARDWARE_GPS_STATUS_ENGINE_ON: |
4315 | - printf("status: Engine On\n"); |
4316 | - break; |
4317 | - case U_HARDWARE_GPS_STATUS_ENGINE_OFF: |
4318 | - printf("status: Engine Off\n"); |
4319 | - default: |
4320 | - break; |
4321 | - }; |
4322 | -} |
4323 | - |
4324 | -void gps_sb_status_cb(UHardwareGpsSvStatus* sv_info, void* context) |
4325 | -{ |
4326 | - printf("gps_sb_status_cb() called, listing %d space vehicles\n", sv_info->num_svs); |
4327 | -} |
4328 | - |
4329 | -void gps_nmea_cb(int64_t timestamp, const char* nmea, int length, void* context) |
4330 | -{ |
4331 | - char str[length+1]; |
4332 | - memcpy(str, nmea, length); |
4333 | - str[length] = 0; |
4334 | - printf("gps_nmea_cb() - %s\n", str); |
4335 | -} |
4336 | - |
4337 | -void gps_set_cabapilities_cb(uint32_t capabilities, void* context) |
4338 | -{ |
4339 | - printf("gps_set_cabapilities_cb() -"); |
4340 | - |
4341 | - if (capabilities & U_HARDWARE_GPS_CAPABILITY_SCHEDULING) |
4342 | - printf(" scheduling"); |
4343 | - if (capabilities & U_HARDWARE_GPS_CAPABILITY_MSB) |
4344 | - printf(" MSB"); |
4345 | - if (capabilities & U_HARDWARE_GPS_CAPABILITY_MSA) |
4346 | - printf(" MSA"); |
4347 | - if (capabilities & U_HARDWARE_GPS_CAPABILITY_SINGLE_SHOT) |
4348 | - printf(" 'single shot'"); |
4349 | - if (capabilities & U_HARDWARE_GPS_CAPABILITY_ON_DEMAND_TIME) |
4350 | - printf(" 'on demand time'"); |
4351 | - |
4352 | - printf("\n"); |
4353 | -} |
4354 | - |
4355 | -void gps_request_utc_time_cb(void* context) |
4356 | -{ |
4357 | - printf("gps_request_utc_time_cb() called.\n"); |
4358 | - ((GPSTest*)context)->inject_time(); |
4359 | -} |
4360 | - |
4361 | -void gps_xtra_download_request_cb(void* context) |
4362 | -{ |
4363 | - printf("gps_xtra_download_request_cb() called.\n"); |
4364 | -} |
4365 | - |
4366 | -void agps_status_cb(UHardwareGpsAGpsStatus* status, void* context) |
4367 | -{ |
4368 | - printf("agps status -"); |
4369 | - |
4370 | - if (status->type == U_HARDWARE_GPS_AGPS_TYPE_SUPL) |
4371 | - printf(" SUPL"); |
4372 | - else |
4373 | - printf(" C2K"); |
4374 | - |
4375 | - switch (status->status) |
4376 | - { |
4377 | - case U_HARDWARE_GPS_REQUEST_AGPS_DATA_CONN: |
4378 | - printf(", request AGPS data connection"); |
4379 | - break; |
4380 | - case U_HARDWARE_GPS_RELEASE_AGPS_DATA_CONN: |
4381 | - printf(", release AGPS data connection"); |
4382 | - break; |
4383 | - case U_HARDWARE_GPS_AGPS_DATA_CONNECTED: |
4384 | - printf(", request AGPS data connected"); |
4385 | - break; |
4386 | - case U_HARDWARE_GPS_AGPS_DATA_CONN_DONE: |
4387 | - printf(", AGPS data connection done"); |
4388 | - break; |
4389 | - default: |
4390 | - case U_HARDWARE_GPS_AGPS_DATA_CONN_FAILED: |
4391 | - printf(", AGPS data connection failed"); |
4392 | - break; |
4393 | - } |
4394 | - |
4395 | - printf(" ipaddr=%u\n", status->ipaddr); |
4396 | -} |
4397 | - |
4398 | -void gps_notify_cb(UHardwareGpsNiNotification *notification, void* context) |
4399 | -{ |
4400 | - printf("gps_notify_cb() called.\n"); |
4401 | -} |
4402 | - |
4403 | -void agps_ril_request_set_id_cb(uint32_t flags, void* context) |
4404 | -{ |
4405 | - printf("agps_ril_request_set_id_cb() called.\n"); |
4406 | -} |
4407 | - |
4408 | -void agps_ril_request_refloc_cb(uint32_t flags, void* context) |
4409 | -{ |
4410 | - printf("agps_ril_request_refloc_cb() called.\n"); |
4411 | -} |
4412 | - |
4413 | -GPSTest::GPSTest() |
4414 | - : u_hardware_gps(NULL) |
4415 | -{ |
4416 | -} |
4417 | - |
4418 | -GPSTest::~GPSTest() |
4419 | -{ |
4420 | - if (u_hardware_gps) |
4421 | - u_hardware_gps_delete(u_hardware_gps); |
4422 | -} |
4423 | - |
4424 | -void GPSTest::inject_time() |
4425 | -{ |
4426 | - // A real implementation would inject time from some NTP server. |
4427 | - time_t t = time(0); |
4428 | - int64_t time_millis = (int64_t)t * (int64_t)1000; |
4429 | - u_hardware_gps_inject_time(u_hardware_gps, |
4430 | - time_millis /*NTP time would go here*/, |
4431 | - time_millis /*internal time when that NTP time was taken*/, |
4432 | - 10 /* possible deviation, in milliseconds*/); |
4433 | -} |
4434 | - |
4435 | -void GPSTest::inject_reference_location(float lat, float lon, float accuracy) |
4436 | -{ |
4437 | - UHardwareGpsLocation location; |
4438 | - location.latitude = lat; |
4439 | - location.longitude = lon; |
4440 | - location.accuracy = accuracy; |
4441 | - u_hardware_gps_inject_location(u_hardware_gps, location); |
4442 | -} |
4443 | - |
4444 | -bool GPSTest::init_and_start(const char* supl_server, uint16_t port) |
4445 | -{ |
4446 | - UHardwareGpsParams gps_params; |
4447 | - |
4448 | - gps_params.location_cb = gps_location_cb; |
4449 | - gps_params.status_cb = gps_status_cb; |
4450 | - gps_params.sv_status_cb = gps_sb_status_cb; |
4451 | - gps_params.nmea_cb = gps_nmea_cb; |
4452 | - gps_params.set_capabilities_cb = gps_set_cabapilities_cb; |
4453 | - gps_params.request_utc_time_cb = gps_request_utc_time_cb; |
4454 | - gps_params.xtra_download_request_cb = gps_xtra_download_request_cb; |
4455 | - gps_params.agps_status_cb = agps_status_cb; |
4456 | - gps_params.gps_ni_notify_cb = gps_notify_cb; |
4457 | - gps_params.request_setid_cb = agps_ril_request_set_id_cb; |
4458 | - gps_params.request_refloc_cb = agps_ril_request_refloc_cb; |
4459 | - gps_params.context = this; |
4460 | - |
4461 | - UHardwareGps u_hardware_gps = u_hardware_gps_new(&gps_params); |
4462 | - if (!u_hardware_gps) |
4463 | - { |
4464 | - printf("GPS creation failed!\n"); |
4465 | - return false; |
4466 | - } |
4467 | - |
4468 | - bool ok = u_hardware_gps_start(u_hardware_gps); |
4469 | - if (!ok) |
4470 | - { |
4471 | - printf("GPS start up failed!\n"); |
4472 | - return false; |
4473 | - } |
4474 | - |
4475 | - u_hardware_gps_delete_aiding_data(u_hardware_gps, |
4476 | - U_HARDWARE_GPS_DELETE_ALL); |
4477 | - |
4478 | - u_hardware_gps_agps_set_server_for_type( |
4479 | - u_hardware_gps, |
4480 | - U_HARDWARE_GPS_AGPS_TYPE_SUPL, |
4481 | - supl_server, |
4482 | - port); |
4483 | - |
4484 | - return true; |
4485 | -} |
4486 | - |
4487 | -bool GPSTest::stop() |
4488 | -{ |
4489 | - bool ok = u_hardware_gps_stop(u_hardware_gps); |
4490 | - if (!ok) |
4491 | - printf("failed when stopping GPS!\n"); |
4492 | - |
4493 | - return ok; |
4494 | -} |
4495 | -} |
4496 | - |
4497 | -void wait_for_sigint() |
4498 | -{ |
4499 | - sigset_t signals; |
4500 | - sigemptyset(&signals); |
4501 | - sigaddset(&signals, SIGINT); |
4502 | - |
4503 | - int sig; |
4504 | - int result = sigwait(&signals, &sig); |
4505 | - if (result != 0) |
4506 | - printf("sigwait failed!\n"); |
4507 | -} |
4508 | - |
4509 | -int main(int argc, char** argv) |
4510 | -{ |
4511 | - if (argc != 6) |
4512 | - { |
4513 | - printf("Usage: test_gps supl_server supl_server_port lat lon accuracy\n"); |
4514 | - return 1; |
4515 | - } |
4516 | - |
4517 | - const char* supl_server = argv[1]; |
4518 | - uint16_t port = atoi(argv[2]); |
4519 | - |
4520 | - double lat = atof(argv[3]); |
4521 | - double lon = atof(argv[4]); |
4522 | - float accuracy = atof(argv[5]); |
4523 | - |
4524 | - int return_value = 0; |
4525 | - ubuntu::GPSTest test; |
4526 | - |
4527 | - if (!test.init_and_start(supl_server, port)) |
4528 | - return 1; |
4529 | - |
4530 | - printf("GPS initialized and started. Injecting reference location: %f %f %f.\n", lat, lon, accuracy); |
4531 | - test.inject_reference_location(lat, lon, accuracy); |
4532 | - printf("Now waiting for callbacks or SIGINT (to quit).\n"); |
4533 | - wait_for_sigint(); |
4534 | - printf("Exiting...\n"); |
4535 | - |
4536 | - if (!test.stop()) |
4537 | - return 1; |
4538 | - |
4539 | - printf("GPS stopped.\n"); |
4540 | - return 0; |
4541 | -} |
4542 | |
4543 | === removed file 'src/ubuntu/hybris/ubuntu_platform_hardware_api.cpp' |
4544 | --- src/ubuntu/hybris/ubuntu_platform_hardware_api.cpp 2014-05-22 15:29:37 +0000 |
4545 | +++ src/ubuntu/hybris/ubuntu_platform_hardware_api.cpp 1970-01-01 00:00:00 +0000 |
4546 | @@ -1,103 +0,0 @@ |
4547 | -/* |
4548 | - * Copyright (C) 2012 Canonical Ltd |
4549 | - * |
4550 | - * This program is free software: you can redistribute it and/or modify |
4551 | - * it under the terms of the GNU Lesser General Public License version 3 as |
4552 | - * published by the Free Software Foundation. |
4553 | - * |
4554 | - * This program is distributed in the hope that it will be useful, |
4555 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4556 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4557 | - * GNU Lesser General Public License for more details. |
4558 | - * |
4559 | - * You should have received a copy of the GNU Lesser General Public License |
4560 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4561 | - * |
4562 | - * Authored by: Thomas Voss <thomas.voss@canonical.com> |
4563 | - * Ricardo Mendoza <ricardo.mendoza@canonical.com> |
4564 | - */ |
4565 | - |
4566 | -// C APIs |
4567 | -#include <ubuntu/hardware/alarm.h> |
4568 | -#include <ubuntu/hardware/gps.h> |
4569 | - |
4570 | -#include "bridge.h" |
4571 | - |
4572 | -// Hardware - GPS |
4573 | -IMPLEMENT_FUNCTION1( |
4574 | -UHardwareGps, |
4575 | -u_hardware_gps_new, |
4576 | -UHardwareGpsParams*); |
4577 | - |
4578 | -IMPLEMENT_VOID_FUNCTION1( |
4579 | -u_hardware_gps_delete, |
4580 | -UHardwareGps); |
4581 | - |
4582 | -IMPLEMENT_FUNCTION1( |
4583 | -bool, |
4584 | -u_hardware_gps_start, |
4585 | -UHardwareGps); |
4586 | - |
4587 | -IMPLEMENT_FUNCTION1( |
4588 | -bool, |
4589 | -u_hardware_gps_stop, |
4590 | -UHardwareGps); |
4591 | - |
4592 | -IMPLEMENT_VOID_FUNCTION4( |
4593 | -u_hardware_gps_inject_time, |
4594 | -UHardwareGps, |
4595 | -int64_t, |
4596 | -int64_t, |
4597 | -int); |
4598 | - |
4599 | -IMPLEMENT_VOID_FUNCTION2( |
4600 | -u_hardware_gps_inject_location, |
4601 | -UHardwareGps, |
4602 | -UHardwareGpsLocation); |
4603 | - |
4604 | -IMPLEMENT_VOID_FUNCTION2( |
4605 | -u_hardware_gps_delete_aiding_data, |
4606 | -UHardwareGps, |
4607 | -UHardwareGpsAidingData); |
4608 | - |
4609 | -IMPLEMENT_VOID_FUNCTION3( |
4610 | -u_hardware_gps_agps_set_reference_location, |
4611 | -UHardwareGps, |
4612 | -UHardwareGpsAGpsRefLocation*, |
4613 | -size_t); |
4614 | - |
4615 | -IMPLEMENT_VOID_FUNCTION2( |
4616 | -u_hardware_gps_agps_notify_connection_is_open, |
4617 | -UHardwareGps, |
4618 | -const char *); |
4619 | - |
4620 | -IMPLEMENT_VOID_FUNCTION1( |
4621 | -u_hardware_gps_agps_notify_connection_is_closed, |
4622 | -UHardwareGps); |
4623 | - |
4624 | -IMPLEMENT_VOID_FUNCTION1( |
4625 | -u_hardware_gps_agps_notify_connection_not_available, |
4626 | -UHardwareGps); |
4627 | - |
4628 | -IMPLEMENT_VOID_FUNCTION4( |
4629 | -u_hardware_gps_agps_set_server_for_type, |
4630 | -UHardwareGps, |
4631 | -UHardwareGpsAGpsType, |
4632 | -const char*, |
4633 | -uint16_t); |
4634 | - |
4635 | -IMPLEMENT_FUNCTION6( |
4636 | -bool, |
4637 | -u_hardware_gps_set_position_mode, |
4638 | -UHardwareGps, |
4639 | -uint32_t, |
4640 | -uint32_t, |
4641 | -uint32_t, |
4642 | -uint32_t, |
4643 | -uint32_t); |
4644 | - |
4645 | -IMPLEMENT_VOID_FUNCTION3( |
4646 | -u_hardware_gps_inject_xtra_data, |
4647 | -UHardwareGps, |
4648 | -char*, |
4649 | -int); |
4650 | |
4651 | === removed file 'src/ubuntu/mirserver/ubuntu_application_api_mirserver_priv.h' |
4652 | --- src/ubuntu/mirserver/ubuntu_application_api_mirserver_priv.h 2013-08-23 00:02:57 +0000 |
4653 | +++ src/ubuntu/mirserver/ubuntu_application_api_mirserver_priv.h 1970-01-01 00:00:00 +0000 |
4654 | @@ -1,43 +0,0 @@ |
4655 | -/* |
4656 | - * Copyright (C) 2013 Canonical Ltd |
4657 | - * |
4658 | - * This program is free software: you can redistribute it and/or modify |
4659 | - * it under the terms of the GNU Lesser General Public License version 3 as |
4660 | - * published by the Free Software Foundation. |
4661 | - * |
4662 | - * This program is distributed in the hope that it will be useful, |
4663 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4664 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4665 | - * GNU Lesser General Public License for more details. |
4666 | - * |
4667 | - * You should have received a copy of the GNU Lesser General Public License |
4668 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4669 | - * |
4670 | - * Authored by: Robert Carr <robert.carr@canonical.com> |
4671 | - */ |
4672 | - |
4673 | -#ifndef UBUNTU_APPLICATION_API_MIRSERVER_PRIV_H_ |
4674 | -#define UBUNTU_APPLICATION_API_MIRSERVER_PRIV_H_ |
4675 | - |
4676 | -#include <ubuntu/visibility.h> |
4677 | - |
4678 | -namespace mir |
4679 | -{ |
4680 | -class DefaultServerConfiguration; |
4681 | -} |
4682 | - |
4683 | -// We need to provide the platform API with Mir server objects as dependency. The analog |
4684 | -// on the client side is of course the named socket for connection to Mir. This should be |
4685 | -// invoked from the run_mir handler prior to creation of a UApplicationInstance or usage of |
4686 | -// any ua_ui functions. |
4687 | - |
4688 | -extern "C" |
4689 | -{ |
4690 | -UBUNTU_DLL_PUBLIC void ua_ui_mirserver_init(mir::DefaultServerConfiguration& config); |
4691 | - |
4692 | -// Release platform-api ownership of Mir server objects to allow for clean shutdown. |
4693 | -UBUNTU_DLL_PUBLIC void ua_ui_mirserver_finish(); |
4694 | -} |
4695 | - |
4696 | -#endif // UBUNTU_APPLICATION_API_MIRSERVER_PRIV_H_ |
4697 | - |
4698 | |
4699 | === modified file 'tests/CMakeLists.txt' |
4700 | --- tests/CMakeLists.txt 2013-12-06 13:47:56 +0000 |
4701 | +++ tests/CMakeLists.txt 2014-06-11 12:19:49 +0000 |
4702 | @@ -7,24 +7,43 @@ |
4703 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11") |
4704 | |
4705 | add_executable( |
4706 | - test_ubuntu_application_sensors |
4707 | - test_ubuntu_application_sensors.cpp |
4708 | -) |
4709 | - |
4710 | -target_link_libraries( |
4711 | - test_ubuntu_application_sensors |
4712 | - |
4713 | - ubuntu_application_api |
4714 | - gtest |
4715 | - gtest_main |
4716 | - ${PROCESS_CPP_LIBRARIES} |
4717 | -) |
4718 | - |
4719 | -# we need to call the tests with pointing to the locally built test platform |
4720 | -# library |
4721 | + test_ua_sensors_real |
4722 | + test_ua_sensors_real.cpp |
4723 | +) |
4724 | + |
4725 | +add_executable( |
4726 | + test_ua_sensors_mock |
4727 | + test_ua_sensors_mock.cpp |
4728 | +) |
4729 | + |
4730 | +target_link_libraries( |
4731 | + test_ua_sensors_mock |
4732 | + |
4733 | + ubuntu_application_api |
4734 | + gtest |
4735 | + gtest_main |
4736 | + ${PROCESS_CPP_LIBRARIES} |
4737 | +) |
4738 | + |
4739 | +target_link_libraries( |
4740 | + test_ua_sensors_real |
4741 | + |
4742 | + ubuntu_application_api |
4743 | + gtest |
4744 | + gtest_main |
4745 | + ${PROCESS_CPP_LIBRARIES} |
4746 | +) |
4747 | + |
4748 | add_test( |
4749 | - test_ubuntu_application_sensors |
4750 | + test_ua_sensors_mock |
4751 | |
4752 | - env LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/src/ubuntu/testbackend ${CMAKE_CURRENT_BINARY_DIR}/test_ubuntu_application_sensors |
4753 | + env LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/src/ubuntu:${CMAKE_BINARY_DIR}/src/ubuntu/application/testbackend ${CMAKE_CURRENT_BINARY_DIR}/test_ua_sensors_mock |
4754 | ) |
4755 | |
4756 | +if(DEFINED ENV{UBUNTU_PLATFORM_API_BACKEND}) |
4757 | + add_test( |
4758 | + test_ua_sensors_real |
4759 | + |
4760 | + env LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/src/ubuntu:${CMAKE_BINARY_DIR}/src/ubuntu/application/touch:${CMAKE_BINARY_DIR}/src/ubuntu/desktop ${CMAKE_CURRENT_BINARY_DIR}/test_ua_sensors_real |
4761 | + ) |
4762 | +endif() |
4763 | |
4764 | === added file 'tests/test_ua_sensors_mock.cpp' |
4765 | --- tests/test_ua_sensors_mock.cpp 1970-01-01 00:00:00 +0000 |
4766 | +++ tests/test_ua_sensors_mock.cpp 2014-06-11 12:19:49 +0000 |
4767 | @@ -0,0 +1,268 @@ |
4768 | +/* |
4769 | + * Copyright (C) 2013 Canonical Ltd |
4770 | + * |
4771 | + * This program is free software: you can redistribute it and/or modify |
4772 | + * it under the terms of the GNU Lesser General Public License version 3 as |
4773 | + * published by the Free Software Foundation. |
4774 | + * |
4775 | + * This program is distributed in the hope that it will be useful, |
4776 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4777 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4778 | + * GNU Lesser General Public License for more details. |
4779 | + * |
4780 | + * You should have received a copy of the GNU Lesser General Public License |
4781 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4782 | + * |
4783 | + * Authored by: Martin Pitt <martin.pitti@ubuntu.com> |
4784 | + */ |
4785 | + |
4786 | +#include <cstdlib> |
4787 | +#include <cstdio> |
4788 | +#include <queue> |
4789 | +#include <chrono> |
4790 | +#include <iostream> |
4791 | + |
4792 | +#include <core/testing/fork_and_run.h> |
4793 | + |
4794 | +#include "gtest/gtest.h" |
4795 | + |
4796 | +#include <ubuntu/application/sensors/accelerometer.h> |
4797 | +#include <ubuntu/application/sensors/event/accelerometer.h> |
4798 | +#include <ubuntu/application/sensors/proximity.h> |
4799 | +#include <ubuntu/application/sensors/event/proximity.h> |
4800 | +#include <ubuntu/application/sensors/light.h> |
4801 | +#include <ubuntu/application/sensors/event/light.h> |
4802 | + |
4803 | +using namespace std; |
4804 | + |
4805 | +typedef chrono::time_point<chrono::system_clock,chrono::nanoseconds> time_point_system_ns; |
4806 | + |
4807 | + |
4808 | +/******************************************* |
4809 | + * |
4810 | + * Tests with simulated sensor backend |
4811 | + * |
4812 | + *******************************************/ |
4813 | + |
4814 | +struct event { |
4815 | + uint64_t timestamp; |
4816 | + float x, y, z; |
4817 | + UASProximityDistance distance; |
4818 | + void* context; |
4819 | +}; |
4820 | +queue<struct event> events; |
4821 | + |
4822 | + |
4823 | +class SimBackendTest : public testing::Test |
4824 | +{ |
4825 | + protected: |
4826 | + virtual void SetUp() |
4827 | + { |
4828 | + snprintf(data_file, sizeof(data_file), "%s", "/tmp/sensor_test.XXXXXX"); |
4829 | + data_fd = mkstemp(data_file); |
4830 | + if (data_fd < 0) { |
4831 | + perror("mkstemp"); |
4832 | + abort(); |
4833 | + } |
4834 | + setenv("UBUNTU_PLATFORM_API_SENSOR_TEST", data_file, 1); |
4835 | + setenv("UBUNTU_PLATFORM_API_BACKEND", "test", 1); |
4836 | + |
4837 | + // ensure the queue is clear |
4838 | + while (events.size() > 0) |
4839 | + events.pop(); |
4840 | + } |
4841 | + |
4842 | + virtual void TearDown() |
4843 | + { |
4844 | + unlink(data_file); |
4845 | + } |
4846 | + |
4847 | + void set_data(const char* data) |
4848 | + { |
4849 | + write(data_fd, data, strlen(data)); |
4850 | + fsync(data_fd); |
4851 | + } |
4852 | + |
4853 | + char data_file[100]; |
4854 | + int data_fd; |
4855 | +}; |
4856 | + |
4857 | +// without any data, there are no sensors defined |
4858 | +TESTP_F(SimBackendTest, NoData, { |
4859 | + EXPECT_EQ(NULL, ua_sensors_accelerometer_new()); |
4860 | + EXPECT_EQ(NULL, ua_sensors_proximity_new()); |
4861 | + EXPECT_EQ(NULL, ua_sensors_light_new()); |
4862 | +}) |
4863 | + |
4864 | +TESTP_F(SimBackendTest, CreateProximity, { |
4865 | + set_data("create proximity"); |
4866 | + EXPECT_EQ(NULL, ua_sensors_accelerometer_new()); |
4867 | + EXPECT_EQ(NULL, ua_sensors_light_new()); |
4868 | + |
4869 | + UASensorsProximity *s = ua_sensors_proximity_new(); |
4870 | + EXPECT_TRUE(s != NULL); |
4871 | +}) |
4872 | + |
4873 | +TESTP_F(SimBackendTest, CreateAccelerometer, { |
4874 | + set_data("create accel 0.5 1000 0.1"); |
4875 | + EXPECT_EQ(NULL, ua_sensors_proximity_new()); |
4876 | + EXPECT_EQ(NULL, ua_sensors_light_new()); |
4877 | + |
4878 | + UASensorsAccelerometer *s = ua_sensors_accelerometer_new(); |
4879 | + EXPECT_TRUE(s != NULL); |
4880 | + |
4881 | + float min = 0.f; ua_sensors_accelerometer_get_min_value(s, &min); |
4882 | + float max = 0.f; ua_sensors_accelerometer_get_max_value(s, &max); |
4883 | + float res = 0.f; ua_sensors_accelerometer_get_resolution(s, &res); |
4884 | + |
4885 | + EXPECT_FLOAT_EQ(0.5, min); |
4886 | + EXPECT_FLOAT_EQ(1000.0, max); |
4887 | + EXPECT_FLOAT_EQ(0.1, res); |
4888 | +}) |
4889 | + |
4890 | +TESTP_F(SimBackendTest, CreateLight, { |
4891 | + set_data("create light 0 10 0.5"); |
4892 | + EXPECT_EQ(NULL, ua_sensors_proximity_new()); |
4893 | + EXPECT_EQ(NULL, ua_sensors_accelerometer_new()); |
4894 | + |
4895 | + UASensorsLight *s = ua_sensors_light_new(); |
4896 | + EXPECT_TRUE(s != NULL); |
4897 | + |
4898 | + float min = 0.f; ua_sensors_light_get_min_value(s, &min); |
4899 | + float max = 0.f; ua_sensors_light_get_max_value(s, &max); |
4900 | + float res = 0.f; ua_sensors_light_get_resolution(s, &res); |
4901 | + |
4902 | + EXPECT_FLOAT_EQ(0.0, min); |
4903 | + EXPECT_FLOAT_EQ(10.0, max); |
4904 | + EXPECT_FLOAT_EQ(0.5, res); |
4905 | +}) |
4906 | + |
4907 | +TESTP_F(SimBackendTest, ProximityEvents, { |
4908 | + set_data("create proximity\n" |
4909 | + " # some comment\n" |
4910 | + " \n" |
4911 | + "50 proximity near\n" |
4912 | + "100 proximity far\n" |
4913 | + "80 proximity unknown\n" |
4914 | + ); |
4915 | + |
4916 | + UASensorsProximity *s = ua_sensors_proximity_new(); |
4917 | + EXPECT_TRUE(s != NULL); |
4918 | + ua_sensors_proximity_enable(s); |
4919 | + auto start_time = chrono::system_clock::now(); |
4920 | + |
4921 | + ua_sensors_proximity_set_reading_cb(s, |
4922 | + [](UASProximityEvent* ev, void* ctx) { |
4923 | + events.push({uas_proximity_event_get_timestamp(ev), |
4924 | + .0, .0, .0, |
4925 | + uas_proximity_event_get_distance(ev), |
4926 | + ctx}); |
4927 | + }, NULL); |
4928 | + |
4929 | + usleep(350000); |
4930 | + EXPECT_EQ(3, events.size()); |
4931 | + |
4932 | + auto e = events.front(); |
4933 | + events.pop(); |
4934 | + EXPECT_EQ(e.distance, U_PROXIMITY_NEAR); |
4935 | + EXPECT_EQ(NULL, e.context); |
4936 | + auto event_time = time_point_system_ns(std::chrono::nanoseconds(e.timestamp)); |
4937 | + auto delay = chrono::duration_cast<chrono::milliseconds>(event_time - start_time).count(); |
4938 | + EXPECT_GE(delay, 30); |
4939 | + EXPECT_LE(delay, 70); |
4940 | + |
4941 | + e = events.front(); |
4942 | + events.pop(); |
4943 | + EXPECT_EQ(e.distance, U_PROXIMITY_FAR); |
4944 | + event_time = time_point_system_ns(std::chrono::nanoseconds(e.timestamp)); |
4945 | + delay = chrono::duration_cast<chrono::milliseconds>(event_time - start_time).count(); |
4946 | + EXPECT_GE(delay, 130); |
4947 | + EXPECT_LE(delay, 170); |
4948 | + |
4949 | + e = events.front(); |
4950 | + events.pop(); |
4951 | + EXPECT_EQ(e.distance, (UASProximityDistance) 0); |
4952 | + event_time = time_point_system_ns(std::chrono::nanoseconds(e.timestamp)); |
4953 | + delay = chrono::duration_cast<chrono::milliseconds>(event_time - start_time).count(); |
4954 | + EXPECT_GE(delay, 210); |
4955 | + EXPECT_LE(delay, 250); |
4956 | +}) |
4957 | + |
4958 | +TESTP_F(SimBackendTest, LightEvents, { |
4959 | + set_data(" create light 0 10 1\n" |
4960 | + "1 light 5\n" |
4961 | + "100 light 8\n" |
4962 | + ); |
4963 | + |
4964 | + UASensorsLight *s = ua_sensors_light_new(); |
4965 | + EXPECT_TRUE(s != NULL); |
4966 | + ua_sensors_light_enable(s); |
4967 | + auto start_time = chrono::system_clock::now(); |
4968 | + |
4969 | + ua_sensors_light_set_reading_cb(s, |
4970 | + [](UASLightEvent* ev, void* ctx) { |
4971 | + float light = -1.f; |
4972 | + uas_light_event_get_light(ev, &light); |
4973 | + events.push({uas_light_event_get_timestamp(ev), |
4974 | + light, .0, .0, |
4975 | + (UASProximityDistance) 0, ctx}); |
4976 | + }, NULL); |
4977 | + |
4978 | + usleep(130000); |
4979 | + EXPECT_EQ(2, events.size()); |
4980 | + |
4981 | + auto e = events.front(); |
4982 | + events.pop(); |
4983 | + EXPECT_FLOAT_EQ(e.x, 5); |
4984 | + EXPECT_EQ(NULL, e.context); |
4985 | + auto event_time = time_point_system_ns(std::chrono::nanoseconds(e.timestamp)); |
4986 | + auto delay = chrono::duration_cast<chrono::milliseconds>(event_time - start_time).count(); |
4987 | + EXPECT_LE(delay, 10); |
4988 | + |
4989 | + e = events.front(); |
4990 | + events.pop(); |
4991 | + EXPECT_FLOAT_EQ(e.x, 8); |
4992 | + event_time = time_point_system_ns(std::chrono::nanoseconds(e.timestamp)); |
4993 | + delay = chrono::duration_cast<chrono::milliseconds>(event_time - start_time).count(); |
4994 | + EXPECT_GE(delay, 91); |
4995 | + EXPECT_LE(delay, 111); |
4996 | +}) |
4997 | + |
4998 | +TESTP_F(SimBackendTest, AccelEvents, { |
4999 | + // cover the case of > 1 s, to ensure that we correctly do mod arithmetic |
5000 | + set_data("create accel -1000 1000 0.1\n" |
FAILED: Continuous integration, rev:243 jenkins. qa.ubuntu. com/job/ platform- api-ci/ 297/ jenkins. qa.ubuntu. com/job/ platform- api-utopic- amd64-ci/ 30/console jenkins. qa.ubuntu. com/job/ platform- api-utopic- armhf-ci/ 30/console jenkins. qa.ubuntu. com/job/ platform- api-utopic- i386-ci/ 30/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/platform- api-ci/ 297/rebuild
http://