2 * Copyright (c) 2011 - 2016 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #ifndef __TIZEN_APPFW_ALARM_H__
19 #define __TIZEN_APPFW_ALARM_H__
23 #include <app_control.h>
24 #include <notification.h>
35 * @addtogroup CAPI_ALARM_MODULE
40 * @brief Definition to app_control extra data : the ID of the alarm registered.
41 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
43 #define APP_CONTROL_DATA_ALARM_ID "http://tizen.org/appcontrol/data/alarm_id"
46 * @brief Enumeration for Alarm Error.
47 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
50 ALARM_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
51 ALARM_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
52 ALARM_ERROR_INVALID_TIME = TIZEN_ERROR_APPLICATION | 0x05, /**< Invalid time */
53 ALARM_ERROR_INVALID_DATE = TIZEN_ERROR_APPLICATION | 0x06, /**< Invalid date */
54 ALARM_ERROR_CONNECTION_FAIL = TIZEN_ERROR_APPLICATION | 0x07, /**< The alarm service connection failed */
55 ALARM_ERROR_NOT_PERMITTED_APP = TIZEN_ERROR_APPLICATION | 0x08, /**< Application is not permitted. (Since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif) */
56 ALARM_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
57 ALARM_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED /**< Permission denied */
62 * @brief Enumeration for Alarm Week Flag, the days of the week.
63 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
66 ALARM_WEEK_FLAG_SUNDAY = 0x01, /**< Sunday */
67 ALARM_WEEK_FLAG_MONDAY = 0x02, /**< Monday */
68 ALARM_WEEK_FLAG_TUESDAY = 0x04, /**< Tuesday */
69 ALARM_WEEK_FLAG_WEDNESDAY = 0x08, /**< Wednesday */
70 ALARM_WEEK_FLAG_THURSDAY = 0x10, /**< Thursday */
71 ALARM_WEEK_FLAG_FRIDAY = 0x20, /**< Friday */
72 ALARM_WEEK_FLAG_SATURDAY = 0x40 /**< Saturday */
76 * @brief Called once for each scheduled alarm to get the alarm ID.
78 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
79 * @param[in] alarm_id The alarm ID returned when the alarm is scheduled
80 * @param[in] user_data The user data passed from the foreach function
81 * @return @c true to continue with the next iteration of the loop,
82 * otherwise @c false to break out of the loop
83 * @pre alarm_foreach_registered_alarm() will invoke this callback to get all the registered alarm IDs.
84 * @see alarm_foreach_registered_alarm()
86 typedef bool (*alarm_registered_alarm_cb)(int alarm_id, void *user_data);
89 * @brief Sets an alarm to be triggered after a specific time.
90 * @details The alarm will first go off @a delay seconds later and then will go off every certain amount of time defined using @a period seconds.
91 * To cancel the alarm, call alarm_cancel() with @a alarm_id.
92 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
94 * @privilege %http://tizen.org/privilege/alarm.set
95 * @remarks If the application is uninstalled after setting an alarm, the alarm is cancelled automatically.
96 * If the operation of @a app_control is not specified, #APP_CONTROL_OPERATION_DEFAULT is used for the launch request.
97 * If the operation of @a app_control is #APP_CONTROL_OPERATION_DEFAULT, the package information is mandatory to explicitly launch the application.
98 * Since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif, this api does not support exact period and delay for minimizing the wakeups of the device. The system can adjust when the alarm expires.
99 * If you want to trigger an alarm exactly, see @see alarm_schedule_once_after_delay()
100 * Since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif If @a app_control is specified with service-application, the application is only allowed to run on which has Background Category.
101 * Since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif If the appid of @a app_control is not specified, this api is not allowed. In other words, the explicit @a app_control is only allowed.
103 * @param[in] app_control The destination app_control to perform a specific task when the alarm is triggered
104 * @param[in] delay The amount of time before the first execution (in seconds). Since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif, Although this is inexact, the alarm will not fire before this time
105 * @param[in] period The amount of time between subsequent alarms (in seconds). Since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif, This value does not guarantee the accuracy. The actual interval is calculated by the OS. The minimum value is 600sec
106 * @param[out] alarm_id The alarm ID that uniquely identifies an alarm
107 * @return @c 0 on success,
108 * otherwise a negative error value
109 * @retval #ALARM_ERROR_NONE Successful
110 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
111 * @retval #ALARM_ERROR_INVALID_TIME Triggered time is invalid
112 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
113 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
114 * @retval #ALARM_ERROR_NOT_PERMITTED_APP @a app_control is not permitted
115 * @see alarm_cancel()
116 * @see alarm_cancel_all()
117 * @see alarm_get_scheduled_date()
118 * @see alarm_get_scheduled_period()
119 * @see alarm_schedule_once_after_delay()
121 int alarm_schedule_after_delay(app_control_h app_control, int delay, int period, int *alarm_id);
125 * @deprecated Deprecated since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif. [Use alarm_schedule_once_at_date() instead]
126 * @brief Sets an alarm to be triggered at a specific time.
127 * @details The @a date describes the time of the first occurrence.
128 * If @a period is bigger than @c 0, the alarm will be scheduled after the @a period time.
129 * If @a period is set to @c 0, the alarm will go off just once without repetition.
130 * To cancel the alarm, call alarm_cancel() with @a alarm_id.
131 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
133 * @privilege %http://tizen.org/privilege/alarm.set
134 * @remarks If application is uninstalled after setting an alarm, the alarm is cancelled automatically.
135 * If the operation of @a app_control is not specified, #APP_CONTROL_OPERATION_DEFAULT is used for the launch request.
136 * If the operation of @a app_control is #APP_CONTROL_OPERATION_DEFAULT, the package information is mandatory to explicitly launch the application.
138 * @param[in] app_control The destination app_control to perform specific work when the alarm is triggered
139 * @param[in] date The first active alarm time
140 * @param[in] period The amount of time between subsequent alarms(in second)
141 * @param[out] alarm_id The alarm ID that uniquely identifies an alarm
142 * @return @c 0 on success,
143 * otherwise a negative error value
144 * @retval #ALARM_ERROR_NONE Successful
145 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
146 * @retval #ALARM_ERROR_INVALID_DATE Triggered date is invalid
147 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
148 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
149 * @see alarm_cancel()
150 * @see alarm_cancel_all()
151 * @see alarm_get_scheduled_date()
152 * @see alarm_get_scheduled_period()
154 int alarm_schedule_at_date(app_control_h app_control, struct tm *date, int period, int *alarm_id) TIZEN_DEPRECATED_API;
157 * @brief Sets an alarm to be triggered after a specific time.
158 * @details The alarm will go off @a delay seconds later.
159 * To cancel the alarm, call alarm_cancel() with @a alarm_id.
160 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
162 * @privilege %http://tizen.org/privilege/alarm.set
163 * @remarks If the application is uninstalled after setting an alarm, the alarm is cancelled automatically.
164 * If the operation of @a app_control is not specified, #APP_CONTROL_OPERATION_DEFAULT is used for the launch request.
165 * If the operation of @a app_control is #APP_CONTROL_OPERATION_DEFAULT, the package information is mandatory to explicitly launch the application.
166 * If the appid of @a app_control is not specified, this api is not allowed. In other words, the explicit @a app_control is only allowed.
167 * The @a app_control only supports UI application with this api. If @a app_control is not UI application, #ALARM_ERROR_NOT_PERMITTED_APP returned.
168 * When the alarm is expired, Alarm Manager will turn on LCD to prohibit background jobs.
170 * @param[in] app_control The destination app_control to perform a specific task when the alarm is triggered
171 * @param[in] delay The amount of time before the execution (in seconds)
172 * @param[out] alarm_id The alarm ID that uniquely identifies an alarm
173 * @return @c 0 on success,
174 * otherwise a negative error value
175 * @retval #ALARM_ERROR_NONE Successful
176 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
177 * @retval #ALARM_ERROR_INVALID_TIME Triggered time is invalid
178 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
179 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
180 * @retval #ALARM_ERROR_NOT_PERMITTED_APP @a app_control is not permitted. @a app_control for UI application is only permitted.
181 * @see alarm_cancel()
182 * @see alarm_cancel_all()
183 * @see alarm_get_scheduled_date()
185 int alarm_schedule_once_after_delay(app_control_h app_control, int delay, int *alarm_id);
189 * @brief Sets an alarm to be triggered at a specific time.
190 * @details The @a date describes the time of the first occurrence.
191 * To cancel the alarm, call alarm_cancel() with @a alarm_id.
192 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
194 * @privilege %http://tizen.org/privilege/alarm.set
195 * @remarks If application is uninstalled after setting an alarm, the alarm is cancelled automatically.
196 * If the operation of @a app_control is not specified, #APP_CONTROL_OPERATION_DEFAULT is used for the launch request.
197 * If the operation of @a app_control is #APP_CONTROL_OPERATION_DEFAULT, the package information is mandatory to explicitly launch the application.
198 * If the appid of @a app_control is not specified, this api is not allowed. In other words, the explicit @a app_control is only allowed.
199 * The @a app_control only supports UI application with this api. If @a app_control is not UI application, #ALARM_ERROR_NOT_PERMITTED_APP returned.
200 * When the alarm is expired, Alarm Manager will turn on LCD to prohibit background jobs.
202 * @param[in] app_control The destination app_control to perform specific work when the alarm is triggered
203 * @param[in] date The first active alarm time
204 * @param[out] alarm_id The alarm ID that uniquely identifies an alarm
205 * @return @c 0 on success,
206 * otherwise a negative error value
207 * @retval #ALARM_ERROR_NONE Successful
208 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
209 * @retval #ALARM_ERROR_INVALID_DATE Triggered date is invalid
210 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
211 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
212 * @retval #ALARM_ERROR_NOT_PERMITTED_APP @a app_control is not permitted. @a app_control for UI application is only permitted.
213 * @see alarm_cancel()
214 * @see alarm_cancel_all()
215 * @see alarm_get_scheduled_date()
217 int alarm_schedule_once_at_date(app_control_h app_control, struct tm *date, int *alarm_id);
221 * @brief Sets an alarm to be triggered periodically, starting at a specific time.
222 * @details The @a date describes the time of the first occurrence.
223 * @a week_flag is the repeat value of the days of the week.
224 * If @a week_flag is #ALARM_WEEK_FLAG_TUESDAY, the alarm will repeat every Tuesday at a specific time.
225 * To cancel the alarm, call alarm_cancel() with @a alarm_id.
226 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
228 * @privilege %http://tizen.org/privilege/alarm.set
229 * @remarks If the application is uninstalled after setting an alarm, the alarm is cancelled automatically.
230 * If the operation of @a app_control is not specified, #APP_CONTROL_OPERATION_DEFAULT is used for the launch request.
231 * If the operation of @a app_control is #APP_CONTROL_OPERATION_DEFAULT, the package information is mandatory to explicitly launch the application.
232 * Since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif, The @a app_control only supports UI application with this api. If @a app_control is not UI application, #ALARM_ERROR_NOT_PERMITTED_APP returned.
233 * When the alarm is expired, Alarm Manager will turn on LCD to prohibit background jobs.
234 * Since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif, If the appid of @a app_control is not specified, this api is not allowed. In other words, the explicit @a app_control is only allowed.
236 * @param[in] app_control The destination app_control to perform specific work when the alarm is triggered
237 * @param[in] date The first active alarm time
238 * @param[in] week_flag The day of the week, @a week_flag may be a combination of days, like #ALARM_WEEK_FLAG_TUESDAY | #ALARM_WEEK_FLAG_FRIDAY
239 * @param[out] alarm_id The alarm ID that uniquely identifies an alarm
240 * @return @c 0 on success,
241 * otherwise a negative error value
242 * @retval #ALARM_ERROR_NONE Successful
243 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
244 * @retval #ALARM_ERROR_INVALID_DATE Triggered date is invalid
245 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
246 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
247 * @retval #ALARM_ERROR_NOT_PERMITTED_APP @a app_control is not permitted. @a app_control for UI application is only permitted.
248 * @see alarm_cancel()
249 * @see alarm_cancel_all()
250 * @see alarm_get_scheduled_recurrence_week_flag()
251 * @see alarm_get_scheduled_date()
252 * @see #alarm_week_flag_e
254 int alarm_schedule_with_recurrence_week_flag(app_control_h app_control, struct tm *date, int week_flag, int *alarm_id);
258 * @brief Gets the recurrence days of the week.
259 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
261 * @privilege %http://tizen.org/privilege/alarm.get
262 * @remarks If the given @a alarm_id is not obtained by using the alarm_schedule_with_recurrence_week_flag() function,
263 * an error (error code #ALARM_ERROR_INVALID_PARAMETER) will occur because this alarm is scheduled with no recurrence.
264 * If the operation of @a app_control is not specified, #APP_CONTROL_OPERATION_DEFAULT is used for the launch request.
265 * If the operation of @a app_control is #APP_CONTROL_OPERATION_DEFAULT, the package information is mandatory to explicitly launch the application.
266 * @param[in] alarm_id The alarm ID returned when the alarm is scheduled
267 * @param[out] week_flag The recurrence days of the week, @a week_flag may be a combination of days, like #ALARM_WEEK_FLAG_TUESDAY | #ALARM_WEEK_FLAG_FRIDAY
268 * @return @c 0 on success,
269 * otherwise a negative error value
270 * @retval #ALARM_ERROR_NONE Successful
271 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
272 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
273 * @see alarm_schedule_with_recurrence_week_flag()
274 * @see #alarm_week_flag_e
276 int alarm_get_scheduled_recurrence_week_flag(int alarm_id, int *week_flag);
280 * @brief Cancels the alarm with the specific alarm ID.
281 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
283 * @privilege %http://tizen.org/privilege/alarm.set
284 * @param[in] alarm_id The alarm ID that is cancelled
285 * @return @c 0 on success,
286 * otherwise a negative error value
287 * @retval #ALARM_ERROR_NONE Successful
288 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
289 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
290 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
291 * @see alarm_schedule_at_date()
292 * @see alarm_schedule_after_delay()
293 * @see alarm_schedule_with_recurrence_week_flag()
294 * @see alarm_cancel_all()
296 int alarm_cancel(int alarm_id);
300 * @brief Cancels all scheduled alarms that are registered by the application that calls this API.
301 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
303 * @privilege %http://tizen.org/privilege/alarm.set
304 * @return @c 0 on success,
305 * otherwise a negative error value
306 * @retval #ALARM_ERROR_NONE Successful
307 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
308 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
309 * @see alarm_schedule_at_date()
310 * @see alarm_schedule_after_delay()
311 * @see alarm_schedule_with_recurrence_week_flag()
312 * @see alarm_cancel()
314 int alarm_cancel_all(void);
318 * @brief Retrieves the IDs of all registered alarms by invoking a callback once for each scheduled alarm.
319 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
321 * @privilege %http://tizen.org/privilege/alarm.get
322 * @param[in] callback The callback function to invoke
323 * @param[in] user_data The user data to be passed to the callback function
324 * @return @c 0 on success,
325 * otherwise a negative error value
326 * @retval #ALARM_ERROR_NONE Successful
327 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
328 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
329 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
330 * @post This function invokes alarm_registered_alarm_cb() repeatedly for each registered alarm.
331 * @see alarm_registered_alarm_cb()
333 int alarm_foreach_registered_alarm(alarm_registered_alarm_cb callback, void *user_data);
337 * @brief Gets the scheduled time from the given alarm ID in C standard time struct.
338 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
340 * @privilege %http://tizen.org/privilege/alarm.get
341 * @param[in] alarm_id The alarm ID returned when the alarm is scheduled
342 * @param[out] date The time value of the next alarm event
343 * @return @c 0 on success,
344 * otherwise a negative error value
345 * @retval #ALARM_ERROR_NONE Successful
346 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
347 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
348 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
349 * @see alarm_schedule_at_date()
350 * @see alarm_schedule_after_delay()
351 * @see alarm_schedule_with_recurrence_week_flag()
353 int alarm_get_scheduled_date(int alarm_id, struct tm *date);
357 * @brief Gets the period of time between the recurrent alarms.
358 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
360 * @privilege %http://tizen.org/privilege/alarm.get
361 * @remarks If the given @a alarm_id is not obtained by using the alarm_schedule_at_date() or alarm_schedule_after_delay() function,
362 * an error (error code #ALARM_ERROR_INVALID_PARAMETER) will occur.
363 * @param[in] alarm_id The alarm ID returned when the alarm is scheduled
364 * @param[out] period The period of time between recurrent alarms in seconds
365 * @return @c 0 on success,
366 * otherwise a negative error value
367 * @retval #ALARM_ERROR_NONE Successful
368 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
369 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
370 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
371 * @see alarm_schedule_at_date()
372 * @see alarm_schedule_after_delay()
373 * @see alarm_schedule_with_recurrence_week_flag()
375 int alarm_get_scheduled_period(int alarm_id, int *period);
379 * @brief Gets the current system time using C standard time struct.
380 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
381 * @param[out] date The current system time
382 * @return @c 0 on success,
383 * otherwise a negative error value
384 * @retval #ALARM_ERROR_NONE Successful
385 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
386 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
388 int alarm_get_current_time(struct tm *date);
392 * @brief Gets the app_control to be invoked when the the alarm is triggered.
393 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
395 * @privilege %http://tizen.org/privilege/alarm.get
396 * @remarks The @a app_control must be released using app_control_destroy().
397 * @param[in] alarm_id The alarm ID uniquely identifies an alarm
398 * @param[out] app_control The app_control handle to launch when the alarm is triggered
399 * @return @c 0 on success,
400 * otherwise a negative error value
401 * @retval #ALARM_ERROR_NONE Successful
402 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
403 * @retval #ALARM_ERROR_OUT_OF_MEMORY Out of memory
404 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
405 * @see alarm_schedule_at_date()
406 * @see alarm_schedule_after_delay()
407 * @see alarm_schedule_with_recurrence_week_flag()
409 int alarm_get_app_control(int alarm_id, app_control_h *app_control);
413 * @brief Sets global flag in the alarm.
414 * @details Sets @a global flag to set/unset alarm globally.
417 * @privilege %http://tizen.org/privilege/alarm.set
418 * @remarks The @a alarm_id must be id of alarm which will launch global application.
419 * The function returns an error (error code #ALARM_ERROR_NOT_PERMITTED_APP) if it is not.
420 * Note that the application which is launched by global alarm runs in the user session that is logined currently.
421 * It doesn't run in the session for the user who registers the global alarm.
422 * So, If the application uses application's private data for each user to handling the app_control for the alarm, it might not show proper data to the user.
423 * Therefore, We recommend to contain all the data for the alarm to the app_control handle for the global alarm.
424 * Then, the launched application would be able to use the data to show proper alarm UX to the user.
425 * @param[in] alarm_id The alarm ID uniquely identifies an alarm
426 * @param[in] global The global flag to set/unset alarm globally
427 * @return @c 0 on success,
428 * otherwise a negative error value
429 * @retval #ALARM_ERROR_NONE Successful
430 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
431 * @retval #ALARM_ERROR_NOT_PERMITTED_APP @a alarm_id is not permitted
432 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
433 * @see alarm_schedule_at_date()
434 * @see alarm_schedule_after_delay()
435 * @see alarm_schedule_with_recurrence_week_flag()
437 int alarm_set_global(int alarm_id, bool global);
441 * @brief Gets whether the alarm will launch global application or not.
444 * @privilege %http://tizen.org/privilege/alarm.get
445 * @param[in] alarm_id The alarm ID uniquely identifies an alarm
446 * @param[out] global Whether the alarm will launch global application or not
447 * @return @c 0 on success,
448 * otherwise a negative error value
449 * @retval #ALARM_ERROR_NONE Successful
450 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
451 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
452 * @see alarm_set_global()
454 int alarm_get_global(int alarm_id, bool *global);
458 * @brief Sets a notification alarm to be triggered at a specific time.
459 * @details The @a date describes the time of the alarm occurrence.
460 * To cancel the alarm, call alarm_cancel() with @a alarm_id.
463 * @privilege %http://tizen.org/privilege/alarm.set
464 * @privilege %http://tizen.org/privilege/notification
465 * @remarks If application is uninstalled after setting an alarm, the alarm is cancelled automatically.
466 * When the alarm goes off, Alarm Manager will turn on LCD to prohibit background jobs.
468 * @param[in] noti The notification to be posted when the alarm is triggered
469 * @param[in] date The active alarm time
470 * @param[out] alarm_id The ID which uniquely identifies the scheduled alarm
471 * @return @c 0 on success,
472 * otherwise a negative error value
473 * @retval #ALARM_ERROR_NONE Successful
474 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
475 * @retval #ALARM_ERROR_INVALID_DATE Triggered date is invalid
476 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
477 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
478 * @see alarm_cancel()
479 * @see alarm_cancel_all()
480 * @see alarm_get_scheduled_date()
482 int alarm_schedule_noti_once_at_date(notification_h noti, struct tm *date, int *alarm_id);
485 * @brief Sets a notification alarm to be triggered after a specific delay.
486 * @details The alarm will first go off after @a delay seconds.
487 * The alarm will then go off every period seconds until canceled.
488 * To cancel the alarm, call alarm_cancel() with @a alarm_id.
491 * @privilege %http://tizen.org/privilege/alarm.set
492 * @privilege %http://tizen.org/privilege/notification
493 * @remarks If the application is uninstalled after setting an alarm, the alarm is cancelled automatically.
494 * This function is a minimally intrusive way to trigger alarms when precision is not important.
495 * The system will adjust the @a delay and @a period requests to suit internal needs; the requests
496 * will be treated as minimum values. Note that @a period cannot be less than 600 seconds, if
497 * a smaller request is supplied it will be silently adjusted to a request of 600.
498 * When the alarm goes off, Alarm Manager will turn on LCD to prohibit background jobs.
500 * @param[in] noti The notification to be posted when the alarm is triggered
501 * @param[in] delay The amount of time before the first execution (in seconds).
502 * @param[in] period The amount of time between subsequent alarms (in seconds).
503 * @param[out] alarm_id The ID which uniquely identifies the scheduled alarm
504 * @return @c 0 on success,
505 * otherwise a negative error value
506 * @retval #ALARM_ERROR_NONE Successful
507 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
508 * @retval #ALARM_ERROR_INVALID_TIME Triggered time is invalid
509 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
510 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
511 * @see alarm_cancel()
512 * @see alarm_cancel_all()
513 * @see alarm_get_scheduled_date()
514 * @see alarm_get_scheduled_period()
515 * @see alarm_schedule_noti_once_after_delay()
517 int alarm_schedule_noti_after_delay(notification_h noti, int delay, int period, int *alarm_id);
520 * @brief Sets a notification alarm to be triggered after a specific delay.
521 * @details The alarm will go off @a delay seconds later.
522 * To cancel the alarm, call alarm_cancel() with @a alarm_id.
525 * @privilege %http://tizen.org/privilege/alarm.set
526 * @privilege %http://tizen.org/privilege/notification
527 * @remarks If the application is uninstalled after setting an alarm, the alarm is cancelled automatically.
528 * When the alarm goes off, Alarm Manager will turn on LCD to prohibit background jobs.
530 * @param[in] noti The notification to be posted when the alarm is triggered
531 * @param[in] delay The amount of time before the execution (in seconds)
532 * @param[out] alarm_id The ID which uniquely identifies the scheduled alarm
533 * @return @c 0 on success,
534 * otherwise a negative error value
535 * @retval #ALARM_ERROR_NONE Successful
536 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
537 * @retval #ALARM_ERROR_INVALID_TIME Triggered time is invalid
538 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
539 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
540 * @see alarm_cancel()
541 * @see alarm_cancel_all()
542 * @see alarm_get_scheduled_date()
544 int alarm_schedule_noti_once_after_delay(notification_h noti, int delay, int *alarm_id);
547 * @brief Sets a notification to be triggered periodically, starting at a specific time.
548 * @details The @a date describes the time of the first occurrence.
549 * @a week_flag describes the day(s) of the week when the notification recurs.
550 * If @a week_flag is #ALARM_WEEK_FLAG_TUESDAY, the alarm will repeat every Tuesday at a specific time.
551 * If @a week_flag is less than or equal to zero, the alarm is not repeated.
552 * To cancel the alarm, call alarm_cancel() with @a alarm_id.
555 * @privilege %http://tizen.org/privilege/alarm.set
556 * @privilege %http://tizen.org/privilege/notification
557 * @remarks If the application is uninstalled after setting an alarm, the alarm is cancelled automatically.
559 * @param[in] noti The notification to be posted when the alarm is triggered
560 * @param[in] date The first active alarm time
561 * @param[in] week_flag The day of the week the notification recurs. @a week_flag may be a combination of days, like #ALARM_WEEK_FLAG_TUESDAY | #ALARM_WEEK_FLAG_FRIDAY
562 * @param[out] alarm_id The ID which uniquely identifies the scheduled alarm
563 * @return @c 0 on success,
564 * otherwise a negative error value
565 * @retval #ALARM_ERROR_NONE Successful
566 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
567 * @retval #ALARM_ERROR_INVALID_DATE Triggered date is invalid
568 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
569 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
570 * @see alarm_cancel()
571 * @see alarm_cancel_all()
572 * @see alarm_get_scheduled_recurrence_week_flag()
573 * @see alarm_get_scheduled_date()
574 * @see #alarm_week_flag_e
576 int alarm_schedule_noti_with_recurrence_week_flag(notification_h noti, struct tm *date, int week_flag, int *alarm_id);
579 * @brief Gets the notification to be posted when an alarm is triggered.
582 * @privilege %http://tizen.org/privilege/alarm.get
583 * @remarks @a noti must be released using notification_free().
585 * @param[in] alarm_id The ID which uniquely identifies a scheduled alarm
586 * @param[out] noti The notification to be posted when the alarm is triggered
587 * @return @c 0 on success,
588 * otherwise a negative error value
589 * @retval #ALARM_ERROR_NONE Successful
590 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
591 * @retval #ALARM_ERROR_OUT_OF_MEMORY Out of memory
592 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
593 * @see alarm_schedule_noti_once_at_date()
594 * @see alarm_schedule_noti_after_delay()
595 * @see alarm_schedule_noti_once_after_delay()
596 * @see alarm_schedule_noti_with_recurrence_week_flag()
598 int alarm_get_notification(int alarm_id, notification_h *noti);
608 #endif /* __TIZEN_APPFW_ALARM_H__ */