Merge lp:~ricmm/platform-api/refactor-headers-new-cleanup into lp:platform-api

Proposed by Ricardo Mendoza
Status: Merged
Approved by: Ricardo Salveti
Approved revision: 64
Merged at revision: 54
Proposed branch: lp:~ricmm/platform-api/refactor-headers-new-cleanup
Merge into: lp:platform-api
Diff against target: 6926 lines (+2394/-2775)
76 files modified
CMakeLists.txt (+1/-0)
android/default/default_ubuntu_application_sensor.cpp (+4/-4)
android/default/default_ubuntu_application_ui.cpp (+9/-9)
android/default/default_ubuntu_ui.cpp (+2/-2)
android/hybris/Android.mk (+22/-11)
android/hybris/default_application_session.h (+3/-3)
android/hybris/test.cpp (+5/-5)
android/hybris/test_c_api.cpp (+1/-1)
android/hybris/test_sensors.cpp (+4/-4)
android/hybris/ubuntu_application_api_for_hybris.cpp (+11/-11)
android/hybris/ubuntu_application_sensors_for_hybris.cpp (+5/-5)
android/include/private/application/application.h (+119/-0)
android/include/private/application/sensors/sensor.h (+83/-0)
android/include/private/application/sensors/sensor_listener.h (+53/-0)
android/include/private/application/sensors/sensor_reading.h (+78/-0)
android/include/private/application/sensors/sensor_service.h (+48/-0)
android/include/private/application/sensors/sensor_type.h (+45/-0)
android/include/private/application/session.h (+95/-0)
android/include/private/application/session_delegates.h (+48/-0)
android/include/private/application/ui/clipboard.h (+91/-0)
android/include/private/application/ui/form_factor_hint.h (+44/-0)
android/include/private/application/ui/init.h (+35/-0)
android/include/private/application/ui/input/event.h (+106/-0)
android/include/private/application/ui/input/listener.h (+53/-0)
android/include/private/application/ui/physical_display_info.h (+77/-0)
android/include/private/application/ui/session.h (+88/-0)
android/include/private/application/ui/session_credentials.h (+86/-0)
android/include/private/application/ui/session_delegates.h (+45/-0)
android/include/private/application/ui/setup.h (+59/-0)
android/include/private/application/ui/stage_hint.h (+42/-0)
android/include/private/application/ui/surface.h (+74/-0)
android/include/private/application/ui/surface_factory.h (+53/-0)
android/include/private/application/ui/surface_properties.h (+63/-0)
android/include/private/application/ui/surface_role.h (+49/-0)
android/include/private/application/ui/ubuntu_application_ui.h (+373/-0)
android/include/private/platform/empty_base.h (+37/-0)
android/include/private/platform/shared_ptr.h (+58/-0)
android/include/private/ui/config.h (+24/-0)
android/include/private/ui/session_enumerator.h (+117/-0)
android/include/private/ui/session_service.h (+80/-0)
android/include/private/ui/session_snapshot.h (+50/-0)
android/include/private/ui/well_known_applications.h (+41/-0)
android/mock/mock.cpp (+9/-9)
include/ubuntu/application/sensors/sensor.h (+0/-83)
include/ubuntu/application/sensors/sensor_listener.h (+0/-53)
include/ubuntu/application/sensors/sensor_reading.h (+0/-78)
include/ubuntu/application/sensors/sensor_service.h (+0/-48)
include/ubuntu/application/sensors/sensor_type.h (+0/-45)
include/ubuntu/application/sensors/ubuntu_application_sensors.h (+0/-155)
include/ubuntu/application/session.h (+0/-45)
include/ubuntu/application/ubuntu_application_gps.h (+0/-408)
include/ubuntu/application/ui/clipboard.h (+0/-91)
include/ubuntu/application/ui/form_factor_hint.h (+0/-44)
include/ubuntu/application/ui/init.h (+0/-35)
include/ubuntu/application/ui/input/event.h (+0/-106)
include/ubuntu/application/ui/input/listener.h (+0/-53)
include/ubuntu/application/ui/physical_display_info.h (+0/-77)
include/ubuntu/application/ui/session.h (+0/-86)
include/ubuntu/application/ui/session_credentials.h (+0/-84)
include/ubuntu/application/ui/setup.h (+0/-59)
include/ubuntu/application/ui/stage_hint.h (+0/-42)
include/ubuntu/application/ui/surface.h (+0/-74)
include/ubuntu/application/ui/surface_factory.h (+0/-53)
include/ubuntu/application/ui/surface_properties.h (+0/-63)
include/ubuntu/application/ui/surface_role.h (+0/-49)
include/ubuntu/application/ui/ubuntu_application_ui.h (+0/-358)
include/ubuntu/platform/empty_base.h (+0/-37)
include/ubuntu/platform/shared_ptr.h (+0/-58)
include/ubuntu/ui/session_enumerator.h (+0/-117)
include/ubuntu/ui/session_service.h (+0/-80)
include/ubuntu/ui/session_snapshot.h (+0/-50)
include/ubuntu/ui/ubuntu_ui_session_service.h (+0/-136)
include/ubuntu/ui/well_known_applications.h (+0/-41)
src/android/tests/test_c_api.cpp (+1/-1)
src/android/tests/test_multiple_surfaces_event_delivery.cpp (+1/-1)
src/android/ubuntu_application_api.cpp (+2/-1)
To merge this branch: bzr merge lp:~ricmm/platform-api/refactor-headers-new-cleanup
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ricardo Salveti (community) Approve
Ricardo Mendoza Pending
Review via email: mp+165467@code.launchpad.net

This proposal supersedes a proposal from 2013-05-21.

Commit message

* Move all private headers for android interfaces to android/include/
* Expose publicly only the C headers for the API
* Change namespaces to match new coding guidelines
* General cleanup and housekeeping of the codebase

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:56
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~ricmm/platform-api/refactor-headers-new-cleanup/+merge/165467/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/platform-api-ci/19/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/platform-api-raring-amd64-ci/16
    SUCCESS: http://jenkins.qa.ubuntu.com/job/platform-api-raring-armhf-ci/16
        deb: http://jenkins.qa.ubuntu.com/job/platform-api-raring-armhf-ci/16/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/platform-api-raring-i386-ci/9

Click here to trigger a rebuild:
http://s-jenkins:8080/job/platform-api-ci/19/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Ricardo Salveti (rsalveti) wrote :
Download full text (3.5 KiB)

Code review, not yet tested:

87 + $(UPAPI_PATH)/include \
88 + $(UPAPI_PATH)/android/include

97 + $(UPAPI_PATH)/include \
98 + $(UPAPI_PATH)/android/include

107 + $(UPAPI_PATH)/include \
108 + $(UPAPI_PATH)/android/include

117 + $(UPAPI_PATH)/include \
118 + $(UPAPI_PATH)/android/include

127 + $(UPAPI_PATH)/include \
128 + $(UPAPI_PATH)/android/include

137 + $(UPAPI_PATH)/include \
138 + $(UPAPI_PATH)/android/include

147 + $(UPAPI_PATH)/include \
148 + $(UPAPI_PATH)/android/include

157 + $(UPAPI_PATH)/include \
158 + $(UPAPI_PATH)/android/include

167 + $(UPAPI_PATH)/include \
168 + $(UPAPI_PATH)/android/include

177 + $(UPAPI_PATH)/include \
178 + $(UPAPI_PATH)/android/include

187 + $(UPAPI_PATH)/include \
188 + $(UPAPI_PATH)/android/include

Cosmetics, please use tab instead of spaces in the new line (android/include).

Please remove android/include/private/application/ui/session_credentials.h.rej.

+//#include "NEW_lifecycle_delegate.h"

If not needed, please remove.

android/include/private/application/ui/window_internal.h
include/ubuntu/application/description.h
include/ubuntu/application/id.h
include/ubuntu/application/instance.h
include/ubuntu/application/options.h
include/ubuntu/application/ui/clipboard.h
include/ubuntu/application/ui/display.h
include/ubuntu/application/ui/form_factor.h
include/ubuntu/application/ui/options.h
include/ubuntu/application/ui/session.h
include/ubuntu/application/ui/stage.h
include/ubuntu/application/ui/window.h
include/ubuntu/application/ui/window_parent.h
include/ubuntu/application/ui/window_properties.h
include/ubuntu/application/ui/window_type.h

Missing copyright/license header.

871 + this->string = (char*) malloc(sizeof (char) * (size+1));
2408 + this->title = (char *) malloc(sizeof (char) * (size+1));

When allocating with malloc, don't you need a free in the class destructor?

include/ubuntu/application/description.h

/*
void
u_application_description_set_application_error_delegate(
 UApplicationDescription *desc,
 u_application_error_delegate *error_delegate);

u_application_error_delegate*
u_application_description_get_application_error_delegate(
 UApplicationDescription *desc);

void
u_application_description_set_system_delegate(
 UApplicationDescription *desc,
 u_system_delegate *system_delegate);

u_system_delegate*
u_application_description_get_system_delegate(
 UApplicationDescription *desc);
*/

Why is this piece commented out?

include/ubuntu/application/ui/form_factor.h

//typedef unsigned int FormFactorHintFlags;
//typedef FormFactorHintFlags UApplicationUiFormFactor;

Why is this piece commented out?

include/ubuntu/application/ui/stage.h

typedef enum
{
 U_MAIN_STAGE = 0,
 U_INTEGRATION_STAGE = 1,
    U_SHARE_STAGE = 2,
    U_CONTENT_PICKING_STAGE = 3,
    U_SIDE_STAGE = 4,
    U_CONFIGURATION_STAGE = 5
} UAUiStage;

Cosmetics, please fix the indentation.

include/ubuntu/application/ui/stage.h

#ifndef UBUNTU_APPLICATION_UI_STAGE_HINT_H_
#define UBUNTU_APPLICATION_UI_STAGE_HINT_H_

/*namespace ubuntu
{
namespace application
{
namespace ui
{
enum StageHint
{
    main_stage = MAIN_STAGE_HINT,
    integration_stage = INTEGRATION_STAGE_HINT,
    share_stage = SHARE_STAGE_HINT,
 ...

Read more...

review: Needs Fixing
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Also, you're not just moving stuff around, but we also got quite a few new headers and new definitions. Ideally they would be part of a different MR.

Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Also, build failure:
Install: /media/rsalveti/home/dev/android/build/public/out/target/product/mako/system/bin/direct_osk_visibility
Import includes file: /media/rsalveti/home/dev/android/build/public/out/target/product/mako/obj/EXECUTABLES/direct_ubuntu_application_sensors_c_api_for_hybris_test_intermediates/import_includes
target thumb C++: direct_ubuntu_application_sensors_c_api_for_hybris_test <= ubuntu/platform-api/android/hybris/test_sensors_c_api.cpp
ubuntu/platform-api/android/hybris/test_sensors_c_api.cpp:19:68: fatal error: private/application/sensors/ubuntu_application_sensors.h: No such file or directory
compilation terminated.
make: *** [/media/rsalveti/home/dev/android/build/public/out/target/product/mako/obj/EXECUTABLES/direct_ubuntu_application_sensors_c_api_for_hybris_test_intermediates/test_sensors_c_api.o] Error 1
make: Leaving directory `/media/rsalveti/home/dev/android/build/public'

mmm ubuntu/platform-api/android/hybris/

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Good, thanks!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2013-02-06 00:32:45 +0000
3+++ CMakeLists.txt 2013-05-28 11:49:27 +0000
4@@ -10,6 +10,7 @@
5 ARCHIVE DESTINATION "${LIB_INSTALL_DIR}")
6
7 include_directories(include/)
8+include_directories(android/include/)
9
10 add_subdirectory(src/)
11 add_subdirectory(include/)
12
13=== modified file 'android/default/default_ubuntu_application_sensor.cpp'
14--- android/default/default_ubuntu_application_sensor.cpp 2013-02-28 14:29:36 +0000
15+++ android/default/default_ubuntu_application_sensor.cpp 2013-05-28 11:49:27 +0000
16@@ -18,10 +18,10 @@
17
18 #include <ubuntu/application/sensors/ubuntu_application_sensors.h>
19
20-#include <ubuntu/application/sensors/sensor.h>
21-#include <ubuntu/application/sensors/sensor_listener.h>
22-#include <ubuntu/application/sensors/sensor_service.h>
23-#include <ubuntu/application/sensors/sensor_type.h>
24+#include <private/application/sensors/sensor.h>
25+#include <private/application/sensors/sensor_listener.h>
26+#include <private/application/sensors/sensor_service.h>
27+#include <private/application/sensors/sensor_type.h>
28
29 #include <cassert>
30 #include <cstdio>
31
32=== modified file 'android/default/default_ubuntu_application_ui.cpp'
33--- android/default/default_ubuntu_application_ui.cpp 2013-02-19 12:36:06 +0000
34+++ android/default/default_ubuntu_application_ui.cpp 2013-05-28 11:49:27 +0000
35@@ -15,18 +15,18 @@
36 *
37 * Authored by: Thomas Voß <thomas.voss@canonical.com>
38 */
39-#include <ubuntu/application/ui/init.h>
40-#include <ubuntu/application/ui/session.h>
41-#include <ubuntu/application/ui/session_credentials.h>
42-#include <ubuntu/application/ui/setup.h>
43-#include <ubuntu/application/ui/surface.h>
44-#include <ubuntu/application/ui/surface_factory.h>
45-#include <ubuntu/application/ui/surface_properties.h>
46+#include <private/application/ui/init.h>
47+#include <private/application/ui/session.h>
48+#include <private/application/ui/session_credentials.h>
49+#include <private/application/ui/setup.h>
50+#include <private/application/ui/surface.h>
51+#include <private/application/ui/surface_factory.h>
52+#include <private/application/ui/surface_properties.h>
53
54-#include <ubuntu/ui/session_service.h>
55+#include <private/ui/session_service.h>
56
57 // C apis
58-#include <ubuntu/application/ui/ubuntu_application_ui.h>
59+#include <private/application/ui/ubuntu_application_ui.h>
60
61 // C-API implementation
62 namespace
63
64=== modified file 'android/default/default_ubuntu_ui.cpp'
65--- android/default/default_ubuntu_ui.cpp 2013-02-20 05:24:03 +0000
66+++ android/default/default_ubuntu_ui.cpp 2013-05-28 11:49:27 +0000
67@@ -18,8 +18,8 @@
68
69 #include <ubuntu/ui/ubuntu_ui_session_service.h>
70
71-#include <ubuntu/ui/session_service.h>
72-#include <ubuntu/ui/session_enumerator.h>
73+#include <private/ui/session_service.h>
74+#include <private/ui/session_enumerator.h>
75
76 #include <stdio.h>
77
78
79=== modified file 'android/hybris/Android.mk'
80--- android/hybris/Android.mk 2013-04-12 13:34:02 +0000
81+++ android/hybris/Android.mk 2013-05-28 11:49:27 +0000
82@@ -13,7 +13,8 @@
83 LOCAL_GENERATED_SOURCES := $(CONFIG_H)
84
85 LOCAL_C_INCLUDES := \
86- $(UPAPI_PATH)/include
87+ $(UPAPI_PATH)/include \
88+ $(UPAPI_PATH)/android/include
89
90 LOCAL_SRC_FILES := \
91 ubuntu_application_api_for_hybris.cpp \
92@@ -44,7 +45,8 @@
93 LOCAL_CFLAGS += -std=gnu++0x
94
95 LOCAL_C_INCLUDES := \
96- $(UPAPI_PATH)/include
97+ $(UPAPI_PATH)/include \
98+ $(UPAPI_PATH)/android/include
99
100 LOCAL_SRC_FILES:= \
101 test.cpp \
102@@ -66,7 +68,8 @@
103 LOCAL_CFLAGS += -std=gnu++0x
104
105 LOCAL_C_INCLUDES := \
106- $(UPAPI_PATH)/include
107+ $(UPAPI_PATH)/include \
108+ $(UPAPI_PATH)/android/include
109
110 LOCAL_SRC_FILES:= \
111 test_c_api.cpp \
112@@ -88,7 +91,8 @@
113 LOCAL_CFLAGS += -std=gnu++0x
114
115 LOCAL_C_INCLUDES := \
116- $(UPAPI_PATH)/include
117+ $(UPAPI_PATH)/include \
118+ $(UPAPI_PATH)/android/include
119
120 LOCAL_SRC_FILES:= \
121 test_session_c_api.cpp \
122@@ -110,7 +114,8 @@
123 LOCAL_CFLAGS += -std=gnu++0x
124
125 LOCAL_C_INCLUDES := \
126- $(UPAPI_PATH)/include
127+ $(UPAPI_PATH)/include \
128+ $(UPAPI_PATH)/android/include
129
130 LOCAL_SRC_FILES:= \
131 test_trap.cpp \
132@@ -132,7 +137,8 @@
133 LOCAL_CFLAGS += -std=gnu++0x
134
135 LOCAL_C_INCLUDES := \
136- $(UPAPI_PATH)/include
137+ $(UPAPI_PATH)/include \
138+ $(UPAPI_PATH)/android/include
139
140 LOCAL_SRC_FILES:= \
141 test_osk_visibility.cpp \
142@@ -154,7 +160,8 @@
143 LOCAL_CFLAGS += -std=gnu++0x
144
145 LOCAL_C_INCLUDES := \
146- $(UPAPI_PATH)/include
147+ $(UPAPI_PATH)/include \
148+ $(UPAPI_PATH)/android/include
149
150 LOCAL_SRC_FILES:= \
151 test_sensors_c_api.cpp \
152@@ -176,7 +183,8 @@
153 LOCAL_CFLAGS += -std=gnu++0x
154
155 LOCAL_C_INCLUDES := \
156- $(UPAPI_PATH)/include
157+ $(UPAPI_PATH)/include \
158+ $(UPAPI_PATH)/android/include
159
160 LOCAL_SRC_FILES:= \
161 test_sensors.cpp \
162@@ -200,7 +208,8 @@
163 LOCAL_C_INCLUDES := \
164 external/skia/include/core \
165 frameworks/base/services \
166- $(UPAPI_PATH)/include
167+ $(UPAPI_PATH)/include \
168+ $(UPAPI_PATH)/android/include
169
170 LOCAL_SRC_FILES:= \
171 application_manager.cpp \
172@@ -227,7 +236,8 @@
173 LOCAL_CFLAGS += -std=gnu++0x
174
175 LOCAL_C_INCLUDES := \
176- $(UPAPI_PATH)/include
177+ $(UPAPI_PATH)/include \
178+ $(UPAPI_PATH)/android/include
179
180 LOCAL_SRC_FILES:= \
181 application_manager.cpp \
182@@ -251,7 +261,8 @@
183 LOCAL_CFLAGS += -std=gnu++0x
184
185 LOCAL_C_INCLUDES := \
186- $(UPAPI_PATH)/include
187+ $(UPAPI_PATH)/include \
188+ $(UPAPI_PATH)/android/include
189
190 LOCAL_SRC_FILES:= \
191 test_gps_api.cpp \
192
193=== modified file 'android/hybris/default_application_session.h'
194--- android/hybris/default_application_session.h 2013-02-27 22:05:31 +0000
195+++ android/hybris/default_application_session.h 2013-05-28 11:49:27 +0000
196@@ -20,9 +20,9 @@
197
198 #include "application_manager.h"
199
200-#include "ubuntu/application/ui/session_credentials.h"
201-#include "ubuntu/application/ui/surface_role.h"
202-#include "ubuntu/application/ui/stage_hint.h"
203+#include "private/application/ui/session_credentials.h"
204+#include "private/application/ui/surface_role.h"
205+#include "private/application/ui/stage_hint.h"
206
207 #include <binder/IPCThreadState.h>
208 #include <binder/IServiceManager.h>
209
210=== modified file 'android/hybris/test.cpp'
211--- android/hybris/test.cpp 2013-02-05 08:01:14 +0000
212+++ android/hybris/test.cpp 2013-05-28 11:49:27 +0000
213@@ -15,12 +15,12 @@
214 *
215 * Authored by: Thomas Voß <thomas.voss@canonical.com>
216 */
217-#include <ubuntu/application/ui/init.h>
218-#include <ubuntu/application/ui/session.h>
219-#include <ubuntu/application/ui/session_credentials.h>
220-#include <ubuntu/application/ui/setup.h>
221+#include <private/application/ui/init.h>
222+#include <private/application/ui/session.h>
223+#include <private/application/ui/session_credentials.h>
224+#include <private/application/ui/setup.h>
225
226-#include <ubuntu/ui/session_service.h>
227+#include <private/ui/session_service.h>
228
229 #include <GLES2/gl2.h>
230 #include <GLES2/gl2ext.h>
231
232=== modified file 'android/hybris/test_c_api.cpp'
233--- android/hybris/test_c_api.cpp 2013-02-05 08:01:14 +0000
234+++ android/hybris/test_c_api.cpp 2013-05-28 11:49:27 +0000
235@@ -15,7 +15,7 @@
236 *
237 * Authored by: Thomas Voß <thomas.voss@canonical.com>
238 */
239-#include <ubuntu/application/ui/ubuntu_application_ui.h>
240+#include <private/application/ui/ubuntu_application_ui.h>
241
242 #include <EGL/egl.h>
243 #include <GLES2/gl2.h>
244
245=== modified file 'android/hybris/test_sensors.cpp'
246--- android/hybris/test_sensors.cpp 2013-02-05 08:01:14 +0000
247+++ android/hybris/test_sensors.cpp 2013-05-28 11:49:27 +0000
248@@ -15,11 +15,11 @@
249 *
250 * Authored by: Thomas Voß <thomas.voss@canonical.com>
251 */
252-#include <ubuntu/application/sensors/sensor_service.h>
253+#include <private/application/sensors/sensor_service.h>
254
255-#include <ubuntu/application/sensors/sensor.h>
256-#include <ubuntu/application/sensors/sensor_listener.h>
257-#include <ubuntu/application/sensors/sensor_reading.h>
258+#include <private/application/sensors/sensor.h>
259+#include <private/application/sensors/sensor_listener.h>
260+#include <private/application/sensors/sensor_reading.h>
261
262 #include <cstdio>
263
264
265=== modified file 'android/hybris/ubuntu_application_api_for_hybris.cpp'
266--- android/hybris/ubuntu_application_api_for_hybris.cpp 2013-02-20 05:24:03 +0000
267+++ android/hybris/ubuntu_application_api_for_hybris.cpp 2013-05-28 11:49:27 +0000
268@@ -19,18 +19,18 @@
269 #include "event_loop.h"
270 #include "input_consumer_thread.h"
271
272-#include <ubuntu/application/ui/clipboard.h>
273-#include <ubuntu/application/ui/init.h>
274-#include <ubuntu/application/ui/session.h>
275-#include <ubuntu/application/ui/session_credentials.h>
276-#include <ubuntu/application/ui/setup.h>
277-#include <ubuntu/application/ui/surface.h>
278-#include <ubuntu/application/ui/surface_factory.h>
279-#include <ubuntu/application/ui/surface_properties.h>
280+#include <private/application/ui/clipboard.h>
281+#include <private/application/ui/init.h>
282+#include <private/application/ui/session.h>
283+#include <private/application/ui/session_credentials.h>
284+#include <private/application/ui/setup.h>
285+#include <private/application/ui/surface.h>
286+#include <private/application/ui/surface_factory.h>
287+#include <private/application/ui/surface_properties.h>
288
289-#include <ubuntu/ui/session_enumerator.h>
290-#include <ubuntu/ui/session_service.h>
291-#include <ubuntu/ui/well_known_applications.h>
292+#include <private/ui/session_enumerator.h>
293+#include <private/ui/session_service.h>
294+#include <private/ui/well_known_applications.h>
295
296 #include <binder/IMemory.h>
297 #include <binder/IPCThreadState.h>
298
299=== modified file 'android/hybris/ubuntu_application_sensors_for_hybris.cpp'
300--- android/hybris/ubuntu_application_sensors_for_hybris.cpp 2013-02-27 14:43:42 +0000
301+++ android/hybris/ubuntu_application_sensors_for_hybris.cpp 2013-05-28 11:49:27 +0000
302@@ -17,11 +17,11 @@
303 */
304 #include "event_loop.h"
305
306-#include <ubuntu/application/sensors/sensor_service.h>
307-#include <ubuntu/application/sensors/sensor_listener.h>
308-#include <ubuntu/application/sensors/sensor_reading.h>
309-#include <ubuntu/application/sensors/sensor_type.h>
310-#include <ubuntu/application/sensors/sensor.h>
311+#include <private/application/sensors/sensor_service.h>
312+#include <private/application/sensors/sensor_listener.h>
313+#include <private/application/sensors/sensor_reading.h>
314+#include <private/application/sensors/sensor_type.h>
315+#include <private/application/sensors/sensor.h>
316
317 #include <android/sensor.h>
318
319
320=== added directory 'android/include'
321=== added directory 'android/include/private'
322=== added directory 'android/include/private/application'
323=== added file 'android/include/private/application/application.h'
324--- android/include/private/application/application.h 1970-01-01 00:00:00 +0000
325+++ android/include/private/application/application.h 2013-05-28 11:49:27 +0000
326@@ -0,0 +1,119 @@
327+/*
328+ * Copyright © 2013 Canonical Ltd.
329+ *
330+ * This program is free software: you can redistribute it and/or modify
331+ * it under the terms of the GNU Lesser General Public License version 3 as
332+ * published by the Free Software Foundation.
333+ *
334+ * This program is distributed in the hope that it will be useful,
335+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
336+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
337+ * GNU Lesser General Public License for more details.
338+ *
339+ * You should have received a copy of the GNU Lesser General Public License
340+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
341+ *
342+ * Authored by: Ricardo Mendoza <ricardo.mendoza@canonical.com>
343+ */
344+
345+#ifndef UBUNTU_APPLICATION_APPLICATION_H_
346+#define UBUNTU_APPLICATION_APPLICATION_H_
347+
348+#include <utils/Log.h>
349+
350+namespace ubuntu
351+{
352+namespace application
353+{
354+class Instance : public ubuntu::platform::ReferenceCountedBase
355+{
356+public:
357+ Instance(UApplicationDescription *description, UApplicationOptions *options)
358+ : description(description),
359+ options(options)
360+ {}
361+
362+ typedef ubuntu::platform::shared_ptr<Instance> Ptr;
363+
364+ void run()
365+ {
366+ return;
367+ }
368+
369+ void ref()
370+ {
371+ refcount++;
372+ }
373+
374+ void unref()
375+ {
376+ if (refcount)
377+ refcount--;
378+ }
379+
380+ unsigned int get_refcount()
381+ {
382+ return this->refcount;
383+ }
384+
385+ UApplicationDescription* get_description()
386+ {
387+ return this->description;
388+ }
389+
390+private:
391+ UApplicationDescription *description;
392+ UApplicationOptions *options;
393+ unsigned int refcount;
394+
395+protected:
396+ virtual ~Instance() {}
397+
398+ Instance(const Instance&) = delete;
399+ Instance& operator=(const Instance&) = delete;
400+};
401+
402+
403+class Description : public ubuntu::platform::ReferenceCountedBase
404+{
405+public:
406+ Description() : refcount(1) {}
407+
408+ typedef ubuntu::platform::shared_ptr<Description> Ptr;
409+
410+ void set_lifecycle_delegate(UApplicationLifecycleDelegate *delegate)
411+ {
412+ this->lifecycle_delegate = delegate;
413+ }
414+
415+ void set_application_id(UApplicationId *id)
416+ {
417+ this->application_id = id;
418+ }
419+
420+ UApplicationId* get_application_id()
421+ {
422+ return this->application_id;
423+ }
424+
425+ UApplicationLifecycleDelegate* get_lifecycle_delegate()
426+ {
427+ return this->lifecycle_delegate;
428+ }
429+
430+ unsigned int refcount;
431+
432+private:
433+ UApplicationId *application_id;
434+ UApplicationLifecycleDelegate *lifecycle_delegate;
435+
436+protected:
437+ virtual ~Description() {}
438+
439+ Description(const Description&) = delete;
440+ Description& operator=(const Description&) = delete;
441+};
442+}
443+}
444+
445+#endif /* UBUNTU_APPLICATION_UI_WINDOW_INTERNAL_H_ */
446
447=== added directory 'android/include/private/application/sensors'
448=== added file 'android/include/private/application/sensors/sensor.h'
449--- android/include/private/application/sensors/sensor.h 1970-01-01 00:00:00 +0000
450+++ android/include/private/application/sensors/sensor.h 2013-05-28 11:49:27 +0000
451@@ -0,0 +1,83 @@
452+/*
453+ * Copyright © 2012 Canonical Ltd.
454+ *
455+ * This program is free software: you can redistribute it and/or modify
456+ * it under the terms of the GNU Lesser General Public License version 3 as
457+ * published by the Free Software Foundation.
458+ *
459+ * This program is distributed in the hope that it will be useful,
460+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
461+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
462+ * GNU Lesser General Public License for more details.
463+ *
464+ * You should have received a copy of the GNU Lesser General Public License
465+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
466+ *
467+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
468+ */
469+#ifndef UBUNTU_APPLICATION_SENSORS_SENSOR_H_
470+#define UBUNTU_APPLICATION_SENSORS_SENSOR_H_
471+
472+#include "private/platform/shared_ptr.h"
473+
474+#include "private/application/sensors/sensor_listener.h"
475+#include "private/application/sensors/sensor_type.h"
476+
477+#include <cstdint>
478+
479+namespace ubuntu
480+{
481+namespace application
482+{
483+namespace sensors
484+{
485+/** A data acquisition device that samples a device's environment. */
486+class Sensor : public ubuntu::platform::ReferenceCountedBase
487+{
488+public:
489+ typedef ubuntu::platform::shared_ptr<Sensor> Ptr;
490+
491+ /** Accesses the name of the sensor. Returned pointer is owned by the implementation. */
492+ virtual const char* name() = 0;
493+
494+ /** Accesses the vendor of the sensor. Returned pointer is owned by the implementation. */
495+ virtual const char* vendor() = 0;
496+
497+ /** Accesses the numeric id of the sensor. Should be as stable as possible. */
498+ virtual int32_t id() = 0;
499+
500+ /** Registers the provided listener with the sensor and integrates it with the reporting of sensor readings. */
501+ virtual void register_listener(const SensorListener::Ptr& listener) = 0;
502+
503+ /** Enables the sensor and starts the data acquisition. */
504+ virtual void enable() = 0;
505+ /** Disables the sensor and stops the data acquisition. */
506+ virtual void disable() = 0;
507+
508+ virtual SensorType type() = 0;
509+
510+ /** Returns the minimum numeric value of a sensor reading. */
511+ virtual float min_value() = 0;
512+ /** Returns the maximum numeric value of a sensor reading. */
513+ virtual float max_value() = 0;
514+ /** Returns the numerical resolution of a sensor reading. */
515+ virtual float resolution() = 0;
516+
517+ /** Returns an estimate of the sensor's power consumption, normalized to [0,1]. */
518+ virtual float power_consumption() = 0;
519+
520+ /** Returns the minimum delay between two consecutive sensor readings. */
521+ virtual int32_t min_delay() = 0;
522+
523+protected:
524+ Sensor() {}
525+ virtual ~Sensor() {}
526+
527+ Sensor(const Sensor&) = delete;
528+ Sensor& operator=(const Sensor&) = delete;
529+};
530+}
531+}
532+}
533+
534+#endif // UBUNTU_APPLICATION_SENSORS_SENSOR_H_
535
536=== added file 'android/include/private/application/sensors/sensor_listener.h'
537--- android/include/private/application/sensors/sensor_listener.h 1970-01-01 00:00:00 +0000
538+++ android/include/private/application/sensors/sensor_listener.h 2013-05-28 11:49:27 +0000
539@@ -0,0 +1,53 @@
540+/*
541+ * Copyright © 2012 Canonical Ltd.
542+ *
543+ * This program is free software: you can redistribute it and/or modify
544+ * it under the terms of the GNU Lesser General Public License version 3 as
545+ * published by the Free Software Foundation.
546+ *
547+ * This program is distributed in the hope that it will be useful,
548+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
549+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
550+ * GNU Lesser General Public License for more details.
551+ *
552+ * You should have received a copy of the GNU Lesser General Public License
553+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
554+ *
555+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
556+ */
557+#ifndef UBUNTU_APPLICATION_SENSORS_SENSOR_LISTENER_H_
558+#define UBUNTU_APPLICATION_SENSORS_SENSOR_LISTENER_H_
559+
560+#include "private/platform/shared_ptr.h"
561+
562+#include "private/application/sensors/sensor_reading.h"
563+
564+namespace ubuntu
565+{
566+namespace application
567+{
568+namespace sensors
569+{
570+/** Extension point to allow for observing a sensor's readings. */
571+class SensorListener : public ubuntu::platform::ReferenceCountedBase
572+{
573+public:
574+ typedef ubuntu::platform::shared_ptr<SensorListener> Ptr;
575+
576+ /** Invoked whenever a new reading is available from the sensor.
577+ * \param [in] reading The new reading.
578+ */
579+ virtual void on_new_reading(const SensorReading::Ptr& reading) = 0;
580+
581+protected:
582+ SensorListener() {}
583+ virtual ~SensorListener() {}
584+
585+ SensorListener(const SensorListener&) = delete;
586+ SensorListener& operator=(const SensorListener&) = delete;
587+};
588+}
589+}
590+}
591+
592+#endif // UBUNTU_APPLICATION_SENSORS_SENSOR_LISTENER_H_
593
594=== added file 'android/include/private/application/sensors/sensor_reading.h'
595--- android/include/private/application/sensors/sensor_reading.h 1970-01-01 00:00:00 +0000
596+++ android/include/private/application/sensors/sensor_reading.h 2013-05-28 11:49:27 +0000
597@@ -0,0 +1,78 @@
598+/*
599+ * Copyright © 2012 Canonical Ltd.
600+ *
601+ * This program is free software: you can redistribute it and/or modify
602+ * it under the terms of the GNU Lesser General Public License version 3 as
603+ * published by the Free Software Foundation.
604+ *
605+ * This program is distributed in the hope that it will be useful,
606+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
607+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
608+ * GNU Lesser General Public License for more details.
609+ *
610+ * You should have received a copy of the GNU Lesser General Public License
611+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
612+ *
613+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
614+ */
615+#ifndef UBUNTU_APPLICATION_SENSORS_SENSOR_READING_H_
616+#define UBUNTU_APPLICATION_SENSORS_SENSOR_READING_H_
617+
618+#include "private/platform/shared_ptr.h"
619+
620+#include <cstddef>
621+#include <cstdint>
622+
623+namespace ubuntu
624+{
625+namespace application
626+{
627+namespace sensors
628+{
629+
630+/** A vector of static size. */
631+template<size_t size, typename NumericType = float>
632+struct Vector
633+{
634+ NumericType v[size];
635+
636+ /** Accesses the element at index index. */
637+ NumericType& operator[](size_t index)
638+ {
639+ return v[index];
640+ }
641+
642+ /** Accesses the element at index index. */
643+ const NumericType& operator[](size_t index) const
644+ {
645+ return v[index];
646+ }
647+};
648+
649+/** A timestamped reading from a sensor. */
650+struct SensorReading : public ubuntu::platform::ReferenceCountedBase
651+{
652+ typedef ubuntu::platform::shared_ptr<SensorReading> Ptr;
653+
654+ SensorReading() : timestamp(-1)
655+ {
656+ }
657+
658+ int64_t timestamp; ///< The timestamp of the reading in [ns], CLOCK_MONOTONIC.
659+ /** A union of different possible sensor readings. */
660+ union
661+ {
662+ Vector<3> vector; ///< Arbitrary vector, orientation and linear acceleration readings are reported here.
663+ Vector<3> acceleration; ///< Acceleration vector containing acceleration readings for the three axis.
664+ Vector<3> magnetic; ///< Readings from magnetometer, in three dimensions.
665+ float temperature; ///< Ambient temperature.
666+ float distance; ///< Discrete distance, everything > 5 is considered far, everything < 5 is considered near.
667+ float light; ///< Ambient light conditions.
668+ float pressure; ///< Ambient pressure.
669+ };
670+};
671+}
672+}
673+}
674+
675+#endif // UBUNTU_APPLICATION_SENSORS_SENSOR_READING_H_
676
677=== added file 'android/include/private/application/sensors/sensor_service.h'
678--- android/include/private/application/sensors/sensor_service.h 1970-01-01 00:00:00 +0000
679+++ android/include/private/application/sensors/sensor_service.h 2013-05-28 11:49:27 +0000
680@@ -0,0 +1,48 @@
681+/*
682+ * Copyright © 2012 Canonical Ltd.
683+ *
684+ * This program is free software: you can redistribute it and/or modify
685+ * it under the terms of the GNU Lesser General Public License version 3 as
686+ * published by the Free Software Foundation.
687+ *
688+ * This program is distributed in the hope that it will be useful,
689+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
690+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
691+ * GNU Lesser General Public License for more details.
692+ *
693+ * You should have received a copy of the GNU Lesser General Public License
694+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
695+ *
696+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
697+ */
698+#ifndef UBUNTU_APPLICATION_SENSORS_SENSOR_SERVICE_H_
699+#define UBUNTU_APPLICATION_SENSORS_SENSOR_SERVICE_H_
700+
701+#include "private/platform/shared_ptr.h"
702+
703+#include "private/application/sensors/sensor.h"
704+
705+namespace ubuntu
706+{
707+namespace application
708+{
709+namespace sensors
710+{
711+/** Local stub that allows for instantiating sensor instances given a type. */
712+class SensorService : public ubuntu::platform::ReferenceCountedBase
713+{
714+public:
715+ /** Returns a sensor instance for the provided type or NULL. */
716+ static Sensor::Ptr sensor_for_type(SensorType type);
717+protected:
718+ SensorService() {}
719+ virtual ~SensorService() {}
720+
721+ SensorService(const SensorService&) = delete;
722+ SensorService& operator=(const SensorService&) = delete;
723+};
724+}
725+}
726+}
727+
728+#endif // UBUNTU_APPLICATION_SENSORS_SENSOR_SERVICE_H_
729
730=== added file 'android/include/private/application/sensors/sensor_type.h'
731--- android/include/private/application/sensors/sensor_type.h 1970-01-01 00:00:00 +0000
732+++ android/include/private/application/sensors/sensor_type.h 2013-05-28 11:49:27 +0000
733@@ -0,0 +1,45 @@
734+/*
735+ * Copyright © 2012 Canonical Ltd.
736+ *
737+ * This program is free software: you can redistribute it and/or modify
738+ * it under the terms of the GNU Lesser General Public License version 3 as
739+ * published by the Free Software Foundation.
740+ *
741+ * This program is distributed in the hope that it will be useful,
742+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
743+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
744+ * GNU Lesser General Public License for more details.
745+ *
746+ * You should have received a copy of the GNU Lesser General Public License
747+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
748+ *
749+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
750+ */
751+#ifndef UBUNTU_APPLICATION_SENSORS_SENSOR_TYPE_H_
752+#define UBUNTU_APPLICATION_SENSORS_SENSOR_TYPE_H_
753+
754+namespace ubuntu
755+{
756+namespace application
757+{
758+namespace sensors
759+{
760+/** Models a special type of a sensor */
761+enum SensorType
762+{
763+ first_defined_sensor_type = 0,
764+ sensor_type_accelerometer = first_defined_sensor_type, ///< An accelerometer
765+ sensor_type_magnetic_field, ///< A magnetic field sensor, i.e., a compass
766+ sensor_type_gyroscope, ///< A gyroscope
767+ sensor_type_light, ///< An ambient light sensor
768+ sensor_type_proximity, ///< A proximity sensor, used to blank the screen when making a call
769+ sensor_type_orientation, ///< Virtual sensor, reports sensor fusion results regarding a device's orientation
770+ sensor_type_linear_acceleration, ///< Virtual sensor, reports sensor fusion results regarding a device's linear acceleration
771+ sensor_type_rotation_vector, ///< Virtual sensor, reports sensor fusion results regarding a device's rotation vector
772+ undefined_sensor_type
773+};
774+}
775+}
776+}
777+
778+#endif // UBUNTU_APPLICATION_SENSORS_SENSOR_TYPE_H_
779
780=== added file 'android/include/private/application/session.h'
781--- android/include/private/application/session.h 1970-01-01 00:00:00 +0000
782+++ android/include/private/application/session.h 2013-05-28 11:49:27 +0000
783@@ -0,0 +1,95 @@
784+/*
785+ * Copyright © 2012 Canonical Ltd.
786+ *
787+ * This program is free software: you can redistribute it and/or modify
788+ * it under the terms of the GNU Lesser General Public License version 3 as
789+ * published by the Free Software Foundation.
790+ *
791+ * This program is distributed in the hope that it will be useful,
792+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
793+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
794+ * GNU Lesser General Public License for more details.
795+ *
796+ * You should have received a copy of the GNU Lesser General Public License
797+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
798+ *
799+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
800+ */
801+
802+#ifndef UBUNTU_APPLICATION_SESSION_H_
803+#define UBUNTU_APPLICATION_SESSION_H_
804+
805+#include <private/platform/shared_ptr.h>
806+
807+#include <utils/Log.h>
808+
809+namespace ubuntu
810+{
811+namespace application
812+{
813+/**
814+ * Represents a session with the service providers abstracted by Ubuntu platform API.
815+ */
816+class Session : public ubuntu::platform::ReferenceCountedBase
817+{
818+public:
819+ typedef ubuntu::platform::shared_ptr<Session> Ptr;
820+
821+protected:
822+ Session() {}
823+ virtual ~Session() {}
824+
825+ Session(const Session&) = delete;
826+ Session& operator=(const Session&) = delete;
827+};
828+
829+/**
830+ * Represents a session lifecycle delegate.
831+ */
832+class LifecycleDelegate : public ubuntu::platform::ReferenceCountedBase
833+{
834+public:
835+ typedef ubuntu::platform::shared_ptr<LifecycleDelegate> Ptr;
836+
837+ virtual void on_application_started() = 0;
838+ virtual void on_application_about_to_stop() = 0;
839+
840+protected:
841+ LifecycleDelegate() {}
842+
843+ virtual ~LifecycleDelegate() {}
844+
845+ LifecycleDelegate(const LifecycleDelegate&) = delete;
846+ LifecycleDelegate& operator=(const LifecycleDelegate&) = delete;
847+};
848+
849+class Id : public ubuntu::platform::ReferenceCountedBase
850+{
851+public:
852+ typedef ubuntu::platform::shared_ptr<Id> Ptr;
853+
854+ Id(const char *string, size_t size)
855+ {
856+ this->size = size;
857+ this->string = (char*) malloc(sizeof (char) * (size+1));
858+ memcpy(this->string, string, (size+1));
859+ }
860+
861+ ~Id()
862+ {
863+ free(this->string);
864+ }
865+
866+ char *string;
867+ size_t size;
868+
869+protected:
870+ Id() {}
871+
872+ Id(const Id&) = delete;
873+ Id& operator=(const Id&) = delete;
874+};
875+}
876+}
877+
878+#endif // UBUNTU_APPLICATION_SESSION_H_
879
880=== added file 'android/include/private/application/session_delegates.h'
881--- android/include/private/application/session_delegates.h 1970-01-01 00:00:00 +0000
882+++ android/include/private/application/session_delegates.h 2013-05-28 11:49:27 +0000
883@@ -0,0 +1,48 @@
884+/*
885+ * Copyright © 2013 Canonical Ltd.
886+ *
887+ * This program is free software: you can redistribute it and/or modify
888+ * it under the terms of the GNU Lesser General Public License version 3 as
889+ * published by the Free Software Foundation.
890+ *
891+ * This program is distributed in the hope that it will be useful,
892+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
893+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
894+ * GNU Lesser General Public License for more details.
895+ *
896+ * You should have received a copy of the GNU Lesser General Public License
897+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
898+ *
899+ * Authored by: Ricardo Mendoza <ricardo.mendoza@canonical.com>
900+ */
901+
902+#ifndef UBUNTU_APPLICATION_UI_SESSION_DELEGATES_H_
903+#define UBUNTU_APPLICATION_UI_SESSION_DELEGATES_H_
904+
905+#include <session/lifecycle_delegate.h>
906+
907+#include <cstdio>
908+
909+namespace ubuntu
910+{
911+namespace application
912+{
913+class LifecycleDelegate : public platform::ReferenceCountedBase
914+{
915+public:
916+ typedef platform::shared_ptr<LifecycleDelegate> Ptr;
917+
918+ virtual void on_application_started() = 0;
919+ virtual void on_application_about_to_stop() = 0;
920+
921+protected:
922+ LifecycleDelegate() {}
923+ virtual ~LifecycleDelegate() {}
924+
925+ LifecycleDelegate(const LifecycleDelegate&) = delete;
926+ LifecycleDelegate& operator=(const LifecycleDelegate&) = delete;
927+};
928+}
929+}
930+
931+#endif // UBUNTU_APPLICATION_UI_SESSION_DELEGATES_H_
932
933=== added directory 'android/include/private/application/ui'
934=== added file 'android/include/private/application/ui/clipboard.h'
935--- android/include/private/application/ui/clipboard.h 1970-01-01 00:00:00 +0000
936+++ android/include/private/application/ui/clipboard.h 2013-05-28 11:49:27 +0000
937@@ -0,0 +1,91 @@
938+/*
939+ * Copyright © 2012 Canonical Ltd.
940+ *
941+ * This program is free software: you can redistribute it and/or modify
942+ * it under the terms of the GNU General Public License version 3 as
943+ * published by the Free Software Foundation.
944+ *
945+ * This program is distributed in the hope that it will be useful,
946+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
947+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
948+ * GNU General Public License for more details.
949+ *
950+ * You should have received a copy of the GNU General Public License
951+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
952+ *
953+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
954+ */
955+#ifndef UBUNTU_APPLICATION_UI_CLIPBOARD_H_
956+#define UBUNTU_APPLICATION_UI_CLIPBOARD_H_
957+
958+#include "private/platform/shared_ptr.h"
959+
960+namespace ubuntu
961+{
962+namespace application
963+{
964+namespace ui
965+{
966+/** Models a system-wide clipboard.
967+ * \deprecated This is a temporary solution and is likely to be removed or subject to significant changes in upcoming revisions.
968+ */
969+class Clipboard : public ubuntu::platform::ReferenceCountedBase
970+{
971+public:
972+ typedef ubuntu::platform::shared_ptr<Clipboard> Ptr;
973+
974+ struct Content
975+ {
976+ static const int MAX_MIME_TYPE_SIZE=32;
977+
978+ Content() : data(NULL),
979+ data_size(0)
980+ {
981+ }
982+
983+ Content(const char* mime,
984+ void* _data,
985+ size_t size) : data(malloc(size)),
986+ data_size(size)
987+ {
988+ memcpy(mime_type, mime, MAX_MIME_TYPE_SIZE);
989+ memcpy(data, _data, size);
990+ }
991+
992+ Content(const Content& rhs) : data(malloc(rhs.data_size)),
993+ data_size(rhs.data_size)
994+ {
995+ memcpy(mime_type, rhs.mime_type, MAX_MIME_TYPE_SIZE);
996+ memcpy(data, rhs.data, data_size);
997+ }
998+
999+ Content& operator=(const Content& rhs)
1000+ {
1001+ memcpy(mime_type, rhs.mime_type, MAX_MIME_TYPE_SIZE);
1002+ data = realloc(data, rhs.data_size);
1003+ memcpy(data, rhs.data, data_size);
1004+ data_size = rhs.data_size;
1005+
1006+ return *this;
1007+ }
1008+
1009+ char mime_type[MAX_MIME_TYPE_SIZE];
1010+ void* data;
1011+ size_t data_size;
1012+ };
1013+
1014+ virtual void set_content(const Content& content) = 0;
1015+ virtual Content get_content() = 0;
1016+
1017+protected:
1018+ Clipboard() {}
1019+ virtual ~Clipboard() {}
1020+
1021+ Clipboard(const Clipboard&) = delete;
1022+ Clipboard& operator=(const Clipboard&) = delete;
1023+};
1024+}
1025+}
1026+}
1027+
1028+#endif // UBUNTU_APPLICATION_UI_CLIPBOARD_H_
1029
1030=== added file 'android/include/private/application/ui/form_factor_hint.h'
1031--- android/include/private/application/ui/form_factor_hint.h 1970-01-01 00:00:00 +0000
1032+++ android/include/private/application/ui/form_factor_hint.h 2013-05-28 11:49:27 +0000
1033@@ -0,0 +1,44 @@
1034+/*
1035+ * Copyright © 2012 Canonical Ltd.
1036+ *
1037+ * This program is free software: you can redistribute it and/or modify
1038+ * it under the terms of the GNU Lesser General Public License version 3 as
1039+ * published by the Free Software Foundation.
1040+ *
1041+ * This program is distributed in the hope that it will be useful,
1042+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1043+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1044+ * GNU Lesser General Public License for more details.
1045+ *
1046+ * You should have received a copy of the GNU Lesser General Public License
1047+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1048+ *
1049+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
1050+ */
1051+#ifndef UBUNTU_APPLICATION_UI_FORM_FACTOR_HINT_H_
1052+#define UBUNTU_APPLICATION_UI_FORM_FACTOR_HINT_H_
1053+
1054+#include "private/application/ui/ubuntu_application_ui.h"
1055+
1056+namespace ubuntu
1057+{
1058+namespace application
1059+{
1060+namespace ui
1061+{
1062+/** Provides applications with a hint about the form factor it is running on. */
1063+enum FormFactorHint
1064+{
1065+ desktop_form_factor = DESKTOP_FORM_FACTOR_HINT, ///< An ordinary desktop or laptop form factor.
1066+ phone_form_factor = PHONE_FORM_FACTOR_HINT, ///< A phone form factor.
1067+ tablet_form_factor = TABLET_FORM_FACTOR_HINT ///< A tablet form factor.
1068+};
1069+
1070+/** Bitfield as multiple form factor hints can be applied in a converged scenario. */
1071+typedef unsigned int FormFactorHintFlags;
1072+
1073+}
1074+}
1075+}
1076+
1077+#endif // UBUNTU_APPLICATION_UI_FORM_FACTOR_HINT_H_
1078
1079=== added file 'android/include/private/application/ui/init.h'
1080--- android/include/private/application/ui/init.h 1970-01-01 00:00:00 +0000
1081+++ android/include/private/application/ui/init.h 2013-05-28 11:49:27 +0000
1082@@ -0,0 +1,35 @@
1083+/*
1084+ * Copyright © 2012 Canonical Ltd.
1085+ *
1086+ * This program is free software: you can redistribute it and/or modify
1087+ * it under the terms of the GNU Lesser General Public License version 3 as
1088+ * published by the Free Software Foundation.
1089+ *
1090+ * This program is distributed in the hope that it will be useful,
1091+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1092+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1093+ * GNU Lesser General Public License for more details.
1094+ *
1095+ * You should have received a copy of the GNU Lesser General Public License
1096+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1097+ *
1098+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
1099+ */
1100+#ifndef UBUNTU_APPLICATION_UI_INIT_H_
1101+#define UBUNTU_APPLICATION_UI_INIT_H_
1102+
1103+namespace ubuntu
1104+{
1105+namespace application
1106+{
1107+namespace ui
1108+{
1109+/** Initializes internals with the given command line arguments.
1110+ * \attention Has to be called before any other function is called.
1111+ */
1112+void init(int argc, char** argv);
1113+}
1114+}
1115+}
1116+
1117+#endif // UBUNTU_APPLICATION_UI_INIT_H_
1118
1119=== added directory 'android/include/private/application/ui/input'
1120=== added file 'android/include/private/application/ui/input/event.h'
1121--- android/include/private/application/ui/input/event.h 1970-01-01 00:00:00 +0000
1122+++ android/include/private/application/ui/input/event.h 2013-05-28 11:49:27 +0000
1123@@ -0,0 +1,106 @@
1124+/*
1125+ * Copyright © 2012 Canonical Ltd.
1126+ *
1127+ * This program is free software: you can redistribute it and/or modify
1128+ * it under the terms of the GNU Lesser General Public License version 3 as
1129+ * published by the Free Software Foundation.
1130+ *
1131+ * This program is distributed in the hope that it will be useful,
1132+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1133+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1134+ * GNU Lesser General Public License for more details.
1135+ *
1136+ * You should have received a copy of the GNU Lesser General Public License
1137+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1138+ *
1139+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
1140+ */
1141+#ifndef UBUNTU_APPLICATION_UI_INPUT_EVENT_H_
1142+#define UBUNTU_APPLICATION_UI_INPUT_EVENT_H_
1143+
1144+#include <stddef.h>
1145+#include <stdint.h>
1146+
1147+#ifdef __cplusplus
1148+extern "C" {
1149+#endif
1150+
1151+ /** Maximum number of pointers reported within one input event. */
1152+#define UBUNTU_APPLICATION_UI_INPUT_EVENT_MAX_POINTER_COUNT (16)
1153+
1154+ /** Reference timebase, nanoseconds as measured by CLOCK_MONOTONIC. */
1155+ typedef int64_t nsecs_t;
1156+
1157+ /** Describes the different event types. */
1158+ typedef enum
1159+ {
1160+ KEY_EVENT_TYPE, ///< Event originates from a keyboard.
1161+ MOTION_EVENT_TYPE, ///< Event originates from something moving, e.g., a wheel, a mouse, a finger on a touchpad.
1162+ HW_SWITCH_EVENT_TYPE ///< Event originates from an additional button attached to the device's HW, e.g., power button.
1163+ } EventType;
1164+
1165+ /** Models an input event. */
1166+ typedef struct
1167+ {
1168+ EventType type; ///< Type of the event.
1169+ int32_t device_id; ///< Device that this event originated from.
1170+ int32_t source_id; ///< Source that this event originated from.
1171+ int32_t action; ///< Action signalled by this event.
1172+ int32_t flags; ///< Flags associated with this event.
1173+ int32_t meta_state; ///< State of the meta modifiers (ALT, CTRL, SHIFT).
1174+ /** Information specific to key/motion event types. */
1175+ union
1176+ {
1177+ /** Information describing an event originating from a HW switch. */
1178+ struct HardwareSwitchEvent
1179+ {
1180+ nsecs_t event_time; ///< Timestamp when the event happened.
1181+ uint32_t policy_flags; ///< Policy flags.
1182+ int32_t switch_code; ///< The scan code of the switch.
1183+ int32_t switch_value; ///< The value reported by the switch.
1184+ } hw_switch;
1185+ /** Information describing an event originating from a keyboard key. */
1186+ struct KeyEvent
1187+ {
1188+ int32_t key_code;
1189+ int32_t scan_code;
1190+ int32_t repeat_count;
1191+ nsecs_t down_time;
1192+ nsecs_t event_time;
1193+ int is_system_key; ///< \deprecated Do not use.
1194+ } key;
1195+ /** Information describing an event originating from a
1196+ * "moving" device, e.g., a mouse, a mouse-wheel, a finger
1197+ * on a touchpad.
1198+ */
1199+ struct MotionEvent
1200+ {
1201+ int32_t edge_flags; ///< Set for touches intersecting a touchscreen's edges, requires HW support.
1202+ int32_t button_state; ///< State of buttons of the device
1203+ float x_offset; ///< Movement in x direction since down event
1204+ float y_offset; ///< Movement in y direction since down event
1205+ float x_precision; ///< Sampling precision in x direction
1206+ float y_precision; ///< Sampling precision in y direction
1207+ nsecs_t down_time; ///< Timestamp that marks the down event
1208+ nsecs_t event_time; ///< Timestamp that marks when this event happened
1209+ size_t pointer_count; ///< Number of pointers reported in this event
1210+ struct PointerCoordinate
1211+ {
1212+ int id; ///< Unique id of the pointer
1213+ float x, raw_x; ///< Processed and raw x coordinates
1214+ float y, raw_y; ///< Processed and raw y coordinates
1215+ float touch_major; ///< Touch major coordinate
1216+ float touch_minor; ///< Touch minor coordinate
1217+ float size; ///< Size of the pointer/touch
1218+ float pressure; ///< Pressure of the touch
1219+ float orientation; ///< Orientation
1220+ } pointer_coordinates[UBUNTU_APPLICATION_UI_INPUT_EVENT_MAX_POINTER_COUNT]; ///< Pointer information, valid from [0,pointer_count).
1221+ } motion;
1222+ } details;
1223+ } Event;
1224+
1225+#ifdef __cplusplus
1226+}
1227+#endif
1228+
1229+#endif // UBUNTU_APPLICATION_UI_INPUT_EVENT_H_
1230
1231=== added file 'android/include/private/application/ui/input/listener.h'
1232--- android/include/private/application/ui/input/listener.h 1970-01-01 00:00:00 +0000
1233+++ android/include/private/application/ui/input/listener.h 2013-05-28 11:49:27 +0000
1234@@ -0,0 +1,53 @@
1235+/*
1236+ * Copyright © 2012 Canonical Ltd.
1237+ *
1238+ * This program is free software: you can redistribute it and/or modify
1239+ * it under the terms of the GNU Lesser General Public License version 3 as
1240+ * published by the Free Software Foundation.
1241+ *
1242+ * This program is distributed in the hope that it will be useful,
1243+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1244+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1245+ * GNU Lesser General Public License for more details.
1246+ *
1247+ * You should have received a copy of the GNU Lesser General Public License
1248+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1249+ *
1250+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
1251+ */
1252+#ifndef UBUNTU_APPLICATION_UI_INPUT_LISTENER_H_
1253+#define UBUNTU_APPLICATION_UI_INPUT_LISTENER_H_
1254+
1255+#include "private/application/ui/input/event.h"
1256+#include "private/platform/shared_ptr.h"
1257+
1258+namespace ubuntu
1259+{
1260+namespace application
1261+{
1262+namespace ui
1263+{
1264+namespace input
1265+{
1266+/** Models a listener for classic input event originating from input devices like mice or touchpads. */
1267+class Listener : public ubuntu::platform::ReferenceCountedBase
1268+{
1269+public:
1270+ typedef ubuntu::platform::shared_ptr<Listener> Ptr;
1271+
1272+ /** Invoked whenever a new event is available. */
1273+ virtual void on_new_event(const Event& event) = 0;
1274+
1275+protected:
1276+ Listener() {}
1277+ virtual ~Listener() {}
1278+
1279+ Listener(const Listener&) = delete;
1280+ Listener& operator=(const Listener&) = delete;
1281+};
1282+}
1283+}
1284+}
1285+}
1286+
1287+#endif // UBUNTU_APPLICATION_UI_INPUT_LISTENER_H_
1288
1289=== added file 'android/include/private/application/ui/physical_display_info.h'
1290--- android/include/private/application/ui/physical_display_info.h 1970-01-01 00:00:00 +0000
1291+++ android/include/private/application/ui/physical_display_info.h 2013-05-28 11:49:27 +0000
1292@@ -0,0 +1,77 @@
1293+/*
1294+ * Copyright © 2012 Canonical Ltd.
1295+ *
1296+ * This program is free software: you can redistribute it and/or modify
1297+ * it under the terms of the GNU Lesser General Public License version 3 as
1298+ * published by the Free Software Foundation.
1299+ *
1300+ * This program is distributed in the hope that it will be useful,
1301+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1302+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1303+ * GNU Lesser General Public License for more details.
1304+ *
1305+ * You should have received a copy of the GNU Lesser General Public License
1306+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1307+ *
1308+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
1309+ */
1310+#ifndef UBUNTU_APPLICATION_UI_PHYSICAL_DISPLAY_INFO_H_
1311+#define UBUNTU_APPLICATION_UI_PHYSICAL_DISPLAY_INFO_H_
1312+
1313+#include "private/platform/shared_ptr.h"
1314+
1315+namespace ubuntu
1316+{
1317+namespace application
1318+{
1319+namespace ui
1320+{
1321+
1322+/**
1323+ * Marks physical displays connected to the system
1324+ */
1325+enum PhysicalDisplayIdentifier
1326+{
1327+ first_physical_display = 0,
1328+ second_physical_display = 1,
1329+ third_physical_display = 2,
1330+ fourth_physical_display = 3,
1331+ fifth_physical_display = 4,
1332+ sixth_physical_display = 5,
1333+ seventh_physical_display = 6,
1334+ eigth_physical_display = 7,
1335+ ninth_physical_display = 8,
1336+ tenth_physical_display = 9,
1337+
1338+ primary_physical_display = first_physical_display
1339+};
1340+
1341+/**
1342+ * Models information about a physical display.
1343+ */
1344+class PhysicalDisplayInfo : public ubuntu::platform::ReferenceCountedBase
1345+{
1346+public:
1347+ typedef ubuntu::platform::shared_ptr<PhysicalDisplayInfo> Ptr;
1348+
1349+ /** Access to the horizontal dpi of the physical display. */
1350+ virtual float horizontal_dpi() = 0;
1351+ /** Access to the vertical dpi of the physical display. */
1352+ virtual float vertical_dpi() = 0;
1353+ /** Access to the horizontal resolution of the physical display. */
1354+ virtual int horizontal_resolution() = 0;
1355+ /** Access to the vertical resolution of the physical display. */
1356+ virtual int vertical_resolution() = 0;
1357+
1358+protected:
1359+ PhysicalDisplayInfo() {}
1360+ virtual ~PhysicalDisplayInfo() {}
1361+
1362+ PhysicalDisplayInfo(const PhysicalDisplayInfo&) = delete;
1363+ PhysicalDisplayInfo& operator=(const PhysicalDisplayInfo&) = delete;
1364+};
1365+}
1366+}
1367+}
1368+
1369+#endif // UBUNTU_APPLICATION_UI_PHYSICAL_DISPLAY_INFO_H_
1370
1371=== added file 'android/include/private/application/ui/session.h'
1372--- android/include/private/application/ui/session.h 1970-01-01 00:00:00 +0000
1373+++ android/include/private/application/ui/session.h 2013-05-28 11:49:27 +0000
1374@@ -0,0 +1,88 @@
1375+/*
1376+ * Copyright © 2012 Canonical Ltd.
1377+ *
1378+ * This program is free software: you can redistribute it and/or modify
1379+ * it under the terms of the GNU Lesser General Public License version 3 as
1380+ * published by the Free Software Foundation.
1381+ *
1382+ * This program is distributed in the hope that it will be useful,
1383+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1384+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1385+ * GNU Lesser General Public License for more details.
1386+ *
1387+ * You should have received a copy of the GNU Lesser General Public License
1388+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1389+ *
1390+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
1391+ */
1392+
1393+#ifndef UBUNTU_APPLICATION_UI_SESSION_INTERNAL_H_
1394+#define UBUNTU_APPLICATION_UI_SESSION_INTERNAL_H_
1395+
1396+#include <private/ui/session_enumerator.h>
1397+#include <private/application/session.h>
1398+#include <private/application/ui/clipboard.h>
1399+#include <private/application/ui/physical_display_info.h>
1400+#include <private/application/ui/surface.h>
1401+#include <private/application/ui/surface_properties.h>
1402+#include <private/platform/shared_ptr.h>
1403+
1404+#include <EGL/egl.h>
1405+
1406+namespace ubuntu
1407+{
1408+namespace application
1409+{
1410+namespace ui
1411+{
1412+/**
1413+ * Represents a session with the service providers abstracted by
1414+ * Ubuntu platform API and allows for accessing ui-specific
1415+ * functionality.
1416+ */
1417+class Session : public ubuntu::application::Session
1418+{
1419+public:
1420+ typedef ubuntu::platform::shared_ptr<Session> Ptr;
1421+
1422+ /** Provides access to the system-wide clipboard. */
1423+ static Clipboard::Ptr clipboard();
1424+
1425+ /** Provides system-wide access to the physical displays known to the system.
1426+ * \sa PhysicalDisplayIdentifier
1427+ * \sa PhysicalDisplayInfo
1428+ */
1429+ static PhysicalDisplayInfo::Ptr physical_display_info(PhysicalDisplayIdentifier id);
1430+
1431+ /** Requests a surface from the system.
1432+ * \param [in] props Requested properties for the surface
1433+ * \param [in] listener Event receiver for input events
1434+ * \return Pointer to the surface instance or NULL.
1435+ */
1436+ virtual Surface::Ptr create_surface(
1437+ const SurfaceProperties& props,
1438+ const ubuntu::application::ui::input::Listener::Ptr& listener) = 0;
1439+
1440+ /** Requests the PID for the running session. */
1441+ virtual int get_session_pid() = 0;
1442+
1443+ /** Destroys the surface and renders it unusable. */
1444+ virtual void destroy_surface(const Surface::Ptr& surface) = 0;
1445+
1446+ /** Requests the surface to be shown in fullscreen.
1447+ * \param [in] surface The surface to transition to fullscreen.
1448+ */
1449+ virtual void toggle_fullscreen_for_surface(const Surface::Ptr& surface) = 0;
1450+
1451+protected:
1452+ Session() {}
1453+ virtual ~Session() {}
1454+
1455+ Session(const Session&) = delete;
1456+ Session& operator=(const Session&) = delete;
1457+};
1458+}
1459+}
1460+}
1461+
1462+#endif // UBUNTU_APPLICATION_UI_SESSION_INTERNAL_H_
1463
1464=== added file 'android/include/private/application/ui/session_credentials.h'
1465--- android/include/private/application/ui/session_credentials.h 1970-01-01 00:00:00 +0000
1466+++ android/include/private/application/ui/session_credentials.h 2013-05-28 11:49:27 +0000
1467@@ -0,0 +1,86 @@
1468+/*
1469+ * Copyright © 2012 Canonical Ltd.
1470+ *
1471+ * This program is free software: you can redistribute it and/or modify
1472+ * it under the terms of the GNU Lesser General Public License version 3 as
1473+ * published by the Free Software Foundation.
1474+ *
1475+ * This program is distributed in the hope that it will be useful,
1476+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1477+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1478+ * GNU Lesser General Public License for more details.
1479+ *
1480+ * You should have received a copy of the GNU Lesser General Public License
1481+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1482+ *
1483+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
1484+ */
1485+#ifndef UBUNTU_APPLICATION_UI_SESSION_CREDENTIALS_H_
1486+#define UBUNTU_APPLICATION_UI_SESSION_CREDENTIALS_H_
1487+
1488+#include "ubuntu_application_ui.h"
1489+
1490+#include <cstdio>
1491+
1492+namespace ubuntu
1493+{
1494+namespace application
1495+{
1496+namespace ui
1497+{
1498+/**
1499+ * Specifies the session type.
1500+ * \attention System sessions require special privileged to be registered with the service providers.
1501+ */
1502+enum SessionType
1503+{
1504+ user_session_type = USER_SESSION_TYPE,
1505+ system_session_type = SYSTEM_SESSION_TYPE
1506+};
1507+
1508+enum RunningState
1509+{
1510+ process_stopped = PROCESS_STOPPED,
1511+ process_running = PROCESS_RUNNING,
1512+ process_suspended = PROCESS_SUSPENDED,
1513+ process_destroyed = PROCESS_DESTROYED
1514+};
1515+
1516+/**
1517+ * Specifies whether the application tolerates a menubar when in fullscreen mode.
1518+ */
1519+enum MenuBarSupport
1520+{
1521+ application_supports_overlayed_menubar = APPLICATION_SUPPORTS_OVERLAYED_MENUBAR,
1522+ application_does_not_support_overlayed_menubar = APPLICATION_DOES_NOT_SUPPORT_OVERLAYED_MENUBAR
1523+};
1524+
1525+/**
1526+ * Bundles information about an application instance.
1527+ */
1528+class SessionCredentials
1529+{
1530+public:
1531+ SessionCredentials(::SessionCredentials* parent) : parent(parent)
1532+ {
1533+ }
1534+
1535+ SessionType session_type() const
1536+ {
1537+ return static_cast<SessionType>(parent->session_type);
1538+ }
1539+
1540+ const char* application_name() const
1541+ {
1542+ return parent->application_name;
1543+ }
1544+
1545+
1546+private:
1547+ ::SessionCredentials* parent;
1548+};
1549+}
1550+}
1551+}
1552+
1553+#endif // UBUNTU_APPLICATION_UI_SESSION_CREDENTIALS_H_
1554
1555=== added file 'android/include/private/application/ui/session_delegates.h'
1556--- android/include/private/application/ui/session_delegates.h 1970-01-01 00:00:00 +0000
1557+++ android/include/private/application/ui/session_delegates.h 2013-05-28 11:49:27 +0000
1558@@ -0,0 +1,45 @@
1559+/*
1560+ * Copyright © 2012 Canonical Ltd.
1561+ *
1562+ * This program is free software: you can redistribute it and/or modify
1563+ * it under the terms of the GNU Lesser General Public License version 3 as
1564+ * published by the Free Software Foundation.
1565+ *
1566+ * This program is distributed in the hope that it will be useful,
1567+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1568+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1569+ * GNU Lesser General Public License for more details.
1570+ *
1571+ * You should have received a copy of the GNU Lesser General Public License
1572+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1573+ *
1574+ * Authored by: Ricardo Mendoza <ricardo.mendoza@canonical.com>
1575+ */
1576+#ifndef UBUNTU_APPLICATION_UI_SESSION_DELEGATES_H_
1577+#define UBUNTU_APPLICATION_UI_SESSION_DELEGATES_H_
1578+
1579+#include <cstdio>
1580+
1581+namespace ubuntu
1582+{
1583+namespace application
1584+{
1585+class LifecycleDelegate : public platform::ReferenceCountedBase
1586+{
1587+public:
1588+ typedef platform::shared_ptr<LifecycleDelegate> Ptr;
1589+
1590+ virtual void on_application_started() = 0;
1591+ virtual void on_application_about_to_stop() = 0;
1592+
1593+protected:
1594+ LifecycleDelegate() {}
1595+ virtual ~LifecycleDelegate() {}
1596+
1597+ LifecycleDelegate(const LifecycleDelegate&) = delete;
1598+ LifecycleDelegate& operator=(const LifecycleDelegate&) = delete;
1599+};
1600+}
1601+}
1602+
1603+#endif // UBUNTU_APPLICATION_UI_SESSION_DELEGATES_H_
1604
1605=== added file 'android/include/private/application/ui/setup.h'
1606--- android/include/private/application/ui/setup.h 1970-01-01 00:00:00 +0000
1607+++ android/include/private/application/ui/setup.h 2013-05-28 11:49:27 +0000
1608@@ -0,0 +1,59 @@
1609+/*
1610+ * Copyright © 2012 Canonical Ltd.
1611+ *
1612+ * This program is free software: you can redistribute it and/or modify
1613+ * it under the terms of the GNU Lesser General Public License version 3 as
1614+ * published by the Free Software Foundation.
1615+ *
1616+ * This program is distributed in the hope that it will be useful,
1617+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1618+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1619+ * GNU Lesser General Public License for more details.
1620+ *
1621+ * You should have received a copy of the GNU Lesser General Public License
1622+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1623+ *
1624+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
1625+ */
1626+#ifndef UBUNTU_APPLICATION_UI_SETUP_H_
1627+#define UBUNTU_APPLICATION_UI_SETUP_H_
1628+
1629+#include "private/application/ui/stage_hint.h"
1630+#include "private/application/ui/form_factor_hint.h"
1631+#include "private/platform/shared_ptr.h"
1632+
1633+namespace ubuntu
1634+{
1635+namespace application
1636+{
1637+namespace ui
1638+{
1639+/** Provides access to the setup of the application instance as specified by command line/desktop file. */
1640+class Setup : public ubuntu::platform::ReferenceCountedBase
1641+{
1642+public:
1643+ typedef ubuntu::platform::shared_ptr<Setup> Ptr;
1644+
1645+ static const Ptr& instance();
1646+
1647+ /** Provides access the stage the stage hint that the application should live in. */
1648+ virtual StageHint stage_hint() = 0;
1649+
1650+ /** Provides access to the form factors that the application instance is currently running on. */
1651+ virtual FormFactorHintFlags form_factor_hint() = 0;
1652+
1653+ /** Provides access to the desktop file that describes the current application instance. */
1654+ virtual const char* desktop_file_hint() = 0;
1655+
1656+protected:
1657+ Setup() {}
1658+ virtual ~Setup() {}
1659+
1660+ Setup(const Setup&) = delete;
1661+ Setup& operator=(const Setup&) = delete;
1662+};
1663+}
1664+}
1665+}
1666+
1667+#endif // UBUNTU_APPLICATION_UI_SETUP_H_
1668
1669=== added file 'android/include/private/application/ui/stage_hint.h'
1670--- android/include/private/application/ui/stage_hint.h 1970-01-01 00:00:00 +0000
1671+++ android/include/private/application/ui/stage_hint.h 2013-05-28 11:49:27 +0000
1672@@ -0,0 +1,42 @@
1673+/*
1674+ * Copyright © 2012 Canonical Ltd.
1675+ *
1676+ * This program is free software: you can redistribute it and/or modify
1677+ * it under the terms of the GNU Lesser General Public License version 3 as
1678+ * published by the Free Software Foundation.
1679+ *
1680+ * This program is distributed in the hope that it will be useful,
1681+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1682+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1683+ * GNU Lesser General Public License for more details.
1684+ *
1685+ * You should have received a copy of the GNU Lesser General Public License
1686+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1687+ *
1688+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
1689+ */
1690+#ifndef UBUNTU_APPLICATION_UI_STAGE_HINT_H_
1691+#define UBUNTU_APPLICATION_UI_STAGE_HINT_H_
1692+
1693+#include "private/application/ui/ubuntu_application_ui.h"
1694+
1695+namespace ubuntu
1696+{
1697+namespace application
1698+{
1699+namespace ui
1700+{
1701+enum StageHint
1702+{
1703+ main_stage = MAIN_STAGE_HINT,
1704+ integration_stage = INTEGRATION_STAGE_HINT,
1705+ share_stage = SHARE_STAGE_HINT,
1706+ content_picking_stage = CONTENT_PICKING_STAGE_HINT,
1707+ side_stage = SIDE_STAGE_HINT,
1708+ configuration_stage = CONFIGURATION_STAGE_HINT
1709+};
1710+}
1711+}
1712+}
1713+
1714+#endif // UBUNTU_APPLICATION_UI_STAGE_HINT_H_
1715
1716=== added file 'android/include/private/application/ui/surface.h'
1717--- android/include/private/application/ui/surface.h 1970-01-01 00:00:00 +0000
1718+++ android/include/private/application/ui/surface.h 2013-05-28 11:49:27 +0000
1719@@ -0,0 +1,74 @@
1720+/*
1721+ * Copyright © 2012 Canonical Ltd.
1722+ *
1723+ * This program is free software: you can redistribute it and/or modify
1724+ * it under the terms of the GNU Lesser General Public License version 3 as
1725+ * published by the Free Software Foundation.
1726+ *
1727+ * This program is distributed in the hope that it will be useful,
1728+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1729+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1730+ * GNU Lesser General Public License for more details.
1731+ *
1732+ * You should have received a copy of the GNU Lesser General Public License
1733+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1734+ *
1735+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
1736+ */
1737+#ifndef UBUNTU_APPLICATION_UI_SURFACE_H_
1738+#define UBUNTU_APPLICATION_UI_SURFACE_H_
1739+
1740+#include "private/platform/shared_ptr.h"
1741+
1742+#include "private/application/ui/session.h"
1743+#include "private/application/ui/input/listener.h"
1744+
1745+#include <EGL/egl.h>
1746+
1747+namespace ubuntu
1748+{
1749+namespace application
1750+{
1751+namespace ui
1752+{
1753+/**
1754+ * A surface is a rectangular region on screen.
1755+ */
1756+class Surface : public ubuntu::platform::ReferenceCountedBase
1757+{
1758+public:
1759+ typedef ubuntu::platform::shared_ptr<Surface> Ptr;
1760+
1761+ // Default surface API
1762+ /** Toggles the visibility of the surface. */
1763+ virtual void set_visible(int id, bool visible) = 0;
1764+ /** Adjusts the alpha channel of a surface. */
1765+ virtual void set_alpha(float alpha) = 0;
1766+ /** Moves the surface to the specified coordinates. */
1767+ virtual void move_to(int x, int y) = 0;
1768+ /** Resizes the surface to the specified width and height. */
1769+ virtual void resize(int w, int h) = 0;
1770+
1771+ /** Binds to EGL/GL rendering API. */
1772+ virtual EGLNativeWindowType to_native_window_type() = 0;
1773+
1774+protected:
1775+ Surface(const input::Listener::Ptr& input_listener) : input_listener(input_listener) {}
1776+ virtual ~Surface() {}
1777+
1778+ Surface(const Surface&) = delete;
1779+ Surface& operator=(const Surface&) = delete;
1780+
1781+ const input::Listener::Ptr& registered_input_listener() const
1782+ {
1783+ return input_listener;
1784+ }
1785+
1786+private:
1787+ input::Listener::Ptr input_listener;
1788+};
1789+}
1790+}
1791+}
1792+
1793+#endif // UBUNTU_APPLICATION_UI_SURFACE_H_
1794
1795=== added file 'android/include/private/application/ui/surface_factory.h'
1796--- android/include/private/application/ui/surface_factory.h 1970-01-01 00:00:00 +0000
1797+++ android/include/private/application/ui/surface_factory.h 2013-05-28 11:49:27 +0000
1798@@ -0,0 +1,53 @@
1799+/*
1800+ * Copyright © 2012 Canonical Ltd.
1801+ *
1802+ * This program is free software: you can redistribute it and/or modify
1803+ * it under the terms of the GNU Lesser General Public License version 3 as
1804+ * published by the Free Software Foundation.
1805+ *
1806+ * This program is distributed in the hope that it will be useful,
1807+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1808+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1809+ * GNU Lesser General Public License for more details.
1810+ *
1811+ * You should have received a copy of the GNU Lesser General Public License
1812+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1813+ *
1814+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
1815+ */
1816+#ifndef UBUNTU_APPLICATION_UI_SURFACE_FACTORY_H_
1817+#define UBUNTU_APPLICATION_UI_SURFACE_FACTORY_H_
1818+
1819+#include "private/platform/shared_ptr.h"
1820+
1821+namespace ubuntu
1822+{
1823+namespace application
1824+{
1825+namespace ui
1826+{
1827+class SurfaceProperties;
1828+
1829+class SurfaceFactory : public ubuntu::platform::ReferenceCountedBase
1830+{
1831+public:
1832+ typedef ubuntu::platform::shared_ptr<SurfaceFactory> Ptr;
1833+
1834+ static const Ptr& instance();
1835+
1836+ virtual Surface::Ptr create_surface(
1837+ const ubuntu::application::ui::SurfaceProperties& props,
1838+ const ubuntu::application::ui::input::Listener::Ptr& listener) = 0;
1839+
1840+protected:
1841+ SurfaceFactory() {}
1842+ virtual ~SurfaceFactory() {}
1843+
1844+ SurfaceFactory(const SurfaceFactory&) = delete;
1845+ SurfaceFactory& operator=(const SurfaceFactory&) = delete;
1846+};
1847+}
1848+}
1849+}
1850+
1851+#endif // UBUNTU_APPLICATION_UI_SURFACE_FACTORY_H_
1852
1853=== added file 'android/include/private/application/ui/surface_properties.h'
1854--- android/include/private/application/ui/surface_properties.h 1970-01-01 00:00:00 +0000
1855+++ android/include/private/application/ui/surface_properties.h 2013-05-28 11:49:27 +0000
1856@@ -0,0 +1,63 @@
1857+/*
1858+ * Copyright © 2012 Canonical Ltd.
1859+ *
1860+ * This program is free software: you can redistribute it and/or modify
1861+ * it under the terms of the GNU Lesser General Public License version 3 as
1862+ * published by the Free Software Foundation.
1863+ *
1864+ * This program is distributed in the hope that it will be useful,
1865+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1866+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1867+ * GNU Lesser General Public License for more details.
1868+ *
1869+ * You should have received a copy of the GNU Lesser General Public License
1870+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1871+ *
1872+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
1873+ */
1874+#ifndef UBUNTU_APPLICATION_UI_SURFACE_PROPERTIES_H_
1875+#define UBUNTU_APPLICATION_UI_SURFACE_PROPERTIES_H_
1876+
1877+#include "private/application/ui/surface_role.h"
1878+#include "private/application/ui/ubuntu_application_ui.h"
1879+
1880+namespace ubuntu
1881+{
1882+namespace application
1883+{
1884+namespace ui
1885+{
1886+
1887+/**
1888+ * \enum SurfaceFlags
1889+ * Flags that can be specified for a surface
1890+ * \attention Requires privileged access to the ui service provider
1891+ */
1892+enum SurfaceFlags
1893+{
1894+ is_opaque_flag = IS_OPAQUE_FLAG ///< Specifies that a surface is opaque
1895+};
1896+
1897+/**
1898+ * \struct SurfaceProperties surface_properties.h
1899+ * Bundles the properties for surface creation.
1900+ */
1901+struct SurfaceProperties
1902+{
1903+ enum
1904+ {
1905+ max_surface_title_length = 512 ///< Maximum length of the surface title
1906+ };
1907+
1908+ const char title[max_surface_title_length]; ///< Surface title
1909+ int width; ///< Requested width
1910+ int height; ///< Requested height
1911+ SurfaceRole role; ///< Requested role \sa ubuntu::application::ui::SurfaceRole
1912+ uint32_t flags; ///< Requested flags \sa ubuntu::application::ui::SurfaceFlags
1913+ bool is_opaque; ///< Signals that the surface should be opaque
1914+};
1915+}
1916+}
1917+}
1918+
1919+#endif // UBUNTU_APPLICATION_UI_SURFACE_PROPERTIES_H_
1920
1921=== added file 'android/include/private/application/ui/surface_role.h'
1922--- android/include/private/application/ui/surface_role.h 1970-01-01 00:00:00 +0000
1923+++ android/include/private/application/ui/surface_role.h 2013-05-28 11:49:27 +0000
1924@@ -0,0 +1,49 @@
1925+/*
1926+ * Copyright © 2012 Canonical Ltd.
1927+ *
1928+ * This program is free software: you can redistribute it and/or modify
1929+ * it under the terms of the GNU Lesser General Public License version 3 as
1930+ * published by the Free Software Foundation.
1931+ *
1932+ * This program is distributed in the hope that it will be useful,
1933+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1934+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1935+ * GNU Lesser General Public License for more details.
1936+ *
1937+ * You should have received a copy of the GNU Lesser General Public License
1938+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1939+ *
1940+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
1941+ */
1942+#ifndef UBUNTU_APPLICATION_UI_SURFACE_ROLE_H_
1943+#define UBUNTU_APPLICATION_UI_SURFACE_ROLE_H_
1944+
1945+#include "private/application/ui/ubuntu_application_ui.h"
1946+
1947+namespace ubuntu
1948+{
1949+namespace application
1950+{
1951+namespace ui
1952+{
1953+/**
1954+ * Describes the role of a surface.
1955+ * \attention Reserved roles require special privileges.
1956+ */
1957+enum SurfaceRole
1958+{
1959+ main_actor_role = MAIN_ACTOR_ROLE, ///< An application's main surface
1960+
1961+ dash_actor_role = DASH_ACTOR_ROLE, ///< Reserved for the shell's dash
1962+ indicator_actor_role = INDICATOR_ACTOR_ROLE, ///< Reserved for the shell's indicators
1963+ notifications_actor_role = NOTIFICATIONS_ACTOR_ROLE, ///< Reserved for the shell's notifications
1964+ greeter_actor_role = GREETER_ACTOR_ROLE, ///< Reserved for the greeter
1965+ launcher_actor_role = LAUNCHER_ACTOR_ROLE, ///< Reserved for the launcher
1966+ on_screen_keyboard_actor_role = ON_SCREEN_KEYBOARD_ACTOR_ROLE, ///< Reserved for the onscreen-keyboard
1967+ shutdown_dialog_actor_role = SHUTDOWN_DIALOG_ACTOR_ROLE ///< Reserved for the shutdown dialog
1968+};
1969+}
1970+}
1971+}
1972+
1973+#endif // UBUNTU_APPLICATION_UI_SURFACE_ROLE_H_
1974
1975=== added file 'android/include/private/application/ui/ubuntu_application_ui.h'
1976--- android/include/private/application/ui/ubuntu_application_ui.h 1970-01-01 00:00:00 +0000
1977+++ android/include/private/application/ui/ubuntu_application_ui.h 2013-05-28 11:49:27 +0000
1978@@ -0,0 +1,373 @@
1979+/*
1980+ * Copyright © 2012 Canonical Ltd.
1981+ *
1982+ * This program is free software: you can redistribute it and/or modify
1983+ * it under the terms of the GNU Lesser General Public License version 3 as
1984+ * published by the Free Software Foundation.
1985+ *
1986+ * This program is distributed in the hope that it will be useful,
1987+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1988+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1989+ * GNU Lesser General Public License for more details.
1990+ *
1991+ * You should have received a copy of the GNU Lesser General Public License
1992+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1993+ *
1994+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
1995+ */
1996+#ifndef UBUNTU_APPLICATION_UI_H_
1997+#define UBUNTU_APPLICATION_UI_H_
1998+
1999+#include "ubuntu/application/ui/input/event.h"
2000+
2001+#include <EGL/egl.h>
2002+
2003+#ifdef __cplusplus
2004+extern "C" {
2005+#endif
2006+
2007+ /** \defgroup require_session_functions Functions that require an active session registered with the application manager/service providers.
2008+ * \defgroup ui_access Functions that provide access to UI-specific functionality.
2009+ */
2010+
2011+ /**
2012+ * Specifies the session type.
2013+ * \ingroup ui_access
2014+ * \attention System sessions require special privileges to be registered with the service providers.
2015+ */
2016+ typedef enum
2017+ {
2018+ USER_SESSION_TYPE = 0, /**< An ordinary app. */
2019+ SYSTEM_SESSION_TYPE = 1 /**< A system session that requires elevated privileges.*/
2020+ } SessionType;
2021+
2022+ /** Models the running state of a process. */
2023+ typedef enum
2024+ {
2025+ PROCESS_STOPPED = 0, /**< Process is Stopped (Not in memory, valid-state stored). */
2026+ PROCESS_RUNNING = 1, /**< Process is running normally. */
2027+ PROCESS_SUSPENDED = 2, /**< Process is Suspended (SIGSTOP). */
2028+ PROCESS_DESTROYED = 3, /**< Process is Destroyed or Stateless (Not in memory, invalid state). */
2029+ } RunningState;
2030+
2031+ /**
2032+ * Specifies whether the application tolerates a menubar when in fullscreen mode.
2033+ * \ingroup ui_access
2034+ */
2035+ typedef enum
2036+ {
2037+ APPLICATION_SUPPORTS_OVERLAYED_MENUBAR = 0, /**< App allows for an overlayed menubar in fullscreen mode. */
2038+ APPLICATION_DOES_NOT_SUPPORT_OVERLAYED_MENUBAR = 1 /**< App does not allow an overlayer menubar in fullscreen mode, i.e., a user pinning the menubar results in the app being maximized. */
2039+ } MenuBarSupport;
2040+
2041+ /**
2042+ * Describes the different stages an application can run in.
2043+ * \ingroup ui_access
2044+ */
2045+ typedef enum
2046+ {
2047+ MAIN_STAGE_HINT = 0, /**< Default stage, normal operation mode. */
2048+ INTEGRATION_STAGE_HINT = 1, /**< Integration stage for reusing parts of an app's views. */
2049+ SHARE_STAGE_HINT = 2, /**< Share stage for sharing data between apps. */
2050+ CONTENT_PICKING_STAGE_HINT = 3, /**< Placeholder, not used yet. */
2051+ SIDE_STAGE_HINT = 4, /**< Side stage for displaying apps alongside other apps running in the main stage. */
2052+ CONFIGURATION_STAGE_HINT = 5 /**< Placeholder, not used yet. */
2053+ } StageHint;
2054+
2055+ /**
2056+ * Provides applications with a hint about the form factor it is running on.
2057+ * \ingroup ui_access
2058+ */
2059+ typedef enum
2060+ {
2061+ DESKTOP_FORM_FACTOR_HINT = 0, /**< An ordinary desktop or laptop form factor. */
2062+ PHONE_FORM_FACTOR_HINT = 1, /**< A phone form factor. */
2063+ TABLET_FORM_FACTOR_HINT = 2 /**< A tablet form factor. */
2064+ } FormFactorHint;
2065+
2066+ /**
2067+ * Describes the role of a surface.
2068+ * \ingroup ui_access
2069+ * \attention Reserved roles require special privileges.
2070+ */
2071+ typedef enum
2072+ {
2073+ MAIN_ACTOR_ROLE = 1, /**< An application's main surface */
2074+ DASH_ACTOR_ROLE = 0, /**< Reserved for the shell's dash */
2075+ INDICATOR_ACTOR_ROLE = 2, /**< Reserved for the shell's indicators */
2076+ NOTIFICATIONS_ACTOR_ROLE = 3, /**< Reserved for the shell's notifications */
2077+ GREETER_ACTOR_ROLE = 4, /**< Reserved for the greeter */
2078+ LAUNCHER_ACTOR_ROLE = 5, /**< Reserved for the launcher */
2079+ ON_SCREEN_KEYBOARD_ACTOR_ROLE = 6, /**< Reserved for the onscreen-keyboard */
2080+ SHUTDOWN_DIALOG_ACTOR_ROLE = 7 /**< Reserved for the shutdown dialog */
2081+ } SurfaceRole;
2082+
2083+ /**
2084+ * Flags that can be specified for a surface
2085+ * \ingroup ui_access
2086+ * \attention Requires privileged access to the ui service provider
2087+ */
2088+ typedef enum
2089+ {
2090+ IS_OPAQUE_FLAG = 1
2091+ } SurfaceFlags;
2092+
2093+ enum
2094+ {
2095+ MAX_APPLICATION_NAME_LENGTH = 512
2096+ };
2097+
2098+ typedef void (*on_application_resumed)(void* ctx);
2099+ typedef void (*on_application_suspended)(void* ctx);
2100+
2101+ typedef void (*on_application_focused)(void* ctx);
2102+ typedef void (*on_application_unfocused)(void* ctx);
2103+
2104+ /**
2105+ * Bundles information about an application instance.
2106+ * \ingroup ui_access
2107+ */
2108+ typedef struct
2109+ {
2110+ /** Specifies the session type */
2111+ SessionType session_type;
2112+ /** Per-application instance menu-bar support */
2113+ MenuBarSupport menu_bar_support;
2114+ /** The name of the application */
2115+ char application_name[MAX_APPLICATION_NAME_LENGTH];
2116+
2117+ void* context;
2118+ } SessionCredentials;
2119+
2120+ typedef void (*input_event_cb)(void* ctx, const Event* ev);
2121+
2122+ typedef void* ubuntu_application_ui_physical_display_info;
2123+ typedef void* ubuntu_application_ui_session;
2124+ typedef void* ubuntu_application_ui_surface;
2125+
2126+ typedef const void* u_application_archive;
2127+ typedef const void* u_application_options;
2128+
2129+ typedef void (*application_started_cb)(u_application_archive archive, u_application_options options, void* context);
2130+ typedef void (*application_about_to_stop_cb)(u_application_archive archive, void* context);
2131+
2132+ typedef struct
2133+ {
2134+ application_started_cb on_application_started;
2135+ application_about_to_stop_cb on_application_about_to_stop;
2136+
2137+ void *context;
2138+ } ubuntu_application_ui_lifecycle_delegates;
2139+
2140+ /** Initializes the Ubuntu Platform API. Has to be called before any other function is called.
2141+ * \ingroup ui_access
2142+ * \param argc [in] Argument count.
2143+ * \param argv [in, out] Array of string arguments.
2144+ */
2145+ void
2146+ ubuntu_application_ui_init(
2147+ int argc,
2148+ char**argv);
2149+
2150+ /**
2151+ * Returns the stage this application instance is running in.
2152+ * \ingroup ui_access
2153+ */
2154+ StageHint
2155+ ubuntu_application_ui_setup_get_stage_hint();
2156+
2157+ /**
2158+ * Returns the form factor this application instance is running on.
2159+ * \ingroup ui_access
2160+ */
2161+ FormFactorHint
2162+ ubuntu_application_ui_setup_get_form_factor_hint();
2163+
2164+ /**
2165+ * Opens up a new session with the service providers.
2166+ * \ingroup ui_access
2167+ * \param creds [in] Credentials describing the instance's setup.
2168+ */
2169+ void
2170+ ubuntu_application_ui_start_a_new_session(SessionCredentials* creds);
2171+
2172+ /**
2173+ * Installs the application lifecycle delegates
2174+ * \ingroup ui_access
2175+ * \attention Needs an existing session.
2176+ * \ingroup require_session_functions
2177+ */
2178+ void
2179+ ubuntu_application_ui_install_lifecycle_delegates(ubuntu_application_ui_lifecycle_delegates* delegates);
2180+
2181+ /**
2182+ * Sets the clipboard content.
2183+ * \ingroup ui_access
2184+ * \attention Needs an existing session.
2185+ * \ingroup require_session_functions
2186+ */
2187+ void
2188+ ubuntu_application_ui_set_clipboard_content(
2189+ void* data,
2190+ size_t size);
2191+
2192+ /**
2193+ * Reads the clipboard content.
2194+ * \ingroup ui_access
2195+ * \attention Needs an existing session.
2196+ * \ingroup require_session_functions
2197+ */
2198+ void
2199+ ubuntu_application_ui_get_clipboard_content(
2200+ void** data,
2201+ size_t* size);
2202+
2203+ /**
2204+ * Queries information about a physical display with index index.
2205+ * \ingroup ui_access
2206+ * \attention Needs an existing session.
2207+ * \ingroup require_session_functions
2208+ */
2209+ void
2210+ ubuntu_application_ui_create_display_info(
2211+ ubuntu_application_ui_physical_display_info* info,
2212+ size_t index);
2213+
2214+ /**
2215+ * Destroy information about a physical display.
2216+ * \ingroup ui_access
2217+ */
2218+ void
2219+ ubuntu_application_ui_destroy_display_info(
2220+ ubuntu_application_ui_physical_display_info info);
2221+
2222+ /**
2223+ * Queries the horizontal resolution in [px] of a physical display.
2224+ * \ingroup ui_access
2225+ */
2226+ int32_t
2227+ ubuntu_application_ui_query_horizontal_resolution(
2228+ ubuntu_application_ui_physical_display_info info);
2229+
2230+ /**
2231+ * Queries the vertical resolution in [px] of a physical display.
2232+ * \ingroup ui_access
2233+ */
2234+ int32_t
2235+ ubuntu_application_ui_query_vertical_resolution(
2236+ ubuntu_application_ui_physical_display_info info);
2237+
2238+ /**
2239+ * Queries the horizontal dpi of a physical display.
2240+ * \ingroup ui_access
2241+ */
2242+ float
2243+ ubuntu_application_ui_query_horizontal_dpi(
2244+ ubuntu_application_ui_physical_display_info info);
2245+
2246+ /**
2247+ * Queries the vertical dpi of a physical display.
2248+ * \ingroup ui_access
2249+ */
2250+ float
2251+ ubuntu_application_ui_query_vertical_dpi(
2252+ ubuntu_application_ui_physical_display_info info);
2253+
2254+ /**
2255+ * Creates a new surface and registers it for this application instance.
2256+ * \attention Needs an existing session.
2257+ * \ingroup require_session_functions
2258+ * \ingroup ui_access
2259+ * \param out_surface [out] The resulting surface is placed here.
2260+ * \param title [in] The title of the surface.
2261+ * \param width [in] Requested width, will be clamped to available geometry.
2262+ * \param height [in] Requested height, will be clamped to available geometry.
2263+ * \param role [in] Role of the surface.
2264+ * \param cb [in] Callback to be invoked for input events.
2265+ * \param ctx [in] Context for the input event callback.
2266+ */
2267+ void
2268+ ubuntu_application_ui_create_surface(
2269+ ubuntu_application_ui_surface* out_surface,
2270+ const char* title,
2271+ int width,
2272+ int height,
2273+ SurfaceRole role,
2274+ uint32_t flags,
2275+ input_event_cb cb,
2276+ void* ctx);
2277+
2278+ /**
2279+ * Requests to switch to fullscreen for the specified surface.
2280+ * \ingroup ui_access
2281+ */
2282+ void
2283+ ubuntu_application_ui_request_fullscreen_for_surface(
2284+ ubuntu_application_ui_surface surface);
2285+
2286+ /**
2287+ * Destroys the specified surface.
2288+ * \ingroup ui_access
2289+ */
2290+ void
2291+ ubuntu_application_ui_destroy_surface(
2292+ ubuntu_application_ui_surface surface);
2293+
2294+ /**
2295+ * Translates a surface to an EGLNativeWindowType.
2296+ * \ingroup ui_access
2297+ */
2298+ EGLNativeWindowType
2299+ ubuntu_application_ui_surface_to_native_window_type(
2300+ ubuntu_application_ui_surface surface);
2301+
2302+ /**
2303+ * Forces the specified surface to be shown on screen.
2304+ * \ingroup ui_access
2305+ */
2306+ void
2307+ ubuntu_application_ui_show_surface(
2308+ ubuntu_application_ui_surface surface);
2309+
2310+ /**
2311+ * Forces the specified surface to be hidden.
2312+ * \ingroup ui_access
2313+ */
2314+ void
2315+ ubuntu_application_ui_hide_surface(
2316+ ubuntu_application_ui_surface surface);
2317+
2318+ /**
2319+ * Moves the specified surface.
2320+ * \ingroup ui_access
2321+ * \param surface [in] The surface to be moved.
2322+ * \param x [in] The new x coordinate.
2323+ * \param y [in] The new y coordinate.
2324+ */
2325+ void
2326+ ubuntu_application_ui_move_surface_to(
2327+ ubuntu_application_ui_surface surface,
2328+ int x,
2329+ int y);
2330+
2331+ /**
2332+ * Resizes the specified surface.
2333+ * \ingroup ui_access
2334+ * \param surface [in] The surface to be moved.
2335+ * \param w [in] The new width of the surface.
2336+ * \param h [in] The new height of the surface.
2337+ */
2338+ void
2339+ ubuntu_application_ui_resize_surface_to(
2340+ ubuntu_application_ui_surface surface,
2341+ int w,
2342+ int h);
2343+
2344+ /** \example test_c_api.cpp */
2345+ /** \example test_multiple_surfaces_event_delivery.cpp */
2346+
2347+#ifdef __cplusplus
2348+}
2349+#endif
2350+
2351+#endif /* UBUNTU_APPLICATION_UI_H_ */
2352
2353=== added directory 'android/include/private/platform'
2354=== added file 'android/include/private/platform/empty_base.h'
2355--- android/include/private/platform/empty_base.h 1970-01-01 00:00:00 +0000
2356+++ android/include/private/platform/empty_base.h 2013-05-28 11:49:27 +0000
2357@@ -0,0 +1,37 @@
2358+/*
2359+ * Copyright © 2012 Canonical Ltd.
2360+ *
2361+ * This program is free software: you can redistribute it and/or modify
2362+ * it under the terms of the GNU Lesser General Public License version 3 as
2363+ * published by the Free Software Foundation.
2364+ *
2365+ * This program is distributed in the hope that it will be useful,
2366+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2367+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2368+ * GNU Lesser General Public License for more details.
2369+ *
2370+ * You should have received a copy of the GNU Lesser General Public License
2371+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2372+ *
2373+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
2374+ */
2375+#ifndef UBUNTU_PLATFORM_EMPTY_BASE_H_
2376+#define UBUNTU_PLATFORM_EMPTY_BASE_H_
2377+
2378+namespace ubuntu
2379+{
2380+namespace platform
2381+{
2382+class EmptyBase
2383+{
2384+public:
2385+ virtual ~EmptyBase() {}
2386+protected:
2387+ EmptyBase() {}
2388+ EmptyBase(const EmptyBase&) = delete;
2389+ EmptyBase& operator=(const EmptyBase&) = delete;
2390+};
2391+}
2392+}
2393+
2394+#endif // UBUNTU_PLATFORM_EMPTY_BASE_H_
2395
2396=== added file 'android/include/private/platform/shared_ptr.h'
2397--- android/include/private/platform/shared_ptr.h 1970-01-01 00:00:00 +0000
2398+++ android/include/private/platform/shared_ptr.h 2013-05-28 11:49:27 +0000
2399@@ -0,0 +1,58 @@
2400+/*
2401+ * Copyright © 2012 Canonical Ltd.
2402+ *
2403+ * This program is free software: you can redistribute it and/or modify
2404+ * it under the terms of the GNU Lesser General Public License version 3 as
2405+ * published by the Free Software Foundation.
2406+ *
2407+ * This program is distributed in the hope that it will be useful,
2408+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2409+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2410+ * GNU Lesser General Public License for more details.
2411+ *
2412+ * You should have received a copy of the GNU Lesser General Public License
2413+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2414+ *
2415+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
2416+ */
2417+#ifndef UBUNTU_PLATFORM_SHARED_PTR_H_
2418+#define UBUNTU_PLATFORM_SHARED_PTR_H_
2419+
2420+#ifdef ANDROID
2421+#include <utils/RefBase.h>
2422+#include <utils/StrongPointer.h>
2423+#else
2424+#include <memory>
2425+#endif
2426+
2427+#include "empty_base.h"
2428+
2429+namespace ubuntu
2430+{
2431+namespace platform
2432+{
2433+
2434+#ifdef ANDROID
2435+typedef android::RefBase ReferenceCountedBase;
2436+
2437+template<typename T>
2438+struct shared_ptr : public android::sp<T>
2439+{
2440+ shared_ptr() : android::sp<T>()
2441+ {
2442+ }
2443+
2444+ template<typename Y>
2445+ shared_ptr(Y* p) : android::sp<T>(p)
2446+ {
2447+ }
2448+};
2449+#else
2450+typedef ubuntu::platform::EmptyBase ReferenceCountedBase;
2451+using std::shared_ptr;
2452+#endif
2453+
2454+}
2455+}
2456+
2457+#endif // UBUNTU_PLATFORM_SHARED_PTR_H_
2458
2459=== added directory 'android/include/private/ui'
2460=== added file 'android/include/private/ui/config.h'
2461--- android/include/private/ui/config.h 1970-01-01 00:00:00 +0000
2462+++ android/include/private/ui/config.h 2013-05-28 11:49:27 +0000
2463@@ -0,0 +1,24 @@
2464+/*
2465+ * Copyright © 2013 Canonical Ltd.
2466+ *
2467+ * This program is free software: you can redistribute it and/or modify
2468+ * it under the terms of the GNU Lesser General Public License version 3 as
2469+ * published by the Free Software Foundation.
2470+ *
2471+ * This program is distributed in the hope that it will be useful,
2472+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2473+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2474+ * GNU Lesser General Public License for more details.
2475+ *
2476+ * You should have received a copy of the GNU Lesser General Public License
2477+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2478+ *
2479+ * Authored by: Michael Terry <michael.terry@canonical.com>
2480+ */
2481+
2482+#ifndef UBUNTU_UI_CONFIG_H_
2483+#define UBUNTU_UI_CONFIG_H_
2484+
2485+#define UBUNTU_USE_GLES 1
2486+
2487+#endif // UBUNTU_UI_CONFIG_H_
2488
2489=== added file 'android/include/private/ui/session_enumerator.h'
2490--- android/include/private/ui/session_enumerator.h 1970-01-01 00:00:00 +0000
2491+++ android/include/private/ui/session_enumerator.h 2013-05-28 11:49:27 +0000
2492@@ -0,0 +1,117 @@
2493+/*
2494+ * Copyright © 2012 Canonical Ltd.
2495+ *
2496+ * This program is free software: you can redistribute it and/or modify
2497+ * it under the terms of the GNU Lesser General Public License version 3 as
2498+ * published by the Free Software Foundation.
2499+ *
2500+ * This program is distributed in the hope that it will be useful,
2501+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2502+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2503+ * GNU Lesser General Public License for more details.
2504+ *
2505+ * You should have received a copy of the GNU Lesser General Public License
2506+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2507+ *
2508+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
2509+ */
2510+
2511+#ifndef UBUNTU_UI_SESSION_ENUMERATOR_H_
2512+#define UBUNTU_UI_SESSION_ENUMERATOR_H_
2513+
2514+#include "private/platform/shared_ptr.h"
2515+#include "private/ui/config.h"
2516+#include "private/ui/well_known_applications.h"
2517+
2518+#if UBUNTU_USE_GLES
2519+#include <GLES2/gl2.h>
2520+#else
2521+#include <GL/gl.h>
2522+#include <GL/glext.h>
2523+#endif
2524+
2525+namespace ubuntu
2526+{
2527+namespace ui
2528+{
2529+
2530+class SessionProperties : public platform::ReferenceCountedBase
2531+{
2532+public:
2533+ static const char* key_application_instance_id();
2534+ static const char* key_application_stage_hint();
2535+ static const char* key_application_name();
2536+ static const char* key_desktop_file_hint();
2537+
2538+ typedef platform::shared_ptr<SessionProperties> Ptr;
2539+
2540+ virtual const char* value_for_key(const char* key) const = 0;
2541+
2542+ virtual int application_stage_hint() const
2543+ {
2544+ return atoi(value_for_key(SessionProperties::key_application_stage_hint()));
2545+ }
2546+
2547+ virtual int application_instance_id() const
2548+ {
2549+ return atoi(value_for_key(SessionProperties::key_application_instance_id()));
2550+ }
2551+
2552+ const char* application_name() const
2553+ {
2554+ return value_for_key(SessionProperties::key_application_name());
2555+ }
2556+
2557+ virtual const char* desktop_file_hint() const
2558+ {
2559+ return value_for_key(SessionProperties::key_desktop_file_hint());
2560+ }
2561+
2562+protected:
2563+ SessionProperties() {}
2564+ virtual ~SessionProperties() {}
2565+
2566+ SessionProperties(const SessionProperties&) = delete;
2567+ SessionProperties& operator=(const SessionProperties&) = delete;
2568+};
2569+
2570+class SessionLifeCycleObserver : public platform::ReferenceCountedBase
2571+{
2572+public:
2573+ typedef platform::shared_ptr<SessionLifeCycleObserver> Ptr;
2574+
2575+ virtual void on_session_requested(WellKnownApplication app) = 0;
2576+ virtual void on_session_born(const SessionProperties::Ptr& props) = 0;
2577+ virtual void on_session_unfocused(const SessionProperties::Ptr& props) = 0;
2578+ virtual void on_session_focused(const SessionProperties::Ptr& props) = 0;
2579+ virtual void on_keyboard_geometry_changed(int x, int y, int width, int height) = 0;
2580+ virtual void on_session_requested_fullscreen(const SessionProperties::Ptr& props) = 0;
2581+ virtual void on_session_died(const SessionProperties::Ptr& props) = 0;
2582+
2583+protected:
2584+ SessionLifeCycleObserver() {}
2585+ virtual ~SessionLifeCycleObserver() {}
2586+
2587+ SessionLifeCycleObserver(const SessionLifeCycleObserver&) = delete;
2588+ SessionLifeCycleObserver& operator=(const SessionLifeCycleObserver&) = delete;
2589+};
2590+
2591+class SessionPreviewProvider : public platform::ReferenceCountedBase
2592+{
2593+public:
2594+ typedef platform::shared_ptr<SessionPreviewProvider> Ptr;
2595+
2596+ virtual bool get_or_update_session_preview(GLuint texture, unsigned int& width, unsigned int& height) = 0;
2597+
2598+protected:
2599+ SessionPreviewProvider() {}
2600+ virtual ~SessionPreviewProvider() {}
2601+
2602+ SessionPreviewProvider(const SessionPreviewProvider&) = delete;
2603+ SessionPreviewProvider& operator=(const SessionPreviewProvider&) = delete;
2604+};
2605+
2606+}
2607+}
2608+
2609+#endif // UBUNTU_UI_SESSION_ENUMERATOR_H_
2610
2611=== added file 'android/include/private/ui/session_service.h'
2612--- android/include/private/ui/session_service.h 1970-01-01 00:00:00 +0000
2613+++ android/include/private/ui/session_service.h 2013-05-28 11:49:27 +0000
2614@@ -0,0 +1,80 @@
2615+/*
2616+ * Copyright © 2012 Canonical Ltd.
2617+ *
2618+ * This program is free software: you can redistribute it and/or modify
2619+ * it under the terms of the GNU Lesser General Public License version 3 as
2620+ * published by the Free Software Foundation.
2621+ *
2622+ * This program is distributed in the hope that it will be useful,
2623+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2624+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2625+ * GNU Lesser General Public License for more details.
2626+ *
2627+ * You should have received a copy of the GNU Lesser General Public License
2628+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2629+ *
2630+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
2631+ */
2632+#ifndef UBUNTU_UI_SESSION_SERVICE_H_
2633+#define UBUNTU_UI_SESSION_SERVICE_H_
2634+
2635+#include "private/application/ui/session.h"
2636+#include "private/platform/shared_ptr.h"
2637+#include "private/ui/session_enumerator.h"
2638+#include "private/ui/session_snapshot.h"
2639+#include "private/ui/well_known_applications.h"
2640+
2641+namespace ubuntu
2642+{
2643+namespace application
2644+{
2645+namespace ui
2646+{
2647+class Session;
2648+class SessionCredentials;
2649+}
2650+}
2651+namespace ui
2652+{
2653+class SessionService : public platform::ReferenceCountedBase
2654+{
2655+public:
2656+ typedef platform::shared_ptr<SessionService> Ptr;
2657+
2658+ static const Ptr& instance();
2659+
2660+ virtual ~SessionService() {}
2661+
2662+ virtual const ubuntu::application::ui::Session::Ptr& start_a_new_session(const ubuntu::application::ui::SessionCredentials& cred) = 0;
2663+
2664+ virtual void trigger_switch_to_well_known_application(WellKnownApplication app) = 0;
2665+
2666+ virtual void install_session_lifecycle_observer(const SessionLifeCycleObserver::Ptr& observer) = 0;
2667+
2668+ virtual void unfocus_running_sessions() = 0;
2669+
2670+ virtual void focus_running_session_with_id(int id) = 0;
2671+
2672+ virtual ubuntu::ui::SessionSnapshot::Ptr snapshot_running_session_with_id(int id) = 0;
2673+
2674+ virtual int32_t set_surface_trap(int32_t x, int32_t y, int32_t width, int32_t height) = 0;
2675+
2676+ virtual void unset_surface_trap(int32_t handle) = 0;
2677+
2678+ virtual void report_osk_visible(int x, int y, int width, int height) = 0;
2679+
2680+ virtual void report_osk_invisible() = 0;
2681+
2682+ virtual void report_notification_visible() = 0;
2683+
2684+ virtual void report_notification_invisible() = 0;
2685+
2686+protected:
2687+ SessionService() {}
2688+ SessionService(const SessionService&) = delete;
2689+ SessionService& operator=(const SessionService&) = delete;
2690+};
2691+}
2692+}
2693+
2694+#endif // UBUNTU_UI_SESSION_SERVICE_H_
2695
2696=== added file 'android/include/private/ui/session_snapshot.h'
2697--- android/include/private/ui/session_snapshot.h 1970-01-01 00:00:00 +0000
2698+++ android/include/private/ui/session_snapshot.h 2013-05-28 11:49:27 +0000
2699@@ -0,0 +1,50 @@
2700+/*
2701+ * Copyright © 2012 Canonical Ltd.
2702+ *
2703+ * This program is free software: you can redistribute it and/or modify
2704+ * it under the terms of the GNU Lesser General Public License version 3 as
2705+ * published by the Free Software Foundation.
2706+ *
2707+ * This program is distributed in the hope that it will be useful,
2708+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2709+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2710+ * GNU Lesser General Public License for more details.
2711+ *
2712+ * You should have received a copy of the GNU Lesser General Public License
2713+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2714+ *
2715+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
2716+ */
2717+#ifndef UBUNTU_UI_SESSION_SNAPSHOT_H_
2718+#define UBUNTU_UI_SESSION_SNAPSHOT_H_
2719+
2720+namespace ubuntu
2721+{
2722+namespace ui
2723+{
2724+class SessionSnapshot : public ubuntu::platform::ReferenceCountedBase
2725+{
2726+public:
2727+ typedef ubuntu::platform::shared_ptr<SessionSnapshot> Ptr;
2728+
2729+ virtual const void * pixel_data() = 0;
2730+
2731+ virtual unsigned int x() = 0;
2732+ virtual unsigned int y() = 0;
2733+ virtual unsigned int source_width() = 0;
2734+ virtual unsigned int source_height() = 0;
2735+ virtual unsigned int width() = 0;
2736+ virtual unsigned int height() = 0;
2737+ virtual unsigned int stride() = 0;
2738+
2739+protected:
2740+ SessionSnapshot() {}
2741+ virtual ~SessionSnapshot() {}
2742+
2743+ SessionSnapshot(const SessionSnapshot&) = delete;
2744+ SessionSnapshot& operator=(const SessionSnapshot&) = delete;
2745+};
2746+}
2747+}
2748+
2749+#endif // UBUNTU_UI_SESSION_SNAPSHOT_H_
2750
2751=== added file 'android/include/private/ui/well_known_applications.h'
2752--- android/include/private/ui/well_known_applications.h 1970-01-01 00:00:00 +0000
2753+++ android/include/private/ui/well_known_applications.h 2013-05-28 11:49:27 +0000
2754@@ -0,0 +1,41 @@
2755+/*
2756+ * Copyright © 2012 Canonical Ltd.
2757+ *
2758+ * This program is free software: you can redistribute it and/or modify
2759+ * it under the terms of the GNU Lesser General Public License version 3 as
2760+ * published by the Free Software Foundation.
2761+ *
2762+ * This program is distributed in the hope that it will be useful,
2763+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2764+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2765+ * GNU Lesser General Public License for more details.
2766+ *
2767+ * You should have received a copy of the GNU Lesser General Public License
2768+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2769+ *
2770+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
2771+ */
2772+#ifndef UBUNTU_UI_WELL_KNOWN_APPLICATIONS_H_
2773+#define UBUNTU_UI_WELL_KNOWN_APPLICATIONS_H_
2774+
2775+#include <ubuntu/ui/ubuntu_ui_session_service.h>
2776+
2777+namespace ubuntu
2778+{
2779+namespace ui
2780+{
2781+enum WellKnownApplication
2782+{
2783+ unknown_app = UNKNOWN_APP,
2784+ gallery_app = CAMERA_APP,
2785+ camera_app = GALLERY_APP,
2786+ browser_app = BROWSER_APP,
2787+ share_app = SHARE_APP,
2788+ phone_app = PHONE_APP,
2789+ messages_app = MESSAGES_APP,
2790+ contacts_app = CONTACTS_APP
2791+};
2792+}
2793+}
2794+
2795+#endif // UBUNTU_UI_WELL_KNOWN_APPLICATIONS_H_
2796
2797=== modified file 'android/mock/mock.cpp'
2798--- android/mock/mock.cpp 2013-02-05 07:46:29 +0000
2799+++ android/mock/mock.cpp 2013-05-28 11:49:27 +0000
2800@@ -15,18 +15,18 @@
2801 *
2802 * Authored by: Thomas Voß <thomas.voss@canonical.com>
2803 */
2804-#include <ubuntu/application/ui/init.h>
2805-#include <ubuntu/application/ui/session.h>
2806-#include <ubuntu/application/ui/session_credentials.h>
2807-#include <ubuntu/application/ui/setup.h>
2808-#include <ubuntu/application/ui/surface.h>
2809-#include <ubuntu/application/ui/surface_factory.h>
2810-#include <ubuntu/application/ui/surface_properties.h>
2811+#include <private/application/ui/init.h>
2812+#include <private/application/ui/session.h>
2813+#include <private/application/ui/session_credentials.h>
2814+#include <private/application/ui/setup.h>
2815+#include <private/application/ui/surface.h>
2816+#include <private/application/ui/surface_factory.h>
2817+#include <private/application/ui/surface_properties.h>
2818
2819-#include <ubuntu/ui/session_service.h>
2820+#include <private/ui/session_service.h>
2821
2822 // C apis
2823-#include <ubuntu/application/ui/ubuntu_application_ui.h>
2824+#include <private/application/ui/ubuntu_application_ui.h>
2825
2826 #include <set>
2827
2828
2829=== added directory 'include/ubuntu'
2830=== removed directory 'include/ubuntu'
2831=== added directory 'include/ubuntu/application'
2832=== removed directory 'include/ubuntu/application'
2833=== added directory 'include/ubuntu/application/sensors'
2834=== removed directory 'include/ubuntu/application/sensors'
2835=== removed file 'include/ubuntu/application/sensors/sensor.h'
2836--- include/ubuntu/application/sensors/sensor.h 2013-02-13 12:04:07 +0000
2837+++ include/ubuntu/application/sensors/sensor.h 1970-01-01 00:00:00 +0000
2838@@ -1,83 +0,0 @@
2839-/*
2840- * Copyright © 2012 Canonical Ltd.
2841- *
2842- * This program is free software: you can redistribute it and/or modify
2843- * it under the terms of the GNU Lesser General Public License version 3 as
2844- * published by the Free Software Foundation.
2845- *
2846- * This program is distributed in the hope that it will be useful,
2847- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2848- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2849- * GNU Lesser General Public License for more details.
2850- *
2851- * You should have received a copy of the GNU Lesser General Public License
2852- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2853- *
2854- * Authored by: Thomas Voß <thomas.voss@canonical.com>
2855- */
2856-#ifndef UBUNTU_APPLICATION_SENSORS_SENSOR_H_
2857-#define UBUNTU_APPLICATION_SENSORS_SENSOR_H_
2858-
2859-#include "ubuntu/platform/shared_ptr.h"
2860-
2861-#include "ubuntu/application/sensors/sensor_listener.h"
2862-#include "ubuntu/application/sensors/sensor_type.h"
2863-
2864-#include <cstdint>
2865-
2866-namespace ubuntu
2867-{
2868-namespace application
2869-{
2870-namespace sensors
2871-{
2872-/** A data acquisition device that samples a device's environment. */
2873-class Sensor : public ubuntu::platform::ReferenceCountedBase
2874-{
2875-public:
2876- typedef ubuntu::platform::shared_ptr<Sensor> Ptr;
2877-
2878- /** Accesses the name of the sensor. Returned pointer is owned by the implementation. */
2879- virtual const char* name() = 0;
2880-
2881- /** Accesses the vendor of the sensor. Returned pointer is owned by the implementation. */
2882- virtual const char* vendor() = 0;
2883-
2884- /** Accesses the numeric id of the sensor. Should be as stable as possible. */
2885- virtual int32_t id() = 0;
2886-
2887- /** Registers the provided listener with the sensor and integrates it with the reporting of sensor readings. */
2888- virtual void register_listener(const SensorListener::Ptr& listener) = 0;
2889-
2890- /** Enables the sensor and starts the data acquisition. */
2891- virtual void enable() = 0;
2892- /** Disables the sensor and stops the data acquisition. */
2893- virtual void disable() = 0;
2894-
2895- virtual SensorType type() = 0;
2896-
2897- /** Returns the minimum numeric value of a sensor reading. */
2898- virtual float min_value() = 0;
2899- /** Returns the maximum numeric value of a sensor reading. */
2900- virtual float max_value() = 0;
2901- /** Returns the numerical resolution of a sensor reading. */
2902- virtual float resolution() = 0;
2903-
2904- /** Returns an estimate of the sensor's power consumption, normalized to [0,1]. */
2905- virtual float power_consumption() = 0;
2906-
2907- /** Returns the minimum delay between two consecutive sensor readings. */
2908- virtual int32_t min_delay() = 0;
2909-
2910-protected:
2911- Sensor() {}
2912- virtual ~Sensor() {}
2913-
2914- Sensor(const Sensor&) = delete;
2915- Sensor& operator=(const Sensor&) = delete;
2916-};
2917-}
2918-}
2919-}
2920-
2921-#endif // UBUNTU_APPLICATION_SENSORS_SENSOR_H_
2922
2923=== removed file 'include/ubuntu/application/sensors/sensor_listener.h'
2924--- include/ubuntu/application/sensors/sensor_listener.h 2013-02-13 12:04:07 +0000
2925+++ include/ubuntu/application/sensors/sensor_listener.h 1970-01-01 00:00:00 +0000
2926@@ -1,53 +0,0 @@
2927-/*
2928- * Copyright © 2012 Canonical Ltd.
2929- *
2930- * This program is free software: you can redistribute it and/or modify
2931- * it under the terms of the GNU Lesser General Public License version 3 as
2932- * published by the Free Software Foundation.
2933- *
2934- * This program is distributed in the hope that it will be useful,
2935- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2936- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2937- * GNU Lesser General Public License for more details.
2938- *
2939- * You should have received a copy of the GNU Lesser General Public License
2940- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2941- *
2942- * Authored by: Thomas Voß <thomas.voss@canonical.com>
2943- */
2944-#ifndef UBUNTU_APPLICATION_SENSORS_SENSOR_LISTENER_H_
2945-#define UBUNTU_APPLICATION_SENSORS_SENSOR_LISTENER_H_
2946-
2947-#include "ubuntu/platform/shared_ptr.h"
2948-
2949-#include "ubuntu/application/sensors/sensor_reading.h"
2950-
2951-namespace ubuntu
2952-{
2953-namespace application
2954-{
2955-namespace sensors
2956-{
2957-/** Extension point to allow for observing a sensor's readings. */
2958-class SensorListener : public ubuntu::platform::ReferenceCountedBase
2959-{
2960-public:
2961- typedef ubuntu::platform::shared_ptr<SensorListener> Ptr;
2962-
2963- /** Invoked whenever a new reading is available from the sensor.
2964- * \param [in] reading The new reading.
2965- */
2966- virtual void on_new_reading(const SensorReading::Ptr& reading) = 0;
2967-
2968-protected:
2969- SensorListener() {}
2970- virtual ~SensorListener() {}
2971-
2972- SensorListener(const SensorListener&) = delete;
2973- SensorListener& operator=(const SensorListener&) = delete;
2974-};
2975-}
2976-}
2977-}
2978-
2979-#endif // UBUNTU_APPLICATION_SENSORS_SENSOR_LISTENER_H_
2980
2981=== removed file 'include/ubuntu/application/sensors/sensor_reading.h'
2982--- include/ubuntu/application/sensors/sensor_reading.h 2013-02-13 12:04:07 +0000
2983+++ include/ubuntu/application/sensors/sensor_reading.h 1970-01-01 00:00:00 +0000
2984@@ -1,78 +0,0 @@
2985-/*
2986- * Copyright © 2012 Canonical Ltd.
2987- *
2988- * This program is free software: you can redistribute it and/or modify
2989- * it under the terms of the GNU Lesser General Public License version 3 as
2990- * published by the Free Software Foundation.
2991- *
2992- * This program is distributed in the hope that it will be useful,
2993- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2994- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2995- * GNU Lesser General Public License for more details.
2996- *
2997- * You should have received a copy of the GNU Lesser General Public License
2998- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2999- *
3000- * Authored by: Thomas Voß <thomas.voss@canonical.com>
3001- */
3002-#ifndef UBUNTU_APPLICATION_SENSORS_SENSOR_READING_H_
3003-#define UBUNTU_APPLICATION_SENSORS_SENSOR_READING_H_
3004-
3005-#include "ubuntu/platform/shared_ptr.h"
3006-
3007-#include <cstddef>
3008-#include <cstdint>
3009-
3010-namespace ubuntu
3011-{
3012-namespace application
3013-{
3014-namespace sensors
3015-{
3016-
3017-/** A vector of static size. */
3018-template<size_t size, typename NumericType = float>
3019-struct Vector
3020-{
3021- NumericType v[size];
3022-
3023- /** Accesses the element at index index. */
3024- NumericType& operator[](size_t index)
3025- {
3026- return v[index];
3027- }
3028-
3029- /** Accesses the element at index index. */
3030- const NumericType& operator[](size_t index) const
3031- {
3032- return v[index];
3033- }
3034-};
3035-
3036-/** A timestamped reading from a sensor. */
3037-struct SensorReading : public ubuntu::platform::ReferenceCountedBase
3038-{
3039- typedef ubuntu::platform::shared_ptr<SensorReading> Ptr;
3040-
3041- SensorReading() : timestamp(-1)
3042- {
3043- }
3044-
3045- int64_t timestamp; ///< The timestamp of the reading in [ns], CLOCK_MONOTONIC.
3046- /** A union of different possible sensor readings. */
3047- union
3048- {
3049- Vector<3> vector; ///< Arbitrary vector, orientation and linear acceleration readings are reported here.
3050- Vector<3> acceleration; ///< Acceleration vector containing acceleration readings for the three axis.
3051- Vector<3> magnetic; ///< Readings from magnetometer, in three dimensions.
3052- float temperature; ///< Ambient temperature.
3053- float distance; ///< Discrete distance, everything > 5 is considered far, everything < 5 is considered near.
3054- float light; ///< Ambient light conditions.
3055- float pressure; ///< Ambient pressure.
3056- };
3057-};
3058-}
3059-}
3060-}
3061-
3062-#endif // UBUNTU_APPLICATION_SENSORS_SENSOR_READING_H_
3063
3064=== removed file 'include/ubuntu/application/sensors/sensor_service.h'
3065--- include/ubuntu/application/sensors/sensor_service.h 2013-02-13 12:04:07 +0000
3066+++ include/ubuntu/application/sensors/sensor_service.h 1970-01-01 00:00:00 +0000
3067@@ -1,48 +0,0 @@
3068-/*
3069- * Copyright © 2012 Canonical Ltd.
3070- *
3071- * This program is free software: you can redistribute it and/or modify
3072- * it under the terms of the GNU Lesser General Public License version 3 as
3073- * published by the Free Software Foundation.
3074- *
3075- * This program is distributed in the hope that it will be useful,
3076- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3077- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3078- * GNU Lesser General Public License for more details.
3079- *
3080- * You should have received a copy of the GNU Lesser General Public License
3081- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3082- *
3083- * Authored by: Thomas Voß <thomas.voss@canonical.com>
3084- */
3085-#ifndef UBUNTU_APPLICATION_SENSORS_SENSOR_SERVICE_H_
3086-#define UBUNTU_APPLICATION_SENSORS_SENSOR_SERVICE_H_
3087-
3088-#include "ubuntu/platform/shared_ptr.h"
3089-
3090-#include "ubuntu/application/sensors/sensor.h"
3091-
3092-namespace ubuntu
3093-{
3094-namespace application
3095-{
3096-namespace sensors
3097-{
3098-/** Local stub that allows for instantiating sensor instances given a type. */
3099-class SensorService : public ubuntu::platform::ReferenceCountedBase
3100-{
3101-public:
3102- /** Returns a sensor instance for the provided type or NULL. */
3103- static Sensor::Ptr sensor_for_type(SensorType type);
3104-protected:
3105- SensorService() {}
3106- virtual ~SensorService() {}
3107-
3108- SensorService(const SensorService&) = delete;
3109- SensorService& operator=(const SensorService&) = delete;
3110-};
3111-}
3112-}
3113-}
3114-
3115-#endif // UBUNTU_APPLICATION_SENSORS_SENSOR_SERVICE_H_
3116
3117=== removed file 'include/ubuntu/application/sensors/sensor_type.h'
3118--- include/ubuntu/application/sensors/sensor_type.h 2013-02-13 12:04:07 +0000
3119+++ include/ubuntu/application/sensors/sensor_type.h 1970-01-01 00:00:00 +0000
3120@@ -1,45 +0,0 @@
3121-/*
3122- * Copyright © 2012 Canonical Ltd.
3123- *
3124- * This program is free software: you can redistribute it and/or modify
3125- * it under the terms of the GNU Lesser General Public License version 3 as
3126- * published by the Free Software Foundation.
3127- *
3128- * This program is distributed in the hope that it will be useful,
3129- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3130- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3131- * GNU Lesser General Public License for more details.
3132- *
3133- * You should have received a copy of the GNU Lesser General Public License
3134- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3135- *
3136- * Authored by: Thomas Voß <thomas.voss@canonical.com>
3137- */
3138-#ifndef UBUNTU_APPLICATION_SENSORS_SENSOR_TYPE_H_
3139-#define UBUNTU_APPLICATION_SENSORS_SENSOR_TYPE_H_
3140-
3141-namespace ubuntu
3142-{
3143-namespace application
3144-{
3145-namespace sensors
3146-{
3147-/** Models a special type of a sensor */
3148-enum SensorType
3149-{
3150- first_defined_sensor_type = 0,
3151- sensor_type_accelerometer = first_defined_sensor_type, ///< An accelerometer
3152- sensor_type_magnetic_field, ///< A magnetic field sensor, i.e., a compass
3153- sensor_type_gyroscope, ///< A gyroscope
3154- sensor_type_light, ///< An ambient light sensor
3155- sensor_type_proximity, ///< A proximity sensor, used to blank the screen when making a call
3156- sensor_type_orientation, ///< Virtual sensor, reports sensor fusion results regarding a device's orientation
3157- sensor_type_linear_acceleration, ///< Virtual sensor, reports sensor fusion results regarding a device's linear acceleration
3158- sensor_type_rotation_vector, ///< Virtual sensor, reports sensor fusion results regarding a device's rotation vector
3159- undefined_sensor_type
3160-};
3161-}
3162-}
3163-}
3164-
3165-#endif // UBUNTU_APPLICATION_SENSORS_SENSOR_TYPE_H_
3166
3167=== added file 'include/ubuntu/application/sensors/ubuntu_application_sensors.h'
3168--- include/ubuntu/application/sensors/ubuntu_application_sensors.h 1970-01-01 00:00:00 +0000
3169+++ include/ubuntu/application/sensors/ubuntu_application_sensors.h 2013-05-28 11:49:27 +0000
3170@@ -0,0 +1,155 @@
3171+/*
3172+ * Copyright © 2012 Canonical Ltd.
3173+ *
3174+ * This program is free software: you can redistribute it and/or modify
3175+ * it under the terms of the GNU Lesser General Public License version 3 as
3176+ * published by the Free Software Foundation.
3177+ *
3178+ * This program is distributed in the hope that it will be useful,
3179+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3180+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3181+ * GNU Lesser General Public License for more details.
3182+ *
3183+ * You should have received a copy of the GNU Lesser General Public License
3184+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3185+ *
3186+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
3187+ */
3188+#ifndef UBUNTU_APPLICATION_SENSORS_C_API_H_
3189+#define UBUNTU_APPLICATION_SENSORS_C_API_H_
3190+
3191+#include <stdint.h>
3192+
3193+#ifdef __cplusplus
3194+extern "C" {
3195+#endif
3196+
3197+ /** \defgroup sensor_access Functions and types to access sensor devices. */
3198+
3199+ /** A timestamped accelerometer reading
3200+ * \ingroup sensor_access
3201+ */
3202+ typedef struct
3203+ {
3204+ int64_t timestamp;
3205+
3206+ float acceleration_x;
3207+ float acceleration_y;
3208+ float acceleration_z;
3209+ } ubuntu_sensor_accelerometer_reading;
3210+
3211+ /** A timestamped proximity sensor reading
3212+ * \ingroup sensor_access
3213+ */
3214+ typedef struct
3215+ {
3216+ int64_t timestamp;
3217+
3218+ float distance;
3219+ } ubuntu_sensor_proximity_reading;
3220+
3221+ /** A timestamped ambient light sensor reading
3222+ * \ingroup sensor_access
3223+ */
3224+ typedef struct
3225+ {
3226+ int64_t timestamp;
3227+
3228+ float light;
3229+ } ubuntu_sensor_ambient_light_reading;
3230+
3231+ /** Describes the sensor types known to the system
3232+ * \ingroup sensor_access
3233+ */
3234+ enum ubuntu_sensor_type
3235+ {
3236+ first_defined_sensor_type = 0,
3237+ ubuntu_sensor_type_accelerometer = first_defined_sensor_type,
3238+ ubuntu_sensor_type_magnetic_field,
3239+ ubuntu_sensor_type_gyroscope,
3240+ ubuntu_sensor_type_light,
3241+ ubuntu_sensor_type_proximity,
3242+ ubuntu_sensor_type_orientation,
3243+ ubuntu_sensor_type_linear_acceleration,
3244+ ubuntu_sensor_type_rotation_vector,
3245+ undefined_sensor_type
3246+ };
3247+
3248+ /** Callback that is invoked for new accelerometer readings.
3249+ * \ingroup sensor_access
3250+ * \param reading [in] The new reading.
3251+ * \param context [in] The callback context.
3252+ */
3253+ typedef void (*on_new_accelerometer_reading)(ubuntu_sensor_accelerometer_reading* reading, void* context);
3254+
3255+ /** Callback that is invoked for new proximity sensor readings.
3256+ * \ingroup sensor_access
3257+ * \param reading [in] The new reading.
3258+ * \param context [in] The callback context.
3259+ */
3260+ typedef void (*on_new_proximity_reading)(ubuntu_sensor_proximity_reading* reading, void* context);
3261+
3262+ /** Callback that is invoked for new ambient light sensor readings.
3263+ * \ingroup sensor_access
3264+ * \param reading [in] The new reading.
3265+ * \param context [in] The callback context.
3266+ */
3267+ typedef void (*on_new_ambient_light_reading)(ubuntu_sensor_ambient_light_reading* reading, void* context);
3268+
3269+ /** Models a sensor observer.
3270+ * \ingroup sensor_access
3271+ */
3272+ typedef struct
3273+ {
3274+ /** Invoked for new readings from an accelerometer. */
3275+ on_new_accelerometer_reading on_new_accelerometer_reading_cb;
3276+ /** Invoked for new readings from a proximity sensor. */
3277+ on_new_proximity_reading on_new_proximity_reading_cb;
3278+ /** Invoked for new readings from an ambient light sensor. */
3279+ on_new_ambient_light_reading on_new_ambient_light_reading_cb;
3280+
3281+ /** Callback context. */
3282+ void* context;
3283+ } ubuntu_sensor_observer;
3284+
3285+ void ubuntu_sensor_initialize_observer(ubuntu_sensor_observer* observer);
3286+ /** Installs the supplied observer.
3287+ * \ingroup sensor_access
3288+ */
3289+ void ubuntu_sensor_install_observer(ubuntu_sensor_observer* observer);
3290+ /** Uninstalls the supplied observer.
3291+ * \ingroup sensor_access
3292+ */
3293+ void ubuntu_sensor_uninstall_observer(ubuntu_sensor_observer* observer);
3294+
3295+ /** Enables the specified sensor type and starts data acquisition.
3296+ * \ingroup sensor_access
3297+ */
3298+ void ubuntu_sensor_enable_sensor(ubuntu_sensor_type sensor_type);
3299+ /** Disables the specified sensor type and starts data acquisition.
3300+ * \ingroup sensor_access
3301+ */
3302+ void ubuntu_sensor_disable_sensor(ubuntu_sensor_type sensor_type);
3303+ /** Returns the minimum sensor sampling delay in Hz.
3304+ * \ingroup sensor_access
3305+ */
3306+ int32_t ubuntu_sensor_get_sensor_min_delay(ubuntu_sensor_type sensor_type);
3307+ /** Returns the minimum valid value for the sensor_type.
3308+ * \ingroup sensor_access
3309+ */
3310+ float ubuntu_sensor_get_sensor_min_value(ubuntu_sensor_type sensor_type);
3311+ /** Returns the maximum valid value for the sensor_type.
3312+ * \ingroup sensor_access
3313+ */
3314+ float ubuntu_sensor_get_sensor_max_value(ubuntu_sensor_type sensor_type);
3315+ /** Returns the resolution of valid values for the sensor_type.
3316+ * \ingroup sensor_access
3317+ */
3318+ float ubuntu_sensor_get_sensor_resolution(ubuntu_sensor_type sensor_type);
3319+
3320+ /** \example test_sensors_api.cpp */
3321+#ifdef __cplusplus
3322+}
3323+#endif
3324+
3325+#endif // UBUNTU_APPLICATION_SENSORS_C_API_H_
3326
3327=== removed file 'include/ubuntu/application/sensors/ubuntu_application_sensors.h'
3328--- include/ubuntu/application/sensors/ubuntu_application_sensors.h 2013-02-28 14:29:36 +0000
3329+++ include/ubuntu/application/sensors/ubuntu_application_sensors.h 1970-01-01 00:00:00 +0000
3330@@ -1,155 +0,0 @@
3331-/*
3332- * Copyright © 2012 Canonical Ltd.
3333- *
3334- * This program is free software: you can redistribute it and/or modify
3335- * it under the terms of the GNU Lesser General Public License version 3 as
3336- * published by the Free Software Foundation.
3337- *
3338- * This program is distributed in the hope that it will be useful,
3339- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3340- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3341- * GNU Lesser General Public License for more details.
3342- *
3343- * You should have received a copy of the GNU Lesser General Public License
3344- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3345- *
3346- * Authored by: Thomas Voß <thomas.voss@canonical.com>
3347- */
3348-#ifndef UBUNTU_APPLICATION_SENSORS_C_API_H_
3349-#define UBUNTU_APPLICATION_SENSORS_C_API_H_
3350-
3351-#include <stdint.h>
3352-
3353-#ifdef __cplusplus
3354-extern "C" {
3355-#endif
3356-
3357- /** \defgroup sensor_access Functions and types to access sensor devices. */
3358-
3359- /** A timestamped accelerometer reading
3360- * \ingroup sensor_access
3361- */
3362- typedef struct
3363- {
3364- int64_t timestamp;
3365-
3366- float acceleration_x;
3367- float acceleration_y;
3368- float acceleration_z;
3369- } ubuntu_sensor_accelerometer_reading;
3370-
3371- /** A timestamped proximity sensor reading
3372- * \ingroup sensor_access
3373- */
3374- typedef struct
3375- {
3376- int64_t timestamp;
3377-
3378- float distance;
3379- } ubuntu_sensor_proximity_reading;
3380-
3381- /** A timestamped ambient light sensor reading
3382- * \ingroup sensor_access
3383- */
3384- typedef struct
3385- {
3386- int64_t timestamp;
3387-
3388- float light;
3389- } ubuntu_sensor_ambient_light_reading;
3390-
3391- /** Describes the sensor types known to the system
3392- * \ingroup sensor_access
3393- */
3394- enum ubuntu_sensor_type
3395- {
3396- first_defined_sensor_type = 0,
3397- ubuntu_sensor_type_accelerometer = first_defined_sensor_type,
3398- ubuntu_sensor_type_magnetic_field,
3399- ubuntu_sensor_type_gyroscope,
3400- ubuntu_sensor_type_light,
3401- ubuntu_sensor_type_proximity,
3402- ubuntu_sensor_type_orientation,
3403- ubuntu_sensor_type_linear_acceleration,
3404- ubuntu_sensor_type_rotation_vector,
3405- undefined_sensor_type
3406- };
3407-
3408- /** Callback that is invoked for new accelerometer readings.
3409- * \ingroup sensor_access
3410- * \param reading [in] The new reading.
3411- * \param context [in] The callback context.
3412- */
3413- typedef void (*on_new_accelerometer_reading)(ubuntu_sensor_accelerometer_reading* reading, void* context);
3414-
3415- /** Callback that is invoked for new proximity sensor readings.
3416- * \ingroup sensor_access
3417- * \param reading [in] The new reading.
3418- * \param context [in] The callback context.
3419- */
3420- typedef void (*on_new_proximity_reading)(ubuntu_sensor_proximity_reading* reading, void* context);
3421-
3422- /** Callback that is invoked for new ambient light sensor readings.
3423- * \ingroup sensor_access
3424- * \param reading [in] The new reading.
3425- * \param context [in] The callback context.
3426- */
3427- typedef void (*on_new_ambient_light_reading)(ubuntu_sensor_ambient_light_reading* reading, void* context);
3428-
3429- /** Models a sensor observer.
3430- * \ingroup sensor_access
3431- */
3432- typedef struct
3433- {
3434- /** Invoked for new readings from an accelerometer. */
3435- on_new_accelerometer_reading on_new_accelerometer_reading_cb;
3436- /** Invoked for new readings from a proximity sensor. */
3437- on_new_proximity_reading on_new_proximity_reading_cb;
3438- /** Invoked for new readings from an ambient light sensor. */
3439- on_new_ambient_light_reading on_new_ambient_light_reading_cb;
3440-
3441- /** Callback context. */
3442- void* context;
3443- } ubuntu_sensor_observer;
3444-
3445- void ubuntu_sensor_initialize_observer(ubuntu_sensor_observer* observer);
3446- /** Installs the supplied observer.
3447- * \ingroup sensor_access
3448- */
3449- void ubuntu_sensor_install_observer(ubuntu_sensor_observer* observer);
3450- /** Uninstalls the supplied observer.
3451- * \ingroup sensor_access
3452- */
3453- void ubuntu_sensor_uninstall_observer(ubuntu_sensor_observer* observer);
3454-
3455- /** Enables the specified sensor type and starts data acquisition.
3456- * \ingroup sensor_access
3457- */
3458- void ubuntu_sensor_enable_sensor(ubuntu_sensor_type sensor_type);
3459- /** Disables the specified sensor type and starts data acquisition.
3460- * \ingroup sensor_access
3461- */
3462- void ubuntu_sensor_disable_sensor(ubuntu_sensor_type sensor_type);
3463- /** Returns the minimum sensor sampling delay in Hz.
3464- * \ingroup sensor_access
3465- */
3466- int32_t ubuntu_sensor_get_sensor_min_delay(ubuntu_sensor_type sensor_type);
3467- /** Returns the minimum valid value for the sensor_type.
3468- * \ingroup sensor_access
3469- */
3470- float ubuntu_sensor_get_sensor_min_value(ubuntu_sensor_type sensor_type);
3471- /** Returns the maximum valid value for the sensor_type.
3472- * \ingroup sensor_access
3473- */
3474- float ubuntu_sensor_get_sensor_max_value(ubuntu_sensor_type sensor_type);
3475- /** Returns the resolution of valid values for the sensor_type.
3476- * \ingroup sensor_access
3477- */
3478- float ubuntu_sensor_get_sensor_resolution(ubuntu_sensor_type sensor_type);
3479-
3480- /** \example test_sensors_api.cpp */
3481-#ifdef __cplusplus
3482-}
3483-#endif
3484-
3485-#endif // UBUNTU_APPLICATION_SENSORS_C_API_H_
3486
3487=== removed file 'include/ubuntu/application/session.h'
3488--- include/ubuntu/application/session.h 2013-02-13 12:04:07 +0000
3489+++ include/ubuntu/application/session.h 1970-01-01 00:00:00 +0000
3490@@ -1,45 +0,0 @@
3491-/*
3492- * Copyright © 2012 Canonical Ltd.
3493- *
3494- * This program is free software: you can redistribute it and/or modify
3495- * it under the terms of the GNU Lesser General Public License version 3 as
3496- * published by the Free Software Foundation.
3497- *
3498- * This program is distributed in the hope that it will be useful,
3499- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3500- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3501- * GNU Lesser General Public License for more details.
3502- *
3503- * You should have received a copy of the GNU Lesser General Public License
3504- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3505- *
3506- * Authored by: Thomas Voß <thomas.voss@canonical.com>
3507- */
3508-#ifndef UBUNTU_APPLICATION_SESSION_H_
3509-#define UBUNTU_APPLICATION_SESSION_H_
3510-
3511-#include "ubuntu/platform/shared_ptr.h"
3512-
3513-namespace ubuntu
3514-{
3515-namespace application
3516-{
3517-/**
3518- * Represents a session with the service providers abstracted by Ubuntu platform API.
3519- */
3520-class Session : public ubuntu::platform::ReferenceCountedBase
3521-{
3522-public:
3523- typedef ubuntu::platform::shared_ptr<Session> Ptr;
3524-
3525-protected:
3526- Session() {}
3527- virtual ~Session() {}
3528-
3529- Session(const Session&) = delete;
3530- Session& operator=(const Session&) = delete;
3531-};
3532-}
3533-}
3534-
3535-#endif // UBUNTU_APPLICATION_SESSION_H_
3536
3537=== added file 'include/ubuntu/application/ubuntu_application_gps.h'
3538--- include/ubuntu/application/ubuntu_application_gps.h 1970-01-01 00:00:00 +0000
3539+++ include/ubuntu/application/ubuntu_application_gps.h 2013-05-28 11:49:27 +0000
3540@@ -0,0 +1,408 @@
3541+/*
3542+ * Copyright © 2013 Canonical Ltd.
3543+ *
3544+ * This program is free software: you can redistribute it and/or modify
3545+ * it under the terms of the GNU Lesser General Public License version 3 as
3546+ * published by the Free Software Foundation.
3547+ *
3548+ * This program is distributed in the hope that it will be useful,
3549+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3550+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3551+ * GNU Lesser General Public License for more details.
3552+ *
3553+ * You should have received a copy of the GNU Lesser General Public License
3554+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3555+ *
3556+ * Authored by: Daniel d'Andrada <daniel.dandrada@canonical.com>
3557+ */
3558+#ifndef UBUNTU_APPLICATION_GPS_H_
3559+#define UBUNTU_APPLICATION_GPS_H_
3560+
3561+#include <stdint.h>
3562+#include <stddef.h>
3563+
3564+#ifdef __cplusplus
3565+extern "C" {
3566+#endif
3567+
3568+/** \defgroup gps_access Functions and types for accessing location services. */
3569+
3570+/**
3571+ * Maximum number of SVs for gps_sv_status_callback().
3572+ * \ingroup gps_access
3573+ */
3574+#define UBUNTU_GPS_MAX_SVS 32
3575+
3576+enum
3577+{
3578+ /** GPS status unknown. */
3579+ UBUNTU_GPS_STATUS_NONE = 0,
3580+ /** GPS has begun navigating. */
3581+ UBUNTU_GPS_STATUS_SESSION_BEGIN = 1,
3582+ /** GPS has stopped navigating. */
3583+ UBUNTU_GPS_STATUS_SESSION_END = 2,
3584+ /** GPS has powered on but is not navigating. */
3585+ UBUNTU_GPS_STATUS_ENGINE_ON = 3,
3586+ /** GPS is powered off. */
3587+ UBUNTU_GPS_STATUS_ENGINE_OFF = 4
3588+};
3589+
3590+/**
3591+ * Flags for the gps_set_capabilities callback.
3592+ * \ingroup gps_access
3593+ * GPS HAL schedules fixes for UBUNTU_GPS_POSITION_RECURRENCE_PERIODIC mode.
3594+ * If this is not set, then the framework will use 1000ms for min_interval
3595+ * and will start and call start() and stop() to schedule the GPS.
3596+ */
3597+#define UBUNTU_GPS_CAPABILITY_SCHEDULING 0x0000001
3598+/** GPS supports MS-Based AGPS mode */
3599+#define UBUNTU_GPS_CAPABILITY_MSB 0x0000002
3600+/** GPS supports MS-Assisted AGPS mode */
3601+#define UBUNTU_GPS_CAPABILITY_MSA 0x0000004
3602+/** GPS supports single-shot fixes */
3603+#define UBUNTU_GPS_CAPABILITY_SINGLE_SHOT 0x0000008
3604+/** GPS supports on demand time injection */
3605+#define UBUNTU_GPS_CAPABILITY_ON_DEMAND_TIME 0x0000010
3606+
3607+/**
3608+ * UbuntuGpsNiNotifyFlags constants
3609+ * \ingroup gps_access
3610+ */
3611+typedef uint32_t UbuntuGpsNiNotifyFlags;
3612+/** NI requires notification */
3613+#define UBUNTU_GPS_NI_NEED_NOTIFY 0x0001
3614+/** NI requires verification */
3615+#define UBUNTU_GPS_NI_NEED_VERIFY 0x0002
3616+/** NI requires privacy override, no notification/minimal trace */
3617+#define UBUNTU_GPS_NI_PRIVACY_OVERRIDE 0x0004
3618+
3619+/**
3620+ * GPS NI responses, used to define the response in
3621+ * NI structures
3622+ * \ingroup gps_access
3623+ */
3624+typedef int UbuntuGpsUserResponseType;
3625+enum
3626+{
3627+ UBUNTU_UBUNTU_GPS_NI_RESPONSE_ACCEPT = 1,
3628+ UBUNTU_UBUNTU_GPS_NI_RESPONSE_DENY = 2,
3629+ UBUNTU_UBUNTU_GPS_NI_RESPONSE_NORESP = 3
3630+};
3631+
3632+enum
3633+{
3634+ UBUNTU_GPS_NI_TYPE_VOICE = 1,
3635+ UBUNTU_GPS_NI_TYPE_UMTS_SUPL = 2,
3636+ UBUNTU_GPS_NI_TYPE_UMTS_CTRL_PLANE = 3
3637+};
3638+
3639+/**
3640+ * String length constants
3641+ * \ingroup gps_access
3642+ */
3643+#define UBUNTU_GPS_NI_SHORT_STRING_MAXLEN 256
3644+#define UBUNTU_GPS_NI_LONG_STRING_MAXLEN 2048
3645+
3646+/**
3647+ * NI data encoding scheme
3648+ * \ingroup gps_access
3649+ */
3650+typedef int UbuntuGpsNiEncodingType;
3651+enum
3652+{
3653+ UBUNTU_GPS_ENC_NONE = 0,
3654+ UBUNTU_GPS_ENC_SUPL_GSM_DEFAULT = 1,
3655+ UBUNTU_GPS_ENC_SUPL_UTF8 = 2,
3656+ UBUNTU_GPS_ENC_SUPL_UCS2 = 3,
3657+ UBUNTU_GPS_ENC_UNKNOWN = -1
3658+};
3659+
3660+enum
3661+{
3662+ UBUNTU_AGPS_TYPE_SUPL = 1,
3663+ UBUNTU_AGPS_TYPE_C2K = 2
3664+};
3665+
3666+
3667+enum
3668+{
3669+ /** Mode for running GPS standalone (no assistance). */
3670+ UBUNTU_GPS_POSITION_MODE_STANDALONE = 0,
3671+ /** AGPS MS-Based mode. */
3672+ UBUNTU_GPS_POSITION_MODE_MS_BASED = 1,
3673+ /** AGPS MS-Assisted mode. */
3674+ UBUNTU_GPS_POSITION_MODE_MS_ASSISTED = 2
3675+};
3676+
3677+enum
3678+{
3679+ /** Receive GPS fixes on a recurring basis at a specified period. */
3680+ UBUNTU_GPS_POSITION_RECURRENCE_PERIODIC = 0,
3681+ /** Request a single shot GPS fix. */
3682+ UBUNTU_GPS_POSITION_RECURRENCE_SINGLE = 1
3683+};
3684+
3685+enum
3686+{
3687+ /** GPS requests data connection for AGPS. */
3688+ UBUNTU_GPS_REQUEST_AGPS_DATA_CONN = 1,
3689+ /** GPS releases the AGPS data connection. */
3690+ UBUNTU_GPS_RELEASE_AGPS_DATA_CONN = 2,
3691+ /** AGPS data connection initiated */
3692+ UBUNTU_GPS_AGPS_DATA_CONNECTED = 3,
3693+ /** AGPS data connection completed */
3694+ UBUNTU_GPS_AGPS_DATA_CONN_DONE = 4,
3695+ /** AGPS data connection failed */
3696+ UBUNTU_GPS_AGPS_DATA_CONN_FAILED = 5
3697+};
3698+
3699+/** UbuntuGpsLocation has valid latitude and longitude. */
3700+#define UBUNTU_GPS_LOCATION_HAS_LAT_LONG 0x0001
3701+/** UbuntuGpsLocation has valid altitude. */
3702+#define UBUNTU_GPS_LOCATION_HAS_ALTITUDE 0x0002
3703+/** UbuntuGpsLocation has valid speed. */
3704+#define UBUNTU_GPS_LOCATION_HAS_SPEED 0x0004
3705+/** UbuntuGpsLocation has valid bearing. */
3706+#define UBUNTU_GPS_LOCATION_HAS_BEARING 0x0008
3707+/** UbuntuGpsLocation has valid accuracy. */
3708+#define UBUNTU_GPS_LOCATION_HAS_ACCURACY 0x0010
3709+
3710+typedef struct UbuntuGps_* UbuntuGps;
3711+
3712+/**
3713+ * Models a location as reported by the GPS HAL.
3714+ * \ingroup gps_access
3715+ */
3716+typedef struct
3717+{
3718+ /** set to sizeof(UbuntuGpsLocation) */
3719+ size_t size;
3720+ /** Contains UBUNTU_GPS_LOCATION_* flags bits. */
3721+ uint16_t flags;
3722+ /** Represents latitude in degrees. */
3723+ double latitude;
3724+ /** Represents longitude in degrees. */
3725+ double longitude;
3726+ /** Represents altitude in meters above the WGS 84 reference
3727+ * ellipsoid. */
3728+ double altitude;
3729+ /** Represents speed in meters per second. */
3730+ float speed;
3731+ /** Represents heading in degrees. */
3732+ float bearing;
3733+ /** Represents expected accuracy in meters. */
3734+ float accuracy;
3735+ /** Timestamp for the location fix, in milliseconds since January 1, 1970 */
3736+ int64_t timestamp;
3737+} UbuntuGpsLocation;
3738+
3739+/**
3740+ * Represents space vehicle (satellite) information.
3741+ * \ingroup gps_access
3742+ */
3743+typedef struct {
3744+ /** set to sizeof(UbuntuGpsSvInfo) */
3745+ size_t size;
3746+ /** Pseudo-random number for the SV. */
3747+ int prn;
3748+ /** Signal to noise ratio. */
3749+ float snr;
3750+ /** Elevation of SV in degrees. */
3751+ float elevation;
3752+ /** Azimuth of SV in degrees. */
3753+ float azimuth;
3754+} UbuntuGpsSvInfo;
3755+
3756+/**
3757+ * Represents SV (Space Vehicle) status.
3758+ * \ingroup gps_access
3759+ */
3760+typedef struct {
3761+ /** set to sizeof(GpsSvStatus) */
3762+ size_t size;
3763+
3764+ /** Number of SVs currently visible. */
3765+ int num_svs;
3766+
3767+ /** Contains an array of SV information. */
3768+ UbuntuGpsSvInfo sv_list[UBUNTU_GPS_MAX_SVS];
3769+
3770+ /** Represents a bit mask indicating which SVs
3771+ * have ephemeris data.
3772+ */
3773+ uint32_t ephemeris_mask;
3774+
3775+ /** Represents a bit mask indicating which SVs
3776+ * have almanac data.
3777+ */
3778+ uint32_t almanac_mask;
3779+
3780+ /**
3781+ * Represents a bit mask indicating which SVs
3782+ * were used for computing the most recent position fix.
3783+ */
3784+ uint32_t used_in_fix_mask;
3785+} UbuntuGpsSvStatus;
3786+
3787+/**
3788+ * Represents the status of AGPS.
3789+ * \ingroup gps_access
3790+ */
3791+typedef struct {
3792+ /** set to sizeof(UbuntuAgpsStatus) */
3793+ size_t size;
3794+
3795+ uint16_t type;
3796+ uint16_t status;
3797+ uint32_t ipaddr;
3798+} UbuntuAgpsStatus;
3799+
3800+/**
3801+ * Represents an NI request
3802+ * \ingroup gps_access
3803+ */
3804+typedef struct {
3805+ /** set to sizeof(UbuntuGpsNiNotification) */
3806+ size_t size;
3807+
3808+ /**
3809+ * An ID generated by HAL to associate NI notifications and UI
3810+ * responses
3811+ */
3812+ int notification_id;
3813+
3814+ /**
3815+ * An NI type used to distinguish different categories of NI
3816+ * events, such as UBUNTU_GPS_NI_TYPE_VOICE, UBUNTU_GPS_NI_TYPE_UMTS_SUPL, ...
3817+ */
3818+ uint32_t ni_type;
3819+
3820+ /**
3821+ * Notification/verification options, combinations of UbuntuGpsNiNotifyFlags constants
3822+ */
3823+ UbuntuGpsNiNotifyFlags notify_flags;
3824+
3825+ /**
3826+ * Timeout period to wait for user response.
3827+ * Set to 0 for no time out limit.
3828+ */
3829+ int timeout;
3830+
3831+ /**
3832+ * Default response when time out.
3833+ */
3834+ UbuntuGpsUserResponseType default_response;
3835+
3836+ /**
3837+ * Requestor ID
3838+ */
3839+ char requestor_id[UBUNTU_GPS_NI_SHORT_STRING_MAXLEN];
3840+
3841+ /**
3842+ * Notification message. It can also be used to store client_id in some cases
3843+ */
3844+ char text[UBUNTU_GPS_NI_LONG_STRING_MAXLEN];
3845+
3846+ /**
3847+ * Client name decoding scheme
3848+ */
3849+ UbuntuGpsNiEncodingType requestor_id_encoding;
3850+
3851+ /**
3852+ * Client name decoding scheme
3853+ */
3854+ UbuntuGpsNiEncodingType text_encoding;
3855+
3856+ /**
3857+ * A pointer to extra data. Format:
3858+ * key_1 = value_1
3859+ * key_2 = value_2
3860+ */
3861+ char extras[UBUNTU_GPS_NI_LONG_STRING_MAXLEN];
3862+
3863+} UbuntuGpsNiNotification;
3864+
3865+typedef void (* UbuntuGpsLocationCallback)(UbuntuGpsLocation* location, void* context);
3866+typedef void (* UbuntuGpsStatusCallback)(uint16_t status, void* context);
3867+typedef void (* UbuntuGpsSvStatusCallback)(UbuntuGpsSvStatus* sv_info, void* context);
3868+typedef void (* UbuntuGpsNmeaCallback)(int64_t timestamp, const char* nmea, int length, void* context);
3869+typedef void (* UbuntuGpsSetCapabilities)(uint32_t capabilities, void* context);
3870+typedef void (* UbuntuGpsRequestUtcTime)(void* context);
3871+
3872+/** Callback to request the client to download XTRA data.
3873+ * The client should download XTRA data and inject it by calling inject_xtra_data().
3874+ */
3875+typedef void (* UbuntuGpsXtraDownloadRequest)(void* context);
3876+
3877+/** Callback with AGPS status information.
3878+ */
3879+typedef void (* UbuntuAgpsStatusCallback)(UbuntuAgpsStatus* status, void* context);
3880+
3881+/** Callback with NI notification.
3882+ */
3883+typedef void (*UbuntuGpsNiNotifyCallback)(UbuntuGpsNiNotification *notification, void* context);
3884+
3885+/*
3886+ Callback for AGPS RIL (Radio Interface Library) set id
3887+*/
3888+typedef void (*UbuntuAgpsRilRequestSetId)(uint32_t flags, void* context);
3889+typedef void (*UbuntuAgpsRilRequestRefLoc)(uint32_t flags, void* context);
3890+
3891+typedef struct
3892+{
3893+
3894+ UbuntuGpsLocationCallback location_cb;
3895+ UbuntuGpsStatusCallback status_cb;
3896+ UbuntuGpsSvStatusCallback sv_status_cb;
3897+ UbuntuGpsNmeaCallback nmea_cb;
3898+ UbuntuGpsSetCapabilities set_capabilities_cb;
3899+ UbuntuGpsRequestUtcTime request_utc_time_cb;
3900+
3901+ UbuntuGpsXtraDownloadRequest xtra_download_request_cb;
3902+
3903+ UbuntuAgpsStatusCallback agps_status_cb;
3904+
3905+ UbuntuGpsNiNotifyCallback gps_ni_notify_cb;
3906+
3907+ UbuntuAgpsRilRequestSetId request_setid_cb;
3908+ UbuntuAgpsRilRequestRefLoc request_refloc_cb;
3909+
3910+ void* context;
3911+} UbuntuGpsParams;
3912+
3913+/*
3914+ You must create only one instance per process/application.
3915+*/
3916+UbuntuGps ubuntu_gps_new(UbuntuGpsParams* params);
3917+void ubuntu_gps_delete(UbuntuGps handle);
3918+
3919+bool ubuntu_gps_start(UbuntuGps self);
3920+bool ubuntu_gps_stop(UbuntuGps self);
3921+
3922+/*
3923+ \param time NTP time, in milliseconds since Jan 1st 1970.
3924+ \param time_reference time from the internal clock at the moment that NTP time was taken.
3925+ \param uncertainty possible deviation in the time supplied (uncertainty) in milliseconds.
3926+ */
3927+void ubuntu_gps_inject_time(UbuntuGps self, int64_t time, int64_t time_reference, int uncertainty);
3928+
3929+void ubuntu_gps_inject_location(UbuntuGps self, double latitude, double longitude, float accuracy);
3930+void ubuntu_gps_delete_aiding_data(UbuntuGps self, uint16_t flags);
3931+
3932+/*
3933+ \param mode One of the UBUNTU_GPS_POSITION_MODE_* values
3934+ \param recurrence One of the UBUNTU_GPS_POSITION_RECURRENCE_* values
3935+ \param min_interval represents the time between fixes in milliseconds.
3936+ \param preferred_accuracy The requested fix accuracy in meters. Can be zero.
3937+ \param preferred_time The requested time to first fix in milliseconds. Can be zero.
3938+ */
3939+bool ubuntu_gps_set_position_mode(UbuntuGps self, uint32_t mode, uint32_t recurrence,
3940+ uint32_t min_interval, uint32_t preferred_accuracy,
3941+ uint32_t preferred_time);
3942+void ubuntu_gps_inject_xtra_data(UbuntuGps self, char* data, int length);
3943+
3944+#ifdef __cplusplus
3945+}
3946+#endif
3947+
3948+#endif // UBUNTU_APPLICATION_GPS_H_
3949
3950=== removed file 'include/ubuntu/application/ubuntu_application_gps.h'
3951--- include/ubuntu/application/ubuntu_application_gps.h 2013-02-13 12:04:07 +0000
3952+++ include/ubuntu/application/ubuntu_application_gps.h 1970-01-01 00:00:00 +0000
3953@@ -1,408 +0,0 @@
3954-/*
3955- * Copyright © 2013 Canonical Ltd.
3956- *
3957- * This program is free software: you can redistribute it and/or modify
3958- * it under the terms of the GNU Lesser General Public License version 3 as
3959- * published by the Free Software Foundation.
3960- *
3961- * This program is distributed in the hope that it will be useful,
3962- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3963- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3964- * GNU Lesser General Public License for more details.
3965- *
3966- * You should have received a copy of the GNU Lesser General Public License
3967- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3968- *
3969- * Authored by: Daniel d'Andrada <daniel.dandrada@canonical.com>
3970- */
3971-#ifndef UBUNTU_APPLICATION_GPS_H_
3972-#define UBUNTU_APPLICATION_GPS_H_
3973-
3974-#include <stdint.h>
3975-#include <stddef.h>
3976-
3977-#ifdef __cplusplus
3978-extern "C" {
3979-#endif
3980-
3981-/** \defgroup gps_access Functions and types for accessing location services. */
3982-
3983-/**
3984- * Maximum number of SVs for gps_sv_status_callback().
3985- * \ingroup gps_access
3986- */
3987-#define UBUNTU_GPS_MAX_SVS 32
3988-
3989-enum
3990-{
3991- /** GPS status unknown. */
3992- UBUNTU_GPS_STATUS_NONE = 0,
3993- /** GPS has begun navigating. */
3994- UBUNTU_GPS_STATUS_SESSION_BEGIN = 1,
3995- /** GPS has stopped navigating. */
3996- UBUNTU_GPS_STATUS_SESSION_END = 2,
3997- /** GPS has powered on but is not navigating. */
3998- UBUNTU_GPS_STATUS_ENGINE_ON = 3,
3999- /** GPS is powered off. */
4000- UBUNTU_GPS_STATUS_ENGINE_OFF = 4
4001-};
4002-
4003-/**
4004- * Flags for the gps_set_capabilities callback.
4005- * \ingroup gps_access
4006- * GPS HAL schedules fixes for UBUNTU_GPS_POSITION_RECURRENCE_PERIODIC mode.
4007- * If this is not set, then the framework will use 1000ms for min_interval
4008- * and will start and call start() and stop() to schedule the GPS.
4009- */
4010-#define UBUNTU_GPS_CAPABILITY_SCHEDULING 0x0000001
4011-/** GPS supports MS-Based AGPS mode */
4012-#define UBUNTU_GPS_CAPABILITY_MSB 0x0000002
4013-/** GPS supports MS-Assisted AGPS mode */
4014-#define UBUNTU_GPS_CAPABILITY_MSA 0x0000004
4015-/** GPS supports single-shot fixes */
4016-#define UBUNTU_GPS_CAPABILITY_SINGLE_SHOT 0x0000008
4017-/** GPS supports on demand time injection */
4018-#define UBUNTU_GPS_CAPABILITY_ON_DEMAND_TIME 0x0000010
4019-
4020-/**
4021- * UbuntuGpsNiNotifyFlags constants
4022- * \ingroup gps_access
4023- */
4024-typedef uint32_t UbuntuGpsNiNotifyFlags;
4025-/** NI requires notification */
4026-#define UBUNTU_GPS_NI_NEED_NOTIFY 0x0001
4027-/** NI requires verification */
4028-#define UBUNTU_GPS_NI_NEED_VERIFY 0x0002
4029-/** NI requires privacy override, no notification/minimal trace */
4030-#define UBUNTU_GPS_NI_PRIVACY_OVERRIDE 0x0004
4031-
4032-/**
4033- * GPS NI responses, used to define the response in
4034- * NI structures
4035- * \ingroup gps_access
4036- */
4037-typedef int UbuntuGpsUserResponseType;
4038-enum
4039-{
4040- UBUNTU_UBUNTU_GPS_NI_RESPONSE_ACCEPT = 1,
4041- UBUNTU_UBUNTU_GPS_NI_RESPONSE_DENY = 2,
4042- UBUNTU_UBUNTU_GPS_NI_RESPONSE_NORESP = 3
4043-};
4044-
4045-enum
4046-{
4047- UBUNTU_GPS_NI_TYPE_VOICE = 1,
4048- UBUNTU_GPS_NI_TYPE_UMTS_SUPL = 2,
4049- UBUNTU_GPS_NI_TYPE_UMTS_CTRL_PLANE = 3
4050-};
4051-
4052-/**
4053- * String length constants
4054- * \ingroup gps_access
4055- */
4056-#define UBUNTU_GPS_NI_SHORT_STRING_MAXLEN 256
4057-#define UBUNTU_GPS_NI_LONG_STRING_MAXLEN 2048
4058-
4059-/**
4060- * NI data encoding scheme
4061- * \ingroup gps_access
4062- */
4063-typedef int UbuntuGpsNiEncodingType;
4064-enum
4065-{
4066- UBUNTU_GPS_ENC_NONE = 0,
4067- UBUNTU_GPS_ENC_SUPL_GSM_DEFAULT = 1,
4068- UBUNTU_GPS_ENC_SUPL_UTF8 = 2,
4069- UBUNTU_GPS_ENC_SUPL_UCS2 = 3,
4070- UBUNTU_GPS_ENC_UNKNOWN = -1
4071-};
4072-
4073-enum
4074-{
4075- UBUNTU_AGPS_TYPE_SUPL = 1,
4076- UBUNTU_AGPS_TYPE_C2K = 2
4077-};
4078-
4079-
4080-enum
4081-{
4082- /** Mode for running GPS standalone (no assistance). */
4083- UBUNTU_GPS_POSITION_MODE_STANDALONE = 0,
4084- /** AGPS MS-Based mode. */
4085- UBUNTU_GPS_POSITION_MODE_MS_BASED = 1,
4086- /** AGPS MS-Assisted mode. */
4087- UBUNTU_GPS_POSITION_MODE_MS_ASSISTED = 2
4088-};
4089-
4090-enum
4091-{
4092- /** Receive GPS fixes on a recurring basis at a specified period. */
4093- UBUNTU_GPS_POSITION_RECURRENCE_PERIODIC = 0,
4094- /** Request a single shot GPS fix. */
4095- UBUNTU_GPS_POSITION_RECURRENCE_SINGLE = 1
4096-};
4097-
4098-enum
4099-{
4100- /** GPS requests data connection for AGPS. */
4101- UBUNTU_GPS_REQUEST_AGPS_DATA_CONN = 1,
4102- /** GPS releases the AGPS data connection. */
4103- UBUNTU_GPS_RELEASE_AGPS_DATA_CONN = 2,
4104- /** AGPS data connection initiated */
4105- UBUNTU_GPS_AGPS_DATA_CONNECTED = 3,
4106- /** AGPS data connection completed */
4107- UBUNTU_GPS_AGPS_DATA_CONN_DONE = 4,
4108- /** AGPS data connection failed */
4109- UBUNTU_GPS_AGPS_DATA_CONN_FAILED = 5
4110-};
4111-
4112-/** UbuntuGpsLocation has valid latitude and longitude. */
4113-#define UBUNTU_GPS_LOCATION_HAS_LAT_LONG 0x0001
4114-/** UbuntuGpsLocation has valid altitude. */
4115-#define UBUNTU_GPS_LOCATION_HAS_ALTITUDE 0x0002
4116-/** UbuntuGpsLocation has valid speed. */
4117-#define UBUNTU_GPS_LOCATION_HAS_SPEED 0x0004
4118-/** UbuntuGpsLocation has valid bearing. */
4119-#define UBUNTU_GPS_LOCATION_HAS_BEARING 0x0008
4120-/** UbuntuGpsLocation has valid accuracy. */
4121-#define UBUNTU_GPS_LOCATION_HAS_ACCURACY 0x0010
4122-
4123-typedef struct UbuntuGps_* UbuntuGps;
4124-
4125-/**
4126- * Models a location as reported by the GPS HAL.
4127- * \ingroup gps_access
4128- */
4129-typedef struct
4130-{
4131- /** set to sizeof(UbuntuGpsLocation) */
4132- size_t size;
4133- /** Contains UBUNTU_GPS_LOCATION_* flags bits. */
4134- uint16_t flags;
4135- /** Represents latitude in degrees. */
4136- double latitude;
4137- /** Represents longitude in degrees. */
4138- double longitude;
4139- /** Represents altitude in meters above the WGS 84 reference
4140- * ellipsoid. */
4141- double altitude;
4142- /** Represents speed in meters per second. */
4143- float speed;
4144- /** Represents heading in degrees. */
4145- float bearing;
4146- /** Represents expected accuracy in meters. */
4147- float accuracy;
4148- /** Timestamp for the location fix, in milliseconds since January 1, 1970 */
4149- int64_t timestamp;
4150-} UbuntuGpsLocation;
4151-
4152-/**
4153- * Represents space vehicle (satellite) information.
4154- * \ingroup gps_access
4155- */
4156-typedef struct {
4157- /** set to sizeof(UbuntuGpsSvInfo) */
4158- size_t size;
4159- /** Pseudo-random number for the SV. */
4160- int prn;
4161- /** Signal to noise ratio. */
4162- float snr;
4163- /** Elevation of SV in degrees. */
4164- float elevation;
4165- /** Azimuth of SV in degrees. */
4166- float azimuth;
4167-} UbuntuGpsSvInfo;
4168-
4169-/**
4170- * Represents SV (Space Vehicle) status.
4171- * \ingroup gps_access
4172- */
4173-typedef struct {
4174- /** set to sizeof(GpsSvStatus) */
4175- size_t size;
4176-
4177- /** Number of SVs currently visible. */
4178- int num_svs;
4179-
4180- /** Contains an array of SV information. */
4181- UbuntuGpsSvInfo sv_list[UBUNTU_GPS_MAX_SVS];
4182-
4183- /** Represents a bit mask indicating which SVs
4184- * have ephemeris data.
4185- */
4186- uint32_t ephemeris_mask;
4187-
4188- /** Represents a bit mask indicating which SVs
4189- * have almanac data.
4190- */
4191- uint32_t almanac_mask;
4192-
4193- /**
4194- * Represents a bit mask indicating which SVs
4195- * were used for computing the most recent position fix.
4196- */
4197- uint32_t used_in_fix_mask;
4198-} UbuntuGpsSvStatus;
4199-
4200-/**
4201- * Represents the status of AGPS.
4202- * \ingroup gps_access
4203- */
4204-typedef struct {
4205- /** set to sizeof(UbuntuAgpsStatus) */
4206- size_t size;
4207-
4208- uint16_t type;
4209- uint16_t status;
4210- uint32_t ipaddr;
4211-} UbuntuAgpsStatus;
4212-
4213-/**
4214- * Represents an NI request
4215- * \ingroup gps_access
4216- */
4217-typedef struct {
4218- /** set to sizeof(UbuntuGpsNiNotification) */
4219- size_t size;
4220-
4221- /**
4222- * An ID generated by HAL to associate NI notifications and UI
4223- * responses
4224- */
4225- int notification_id;
4226-
4227- /**
4228- * An NI type used to distinguish different categories of NI
4229- * events, such as UBUNTU_GPS_NI_TYPE_VOICE, UBUNTU_GPS_NI_TYPE_UMTS_SUPL, ...
4230- */
4231- uint32_t ni_type;
4232-
4233- /**
4234- * Notification/verification options, combinations of UbuntuGpsNiNotifyFlags constants
4235- */
4236- UbuntuGpsNiNotifyFlags notify_flags;
4237-
4238- /**
4239- * Timeout period to wait for user response.
4240- * Set to 0 for no time out limit.
4241- */
4242- int timeout;
4243-
4244- /**
4245- * Default response when time out.
4246- */
4247- UbuntuGpsUserResponseType default_response;
4248-
4249- /**
4250- * Requestor ID
4251- */
4252- char requestor_id[UBUNTU_GPS_NI_SHORT_STRING_MAXLEN];
4253-
4254- /**
4255- * Notification message. It can also be used to store client_id in some cases
4256- */
4257- char text[UBUNTU_GPS_NI_LONG_STRING_MAXLEN];
4258-
4259- /**
4260- * Client name decoding scheme
4261- */
4262- UbuntuGpsNiEncodingType requestor_id_encoding;
4263-
4264- /**
4265- * Client name decoding scheme
4266- */
4267- UbuntuGpsNiEncodingType text_encoding;
4268-
4269- /**
4270- * A pointer to extra data. Format:
4271- * key_1 = value_1
4272- * key_2 = value_2
4273- */
4274- char extras[UBUNTU_GPS_NI_LONG_STRING_MAXLEN];
4275-
4276-} UbuntuGpsNiNotification;
4277-
4278-typedef void (* UbuntuGpsLocationCallback)(UbuntuGpsLocation* location, void* context);
4279-typedef void (* UbuntuGpsStatusCallback)(uint16_t status, void* context);
4280-typedef void (* UbuntuGpsSvStatusCallback)(UbuntuGpsSvStatus* sv_info, void* context);
4281-typedef void (* UbuntuGpsNmeaCallback)(int64_t timestamp, const char* nmea, int length, void* context);
4282-typedef void (* UbuntuGpsSetCapabilities)(uint32_t capabilities, void* context);
4283-typedef void (* UbuntuGpsRequestUtcTime)(void* context);
4284-
4285-/** Callback to request the client to download XTRA data.
4286- * The client should download XTRA data and inject it by calling inject_xtra_data().
4287- */
4288-typedef void (* UbuntuGpsXtraDownloadRequest)(void* context);
4289-
4290-/** Callback with AGPS status information.
4291- */
4292-typedef void (* UbuntuAgpsStatusCallback)(UbuntuAgpsStatus* status, void* context);
4293-
4294-/** Callback with NI notification.
4295- */
4296-typedef void (*UbuntuGpsNiNotifyCallback)(UbuntuGpsNiNotification *notification, void* context);
4297-
4298-/*
4299- Callback for AGPS RIL (Radio Interface Library) set id
4300-*/
4301-typedef void (*UbuntuAgpsRilRequestSetId)(uint32_t flags, void* context);
4302-typedef void (*UbuntuAgpsRilRequestRefLoc)(uint32_t flags, void* context);
4303-
4304-typedef struct
4305-{
4306-
4307- UbuntuGpsLocationCallback location_cb;
4308- UbuntuGpsStatusCallback status_cb;
4309- UbuntuGpsSvStatusCallback sv_status_cb;
4310- UbuntuGpsNmeaCallback nmea_cb;
4311- UbuntuGpsSetCapabilities set_capabilities_cb;
4312- UbuntuGpsRequestUtcTime request_utc_time_cb;
4313-
4314- UbuntuGpsXtraDownloadRequest xtra_download_request_cb;
4315-
4316- UbuntuAgpsStatusCallback agps_status_cb;
4317-
4318- UbuntuGpsNiNotifyCallback gps_ni_notify_cb;
4319-
4320- UbuntuAgpsRilRequestSetId request_setid_cb;
4321- UbuntuAgpsRilRequestRefLoc request_refloc_cb;
4322-
4323- void* context;
4324-} UbuntuGpsParams;
4325-
4326-/*
4327- You must create only one instance per process/application.
4328-*/
4329-UbuntuGps ubuntu_gps_new(UbuntuGpsParams* params);
4330-void ubuntu_gps_delete(UbuntuGps handle);
4331-
4332-bool ubuntu_gps_start(UbuntuGps self);
4333-bool ubuntu_gps_stop(UbuntuGps self);
4334-
4335-/*
4336- \param time NTP time, in milliseconds since Jan 1st 1970.
4337- \param time_reference time from the internal clock at the moment that NTP time was taken.
4338- \param uncertainty possible deviation in the time supplied (uncertainty) in milliseconds.
4339- */
4340-void ubuntu_gps_inject_time(UbuntuGps self, int64_t time, int64_t time_reference, int uncertainty);
4341-
4342-void ubuntu_gps_inject_location(UbuntuGps self, double latitude, double longitude, float accuracy);
4343-void ubuntu_gps_delete_aiding_data(UbuntuGps self, uint16_t flags);
4344-
4345-/*
4346- \param mode One of the UBUNTU_GPS_POSITION_MODE_* values
4347- \param recurrence One of the UBUNTU_GPS_POSITION_RECURRENCE_* values
4348- \param min_interval represents the time between fixes in milliseconds.
4349- \param preferred_accuracy The requested fix accuracy in meters. Can be zero.
4350- \param preferred_time The requested time to first fix in milliseconds. Can be zero.
4351- */
4352-bool ubuntu_gps_set_position_mode(UbuntuGps self, uint32_t mode, uint32_t recurrence,
4353- uint32_t min_interval, uint32_t preferred_accuracy,
4354- uint32_t preferred_time);
4355-void ubuntu_gps_inject_xtra_data(UbuntuGps self, char* data, int length);
4356-
4357-#ifdef __cplusplus
4358-}
4359-#endif
4360-
4361-#endif // UBUNTU_APPLICATION_GPS_H_
4362
4363=== added directory 'include/ubuntu/application/ui'
4364=== removed directory 'include/ubuntu/application/ui'
4365=== removed file 'include/ubuntu/application/ui/clipboard.h'
4366--- include/ubuntu/application/ui/clipboard.h 2013-02-13 12:04:07 +0000
4367+++ include/ubuntu/application/ui/clipboard.h 1970-01-01 00:00:00 +0000
4368@@ -1,91 +0,0 @@
4369-/*
4370- * Copyright © 2012 Canonical Ltd.
4371- *
4372- * This program is free software: you can redistribute it and/or modify
4373- * it under the terms of the GNU General Public License version 3 as
4374- * published by the Free Software Foundation.
4375- *
4376- * This program is distributed in the hope that it will be useful,
4377- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4378- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4379- * GNU General Public License for more details.
4380- *
4381- * You should have received a copy of the GNU General Public License
4382- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4383- *
4384- * Authored by: Thomas Voß <thomas.voss@canonical.com>
4385- */
4386-#ifndef UBUNTU_APPLICATION_UI_CLIPBOARD_H_
4387-#define UBUNTU_APPLICATION_UI_CLIPBOARD_H_
4388-
4389-#include "ubuntu/platform/shared_ptr.h"
4390-
4391-namespace ubuntu
4392-{
4393-namespace application
4394-{
4395-namespace ui
4396-{
4397-/** Models a system-wide clipboard.
4398- * \deprecated This is a temporary solution and is likely to be removed or subject to significant changes in upcoming revisions.
4399- */
4400-class Clipboard : public ubuntu::platform::ReferenceCountedBase
4401-{
4402-public:
4403- typedef ubuntu::platform::shared_ptr<Clipboard> Ptr;
4404-
4405- struct Content
4406- {
4407- static const int MAX_MIME_TYPE_SIZE=32;
4408-
4409- Content() : data(NULL),
4410- data_size(0)
4411- {
4412- }
4413-
4414- Content(const char* mime,
4415- void* _data,
4416- size_t size) : data(malloc(size)),
4417- data_size(size)
4418- {
4419- memcpy(mime_type, mime, MAX_MIME_TYPE_SIZE);
4420- memcpy(data, _data, size);
4421- }
4422-
4423- Content(const Content& rhs) : data(malloc(rhs.data_size)),
4424- data_size(rhs.data_size)
4425- {
4426- memcpy(mime_type, rhs.mime_type, MAX_MIME_TYPE_SIZE);
4427- memcpy(data, rhs.data, data_size);
4428- }
4429-
4430- Content& operator=(const Content& rhs)
4431- {
4432- memcpy(mime_type, rhs.mime_type, MAX_MIME_TYPE_SIZE);
4433- data = realloc(data, rhs.data_size);
4434- memcpy(data, rhs.data, data_size);
4435- data_size = rhs.data_size;
4436-
4437- return *this;
4438- }
4439-
4440- char mime_type[MAX_MIME_TYPE_SIZE];
4441- void* data;
4442- size_t data_size;
4443- };
4444-
4445- virtual void set_content(const Content& content) = 0;
4446- virtual Content get_content() = 0;
4447-
4448-protected:
4449- Clipboard() {}
4450- virtual ~Clipboard() {}
4451-
4452- Clipboard(const Clipboard&) = delete;
4453- Clipboard& operator=(const Clipboard&) = delete;
4454-};
4455-}
4456-}
4457-}
4458-
4459-#endif // UBUNTU_APPLICATION_UI_CLIPBOARD_H_
4460
4461=== removed file 'include/ubuntu/application/ui/form_factor_hint.h'
4462--- include/ubuntu/application/ui/form_factor_hint.h 2013-02-13 12:04:07 +0000
4463+++ include/ubuntu/application/ui/form_factor_hint.h 1970-01-01 00:00:00 +0000
4464@@ -1,44 +0,0 @@
4465-/*
4466- * Copyright © 2012 Canonical Ltd.
4467- *
4468- * This program is free software: you can redistribute it and/or modify
4469- * it under the terms of the GNU Lesser General Public License version 3 as
4470- * published by the Free Software Foundation.
4471- *
4472- * This program is distributed in the hope that it will be useful,
4473- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4474- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4475- * GNU Lesser General Public License for more details.
4476- *
4477- * You should have received a copy of the GNU Lesser General Public License
4478- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4479- *
4480- * Authored by: Thomas Voß <thomas.voss@canonical.com>
4481- */
4482-#ifndef UBUNTU_APPLICATION_UI_FORM_FACTOR_HINT_H_
4483-#define UBUNTU_APPLICATION_UI_FORM_FACTOR_HINT_H_
4484-
4485-#include "ubuntu/application/ui/ubuntu_application_ui.h"
4486-
4487-namespace ubuntu
4488-{
4489-namespace application
4490-{
4491-namespace ui
4492-{
4493-/** Provides applications with a hint about the form factor it is running on. */
4494-enum FormFactorHint
4495-{
4496- desktop_form_factor = DESKTOP_FORM_FACTOR_HINT, ///< An ordinary desktop or laptop form factor.
4497- phone_form_factor = PHONE_FORM_FACTOR_HINT, ///< A phone form factor.
4498- tablet_form_factor = TABLET_FORM_FACTOR_HINT ///< A tablet form factor.
4499-};
4500-
4501-/** Bitfield as multiple form factor hints can be applied in a converged scenario. */
4502-typedef unsigned int FormFactorHintFlags;
4503-
4504-}
4505-}
4506-}
4507-
4508-#endif // UBUNTU_APPLICATION_UI_FORM_FACTOR_HINT_H_
4509
4510=== removed file 'include/ubuntu/application/ui/init.h'
4511--- include/ubuntu/application/ui/init.h 2013-02-13 12:04:07 +0000
4512+++ include/ubuntu/application/ui/init.h 1970-01-01 00:00:00 +0000
4513@@ -1,35 +0,0 @@
4514-/*
4515- * Copyright © 2012 Canonical Ltd.
4516- *
4517- * This program is free software: you can redistribute it and/or modify
4518- * it under the terms of the GNU Lesser General Public License version 3 as
4519- * published by the Free Software Foundation.
4520- *
4521- * This program is distributed in the hope that it will be useful,
4522- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4523- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4524- * GNU Lesser General Public License for more details.
4525- *
4526- * You should have received a copy of the GNU Lesser General Public License
4527- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4528- *
4529- * Authored by: Thomas Voß <thomas.voss@canonical.com>
4530- */
4531-#ifndef UBUNTU_APPLICATION_UI_INIT_H_
4532-#define UBUNTU_APPLICATION_UI_INIT_H_
4533-
4534-namespace ubuntu
4535-{
4536-namespace application
4537-{
4538-namespace ui
4539-{
4540-/** Initializes internals with the given command line arguments.
4541- * \attention Has to be called before any other function is called.
4542- */
4543-void init(int argc, char** argv);
4544-}
4545-}
4546-}
4547-
4548-#endif // UBUNTU_APPLICATION_UI_INIT_H_
4549
4550=== added directory 'include/ubuntu/application/ui/input'
4551=== removed directory 'include/ubuntu/application/ui/input'
4552=== added file 'include/ubuntu/application/ui/input/event.h'
4553--- include/ubuntu/application/ui/input/event.h 1970-01-01 00:00:00 +0000
4554+++ include/ubuntu/application/ui/input/event.h 2013-05-28 11:49:27 +0000
4555@@ -0,0 +1,106 @@
4556+/*
4557+ * Copyright © 2012 Canonical Ltd.
4558+ *
4559+ * This program is free software: you can redistribute it and/or modify
4560+ * it under the terms of the GNU Lesser General Public License version 3 as
4561+ * published by the Free Software Foundation.
4562+ *
4563+ * This program is distributed in the hope that it will be useful,
4564+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4565+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4566+ * GNU Lesser General Public License for more details.
4567+ *
4568+ * You should have received a copy of the GNU Lesser General Public License
4569+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4570+ *
4571+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
4572+ */
4573+#ifndef UBUNTU_APPLICATION_UI_INPUT_EVENT_H_
4574+#define UBUNTU_APPLICATION_UI_INPUT_EVENT_H_
4575+
4576+#include <stddef.h>
4577+#include <stdint.h>
4578+
4579+#ifdef __cplusplus
4580+extern "C" {
4581+#endif
4582+
4583+ /** Maximum number of pointers reported within one input event. */
4584+#define UBUNTU_APPLICATION_UI_INPUT_EVENT_MAX_POINTER_COUNT (16)
4585+
4586+ /** Reference timebase, nanoseconds as measured by CLOCK_MONOTONIC. */
4587+ typedef int64_t nsecs_t;
4588+
4589+ /** Describes the different event types. */
4590+ typedef enum
4591+ {
4592+ KEY_EVENT_TYPE, ///< Event originates from a keyboard.
4593+ MOTION_EVENT_TYPE, ///< Event originates from something moving, e.g., a wheel, a mouse, a finger on a touchpad.
4594+ HW_SWITCH_EVENT_TYPE ///< Event originates from an additional button attached to the device's HW, e.g., power button.
4595+ } EventType;
4596+
4597+ /** Models an input event. */
4598+ typedef struct
4599+ {
4600+ EventType type; ///< Type of the event.
4601+ int32_t device_id; ///< Device that this event originated from.
4602+ int32_t source_id; ///< Source that this event originated from.
4603+ int32_t action; ///< Action signalled by this event.
4604+ int32_t flags; ///< Flags associated with this event.
4605+ int32_t meta_state; ///< State of the meta modifiers (ALT, CTRL, SHIFT).
4606+ /** Information specific to key/motion event types. */
4607+ union
4608+ {
4609+ /** Information describing an event originating from a HW switch. */
4610+ struct HardwareSwitchEvent
4611+ {
4612+ nsecs_t event_time; ///< Timestamp when the event happened.
4613+ uint32_t policy_flags; ///< Policy flags.
4614+ int32_t switch_code; ///< The scan code of the switch.
4615+ int32_t switch_value; ///< The value reported by the switch.
4616+ } hw_switch;
4617+ /** Information describing an event originating from a keyboard key. */
4618+ struct KeyEvent
4619+ {
4620+ int32_t key_code;
4621+ int32_t scan_code;
4622+ int32_t repeat_count;
4623+ nsecs_t down_time;
4624+ nsecs_t event_time;
4625+ int is_system_key; ///< \deprecated Do not use.
4626+ } key;
4627+ /** Information describing an event originating from a
4628+ * "moving" device, e.g., a mouse, a mouse-wheel, a finger
4629+ * on a touchpad.
4630+ */
4631+ struct MotionEvent
4632+ {
4633+ int32_t edge_flags; ///< Set for touches intersecting a touchscreen's edges, requires HW support.
4634+ int32_t button_state; ///< State of buttons of the device
4635+ float x_offset; ///< Movement in x direction since down event
4636+ float y_offset; ///< Movement in y direction since down event
4637+ float x_precision; ///< Sampling precision in x direction
4638+ float y_precision; ///< Sampling precision in y direction
4639+ nsecs_t down_time; ///< Timestamp that marks the down event
4640+ nsecs_t event_time; ///< Timestamp that marks when this event happened
4641+ size_t pointer_count; ///< Number of pointers reported in this event
4642+ struct PointerCoordinate
4643+ {
4644+ int id; ///< Unique id of the pointer
4645+ float x, raw_x; ///< Processed and raw x coordinates
4646+ float y, raw_y; ///< Processed and raw y coordinates
4647+ float touch_major; ///< Touch major coordinate
4648+ float touch_minor; ///< Touch minor coordinate
4649+ float size; ///< Size of the pointer/touch
4650+ float pressure; ///< Pressure of the touch
4651+ float orientation; ///< Orientation
4652+ } pointer_coordinates[UBUNTU_APPLICATION_UI_INPUT_EVENT_MAX_POINTER_COUNT]; ///< Pointer information, valid from [0,pointer_count).
4653+ } motion;
4654+ } details;
4655+ } Event;
4656+
4657+#ifdef __cplusplus
4658+}
4659+#endif
4660+
4661+#endif // UBUNTU_APPLICATION_UI_INPUT_EVENT_H_
4662
4663=== removed file 'include/ubuntu/application/ui/input/event.h'
4664--- include/ubuntu/application/ui/input/event.h 2013-02-18 13:16:26 +0000
4665+++ include/ubuntu/application/ui/input/event.h 1970-01-01 00:00:00 +0000
4666@@ -1,106 +0,0 @@
4667-/*
4668- * Copyright © 2012 Canonical Ltd.
4669- *
4670- * This program is free software: you can redistribute it and/or modify
4671- * it under the terms of the GNU Lesser General Public License version 3 as
4672- * published by the Free Software Foundation.
4673- *
4674- * This program is distributed in the hope that it will be useful,
4675- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4676- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4677- * GNU Lesser General Public License for more details.
4678- *
4679- * You should have received a copy of the GNU Lesser General Public License
4680- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4681- *
4682- * Authored by: Thomas Voß <thomas.voss@canonical.com>
4683- */
4684-#ifndef UBUNTU_APPLICATION_UI_INPUT_EVENT_H_
4685-#define UBUNTU_APPLICATION_UI_INPUT_EVENT_H_
4686-
4687-#include <stddef.h>
4688-#include <stdint.h>
4689-
4690-#ifdef __cplusplus
4691-extern "C" {
4692-#endif
4693-
4694- /** Maximum number of pointers reported within one input event. */
4695-#define UBUNTU_APPLICATION_UI_INPUT_EVENT_MAX_POINTER_COUNT (16)
4696-
4697- /** Reference timebase, nanoseconds as measured by CLOCK_MONOTONIC. */
4698- typedef int64_t nsecs_t;
4699-
4700- /** Describes the different event types. */
4701- typedef enum
4702- {
4703- KEY_EVENT_TYPE, ///< Event originates from a keyboard.
4704- MOTION_EVENT_TYPE, ///< Event originates from something moving, e.g., a wheel, a mouse, a finger on a touchpad.
4705- HW_SWITCH_EVENT_TYPE ///< Event originates from an additional button attached to the device's HW, e.g., power button.
4706- } EventType;
4707-
4708- /** Models an input event. */
4709- typedef struct
4710- {
4711- EventType type; ///< Type of the event.
4712- int32_t device_id; ///< Device that this event originated from.
4713- int32_t source_id; ///< Source that this event originated from.
4714- int32_t action; ///< Action signalled by this event.
4715- int32_t flags; ///< Flags associated with this event.
4716- int32_t meta_state; ///< State of the meta modifiers (ALT, CTRL, SHIFT).
4717- /** Information specific to key/motion event types. */
4718- union
4719- {
4720- /** Information describing an event originating from a HW switch. */
4721- struct HardwareSwitchEvent
4722- {
4723- nsecs_t event_time; ///< Timestamp when the event happened.
4724- uint32_t policy_flags; ///< Policy flags.
4725- int32_t switch_code; ///< The scan code of the switch.
4726- int32_t switch_value; ///< The value reported by the switch.
4727- } hw_switch;
4728- /** Information describing an event originating from a keyboard key. */
4729- struct KeyEvent
4730- {
4731- int32_t key_code;
4732- int32_t scan_code;
4733- int32_t repeat_count;
4734- nsecs_t down_time;
4735- nsecs_t event_time;
4736- int is_system_key; ///< \deprecated Do not use.
4737- } key;
4738- /** Information describing an event originating from a
4739- * "moving" device, e.g., a mouse, a mouse-wheel, a finger
4740- * on a touchpad.
4741- */
4742- struct MotionEvent
4743- {
4744- int32_t edge_flags; ///< Set for touches intersecting a touchscreen's edges, requires HW support.
4745- int32_t button_state; ///< State of buttons of the device
4746- float x_offset; ///< Movement in x direction since down event
4747- float y_offset; ///< Movement in y direction since down event
4748- float x_precision; ///< Sampling precision in x direction
4749- float y_precision; ///< Sampling precision in y direction
4750- nsecs_t down_time; ///< Timestamp that marks the down event
4751- nsecs_t event_time; ///< Timestamp that marks when this event happened
4752- size_t pointer_count; ///< Number of pointers reported in this event
4753- struct PointerCoordinate
4754- {
4755- int id; ///< Unique id of the pointer
4756- float x, raw_x; ///< Processed and raw x coordinates
4757- float y, raw_y; ///< Processed and raw y coordinates
4758- float touch_major; ///< Touch major coordinate
4759- float touch_minor; ///< Touch minor coordinate
4760- float size; ///< Size of the pointer/touch
4761- float pressure; ///< Pressure of the touch
4762- float orientation; ///< Orientation
4763- } pointer_coordinates[UBUNTU_APPLICATION_UI_INPUT_EVENT_MAX_POINTER_COUNT]; ///< Pointer information, valid from [0,pointer_count).
4764- } motion;
4765- } details;
4766- } Event;
4767-
4768-#ifdef __cplusplus
4769-}
4770-#endif
4771-
4772-#endif // UBUNTU_APPLICATION_UI_INPUT_EVENT_H_
4773
4774=== removed file 'include/ubuntu/application/ui/input/listener.h'
4775--- include/ubuntu/application/ui/input/listener.h 2013-02-18 12:37:16 +0000
4776+++ include/ubuntu/application/ui/input/listener.h 1970-01-01 00:00:00 +0000
4777@@ -1,53 +0,0 @@
4778-/*
4779- * Copyright © 2012 Canonical Ltd.
4780- *
4781- * This program is free software: you can redistribute it and/or modify
4782- * it under the terms of the GNU Lesser General Public License version 3 as
4783- * published by the Free Software Foundation.
4784- *
4785- * This program is distributed in the hope that it will be useful,
4786- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4787- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4788- * GNU Lesser General Public License for more details.
4789- *
4790- * You should have received a copy of the GNU Lesser General Public License
4791- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4792- *
4793- * Authored by: Thomas Voß <thomas.voss@canonical.com>
4794- */
4795-#ifndef UBUNTU_APPLICATION_UI_INPUT_LISTENER_H_
4796-#define UBUNTU_APPLICATION_UI_INPUT_LISTENER_H_
4797-
4798-#include "ubuntu/application/ui/input/event.h"
4799-#include "ubuntu/platform/shared_ptr.h"
4800-
4801-namespace ubuntu
4802-{
4803-namespace application
4804-{
4805-namespace ui
4806-{
4807-namespace input
4808-{
4809-/** Models a listener for classic input event originating from input devices like mice or touchpads. */
4810-class Listener : public ubuntu::platform::ReferenceCountedBase
4811-{
4812-public:
4813- typedef ubuntu::platform::shared_ptr<Listener> Ptr;
4814-
4815- /** Invoked whenever a new event is available. */
4816- virtual void on_new_event(const Event& event) = 0;
4817-
4818-protected:
4819- Listener() {}
4820- virtual ~Listener() {}
4821-
4822- Listener(const Listener&) = delete;
4823- Listener& operator=(const Listener&) = delete;
4824-};
4825-}
4826-}
4827-}
4828-}
4829-
4830-#endif // UBUNTU_APPLICATION_UI_INPUT_LISTENER_H_
4831
4832=== removed file 'include/ubuntu/application/ui/physical_display_info.h'
4833--- include/ubuntu/application/ui/physical_display_info.h 2013-02-13 12:04:07 +0000
4834+++ include/ubuntu/application/ui/physical_display_info.h 1970-01-01 00:00:00 +0000
4835@@ -1,77 +0,0 @@
4836-/*
4837- * Copyright © 2012 Canonical Ltd.
4838- *
4839- * This program is free software: you can redistribute it and/or modify
4840- * it under the terms of the GNU Lesser General Public License version 3 as
4841- * published by the Free Software Foundation.
4842- *
4843- * This program is distributed in the hope that it will be useful,
4844- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4845- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4846- * GNU Lesser General Public License for more details.
4847- *
4848- * You should have received a copy of the GNU Lesser General Public License
4849- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4850- *
4851- * Authored by: Thomas Voß <thomas.voss@canonical.com>
4852- */
4853-#ifndef UBUNTU_APPLICATION_UI_PHYSICAL_DISPLAY_INFO_H_
4854-#define UBUNTU_APPLICATION_UI_PHYSICAL_DISPLAY_INFO_H_
4855-
4856-#include "ubuntu/platform/shared_ptr.h"
4857-
4858-namespace ubuntu
4859-{
4860-namespace application
4861-{
4862-namespace ui
4863-{
4864-
4865-/**
4866- * Marks physical displays connected to the system
4867- */
4868-enum PhysicalDisplayIdentifier
4869-{
4870- first_physical_display = 0,
4871- second_physical_display = 1,
4872- third_physical_display = 2,
4873- fourth_physical_display = 3,
4874- fifth_physical_display = 4,
4875- sixth_physical_display = 5,
4876- seventh_physical_display = 6,
4877- eigth_physical_display = 7,
4878- ninth_physical_display = 8,
4879- tenth_physical_display = 9,
4880-
4881- primary_physical_display = first_physical_display
4882-};
4883-
4884-/**
4885- * Models information about a physical display.
4886- */
4887-class PhysicalDisplayInfo : public ubuntu::platform::ReferenceCountedBase
4888-{
4889-public:
4890- typedef ubuntu::platform::shared_ptr<PhysicalDisplayInfo> Ptr;
4891-
4892- /** Access to the horizontal dpi of the physical display. */
4893- virtual float horizontal_dpi() = 0;
4894- /** Access to the vertical dpi of the physical display. */
4895- virtual float vertical_dpi() = 0;
4896- /** Access to the horizontal resolution of the physical display. */
4897- virtual int horizontal_resolution() = 0;
4898- /** Access to the vertical resolution of the physical display. */
4899- virtual int vertical_resolution() = 0;
4900-
4901-protected:
4902- PhysicalDisplayInfo() {}
4903- virtual ~PhysicalDisplayInfo() {}
4904-
4905- PhysicalDisplayInfo(const PhysicalDisplayInfo&) = delete;
4906- PhysicalDisplayInfo& operator=(const PhysicalDisplayInfo&) = delete;
4907-};
4908-}
4909-}
4910-}
4911-
4912-#endif // UBUNTU_APPLICATION_UI_PHYSICAL_DISPLAY_INFO_H_
4913
4914=== removed file 'include/ubuntu/application/ui/session.h'
4915--- include/ubuntu/application/ui/session.h 2013-02-19 12:36:06 +0000
4916+++ include/ubuntu/application/ui/session.h 1970-01-01 00:00:00 +0000
4917@@ -1,86 +0,0 @@
4918-/*
4919- * Copyright © 2012 Canonical Ltd.
4920- *
4921- * This program is free software: you can redistribute it and/or modify
4922- * it under the terms of the GNU Lesser General Public License version 3 as
4923- * published by the Free Software Foundation.
4924- *
4925- * This program is distributed in the hope that it will be useful,
4926- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4927- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4928- * GNU Lesser General Public License for more details.
4929- *
4930- * You should have received a copy of the GNU Lesser General Public License
4931- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4932- *
4933- * Authored by: Thomas Voß <thomas.voss@canonical.com>
4934- */
4935-#ifndef UBUNTU_APPLICATION_UI_SESSION_H_
4936-#define UBUNTU_APPLICATION_UI_SESSION_H_
4937-
4938-#include "ubuntu/application/session.h"
4939-#include "ubuntu/application/ui/clipboard.h"
4940-#include "ubuntu/application/ui/physical_display_info.h"
4941-#include "ubuntu/application/ui/surface.h"
4942-#include "ubuntu/application/ui/surface_properties.h"
4943-#include "ubuntu/platform/shared_ptr.h"
4944-
4945-#include <EGL/egl.h>
4946-
4947-namespace ubuntu
4948-{
4949-namespace application
4950-{
4951-namespace ui
4952-{
4953-/**
4954- * Represents a session with the service providers abstracted by
4955- * Ubuntu platform API and allows for accessing ui-specific
4956- * functionality.
4957- */
4958-class Session : public ubuntu::application::Session
4959-{
4960-public:
4961- typedef ubuntu::platform::shared_ptr<Session> Ptr;
4962-
4963- /** Provides access to the system-wide clipboard. */
4964- static Clipboard::Ptr clipboard();
4965-
4966- /** Provides system-wide access to the physical displays known to the system.
4967- * \sa PhysicalDisplayIdentifier
4968- * \sa PhysicalDisplayInfo
4969- */
4970- static PhysicalDisplayInfo::Ptr physical_display_info(PhysicalDisplayIdentifier id);
4971-
4972- /** Requests a surface from the system.
4973- * \param [in] props Requested properties for the surface
4974- * \param [in] listener Event receiver for input events
4975- * \return Pointer to the surface instance or NULL.
4976- */
4977- virtual Surface::Ptr create_surface(
4978- const SurfaceProperties& props,
4979- const ubuntu::application::ui::input::Listener::Ptr& listener) = 0;
4980-
4981- /** Requests the PID for the running session. */
4982- virtual int get_session_pid() = 0;
4983-
4984- /** Destroys the surface and renders it unusable. */
4985- virtual void destroy_surface(const Surface::Ptr& surface) = 0;
4986-
4987- /** Requests the surface to be shown in fullscreen.
4988- * \param [in] surface The surface to transition to fullscreen.
4989- */
4990- virtual void toggle_fullscreen_for_surface(const Surface::Ptr& surface) = 0;
4991-
4992-protected:
4993- Session() {}
4994- virtual ~Session() {}
4995-
4996- Session(const Session&) = delete;
4997- Session& operator=(const Session&) = delete;
4998-};
4999-}
5000-}
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches