add event_keep_last_event_data api
[platform/core/api/application.git] / include / app_event.h
1 /*
2  * Copyright (c) 2015 - 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18 #ifndef __TIZEN_APPFW_EVENT_H__
19 #define __TIZEN_APPFW_EVENT_H__
20
21 #include <bundle.h>
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 /**
28  * @file event.h
29  */
30
31 /**
32  * @addtogroup CAPI_EVENT_MODULE
33  * @{
34  */
35
36
37 /**
38  * @brief Event handle.
39  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
40  */
41 typedef struct event_handler *event_handler_h;
42
43 /**
44  * @brief Event callback.
45  *
46  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
47  * @param[in] event_name The interested event name
48  * @param[in] event_data The data of interested event
49  * @param[in] user_data The user data set by event_add_event_handler()
50  * @see event_add_event_handler
51  */
52 typedef void (*event_cb)(const char *event_name, bundle *event_data, void *user_data);
53
54 /**
55  * @brief Enumeration for Event Error.
56  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
57  */
58 typedef enum {
59         EVENT_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
60         EVENT_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
61         EVENT_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
62         EVENT_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< Time out */
63         EVENT_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< IO error */
64         EVENT_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED /**< Permisiion denied */
65 } event_error_e;
66
67 /**
68  * @brief Definition for system-event of battery : charger status.
69  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
70  * @remarks If there is earlier occurrence regarding this event, you will receive the event as soon as you register event handler for this event. You can use this earlier event-data as initial value.
71  * @see EVENT_KEY_BATTERY_CHARGER_STATUS
72  */
73 #define SYSTEM_EVENT_BATTERY_CHARGER_STATUS "tizen.system.event.battery_charger_status"
74
75 /**
76  * @brief Definition for key of SYSTEM_EVENT_BATTERY_CHARGER_STATUS.
77  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
78  * @see EVENT_VAL_BATTERY_CHARGER_DISCONNECTED
79  * @see EVENT_VAL_BATTERY_CHARGER_CONNECTED
80  * @see EVENT_VAL_BATTERY_CHARGER_CHARGING
81  * @see EVENT_VAL_BATTERY_CHARGER_DISCHARGING
82  */
83 #define EVENT_KEY_BATTERY_CHARGER_STATUS "battery_charger_status"
84
85 /**
86  * @brief Definition for value of EVENT_KEY_BATTERY_CHARGER_STATUS.
87  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
88  * @remarks charger disconnected
89  */
90 #define EVENT_VAL_BATTERY_CHARGER_DISCONNECTED "disconnected"
91
92 /**
93  * @brief Definition for value of EVENT_KEY_BATTERY_CHARGER_STATUS.
94  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
95  * @remarks charger connected
96  */
97 #define EVENT_VAL_BATTERY_CHARGER_CONNECTED "connected"
98
99 /**
100  * @brief Definition for value of EVENT_KEY_BATTERY_CHARGER_STATUS.
101  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
102  * @remarks charging is enabled
103  */
104 #define EVENT_VAL_BATTERY_CHARGER_CHARGING "charging"
105
106 /**
107  * @brief Definition for value of EVENT_KEY_BATTERY_CHARGER_STATUS.
108  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
109  * @remarks charging is disabled
110  */
111 #define EVENT_VAL_BATTERY_CHARGER_DISCHARGING "discharging"
112
113 /**
114  * @brief Definition for system-event of battery : level status.
115  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
116  * @see EVENT_KEY_BATTERY_LEVEL_STATUS
117  */
118 #define SYSTEM_EVENT_BATTERY_LEVEL_STATUS "tizen.system.event.battery_level_status"
119
120 /**
121  * @brief Definition for key of SYSTEM_EVENT_BATTERY_LEVEL_STATUS.
122  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
123  * @see EVENT_VAL_BATTERY_LEVEL_EMPTY
124  * @see EVENT_VAL_BATTERY_LEVEL_CRITICAL
125  * @see EVENT_VAL_BATTERY_LEVEL_LOW
126  * @see EVENT_VAL_BATTERY_LEVEL_HIGH
127  * @see EVENT_VAL_BATTERY_LEVEL_FULL
128  */
129 #define EVENT_KEY_BATTERY_LEVEL_STATUS "battery_level_status"
130
131 /**
132  * @brief Definition for value of EVENT_KEY_BATTERY_LEVEL_STATUS.
133  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
134  */
135 #define EVENT_VAL_BATTERY_LEVEL_EMPTY "empty"
136
137 /**
138  * @brief Definition for value of EVENT_KEY_BATTERY_LEVEL_STATUS.
139  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
140  */
141 #define EVENT_VAL_BATTERY_LEVEL_CRITICAL "critical"
142
143 /**
144  * @brief Definition for value of EVENT_KEY_BATTERY_LEVEL_STATUS.
145  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
146  */
147 #define EVENT_VAL_BATTERY_LEVEL_LOW "low"
148
149 /**
150  * @brief Definition for value of EVENT_KEY_BATTERY_LEVEL_STATUS.
151  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
152  */
153 #define EVENT_VAL_BATTERY_LEVEL_HIGH "high"
154
155 /**
156  * @brief Definition for value of EVENT_KEY_BATTERY_LEVEL_STATUS.
157  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
158  */
159 #define EVENT_VAL_BATTERY_LEVEL_FULL "full"
160
161 /**
162  * @brief Definition for system-event of usb : status of usb connection.
163  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
164  * @see EVENT_KEY_USB_STATUS
165  */
166 #define SYSTEM_EVENT_USB_STATUS "tizen.system.event.usb_status"
167
168 /**
169  * @brief Definition for key of SYSTEM_EVENT_USB_STATUS.
170  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
171  * @see EVENT_VAL_USB_DISCONNECTED
172  * @see EVENT_VAL_USB_CONNECTED
173  * @see EVENT_VAL_USB_AVAILABLE
174  */
175 #define EVENT_KEY_USB_STATUS "usb_status"
176
177 /**
178  * @brief Definition for value of EVENT_KEY_USB_STATUS.
179  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
180  */
181 #define EVENT_VAL_USB_DISCONNECTED "disconnected"
182
183 /**
184  * @brief Definition for value of EVENT_KEY_USB_STATUS.
185  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
186  * @remarks Connected but not-available.
187  */
188 #define EVENT_VAL_USB_CONNECTED "connected"
189
190 /**
191  * @brief Definition for value of EVENT_KEY_USB_STATUS.
192  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
193  */
194 #define EVENT_VAL_USB_AVAILABLE "available"
195
196 /**
197  * @brief Definition for system-event of ear-jack : status of ear-jack connection.
198  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
199  * @see EVENT_KEY_EARJACK_STATUS
200  */
201 #define SYSTEM_EVENT_EARJACK_STATUS "tizen.system.event.earjack_status"
202
203 /**
204  * @brief Definition for key of SYSTEM_EVENT_EARJACK_STATUS.
205  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
206  * @see EVENT_VAL_EARJACK_DISCONNECTED
207  * @see EVENT_VAL_EARJACK_CONNECTED
208  */
209 #define EVENT_KEY_EARJACK_STATUS "earjack_status"
210
211 /**
212  * @brief Definition for value of EVENT_KEY_EARJACK_STATUS.
213  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
214  */
215 #define EVENT_VAL_EARJACK_DISCONNECTED "disconnected"
216
217 /**
218  * @brief Definition for value of EVENT_KEY_EARJACK_STATUS.
219  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
220  */
221 #define EVENT_VAL_EARJACK_CONNECTED "connected"
222
223 /**
224  * @brief Definition for system-event of display : state of display.
225  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
226  * @privilege %http://tizen.org/privilege/display
227  * @remarks If you want to receive this event, you must declare this privilege.
228  * @see EVENT_KEY_DISPLAY_STATE
229  */
230 #define SYSTEM_EVENT_DISPLAY_STATE "tizen.system.event.display_state"
231
232 /**
233  * @brief Definition for key of SYSTEM_EVENT_DISPLAY_STATE.
234  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
235  * @see EVENT_VAL_DISPLAY_NORMAL
236  * @see EVENT_VAL_DISPLAY_DIM
237  * @see EVENT_VAL_DISPLAY_OFF
238  */
239 #define EVENT_KEY_DISPLAY_STATE "display_state"
240
241 /**
242  * @brief Definition for value of EVENT_KEY_DISPLAY_STATE.
243  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
244  */
245 #define EVENT_VAL_DISPLAY_NORMAL "normal"
246
247 /**
248  * @brief Definition for value of EVENT_KEY_DISPLAY_STATE.
249  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
250  */
251 #define EVENT_VAL_DISPLAY_DIM "dim"
252
253 /**
254  * @brief Definition for value of EVENT_KEY_DISPLAY_STATE.
255  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
256  */
257 #define EVENT_VAL_DISPLAY_OFF "off"
258
259 /**
260  * @brief Definition for system-event of system : boot completion.
261  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
262  * @remarks There is no corresponding key/value.
263  * @remarks You can treat the initial value as "false" before you receive this event.
264  * @remarks If it's already boot-completed state before you regiser event handler, you can receive the event as soon as you register the event handler.
265  */
266 #define SYSTEM_EVENT_BOOT_COMPLETED "tizen.system.event.boot_completed"
267
268 /**
269  * @brief Definition for system-event of system : shutdown.
270  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
271  * @remarks There is no corresponding key/value.
272  * @remarks You can treat the inital value as "false" before you receive this event.
273  * @remarks If it's already shutting-down state before you regiser event handler, you can receive the event as soon as you register the event handler.
274 */
275 #define SYSTEM_EVENT_SYSTEM_SHUTDOWN "tizen.system.event.system_shutdown"
276
277 /**
278  * @brief Definition for system-event of system : low memory.
279  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
280  * @see EVENT_KEY_LOW_MEMORY
281  */
282 #define SYSTEM_EVENT_LOW_MEMORY "tizen.system.event.low_memory"
283
284 /**
285  * @brief Definition for key of SYSTEM_EVENT_LOW_MEMORY.
286  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
287  * @remarks If there is earlier occurrence regarding this event, you will receive the event as soon as you register event handler for this event. You can use this earlier event-data as initial value.
288  * @see EVENT_VAL_MEMORY_NORMAL
289  * @see EVENT_VAL_MEMORY_SOFT_WARNING
290  * @see EVENT_VAL_MEMORY_HARD_WARNING
291  */
292 #define EVENT_KEY_LOW_MEMORY "low_memory"
293
294 /**
295  * @brief Definition for value of EVENT_KEY_LOW_MEMORY.
296  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
297  */
298 #define EVENT_VAL_MEMORY_NORMAL "normal"
299
300 /**
301  * @brief Definition for value of EVENT_KEY_LOW_MEMORY.
302  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
303  */
304 #define EVENT_VAL_MEMORY_SOFT_WARNING "soft_warning"
305
306 /**
307  * @brief Definition for value of EVENT_KEY_LOW_MEMORY.
308  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
309  */
310 #define EVENT_VAL_MEMORY_HARD_WARNING "hard_warning"
311
312 /**
313  * @brief Definition for system-event of wifi : state of wifi.
314  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
315  * @privilege %http://tizen.org/privilege/network.get
316  * @remarks If you want to receive this event, you must declare this privilege.
317  * @see EVENT_KEY_WIFI_STATE
318  */
319 #define SYSTEM_EVENT_WIFI_STATE "tizen.system.event.wifi_state"
320
321 /**
322  * @brief Definition for key of SYSTEM_EVENT_WIFI_STATE.
323  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
324  * @see EVENT_VAL_WIFI_OFF
325  * @see EVENT_VAL_WIFI_ON
326  * @see EVENT_VAL_WIFI_CONNECTED
327  */
328 #define EVENT_KEY_WIFI_STATE "wifi_state"
329
330 /**
331  * @brief Definition for value of EVENT_KEY_WIFI_STATE.
332  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
333  */
334 #define EVENT_VAL_WIFI_OFF "off"
335
336 /**
337  * @brief Definition for value of EVENT_KEY_WIFI_STATE.
338  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
339  */
340 #define EVENT_VAL_WIFI_ON "on"
341
342 /**
343  * @brief Definition for value of EVENT_KEY_WIFI_STATE.
344  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
345  */
346 #define EVENT_VAL_WIFI_CONNECTED "connected"
347
348 /**
349  * @brief Definition for system-event of bluetooth : status of bluetooth.
350  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
351  * @see EVENT_KEY_BT_STATE
352  * @see EVENT_KEY_BT_LE_STATE
353  * @see EVENT_KEY_BT_TRANSFERING_STATE
354  */
355 #define SYSTEM_EVENT_BT_STATE "tizen.system.event.bt_state"
356
357 /**
358  * @brief Definition for key of SYSTEM_EVENT_BT_STATE.
359  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
360  * @see EVENT_VAL_BT_STATE_OFF
361  * @see EVENT_VAL_BT_STATE_ON
362  */
363 #define EVENT_KEY_BT_STATE "bt_state"
364
365 /**
366  * @brief Definition for value of EVENT_KEY_BT_STATE.
367  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
368  */
369 #define EVENT_VAL_BT_OFF "off"
370
371 /**
372  * @brief Definition for value of EVENT_KEY_BT_STATE.
373  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
374  */
375 #define EVENT_VAL_BT_ON "on"
376
377 /**
378  * @brief Definition for key of SYSTEM_EVENT_BT_STATE.
379  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
380  * @see EVENT_VAL_BT_LE_STATE_OFF
381  * @see EVENT_VAL_BT_LE_STATE_ON
382  */
383 #define EVENT_KEY_BT_LE_STATE "bt_le_state"
384
385 /**
386  * @brief Definition for value of EVENT_KEY_BT_LE_STATE.
387  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
388  */
389 #define EVENT_VAL_BT_LE_OFF "off"
390
391 /**
392  * @brief Definition for value of EVENT_KEY_BT_LE_STATE.
393  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
394  */
395 #define EVENT_VAL_BT_LE_ON "on"
396
397 /**
398  * @brief Definition for key of SYSTEM_EVENT_BT_STATE.
399  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
400  * @remarks If it's already transfering state before you register this event, you can't receive the event regarding current transfer but you can receive the following transfers.
401  * @see EVENT_VAL_BT_NON_TRANSFERING
402  * @see EVENT_VAL_BT_TRANSFERING
403  */
404 #define EVENT_KEY_BT_TRANSFERING_STATE "bt_transfering_state"
405
406 /**
407  * @brief Definition for value of EVENT_KEY_BT_TRANSFERING_STATE.
408  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
409  */
410 #define EVENT_VAL_BT_NON_TRANSFERING "non_transfering"
411
412 /**
413  * @brief Definition for value of EVENT_KEY_BT_TRANSFERING_STATE.
414  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
415  */
416 #define EVENT_VAL_BT_TRANSFERING "transfering"
417
418 /**
419  * @brief Definition for system-event of location : enable state of location.
420  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
421  * @see EVENT_KEY_LOCATION_ENABLE_STATE
422  */
423 #define SYSTEM_EVENT_LOCATION_ENABLE_STATE "tizen.system.event.location_enable_state"
424
425 /**
426  * @brief Definition for key of SYSTEM_EVENT_LOCATION_ENABLE_STATE.
427  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
428  * @see EVENT_VAL_LOCATION_DISABLED
429  * @see EVENT_VAL_LOCATION_ENABLED
430  */
431 #define EVENT_KEY_LOCATION_ENABLE_STATE "location_enable_state"
432
433 /**
434  * @brief Definition for value of EVENT_KEY_LOCATION_ENABLE_STATE.
435  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
436  */
437 #define EVENT_VAL_LOCATION_DISABLED "disabled"
438
439 /**
440  * @brief Definition for value of EVENT_KEY_LOCATION_ENABLE_STATE.
441  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
442  */
443 #define EVENT_VAL_LOCATION_ENABLED "enabled"
444
445 /**
446  * @brief Definition for system-event of location : enable state of gps.
447  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
448  * @see EVENT_KEY_GPS_ENABLE_STATE
449  */
450 #define SYSTEM_EVENT_GPS_ENABLE_STATE "tizen.system.event.gps_enable_state"
451
452 /**
453  * @brief Definition for key of SYSTEM_EVENT_GPS_ENABLE_STATE.
454  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
455  * @see EVENT_VAL_GPS_DISABLED
456  * @see EVENT_VAL_GPS_ENABLED
457  */
458 #define EVENT_KEY_GPS_ENABLE_STATE "gps_enable_state"
459
460 /**
461  * @brief Definition for value of EVENT_KEY_GPS_ENABLE_STATE.
462  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
463  */
464 #define EVENT_VAL_GPS_DISABLED "disabled"
465
466 /**
467  * @brief Definition for value of EVENT_KEY_GPS_ENABLE_STATE.
468  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
469  */
470 #define EVENT_VAL_GPS_ENABLED "enabled"
471
472 /**
473  * @brief Definition for system-event of location : enable state of nps.
474  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
475  * @see EVENT_KEY_NPS_ENABLE_STATE
476  */
477 #define SYSTEM_EVENT_NPS_ENABLE_STATE "tizen.system.event.nps_enable_state"
478
479 /**
480  * @brief Definition for key of SYSTEM_EVENT_NPS_ENABLE_STATE.
481  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
482  * @see EVENT_VAL_NPS_DISABLED
483  * @see EVENT_VAL_NPS_ENABLED
484  */
485 #define EVENT_KEY_NPS_ENABLE_STATE "nps_enable_state"
486
487 /**
488  * @brief Definition for value of EVENT_KEY_NPS_ENABLE_STATE.
489  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
490  */
491 #define EVENT_VAL_NPS_DISABLED "disabled"
492
493 /**
494  * @brief Definition for value of EVENT_KEY_NPS_ENABLE_STATE.
495  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
496  */
497 #define EVENT_VAL_NPS_ENABLED "enabled"
498
499 /**
500  * @brief Definition for system-event of message : incoming msg.
501  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
502  * @privilege %http://tizen.org/privilege/message.read
503  * @remarks If you want to receive this event, you must declare this privilege.
504  * @see EVENT_KEY_MSG_TYPE
505  * @see EVENT_KEY_MSG_ID
506  */
507 #define SYSTEM_EVENT_INCOMING_MSG "tizen.system.event.incoming_msg"
508
509 /**
510  * @brief Definition for key of SYSTEM_EVENT_INCOMING_MSG.
511  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
512  * @see EVENT_VAL_SMS
513  * @see EVENT_VAL_PUSH
514  * @see EVENT_VAL_CB
515  */
516 #define EVENT_KEY_MSG_TYPE "msg_type"
517
518 /**
519  * @brief Definition for value of EVENT_KEY_MSG_TYPE.
520  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
521  */
522 #define EVENT_VAL_SMS "sms"
523
524 /**
525  * @brief Definition for value of EVENT_KEY_MSG_TYPE.
526  * @since_tizen 3.0
527  */
528 #define EVENT_VAL_MMS "mms"
529
530 /**
531  * @brief Definition for value of EVENT_KEY_MSG_TYPE.
532  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
533  */
534 #define EVENT_VAL_PUSH "push"
535
536 /**
537  * @brief Definition for value of EVENT_KEY_MSG_TYPE.
538  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
539  */
540 #define EVENT_VAL_CB "cb"
541
542 /**
543  * @brief Definition for key of SYSTEM_EVENT_INCOMING_MSG.
544  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
545  * @remarks The value of this key is a string of unsigned int value : new message id.
546  */
547 #define EVENT_KEY_MSG_ID "msg_id"
548
549 /**
550  * @brief Definition for system-event of message : outgoing msg.
551  * @since_tizen 3.0
552  * @privilege %http://tizen.org/privilege/message.read
553  * @remarks If you want to receive this event, you must declare this privilege.
554  * @see EVENT_KEY_OUT_MSG_TYPE
555  * @see EVENT_KEY_OUT_MSG_ID
556  */
557 #define SYSTEM_EVENT_OUTGOING_MSG "tizen.system.event.outgoing_msg"
558
559 /**
560  * @brief Definition for key of SYSTEM_EVENT_OUTGOING_MSG.
561  * @since_tizen 3.0
562  * @see EVENT_VAL_OUT_MSG_SMS
563  * @see EVENT_VAL_OUT_MSG_MMS
564  */
565 #define EVENT_KEY_OUT_MSG_TYPE "msg_type"
566
567 /**
568  * @brief Definition for value of EVENT_KEY_OUT_MSG_TYPE.
569  * @since_tizen 3.0
570  */
571 #define EVENT_VAL_SMS "sms"
572
573 /**
574  * @brief Definition for value of EVENT_KEY_OUT_MSG_TYPE.
575  * @since_tizen 3.0
576  */
577 #define EVENT_VAL_MMS "mms"
578
579 /**
580  * @brief Definition for key of SYSTEM_EVENT_OUTGOING_MSG.
581  * @since_tizen 3.0
582  * @remarks The value of this key is a string of unsigned int value : new message id.
583  */
584 #define EVENT_KEY_OUT_MSG_ID "msg_id"
585
586 /**
587  * @brief Definition for system-event of setting : time changed.
588  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
589  * @remarks There is no corresponding key/value.
590  * @remarks You can use a @a alarm_get_current_time() API for checking new time after receiving this event.
591  */
592 #define SYSTEM_EVENT_TIME_CHANGED "tizen.system.event.time_changed"
593
594 /**
595  * @brief Definition for system-event of setting : timezone setting.
596  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
597  * @see EVENT_KEY_TIME_ZONE
598  */
599 #define SYSTEM_EVENT_TIME_ZONE "tizen.system.event.time_zone"
600
601 /**
602  * @brief Definition for key of SYSTEM_EVENT_TIME_ZONE.
603  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
604  * @remarks The value of this key is timezone value of tz database,
605  *      for example, "Asia/Seoul", "America/New_York",
606  *      refer to the Time Zone Database of IANA.
607  */
608 #define EVENT_KEY_TIME_ZONE "time_zone"
609
610 /**
611  * @brief Definition for system-event of setting : hour format.
612  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
613  * @see EVENT_KEY_HOUR_FORMAT
614  */
615 #define SYSTEM_EVENT_HOUR_FORMAT "tizen.system.event.hour_format"
616
617 /**
618  * @brief Definition for key of SYSTEM_EVENT_HOUR_FORMAT.
619  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
620  * @see EVENT_VAL_HOURFORMAT_12
621  * @see EVENT_VAL_HOURFORMAT_24
622  */
623 #define EVENT_KEY_HOUR_FORMAT "hour_format"
624
625 /**
626  * @brief Definition for value of EVENT_KEY_HOUR_FORMAT.
627  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
628  */
629 #define EVENT_VAL_HOURFORMAT_12 "12"
630
631 /**
632  * @brief Definition for value of EVENT_KEY_HOUR_FORMAT.
633  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
634  */
635 #define EVENT_VAL_HOURFORMAT_24 "24"
636
637 /**
638  * @brief Definition for system-event of setting : language setting.
639  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
640  * @see EVENT_KEY_LANGUAGE_SET
641  */
642 #define SYSTEM_EVENT_LANGUAGE_SET "tizen.system.event.language_set"
643
644 /**
645  * @brief Definition for key of SYSTEM_EVENT_LANGUAGE_SET.
646  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
647  * @remarks The value of this key is full name of locale, for example,
648  *      "ko_KR.UTF8" : in case of Korean language
649  *      "en_US.UTF8" : in case of USA language,
650  *      refer to linux locale info.
651  */
652 #define EVENT_KEY_LANGUAGE_SET "language_set"
653
654 /**
655  * @brief Definition for system-event of setting : region format.
656  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
657  * @see EVENT_KEY_REGION_FORMAT
658  */
659 #define SYSTEM_EVENT_REGION_FORMAT "tizen.system.event.region_format"
660
661 /**
662  * @brief Definition for key of SYSTEM_EVENT_REGION_FORMAT.
663  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
664  * @remarks The value of this key is full name of locale, for example,
665  *      "ko_KR.UTF8" : in case of Korean region format
666  *      "en_US.UTF8" : in case of USA region format,
667  *      refer to linux locale info.
668  */
669 #define EVENT_KEY_REGION_FORMAT "region_format"
670
671 /**
672  * @brief Definition for system-event of setting : silent_mode.
673  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
674  * @see EVENT_KEY_SILENT_MODE
675  */
676 #define SYSTEM_EVENT_SILENT_MODE "tizen.system.event.silent_mode"
677
678 /**
679  * @brief Definition for key of SYSTEM_EVENT_SILENT_MODE.
680  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
681  * @see EVENT_VAL_SILENTMODE_ON
682  * @see EVENT_VAL_SILENTMODE_OFF
683  */
684 #define EVENT_KEY_SILENT_MODE "silent_mode"
685
686 /**
687  * @brief Definition for value of EVENT_KEY_SILENT_MODE.
688  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
689  */
690 #define EVENT_VAL_SILENTMODE_ON "on"
691
692 /**
693  * @brief Definition for value of EVENT_KEY_SILENT_MODE.
694  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
695  */
696 #define EVENT_VAL_SILENTMODE_OFF "off"
697
698 /**
699  * @brief Definition for system-event of setting : state of vibration.
700  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
701  * @see EVENT_KEY_VIBRATION_STATE
702  */
703 #define SYSTEM_EVENT_VIBRATION_STATE "tizen.system.event.vibration_state"
704
705 /**
706  * @brief Definition for key of SYSTEM_EVENT_VIBRATION_STATE.
707  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
708  * @see EVENT_VAL_VIBRATION_ON
709  * @see EVENT_VAL_VIBRATION_OFF
710  */
711 #define EVENT_KEY_VIBRATION_STATE "vibration_state"
712
713 /**
714  * @brief Definition for value of EVENT_KEY_VIBRATION_STATE.
715  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
716  */
717 #define EVENT_VAL_VIBRATION_ON "on"
718
719 /**
720  * @brief Definition for value of EVENT_KEY_VIBRATION_STATE.
721  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
722  */
723 #define EVENT_VAL_VIBRATION_OFF "off"
724
725 /**
726  * @brief Definition for system-event of setting : state of screen's auto-rotation.
727  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
728  * @see EVENT_KEY_SCREEN_AUTOROTATE_STATE
729  */
730 #define SYSTEM_EVENT_SCREEN_AUTOROTATE_STATE "tizen.system.event.screen_autorotate_state"
731
732 /**
733  * @brief Definition for key of SYSTEM_EVENT_SCREEN_AUTOROTATE_STATE.
734  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
735  * @see EVENT_VAL_SCREEN_AUTOROTATE_ON
736  * @see EVENT_VAL_SCREEN_AUTOROTATE_OFF
737  */
738 #define EVENT_KEY_SCREEN_AUTOROTATE_STATE "screen_autorotate_state"
739
740 /**
741  * @brief Definition for value of EVENT_KEY_SCREEN_AUTOROTATE_STATE.
742  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
743  */
744 #define EVENT_VAL_SCREEN_AUTOROTATE_ON "on"
745
746 /**
747  * @brief Definition for value of EVENT_KEY_SCREEN_AUTOROTATE_STATE.
748  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
749  */
750 #define EVENT_VAL_SCREEN_AUTOROTATE_OFF "off"
751
752 /**
753  * @brief Definition for system-event of setting : state of mobile data.
754  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
755  * @see EVENT_KEY_MOBILE_DATA_STATE
756  */
757 #define SYSTEM_EVENT_MOBILE_DATA_STATE "tizen.system.event.mobile_data_state"
758
759 /**
760  * @brief Definition for key of SYSTEM_EVENT_MOBILE_DATA_STATE.
761  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
762  * @see EVENT_VAL_MOBILE_DATA_OFF
763  * @see EVENT_VAL_MOBILE_DATA_ON
764  */
765 #define EVENT_KEY_MOBILE_DATA_STATE "mobile_data_state"
766
767 /**
768  * @brief Definition for value of EVENT_KEY_MOBILE_DATA_STATE.
769  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
770  */
771 #define EVENT_VAL_MOBILE_DATA_OFF "off"
772
773 /**
774  * @brief Definition for value of EVENT_KEY_MOBILE_DATA_STATE.
775  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
776  */
777 #define EVENT_VAL_MOBILE_DATA_ON "on"
778
779 /**
780  * @brief Definition for system-event of setting : state of data roaming.
781  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
782  * @see EVENT_KEY_DATA_ROAMING_STATE
783  */
784 #define SYSTEM_EVENT_DATA_ROAMING_STATE "tizen.system.event.data_roaming_state"
785
786 /**
787  * @brief Definition for key of SYSTEM_EVENT_DATA_ROAMING_STATE.
788  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
789  * @see EVENT_VAL_DATA_ROAMING_OFF
790  * @see EVENT_VAL_DATA_ROAMING_ON
791  */
792 #define EVENT_KEY_DATA_ROAMING_STATE "data_roaming_state"
793
794 /**
795  * @brief Definition for value of EVENT_KEY_DATA_ROAMING_STATE.
796  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
797  */
798 #define EVENT_VAL_DATA_ROAMING_OFF "off"
799
800 /**
801  * @brief Definition for value of EVENT_KEY_DATA_ROAMING_STATE.
802  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
803  */
804 #define EVENT_VAL_DATA_ROAMING_ON "on"
805
806 /**
807  * @brief Definition for system-event of setting : font setting.
808  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
809  * @see EVENT_KEY_FONT_SET
810  */
811 #define SYSTEM_EVENT_FONT_SET "tizen.system.event.font_set"
812
813 /**
814  * @brief Definition for key of SYSTEM_EVENT_FONT_SET.
815  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
816  * @remarks The value of this key is font name of string type by font-config.
817  */
818 #define EVENT_KEY_FONT_SET "font_set"
819
820 /**
821  * @brief Definition for system-event of network : status of network.
822  * @since_tizen 3.0
823  * @see EVENT_KEY_NETWORK_STATUS
824  */
825 #define SYSTEM_EVENT_NETWORK_STATUS "tizen.system.event.network_status"
826
827 /**
828  * @brief Definition for key of SYSTEM_EVENT_NETWORK_STATUS.
829  * @since_tizen 3.0
830  * @remarks The values of this event indicate the type of the current profile for data connection.
831  * @see EVENT_VAL_NETWORK_DISCONNECTED
832  * @see EVENT_VAL_NETWORK_WIFI
833  * @see EVENT_VAL_NETWORK_CELLULAR
834  * @see EVENT_VAL_NETWORK_ETHERNET
835  * @see EVENT_VAL_NETWORK_BT
836  * @see EVENT_VAL_NETWORK_NET_PROXY
837  */
838 #define EVENT_KEY_NETWORK_STATUS "network_status"
839
840 /**
841  * @brief Definition for value of EVENT_KEY_NETWORK_STATUS.
842  * @since_tizen 3.0
843  */
844 #define EVENT_VAL_NETWORK_DISCONNECTED "disconnected"
845
846 /**
847  * @brief Definition for value of EVENT_KEY_NETWORK_STATUS.
848  * @since_tizen 3.0
849  */
850 #define EVENT_VAL_NETWORK_WIFI "wifi"
851
852 /**
853  * @brief Definition for value of EVENT_KEY_NETWORK_STATUS.
854  * @since_tizen 3.0
855  */
856 #define EVENT_VAL_NETWORK_CELLULAR "cellular"
857
858 /**
859  * @brief Definition for value of EVENT_KEY_NETWORK_STATUS.
860  * @since_tizen 3.0
861  */
862 #define EVENT_VAL_NETWORK_ETHERNET "ethernet"
863
864 /**
865  * @brief Definition for value of EVENT_KEY_NETWORK_STATUS.
866  * @since_tizen 3.0
867  */
868 #define EVENT_VAL_NETWORK_BT "bt"
869
870 /**
871  * @brief Definition for value of EVENT_KEY_NETWORK_STATUS.
872  * @since_tizen 3.0
873  */
874 #define EVENT_VAL_NETWORK_NET_PROXY "net_proxy"
875
876 /**
877  * @brief Adds the event handler for receiving event-data of interested events.
878  *
879  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
880  * @remarks If you want to add the privileged event, you MUST declare right privilge first. Unless that, this function returns #EVENT_ERROR_PERMISSION_DENIED. The privileged events are commented on remarks of it's definitions.
881  * @param[in] event_name The interested event name
882  * @param[in] callback The event callback called when the event occurs
883  * @param[in] user_data The user data for passing to callback
884  * @param[out] event_handler The event handler
885  * @return 0 on success, otherwise a negative error value
886  * @retval #EVENT_ERROR_NONE Successful
887  * @retval #EVENT_ERROR_INVALID_PARAMETER Invalid parameter
888  * @retval #EVENT_ERROR_PERMISSION_DENIED Permission denied
889  * @retval #EVENT_ERROR_IO_ERROR Adding handler failed
890  * @retval #EVENT_ERROR_OUT_OF_MEMORY Out of memory
891  */
892 int event_add_event_handler(const char *event_name, event_cb callback, void *user_data,
893         event_handler_h *event_handler);
894
895 /**
896  * @brief Removes the registered event handler.
897  *
898  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
899  * @param[in] event_handler The event handler
900  * @return 0 on success, otherwise a negative error value
901  * @retval #EVENT_ERROR_NONE Successful
902  * @retval #EVENT_ERROR_INVALID_PARAMETER Invalid parameter
903  */
904 int event_remove_event_handler(event_handler_h event_handler);
905
906 /**
907  * @brief Sends the User-Event to receiver applications.
908  *
909  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
910  * @remarks The format of User-Event's name MUST be "event.{sender's appid}.{user-defined name}", refer to 'The name-format of User-Event' section, If the event_name is invalid, the function returns #EVENT_ERROR_IO_ERROR.
911  * @param[in] event_name The event's name to send
912  * @param[in] event_data The event's data to send
913  * @return 0 on success, otherwise a negative error value
914  * @retval #EVENT_ERROR_NONE Successful
915  * @retval #EVENT_ERROR_INVALID_PARAMETER Invalid parameter
916  * @retval #EVENT_ERROR_IO_ERROR Sending operation failed
917  */
918 int event_publish_app_event(const char *event_name, bundle *event_data);
919
920 /**
921  * @brief Sends the User-Event to trusted receiver-applications.
922  *
923  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
924  * @remarks The application which has same certification with sender can receive the event.
925  * @remarks The format of User-Event's name MUST be "event.{sender's appid}.{user-defined name}", refer to 'The name-format of User-Event' section,  If the event_name is invalid, the function returns #EVENT_ERROR_IO_ERROR.
926  * @param[in] event_name The event's name to send
927  * @param[in] event_data The event's data to send
928  * @return 0 on success, otherwise a negative error value
929  * @retval #EVENT_ERROR_NONE Successful
930  * @retval #EVENT_ERROR_INVALID_PARAMETER Invalid parameter
931  * @retval #EVENT_ERROR_IO_ERROR Sending operation failed
932  */
933 int event_publish_trusted_app_event(const char *event_name, bundle *event_data);
934
935 /**
936  * @brief Keeps last User-Event data for receiver applications.
937  *
938  * @since_tizen 3.0
939  * @remarks The receiver applications will receive this last event data after adding their new handlers via event_add_event_handler() API since the sender application called this API.
940  * @remarks If a sender application sends same event via trusted API and non-trusted API, then a trusted receiver will get latest data regardless of trusted or non-trusted, but non-trusted receiver will get the last data only from non-trusted API.
941  * @remarks The effect of this API continues during runtime. That means when the sender application process restarts, the sender application needs to call this api again to make the event to keep the last event.
942  * @param[in] event_name The event's name to keep last event data
943  * @return 0 on success, otherwise a negative error value
944  * @retval #EVENT_ERROR_NONE Successful
945  * @retval #EVENT_ERROR_INVALID_PARAMETER Invalid parameter
946  * @retval #EVENT_ERROR_IO_ERROR Sending operation failed
947  * @retval #EVENT_ERROR_OUT_OF_MEMORY Out of memory
948  */
949 int event_keep_last_event_data(const char *event_name);
950
951 /**
952  * @}
953  */
954
955 #ifdef __cplusplus
956 }
957 #endif
958
959 #endif /* __TIZEN_APPFW_EVENT_H__ */
960