Tizen 2.4.0 rev3 SDK Public Release
[framework/api/context.git] / include / context_trigger.h
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
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 #ifndef __TIZEN_CONTEXT_CONTEXT_TRIGGER_H__
18 #define __TIZEN_CONTEXT_CONTEXT_TRIGGER_H__
19
20 /**
21  * @addtogroup  CAPI_CONTEXT_TRIGGER_MODULE
22  * @{
23  */
24
25 #include <tizen_error.h>
26 #include <app_control.h>
27 #include <stdbool.h>
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif /* __cplusplus */
32
33 /**
34  * @brief       The operator "is equal to".
35  * @details     This can be used as operators of context_trigger_rule_entry_add_comparison_int()
36  *                      and context_trigger_rule_entry_add_comparison_string().
37  * @since_tizen 2.4
38  */
39 #define CONTEXT_TRIGGER_EQUAL_TO "=="
40
41 /**
42  * @brief       The operator "is not equal to".
43  * @details     This can be used as operators of context_trigger_rule_entry_add_comparison_int()
44  *                      and context_trigger_rule_entry_add_comparison_string().
45  * @since_tizen 2.4
46  */
47 #define CONTEXT_TRIGGER_NOT_EQUAL_TO "!="
48
49 /**
50  * @brief       The operator "is greater than".
51  * @details     This can be used as operators of context_trigger_rule_entry_add_comparison_int().
52  * @since_tizen 2.4
53  */
54 #define CONTEXT_TRIGGER_GREATER_THAN ">"
55
56 /**
57  * @brief       The operator "is greater than or equal to".
58  * @details     This can be used as operators of context_trigger_rule_entry_add_comparison_int().
59  * @since_tizen 2.4
60  */
61 #define CONTEXT_TRIGGER_GREATER_THAN_OR_EQUAL_TO ">="
62
63 /**
64  * @brief       The operator "is less than".
65  * @details     This can be used as operators of context_trigger_rule_entry_add_comparison_int().
66  * @since_tizen 2.4
67  */
68 #define CONTEXT_TRIGGER_LESS_THAN "<"
69
70 /**
71  * @brief       The operator "is less than or equal to".
72  * @details     This can be used as operators of context_trigger_rule_entry_add_comparison_int().
73  * @since_tizen 2.4
74  */
75 #define CONTEXT_TRIGGER_LESS_THAN_OR_EQUAL_TO "<="
76
77 /**
78  * @brief       Logical true.
79  * @details     This can be used as right operands of context_trigger_rule_entry_add_comparison_int().
80  * @since_tizen 2.4
81  */
82 #define CONTEXT_TRIGGER_TRUE 1
83
84 /**
85  * @brief       Logical false.
86  * @details     This can be used as right operands of context_trigger_rule_entry_add_comparison_int().
87  * @since_tizen 2.4
88  */
89 #define CONTEXT_TRIGGER_FALSE 0
90
91 /**
92  * @brief       The attribute key denoting "time of day".
93  * @details     This can be used as a key of context_trigger_rule_entry_add_option_string(),
94  *                      or left operands of context_trigger_rule_entry_add_comparison_int().@n
95  *                      When being used as option, it is time interval of the day. For example, "13-15" denotes "from 1 PM to 3 PM".
96  *                      When being used with #CONTEXT_TRIGGER_EVENT_TIME or #CONTEXT_TRIGGER_CONDITION_TIME, it's unit is "minute",
97  *                      the valid range of the corresponding right operands is thus from 0 (12:00 AM) to 1439 (11:59 PM).
98  * @since_tizen 2.4
99  */
100 #define CONTEXT_TRIGGER_TIME_OF_DAY "TimeOfDay"
101
102 /**
103  * @brief       The attribute key denoting "day of week".
104  * @details     This can be used as a key of context_trigger_rule_entry_add_option_string(),
105  *                      or left operands of context_trigger_rule_entry_add_comparison_string().@n
106  *                      As the right operands of this attribute, one of the following values are allowed:
107  *                      #CONTEXT_TRIGGER_MON, #CONTEXT_TRIGGER_TUE, #CONTEXT_TRIGGER_WED, #CONTEXT_TRIGGER_THU, #CONTEXT_TRIGGER_FRI,
108  *                      #CONTEXT_TRIGGER_SAT, #CONTEXT_TRIGGER_SUN, #CONTEXT_TRIGGER_WEEKDAY, and #CONTEXT_TRIGGER_WEEKEND.
109  * @since_tizen 2.4
110  */
111 #define CONTEXT_TRIGGER_DAY_OF_WEEK "DayOfWeek"
112
113 /**
114  * @brief       The attribute key denoting "day of month".
115  * @details     This can be used as left operands of context_trigger_rule_entry_add_comparison_int().@n
116  *                      The valid range of the corresponding right operands is from 1 to 31.
117  * @since_tizen 2.4
118  */
119 #define CONTEXT_TRIGGER_DAY_OF_MONTH "DayOfMonth"
120
121 /**
122  * @brief       The attribute key denoting boolean states of "is connected".
123  * @details     This can be used as left operands of context_trigger_rule_entry_add_comparison_int().@n
124  *                      As the right operands of this attribute, one of the following values are allowed:
125  *                      #CONTEXT_TRIGGER_TRUE and #CONTEXT_TRIGGER_FALSE.
126  * @since_tizen 2.4
127  */
128 #define CONTEXT_TRIGGER_IS_CONNECTED "IsConnected"
129
130 /**
131  * @brief       The attribute key denoting boolean states of "is charging".
132  * @details     This can be used as left operands of context_trigger_rule_entry_add_comparison_int().@n
133  *                      As the right operands of this attribute, one of the following values are allowed:
134  *                      #CONTEXT_TRIGGER_TRUE and #CONTEXT_TRIGGER_FALSE.
135  * @since_tizen 2.4
136  */
137 #define CONTEXT_TRIGGER_IS_CHARGING "IsCharging"
138
139 /**
140  * @brief       The attribute key denoting boolean states of "is enabled".
141  * @details     This can be used as left operands of context_trigger_rule_entry_add_comparison_int().@n
142  *                      As the right operands of this attribute, one of the following values are allowed:
143  *                      #CONTEXT_TRIGGER_TRUE and #CONTEXT_TRIGGER_FALSE.
144  * @since_tizen 2.4
145  */
146 #define CONTEXT_TRIGGER_IS_ENABLED "IsEnabled"
147
148 /**
149  * @brief       The attribute key denoting "level".
150  * @details     This can be used as left operands of context_trigger_rule_entry_add_comparison_string().@n
151  *                      See the programming guide to find available right operands values.
152  * @since_tizen 2.4
153  */
154 #define CONTEXT_TRIGGER_LEVEL "Level"
155
156 /**
157  * @brief       The attribute key denoting "state".
158  * @details     This can be used as left operands of context_trigger_rule_entry_add_comparison_string().@n
159  *                      See the programming guide to find available right operands.
160  * @since_tizen 2.4
161  */
162 #define CONTEXT_TRIGGER_STATE "State"
163
164 /**
165  * @brief       The attribute key denoting "BSSID".
166  * @details     This can be used as left operands of context_trigger_rule_entry_add_comparison_string().@n
167  *                      See the programming guide to find available right operands.
168  * @since_tizen 2.4
169  */
170 #define CONTEXT_TRIGGER_BSSID "BSSID"
171
172 /**
173  * @brief       The attribute key denoting "type".
174  * @details     This can be used as left operands of context_trigger_rule_entry_add_comparison_string().@n
175  *                      See the programming guide to find available right operands.
176  * @since_tizen 2.4
177  */
178 #define CONTEXT_TRIGGER_TYPE "Type"
179
180 /**
181  * @brief       The attribute key denoting "event".
182  * @details     This can be used as left operands of context_trigger_rule_entry_add_comparison_string().@n
183  *                      See the programming guide to find available right operands.
184  * @since_tizen 2.4
185  */
186 #define CONTEXT_TRIGGER_EVENT "Event"
187
188 /**
189  * @brief       The attribute key denoting "accuracy".
190  * @details     This can be used as left operands of context_trigger_rule_entry_add_comparison_string().@n
191  *                      See the programming guide to find available right operands.
192  * @since_tizen 2.4
193  */
194 #define CONTEXT_TRIGGER_ACCURACY "Accuracy"
195
196 /**
197  * @brief       The attribute key denoting "medium".
198  * @details     This can be used as left operands of context_trigger_rule_entry_add_comparison_string().@n
199  *                      See the programming guide to find available right operands.
200  * @since_tizen 2.4
201  */
202 #define CONTEXT_TRIGGER_MEDIUM "Medium"
203
204 /**
205  * @brief       The attribute key denoting "place id".
206  * @details     This can be used as a key of context_trigger_rule_entry_add_option_int().@n
207  *                      See the programming guide to find the corresponding trigger events.
208  * @since_tizen 2.4
209  */
210 #define CONTEXT_TRIGGER_PLACE_ID "PlaceId"
211
212 /**
213  * @brief       The attribute key denoting "application id".
214  * @details     This can be used as a key of context_trigger_rule_entry_add_option_string().@n
215  *                      See the programming guide to find the corresponding trigger events.
216  * @since_tizen 2.4
217  */
218 #define CONTEXT_TRIGGER_APP_ID "AppId"
219
220 /**
221  * @brief       The attribute key denoting "address".
222  * @details     This can be used as a key of context_trigger_rule_entry_add_option_string(),
223  *                      or context_trigger_rule_entry_add_comparison_string().@n
224  *                      See the programming guide and CAPI_CONTEXT_TRIGGER_MODULE_OPTION_FORMAT to find the corresponding items.
225  * @since_tizen 2.4
226  */
227 #define CONTEXT_TRIGGER_ADDRESS "Address"
228
229 /**
230  * @brief       The attribute key denoting "rank".
231  * @details     This can be used as left operands of context_trigger_rule_entry_add_comparison_int().@n
232  *                      See the programming guide to find available right operands.
233  * @since_tizen 2.4
234  */
235 #define CONTEXT_TRIGGER_RANK "Rank"
236
237 /**
238  * @brief       The attribute key denoting "total count".
239  * @details     This can be used as left operands of context_trigger_rule_entry_add_comparison_int().@n
240  *                      See the programming guide to find available right operands.
241  * @since_tizen 2.4
242  */
243 #define CONTEXT_TRIGGER_TOTAL_COUNT "TotalCount"
244
245 /**
246  * @brief       The attribute value denoting Monday.
247  * @details     This can be used as a value of context_trigger_rule_entry_add_option_string()
248  *                      or right operands of context_trigger_rule_entry_add_comparison_string().@n
249  *                      See the programming guide to find the corresponding option keys or left operand attribute keys.
250  * @since_tizen 2.4
251  */
252 #define CONTEXT_TRIGGER_MON "Mon"
253
254 /**
255  * @brief       The attribute value denoting Tuesday.
256  * @details     This can be used as a value of context_trigger_rule_entry_add_option_string()
257  *                      or right operands of context_trigger_rule_entry_add_comparison_string().@n
258  *                      See the programming guide to find the corresponding option keys or left operand attribute keys.
259  * @since_tizen 2.4
260  */
261 #define CONTEXT_TRIGGER_TUE "Tue"
262
263 /**
264  * @brief       The attribute value denoting Wednesday.
265  * @details     This can be used as a value of context_trigger_rule_entry_add_option_string()
266  *                      or right operands of context_trigger_rule_entry_add_comparison_string().@n
267  *                      See the programming guide to find the corresponding option keys or left operand attribute keys.
268  * @since_tizen 2.4
269  */
270 #define CONTEXT_TRIGGER_WED "Wed"
271
272 /**
273  * @brief       The attribute value denoting Thursday.
274  * @details     This can be used as a value of context_trigger_rule_entry_add_option_string()
275  *                      or right operands of context_trigger_rule_entry_add_comparison_string().@n
276  *                      See the programming guide to find the corresponding option keys or left operand attribute keys.
277  * @since_tizen 2.4
278  */
279 #define CONTEXT_TRIGGER_THU "Thu"
280
281 /**
282  * @brief       The attribute value denoting Friday.
283  * @details     This can be used as a value of context_trigger_rule_entry_add_option_string()
284  *                      or right operands of context_trigger_rule_entry_add_comparison_string().@n
285  *                      See the programming guide to find the corresponding option keys or left operand attribute keys.
286  * @since_tizen 2.4
287  */
288 #define CONTEXT_TRIGGER_FRI "Fri"
289
290 /**
291  * @brief       The attribute value denoting Saturday.
292  * @details     This can be used as a value of context_trigger_rule_entry_add_option_string()
293  *                      or right operands of context_trigger_rule_entry_add_comparison_string().@n
294  *                      See the programming guide to find the corresponding option keys or left operand attribute keys.
295  * @since_tizen 2.4
296  */
297 #define CONTEXT_TRIGGER_SAT "Sat"
298
299 /**
300  * @brief       The attribute value denoting Sunday.
301  * @details     This can be used as a value of context_trigger_rule_entry_add_option_string()
302  *                      or right operands of context_trigger_rule_entry_add_comparison_string().@n
303  *                      See the programming guide to find the corresponding option keys or left operand attribute keys.
304  * @since_tizen 2.4
305  */
306 #define CONTEXT_TRIGGER_SUN "Sun"
307
308 /**
309  * @brief       The attribute value denoting Weekdays.
310  * @details     This can be used as a value of context_trigger_rule_entry_add_option_string()
311  *                      or right operands of context_trigger_rule_entry_add_comparison_string().@n
312  *                      See the programming guide to find the corresponding option keys or left operand attribute keys.
313  * @since_tizen 2.4
314  */
315 #define CONTEXT_TRIGGER_WEEKDAY "Weekday"
316
317 /**
318  * @brief       The attribute value denoting Weekends.
319  * @details     This can be used as a value of context_trigger_rule_entry_add_option_string()
320  *                      or right operands of context_trigger_rule_entry_add_comparison_string().@n
321  *                      See the programming guide to find the corresponding option keys or left operand attribute keys.
322  * @since_tizen 2.4
323  */
324 #define CONTEXT_TRIGGER_WEEKEND "Weekend"
325
326 /**
327  * @brief       The attribute value denoting the "empty" state.
328  * @details     This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
329  *                      See the programming guide to find the corresponding left operand attribute keys.
330  * @since_tizen 2.4
331  */
332 #define CONTEXT_TRIGGER_EMPTY "Empty"
333
334 /**
335  * @brief       The attribute value denoting the "critical" state.
336  * @details     This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
337  *                      See the programming guide to find the corresponding left operand attribute keys.
338  * @since_tizen 2.4
339  */
340 #define CONTEXT_TRIGGER_CRITICAL "Critical"
341
342 /**
343  * @brief       The attribute value denoting the "low" state.
344  * @details     This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
345  *                      See the programming guide to find the corresponding left operand attribute keys.
346  * @since_tizen 2.4
347  */
348 #define CONTEXT_TRIGGER_LOW "Low"
349
350 /**
351  * @brief       The attribute value denoting the "normal" state.
352  * @details     This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
353  *                      See the programming guide to find the corresponding left operand attribute keys.
354  * @since_tizen 2.4
355  */
356 #define CONTEXT_TRIGGER_NORMAL "Normal"
357
358 /**
359  * @brief       The attribute value denoting the "high" state.
360  * @details     This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
361  *                      See the programming guide to find the corresponding left operand attribute keys.
362  * @since_tizen 2.4
363  */
364 #define CONTEXT_TRIGGER_HIGH "High"
365
366 /**
367  * @brief       The attribute value denoting the "full" state.
368  * @details     This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
369  *                      See the programming guide to find the corresponding left operand attribute keys.
370  * @since_tizen 2.4
371  */
372 #define CONTEXT_TRIGGER_FULL "Full"
373
374 /**
375  * @brief       The attribute value denoting the "disabled" state.
376  * @details     This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
377  *                      See the programming guide to find the corresponding left operand attribute keys.
378  * @since_tizen 2.4
379  */
380 #define CONTEXT_TRIGGER_DISABLED "Disabled"
381
382 /**
383  * @brief       The attribute value denoting the "searching" state.
384  * @details     This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
385  *                      See the programming guide to find the corresponding left operand attribute keys.
386  * @since_tizen 2.4
387  */
388 #define CONTEXT_TRIGGER_SEARCHING "Searching"
389
390 /**
391  * @brief       The attribute value denoting the "connecting" state.
392  * @details     This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
393  *                      See the programming guide to find the corresponding left operand attribute keys.
394  * @since_tizen 2.4
395  */
396 #define CONTEXT_TRIGGER_CONNECTING "Connecting"
397
398 /**
399  * @brief       The attribute value denoting the "connected" state.
400  * @details     This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
401  *                      See the programming guide to find the corresponding left operand attribute keys.
402  * @since_tizen 2.4
403  */
404 #define CONTEXT_TRIGGER_CONNECTED "Connected"
405
406 /**
407  * @brief       The attribute value denoting the "unconnected" state.
408  * @details     This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
409  *                      See the programming guide to find the corresponding left operand attribute keys.
410  * @since_tizen 2.4
411  */
412 #define CONTEXT_TRIGGER_UNCONNECTED "Unconnected"
413
414 /**
415  * @brief       The attribute value denoting the "idle" state.
416  * @details     This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
417  *                      See the programming guide to find the corresponding left operand attribute keys.
418  * @since_tizen 2.4
419  */
420 #define CONTEXT_TRIGGER_IDLE "Idle"
421
422 /**
423  * @brief       The attribute value denoting the "voice" type.
424  * @details     This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
425  *                      See the programming guide to find the corresponding left operand attribute keys.
426  * @since_tizen 2.4
427  */
428 #define CONTEXT_TRIGGER_VOICE "Voice"
429
430 /**
431  * @brief       The attribute value denoting the "video" type.
432  * @details     This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
433  *                      See the programming guide to find the corresponding left operand attribute keys.
434  * @since_tizen 2.4
435  */
436 #define CONTEXT_TRIGGER_VIDEO "Video"
437
438 /**
439  * @brief       The attribute value denoting the "headset" type.
440  * @details     This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
441  *                      See the programming guide to find the corresponding left operand attribute keys.
442  * @since_tizen 2.4
443  */
444 #define CONTEXT_TRIGGER_HEADSET "Headset"
445
446 /**
447  * @brief       The attribute value denoting the "bluetooth" type.
448  * @details     This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
449  *                      See the programming guide to find the corresponding left operand attribute keys.
450  * @since_tizen 2.4
451  */
452 #define CONTEXT_TRIGGER_BLUETOOTH "Bluetooth"
453
454 /**
455  * @brief       The attribute value denoting the "received" event.
456  * @details     This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
457  *                      See the programming guide to find the corresponding left operand attribute keys.
458  * @since_tizen 2.4
459  */
460 #define CONTEXT_TRIGGER_RECEIVED "Received"
461
462 /**
463  * @brief       The attribute value denoting the "sent" event.
464  * @details     This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
465  *                      See the programming guide to find the corresponding left operand attribute keys.
466  * @since_tizen 2.4
467  */
468 #define CONTEXT_TRIGGER_SENT "Sent"
469
470 /**
471  * @brief       The attribute value denoting the "SMS" type.
472  * @details     This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
473  *                      See the programming guide to find the corresponding left operand attribute keys.
474  * @since_tizen 2.4
475  */
476 #define CONTEXT_TRIGGER_SMS "SMS"
477
478 /**
479  * @brief       The attribute value denoting the "MMS" type.
480  * @details     This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
481  *                      See the programming guide to find the corresponding left operand attribute keys.
482  * @since_tizen 2.4
483  */
484 #define CONTEXT_TRIGGER_MMS "MMS"
485
486 /**
487  * @brief       The attribute value denoting the "detected" event.
488  * @details     This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
489  *                      See the programming guide to find the corresponding left operand attribute keys.
490  * @since_tizen 2.4
491  */
492 #define CONTEXT_TRIGGER_DETECTED "Detected"
493
494 /**
495  * @brief       The attribute value denoting the "in" event.
496  * @details     This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
497  *                      See the programming guide to find the corresponding left operand attribute keys.
498  * @since_tizen 2.4
499  */
500 #define CONTEXT_TRIGGER_IN "In"
501
502 /**
503  * @brief       The attribute value denoting the "out" event.
504  * @details     This can be used as right operands of context_trigger_rule_entry_add_comparison_string().@n
505  *                      See the programming guide to find the corresponding left operand attribute keys.
506  * @since_tizen 2.4
507  */
508 #define CONTEXT_TRIGGER_OUT "Out"
509
510 /**
511  * @brief       Enumeration of error codes for context trigger API.
512  * @since_tizen 2.4
513  */
514 typedef enum {
515         CONTEXT_TRIGGER_ERROR_NONE                              = TIZEN_ERROR_NONE,                                             /**< Successful */
516         CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,                /**< Invalid function parameter */
517         CONTEXT_TRIGGER_ERROR_OUT_OF_MEMORY             = TIZEN_ERROR_OUT_OF_MEMORY,                    /**< Out of memory */
518         CONTEXT_TRIGGER_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED,                /**< Permission denied */
519         CONTEXT_TRIGGER_ERROR_NOT_SUPPORTED             = TIZEN_ERROR_NOT_SUPPORTED,                    /**< Not supported */
520         CONTEXT_TRIGGER_ERROR_NO_DATA                   = TIZEN_ERROR_NO_DATA,                                  /**< No data */
521         CONTEXT_TRIGGER_ERROR_OPERATION_FAILED  = (TIZEN_ERROR_CONTEXT | 0x04),                 /**< Operation failed */
522         CONTEXT_TRIGGER_ERROR_RULE_ENABLED              = (TIZEN_ERROR_CONTEXT | 0X05),                 /**< Rule is enabled */
523         CONTEXT_TRIGGER_ERROR_RULE_NOT_ENABLED  = (TIZEN_ERROR_CONTEXT | 0X06),                 /**< Rule is not enabled */
524         CONTEXT_TRIGGER_ERROR_INVALID_RULE              = (TIZEN_ERROR_CONTEXT | 0X07),                 /**< Invalid rule */
525         CONTEXT_TRIGGER_ERROR_RULE_NOT_EXIST    = (TIZEN_ERROR_CONTEXT | 0X08),                 /**< Rule does not exist */
526 } context_trigger_error_e;
527
528 /**
529  * @brief               Enumeration for event types.
530  * @since_tizen 2.4
531  */
532 typedef enum {
533         CONTEXT_TRIGGER_EVENT_TIME              = 0x10001,      /**< At certain times of day and days of week @n Privilege: http://tizen.org/privilege/alarm.set */
534         CONTEXT_TRIGGER_EVENT_BATTERY   = 0x10100,      /**< Battery level changed */
535         CONTEXT_TRIGGER_EVENT_CHARGER,                          /**< Charger connected/disconnected */
536         CONTEXT_TRIGGER_EVENT_GPS,                                      /**< GPS state changed */
537         CONTEXT_TRIGGER_EVENT_HEADPHONE,                        /**< Headphone connected/disconnected */
538         CONTEXT_TRIGGER_EVENT_USB,                                      /**< USB connected/disconnected */
539         CONTEXT_TRIGGER_EVENT_WIFI,                                     /**< WiFi state changed @n Privilege: http://tizen.org/privilege/network.get */
540         CONTEXT_TRIGGER_EVENT_POWER_SAVING_MODE = 0x10200,      /**< Power saving mode enabled/disabled */
541         CONTEXT_TRIGGER_EVENT_CALL              = 0x10300,      /**< Call state changed @n Privilege: http://tizen.org/privilege/telephony */
542         CONTEXT_TRIGGER_EVENT_EMAIL,                            /**< Email sent/received */
543         CONTEXT_TRIGGER_EVENT_MESSAGE,                          /**< Message sent/received @n Privilege: http://tizen.org/privilege/message.read */
544         CONTEXT_TRIGGER_EVENT_ACTIVITY_STATIONARY       = 0x10400,      /**< 'Stationary' activity detected */
545         CONTEXT_TRIGGER_EVENT_ACTIVITY_WALKING,         /**< 'Walking' activity detected */
546         CONTEXT_TRIGGER_EVENT_ACTIVITY_RUNNING,         /**< 'Running' activity detected */
547         CONTEXT_TRIGGER_EVENT_ACTIVITY_IN_VEHICLE,      /**< 'In vehicle' activity detected */
548         CONTEXT_TRIGGER_EVENT_PLACE             = 0x10500,      /**< Get in/out to/from a specific user place @n Privilege: http://tizen.org/privilege/location */
549 } context_trigger_event_e;
550
551 /**
552  * @brief               Enumeration for condition types.
553  * @since_tizen 2.4
554  */
555 typedef enum {
556         CONTEXT_TRIGGER_CONDITION_TIME          = 0x20001,      /**< Time of day */
557         CONTEXT_TRIGGER_CONDITION_BATTERY       = 0x20100,      /**< Battery level */
558         CONTEXT_TRIGGER_CONDITION_CHARGER,                              /**< Charger connection */
559         CONTEXT_TRIGGER_CONDITION_GPS,                                  /**< GPS state */
560         CONTEXT_TRIGGER_CONDITION_HEADPHONE,                    /**< Headphone connection */
561         CONTEXT_TRIGGER_CONDITION_USB,                                  /**< USB connection */
562         CONTEXT_TRIGGER_CONDITION_WIFI,                                 /**< WiFi state @n Privilege: http://tizen.org/privilege/network.get */
563         CONTEXT_TRIGGER_CONDITION_POWER_SAVING_MODE     = 0x20200,      /**< Power saving mode setting */
564         CONTEXT_TRIGGER_CONDITION_CALL          = 0x20300,      /**< Call state @n Privilege: http://tizen.org/privilege/telephony */
565         CONTEXT_TRIGGER_CONDITION_APP_USE_FREQUENCY     = 0x20600,      /**< Frequency of app use @n Privilege: http://tizen.org/privilege/apphistory.read  */
566         CONTEXT_TRIGGER_CONDITION_COMMUNICATION_FREQUENCY,              /**< Frequency of communication via call or message @n Privilege: http://tizen.org/privilege/callhistory.read */
567         CONTEXT_TRIGGER_CONDITION_MUSIC_PLAYBACK_FREQUENCY,             /**< Frequency of music playback @n Privilege: http://tizen.org/privilege/mediahistory.read */
568         CONTEXT_TRIGGER_CONDITION_VIDEO_PLAYBACK_FREQUENCY,             /**< Frequency of video playback @n Privilege: http://tizen.org/privilege/mediahistory.read */
569 } context_trigger_condition_e;
570
571 /**
572  * @brief               Enumeration for logical operation types.
573  * @since_tizen 2.4
574  */
575 typedef enum {
576         CONTEXT_TRIGGER_LOGICAL_CONJUNCTION = 1,        /**< Logical conjunction */
577         CONTEXT_TRIGGER_LOGICAL_DISJUNCTION,            /**< Logical disjunction */
578 } context_trigger_logical_type_e;
579
580 /**
581  * @brief               Handle for editing a trigger rule.
582  * @since_tizen 2.4
583  */
584 typedef struct _context_trigger_rule_s* context_trigger_rule_h;
585
586 /**
587  * @brief               Handle for editing an event or a condition, which is added to a rule.
588  * @since_tizen 2.4
589  */
590 typedef struct _context_trigger_rule_entry_s* context_trigger_rule_entry_h;
591
592 /**
593  * @brief               Registers a rule.
594  * @details             Using this, applications can register a rule and get the ID of the registered rule.@n
595  *                              A rule only can be enabled, disabled, or removed by the application that has registered the rule.
596  * @since_tizen 2.4
597  *
598  * @privlevel   public
599  * @privilege   http://tizen.org/privilege/alarm.set @n
600  *                              http://tizen.org/privilege/telephony @n
601  *                              http://tizen.org/privilege/message.read @n
602  *                              http://tizen.org/privilege/network.get
603  *
604  * @remarks             When registering a new rule,
605  *                              regarding the event and condition items used to compose the rule,
606  *                              the application may require one or more privileges.
607  *                              If the application does not have a necessary privilege,
608  *                              #CONTEXT_TRIGGER_ERROR_PERMISSION_DENIED is returned.
609  *
610  * @param[in]   rule            The rule to register
611  * @param[out]  rule_id         The ID assigned to the @c rule
612  *
613  * @return              0 on success, otherwise a negative error value
614  * @retval              #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
615  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
616  * @retval              #CONTEXT_TRIGGER_ERROR_PERMISSION_DENIED        Permission denied
617  * @retval              #CONTEXT_TRIGGER_ERROR_NOT_SUPPORTED            Unsupported event/condition contained
618  * @retval              #CONTEXT_TRIGGER_ERROR_OUT_OF_MEMORY            Out of memory
619  * @retval              #CONTEXT_TRIGGER_ERROR_OPERATION_FAILED         Operation failed
620  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_RULE                     Invalid rule
621  *
622  * @see                 context_trigger_remove_rule()
623  */
624 int context_trigger_add_rule(context_trigger_rule_h rule, int* rule_id);
625
626 /**
627  * @brief               Removes a rule.
628  * @details             This removes the rule designated by the @c rule_id, which is owned by the application.
629  * @since_tizen 2.4
630  *
631  * @remarks             If the rule has been activated, it should be disabled through context_trigger_disable_rule() in advance.
632  *
633  * @param[in]   rule_id         The ID of the rule to be removed
634  *
635  * @return              0 on success, otherwise a negative error value
636  * @retval              #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
637  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
638  * @retval              #CONTEXT_TRIGGER_ERROR_OUT_OF_MEMORY            Out of memory
639  * @retval              #CONTEXT_TRIGGER_ERROR_OPERATION_FAILED         Operation failed
640  * @retval              #CONTEXT_TRIGGER_ERROR_RULE_ENABLED                     Rule is enabled already
641  * @retval              #CONTEXT_TRIGGER_ERROR_RULE_NOT_EXIST           Rule does not exist
642  *
643  * @see                 context_trigger_add_rule()
644  */
645 int context_trigger_remove_rule(int rule_id);
646
647 /**
648  * @brief               Enables a rule.
649  * @details             This activates the rule designated by the @c rule_id, which is owned by the application.
650  * @since_tizen 2.4
651  *
652  * @param[in]   rule_id         The ID of the rule to be enabled
653  *
654  * @return              0 on success, otherwise a negative error value
655  * @retval              #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
656  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
657  * @retval              #CONTEXT_TRIGGER_ERROR_OUT_OF_MEMORY            Out of memory
658  * @retval              #CONTEXT_TRIGGER_ERROR_OPERATION_FAILED         Operation failed
659  * @retval              #CONTEXT_TRIGGER_ERROR_RULE_ENABLED                     Rule is enabled already
660  * @retval              #CONTEXT_TRIGGER_ERROR_RULE_NOT_EXIST           Rule does not exist
661  *
662  * @see                 context_trigger_disable_rule()
663  */
664 int context_trigger_enable_rule(int rule_id);
665
666 /**
667  * @brief               Disables a rule.
668  * @details             This deactivates the rule designated by the @c rule_id, which is owned by the application.
669  * @since_tizen 2.4
670  *
671  * @param[in]   rule_id         The ID of the rule to be disabled
672  *
673  * @return              0 on success, otherwise a negative error value
674  * @retval              #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
675  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
676  * @retval              #CONTEXT_TRIGGER_ERROR_OUT_OF_MEMORY            Out of memory
677  * @retval              #CONTEXT_TRIGGER_ERROR_OPERATION_FAILED         Operation failed
678  * @retval              #CONTEXT_TRIGGER_ERROR_RULE_NOT_ENABLED         Rule is not enabled
679  * @retval              #CONTEXT_TRIGGER_ERROR_RULE_NOT_EXIST           Rule does not exist
680  *
681  * @see                 context_trigger_enable_rule()
682  */
683 int context_trigger_disable_rule(int rule_id);
684
685 /**
686  * @brief               Gets the IDs of the rules owned by the current application.
687  * @since_tizen 2.4
688  *
689  * @remarks             The arrays @c enabled_rule_ids and @c disabled_rule_ids must be released using @c free().
690  *
691  * @param[out]  enabled_rule_ids        The IDs of the active rules
692  * @param[out]  enabled_rule_count      The number of the active rules
693  * @param[out]  disabled_rule_ids       The IDs of the inactive rules
694  * @param[out]  disabled_rule_count     The number of the inactive rules
695  *
696  * @return              0 on success, otherwise a negative error value
697  * @retval              #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
698  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
699  * @retval              #CONTEXT_TRIGGER_ERROR_OUT_OF_MEMORY            Out of memory
700  * @retval              #CONTEXT_TRIGGER_ERROR_OPERATION_FAILED         Operation failed
701  *
702  */
703 int context_trigger_get_own_rule_ids(int** enabled_rule_ids, int* enabled_rule_count, int** disabled_rule_ids, int* disabled_rule_count);
704
705 /**
706  * @brief               Gets a rule stored in the system by rule ID.
707  * @since_tizen 2.4
708  *
709  * @remarks             The @c rule must be released using context_trigger_rule_destroy().
710  *
711  * @param[in]   rule_id         The ID of the rule to be retrieved
712  * @param[out]  rule            The rule retrieved
713  *
714  * @return              0 on success, otherwise a negative error value
715  * @retval              #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
716  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
717  * @retval              #CONTEXT_TRIGGER_ERROR_OUT_OF_MEMORY            Out of memory
718  * @retval              #CONTEXT_TRIGGER_ERROR_OPERATION_FAILED         Operation failed
719  * @retval              #CONTEXT_TRIGGER_ERROR_RULE_NOT_EXIST           Rule does not exist
720  */
721 int context_trigger_get_rule_by_id(int rule_id, context_trigger_rule_h* rule);
722
723 /**
724  * @brief               Creates an empty rule.
725  * @details             An empty rule container is created. When using this,
726  *                              a logical operator, one of #context_trigger_logical_type_e, needs to be designated.@n
727  *                              In case of #CONTEXT_TRIGGER_LOGICAL_CONJUNCTION,
728  *                              the rule can be satisfied only if all conditions are true.
729  *                              Otherwise, in case of #CONTEXT_TRIGGER_LOGICAL_DISJUNCTION,
730  *                              the rule can be satisfied if at least one is true.
731  * @since_tizen 2.4
732  *
733  * @remarks             The @c rule must be released using context_trigger_rule_destroy().
734  *
735  * @param[in]   logical_type    The logical operator
736  * @param[out]  rule                    The rule handle to be initialized
737  *
738  * @return              0 on success, otherwise a negative error value
739  * @retval              #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
740  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
741  * @retval              #CONTEXT_TRIGGER_ERROR_OUT_OF_MEMORY            Memory allocation failed
742  *
743  * @see                 context_trigger_rule_destroy()
744  */
745 int context_trigger_rule_create(context_trigger_logical_type_e logical_type, context_trigger_rule_h* rule);
746
747 /**
748  * @brief               Releases the resources occupied by a rule handle.
749  * @since_tizen 2.4
750  *
751  * @param[in]   rule            The rule handle to be released
752  *
753  * @return              0 on success, otherwise a negative error value
754  * @retval              #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
755  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
756  *
757  * @pre                 context_trigger_rule_create()
758  * @see                 context_trigger_get_rule_by_id()
759  */
760 int context_trigger_rule_destroy(context_trigger_rule_h rule);
761
762 /**
763  * @brief               Adds an event or a condition to a rule.
764  * @since_tizen 2.4
765  *
766  * @param[in]   rule            The rule
767  * @param[in]   entry           The event or condition entry to be added to the rule
768  *
769  * @return              0 on success, otherwise a negative error value
770  * @retval              #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
771  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
772  * @retval              #CONTEXT_TRIGGER_ERROR_OUT_OF_MEMORY            Out of memory
773  * @retval              #CONTEXT_TRIGGER_ERROR_OPERATION_FAILED         Operation failed
774  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_RULE                     Invalid rule
775  */
776 int context_trigger_rule_add_entry(context_trigger_rule_h rule, context_trigger_rule_entry_h entry);
777
778 /**
779  * @brief               Sets a app launching request as the action of a rule.
780  * @details             Contextual Trigger accepts an App Control as the action of a rule,
781  *                              an application thus can be launched when the rule is satisfied.@n
782  * @since_tizen 2.4
783  *
784  * @privlevel   public
785  * @privilege   http://tizen.org/privilege/appmanager.launch @n
786  *                              http://tizen.org/privilege/call
787  *
788  * @remarks             In addition to the privilege http://tizen.org/privilege/appmanager.launch,
789  *                              if it is an App Control that makes a call to someone,
790  *                              the privilege http://tizen.org/privilege/call is also required.
791  * @remarks             The launch request of the service application is restricted.
792  *                              The function will return #CONTEXT_TRIGGER_ERROR_INVALID_RULE,
793  *                              if the launch request is for the service application.
794  *
795  * @param[in]   rule                    The rule
796  * @param[in]   app_control             The App Control, which will be used to launch an application
797  *
798  * @return              0 on success, otherwise a negative error value
799  * @retval              #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
800  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
801  * @retval              #CONTEXT_TRIGGER_ERROR_PERMISSION_DENIED        Permission denied
802  * @retval              #CONTEXT_TRIGGER_ERROR_OUT_OF_MEMORY            Out of memory
803  * @retval              #CONTEXT_TRIGGER_ERROR_OPERATION_FAILED         Operation failed
804  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_RULE                     Invalid rule
805  */
806 int context_trigger_rule_set_action_app_control(context_trigger_rule_h rule, app_control_h app_control);
807
808 /**
809  * @brief               Sets a notification posting request as the action of a rule.
810  * @details             A basic notification can be posted when the rule is satisfied,
811  *                              which consists of the title, a content body text, an icon, and an App Control.
812  * @since_tizen 2.4
813  *
814  * @privlevel   public
815  * @privilege   http://tizen.org/privilege/notification
816  *
817  * @remarks             The @c app_control can be @c NULL. In that case, no application will be launched via the notification.
818  *
819  * @param[in]   rule                    The rule
820  * @param[in]   title                   The title text
821  * @param[in]   content                 The content body text
822  * @param[in]   icon_path               The icon file path
823  * @param[in]   app_control             The app control
824  *
825  * @return              0 on success, otherwise a negative error value
826  * @retval              #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
827  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
828  * @retval              #CONTEXT_TRIGGER_ERROR_PERMISSION_DENIED        Permission denied
829  * @retval              #CONTEXT_TRIGGER_ERROR_OUT_OF_MEMORY            Out of memory
830  * @retval              #CONTEXT_TRIGGER_ERROR_OPERATION_FAILED         Operation failed
831  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_RULE                     Invalid rule
832  */
833 int context_trigger_rule_set_action_notification(context_trigger_rule_h rule, const char* title, const char* content, const char* icon_path, app_control_h app_control);
834
835 /**
836  * @brief               Sets the description of a rule.
837  * @since_tizen 2.4
838  *
839  * @param[in]   rule                    The rule
840  * @param[in]   description             The description to be set
841  *
842  * @return              0 on success, otherwise a negative error value
843  * @retval              #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
844  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
845  * @retval              #CONTEXT_TRIGGER_ERROR_OUT_OF_MEMORY            Out of memory
846  * @retval              #CONTEXT_TRIGGER_ERROR_OPERATION_FAILED         Operation failed
847  *
848  * @see                 context_trigger_rule_get_description()
849  */
850 int context_trigger_rule_set_description(context_trigger_rule_h rule, const char* description);
851
852 /**
853  * @brief               Gets the description of a rule.
854  * @since_tizen 2.4
855  *
856  * @remarks             The @c description must be released using @c free().
857  *
858  * @param[in]   rule                    The rule
859  * @param[out]  description             The description of the rule
860  *
861  * @return              0 on success, otherwise a negative error value
862  * @retval              #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
863  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
864  * @retval              #CONTEXT_TRIGGER_ERROR_OUT_OF_MEMORY            Out of memory
865  * @retval              #CONTEXT_TRIGGER_ERROR_OPERATION_FAILED         Operation failed
866  *
867  * @see                 context_trigger_rule_set_description()
868  */
869 int context_trigger_rule_get_description(context_trigger_rule_h rule, char** description);
870
871 /**
872  * @brief               Creates an event entry.
873  * @details             An event of a contextual event item, which will be monitored by the system, is created.
874  * @since_tizen 2.4
875  *
876  * @remarks             The @c entry must be released using context_trigger_rule_entry_destroy().
877  *
878  * @param[in]   event_item              The contextual event item
879  * @param[in]   logical_type    The logical operator
880  * @param[out]  entry                   The event entry to be initialized
881  *
882  * @return              0 on success, otherwise a negative error value
883  * @retval              #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
884  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
885  * @retval              #CONTEXT_TRIGGER_ERROR_OUT_OF_MEMORY            Memory allocation failed
886  *
887  * @see                 context_trigger_rule_entry_destroy()
888  */
889 int context_trigger_rule_event_create(context_trigger_event_e event_item, context_trigger_logical_type_e logical_type, context_trigger_rule_entry_h* entry);
890
891 /**
892  * @brief               Checks whether a contextual event is supported in the current device.
893  * @since_tizen 2.4
894  *
895  * @param[in]   event_item              The contextual event item
896  * @param[out]  supported               If supported, @c true; Otherwise, @c false
897  *
898  * @return              0 on success, otherwise a negative error value
899  * @retval              #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
900  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
901  * @retval              #CONTEXT_TRIGGER_ERROR_OPERATION_FAILED         Operation failed
902  */
903 int context_trigger_rule_event_is_supported(context_trigger_event_e event_item, bool* supported);
904
905 /**
906  * @brief               Creates a condition entry.
907  * @details             A condition of a contextual condition item is created.
908  * @since_tizen 2.4
909  *
910  * @remarks             The @c entry must be released using context_trigger_rule_entry_destroy().
911  *
912  * @param[in]   condition_item  The contextual condition item
913  * @param[in]   logical_type    The logical operator
914  * @param[out]  entry                   The condition entry to be initialized
915  *
916  * @return              0 on success, otherwise a negative error value
917  * @retval              #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
918  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
919  * @retval              #CONTEXT_TRIGGER_ERROR_OUT_OF_MEMORY            Memory allocation failed
920  *
921  * @see                 context_trigger_rule_entry_destroy()
922  */
923 int context_trigger_rule_condition_create(context_trigger_condition_e condition_item, context_trigger_logical_type_e logical_type, context_trigger_rule_entry_h* entry);
924
925 /**
926  * @brief               Checks whether a contextual condition is supported in the current device.
927  * @since_tizen 2.4
928  *
929  * @param[in]   condition_item  The contextual condition item
930  * @param[out]  supported               If supported, @c true; Otherwise, @c false
931  *
932  * @return              0 on success, otherwise a negative error value
933  * @retval              #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
934  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
935  * @retval              #CONTEXT_TRIGGER_ERROR_OPERATION_FAILED         Operation failed
936  */
937 int context_trigger_rule_condition_is_supported(context_trigger_condition_e condition_item, bool* supported);
938
939 /**
940  * @brief               Releases the resource occupied by an entry.
941  * @since_tizen 2.4
942  *
943  * @param[in]   entry           The event or condition entry
944  *
945  * @return              0 on success, otherwise a negative error value
946  * @retval              #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
947  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
948  *
949  * @pre                 context_trigger_rule_event_create()
950  * @pre                 context_trigger_rule_condition_create()
951  */
952 int context_trigger_rule_entry_destroy(context_trigger_rule_entry_h entry);
953
954 /**
955  * @brief               Sets an integer type option to an event or condition entry.
956  * @details             See the programming guide to find available option keys for each event/condition item.
957  * @since_tizen 2.4
958  *
959  * @param[in]   entry                   The event or condition entry
960  * @param[in]   option_key              The option key
961  * @param[in]   value                   The option value
962  *
963  * @return              0 on success, otherwise a negative error value
964  * @retval              #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
965  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
966  * @retval              #CONTEXT_TRIGGER_ERROR_OUT_OF_MEMORY            Out of memory
967  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_RULE                     Invalid rule
968  *
969  * @see                 context_trigger_rule_entry_add_option()
970  * @see                 context_trigger_rule_entry_add_option_string()
971  */
972 int context_trigger_rule_entry_add_option_int(context_trigger_rule_entry_h entry, const char* option_key, int value);
973
974 /**
975  * @brief               Sets a string type option to an event or condition entry.
976  * @details             See the programming guide to find available option keys for each event/condition item.
977  * @since_tizen 2.4
978  *
979  * @param[in]   entry                   The event or condition entry
980  * @param[in]   option_key              The option key
981  * @param[in]   value                   The option value
982  *
983  * @return              0 on success, otherwise a negative error value
984  * @retval              #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
985  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
986  * @retval              #CONTEXT_TRIGGER_ERROR_OUT_OF_MEMORY            Out of memory
987  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_RULE                     Invalid rule
988  *
989  * @see                 context_trigger_rule_entry_add_option()
990  * @see                 context_trigger_rule_entry_add_option_int()
991  */
992 int context_trigger_rule_entry_add_option_string(context_trigger_rule_entry_h entry, const char* option_key, const char* value);
993
994 /**
995  * @brief               Sets an option to a condition entry, which references an attribute that will be extracted from the event.
996  * @details             See the programming guide to find available option keys for each condition item.
997  * @since_tizen 2.4
998  *
999  * @param[in]   entry                   The condition entry
1000  * @param[in]   option_key              The option key
1001  * @param[in]   event_data_key  The event data key of which the corresponding data value will be used as the option parameter
1002  *
1003  * @return              0 on success, otherwise a negative error value
1004  * @retval              #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
1005  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
1006  * @retval              #CONTEXT_TRIGGER_ERROR_OUT_OF_MEMORY            Out of memory
1007  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_RULE                     Invalid rule
1008  *
1009  * @see                 context_trigger_rule_entry_add_option_int()
1010  * @see                 context_trigger_rule_entry_add_option_string()
1011  */
1012 int context_trigger_rule_entry_add_option(context_trigger_rule_entry_h entry, const char* option_key, const char* event_data_key);
1013
1014 /**
1015  * @brief               Adds an attribute key to an entry.
1016  * @details             The key will be used as the left operand of comparisons.
1017  *                              See the programming guide to find available attribute keys for each event/condition item.
1018  * @since_tizen 2.4
1019  *
1020  * @param[in]   entry                   The event or condition entry
1021  * @param[in]   logical_type    The logical operator
1022  * @param[in]   key                             The attribute key
1023  *
1024  * @return              0 on success, otherwise a negative error value
1025  * @retval              #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
1026  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
1027  * @retval              #CONTEXT_TRIGGER_ERROR_OUT_OF_MEMORY            Out of memory
1028  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_RULE                     Invalid rule
1029  *
1030  * @post                context_trigger_rule_entry_add_comparison()
1031  * @post                context_trigger_rule_entry_add_comparison_int()
1032  * @post                context_trigger_rule_entry_add_comparison_string()
1033  */
1034 int context_trigger_rule_entry_add_key(context_trigger_rule_entry_h entry, context_trigger_logical_type_e logical_type, const char* key);
1035
1036 /**
1037  * @brief               Adds a comparison between an attribute key and an integer.
1038  * @details             The key needs to be registered in advance, via context_trigger_rule_entry_add_key().
1039  *                              As the comparison operator, one of the following operators is allowed:
1040  *                              #CONTEXT_TRIGGER_EQUAL_TO, #CONTEXT_TRIGGER_NOT_EQUAL_TO, #CONTEXT_TRIGGER_LESS_THAN,
1041  *                              #CONTEXT_TRIGGER_GREATER_THAN, #CONTEXT_TRIGGER_LESS_THAN_OR_EQUAL_TO
1042  *                              and #CONTEXT_TRIGGER_GREATER_THAN_OR_EQUAL_TO.
1043  * @since_tizen 2.4
1044  *
1045  * @param[in]   entry                   The event or condition entry
1046  * @param[in]   key                             The attribute key, which will be used as the left operand
1047  * @param[in]   comp_operator   The comparison operator
1048  * @param[in]   value                   The right operand value
1049  *
1050  * @return              0 on success, otherwise a negative error value
1051  * @retval              #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
1052  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
1053  * @retval              #CONTEXT_TRIGGER_ERROR_OUT_OF_MEMORY            Out of memory
1054  * @retval              #CONTEXT_TRIGGER_ERROR_NO_DATA                          The key was not added in the entry
1055  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_RULE                     Invalid rule
1056  *
1057  * @pre                 context_trigger_rule_entry_add_key()
1058  * @see                 context_trigger_rule_entry_add_comparison()
1059  * @see                 context_trigger_rule_entry_add_comparison_string()
1060  */
1061 int context_trigger_rule_entry_add_comparison_int(context_trigger_rule_entry_h entry, const char* key, const char* comp_operator, int  value);
1062
1063 /**
1064  * @brief               Adds a comparison between an attribute key and a string.
1065  * @details             The key needs to be registered in advance, via context_trigger_rule_entry_add_key().
1066  *                              As the comparison operator, one of the following operators is allowed:
1067  *                              #CONTEXT_TRIGGER_EQUAL_TO and #CONTEXT_TRIGGER_NOT_EQUAL_TO.
1068  * @since_tizen 2.4
1069  *
1070  * @param[in]   entry                   The event or condition entry
1071  * @param[in]   key                             The attribute key, which will be used as the left operand
1072  * @param[in]   comp_operator   The comparison operator
1073  * @param[in]   value                   The right operand value
1074  *
1075  * @return              0 on success, otherwise a negative error value
1076  * @retval              #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
1077  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
1078  * @retval              #CONTEXT_TRIGGER_ERROR_OUT_OF_MEMORY            Out of memory
1079  * @retval              #CONTEXT_TRIGGER_ERROR_NO_DATA                          The key was not added in the entry
1080  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_RULE                     Invalid rule
1081  *
1082  * @pre                 context_trigger_rule_entry_add_key()
1083  * @see                 context_trigger_rule_entry_add_comparison()
1084  * @see                 context_trigger_rule_entry_add_comparison_int()
1085  */
1086 int context_trigger_rule_entry_add_comparison_string(context_trigger_rule_entry_h entry, const char* key, const char* comp_operator, const char* value);
1087
1088 /**
1089  * @brief               Adds a comparison between an attribute of a condition and an attribute extracted from the event.
1090  * @details             The key needs to be registered in advance, via context_trigger_rule_entry_add_key().
1091  * @since_tizen 2.4
1092  *
1093  * @param[in]   entry                   The condition entry
1094  * @param[in]   key                             The attribute key of the condition, which will be used as the left operand
1095  * @param[in]   comp_operator   The comparison operator
1096  * @param[in]   event_data_key  The event data key of which the corresponding data value will be used as the right operand
1097  *
1098  * @return              0 on success, otherwise a negative error value
1099  * @retval              #CONTEXT_TRIGGER_ERROR_NONE                                     Successful
1100  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER        Invalid parameter
1101  * @retval              #CONTEXT_TRIGGER_ERROR_OUT_OF_MEMORY            Out of memory
1102  * @retval              #CONTEXT_TRIGGER_ERROR_NO_DATA                          The key was not added in the entry
1103  * @retval              #CONTEXT_TRIGGER_ERROR_INVALID_RULE                     Invalid rule
1104  *
1105  * @pre                 context_trigger_rule_entry_add_key()
1106  * @see                 context_trigger_rule_entry_add_comparison_int()
1107  * @see                 context_trigger_rule_entry_add_comparison_string()
1108  */
1109 int context_trigger_rule_entry_add_comparison(context_trigger_rule_entry_h entry, const char* key, const char* comp_operator, const char* event_data_key);
1110
1111 #ifdef __cplusplus
1112 }
1113 #endif /* __cplusplus */
1114
1115 /**
1116 * @}
1117 */
1118
1119 #endif /* __TIZEN_CONTEXT_CONTEXT_TRIGGER_H__ */