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 */
77 * @brief Called once for each scheduled alarm to get the alarm ID.
79 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
80 * @param[in] alarm_id The alarm ID returned when the alarm is scheduled
81 * @param[in] user_data The user data passed from the foreach function
82 * @return @c true to continue with the next iteration of the loop,
83 * otherwise @c false to break out of the loop
84 * @pre alarm_foreach_registered_alarm() will invoke this callback to get all the registered alarm IDs.
85 * @see alarm_foreach_registered_alarm()
87 typedef bool (*alarm_registered_alarm_cb)(int alarm_id, void *user_data);
91 * @brief Sets an alarm to be triggered after a specific time.
92 * @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. To cancel the alarm, call alarm_cancel() with @a alarm_id.
93 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
95 * @privilege %http://tizen.org/privilege/alarm.set
96 * @remarks If the application is uninstalled after setting an alarm, the alarm is cancelled automatically.
97 * If the operation of @a app_control is not specified, #APP_CONTROL_OPERATION_DEFAULT is used for the launch request.
98 * If the operation of @a app_control is #APP_CONTROL_OPERATION_DEFAULT, the package information is mandatory to explicitly launch the application.
99 * 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.
100 * If you want to trigger an alarm exactly, see @see alarm_schedule_once_after_delay()
101 * 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.
102 * 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.
104 * @param[in] app_control The destination app_control to perform a specific task when the alarm is triggered
105 * @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
106 * @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
107 * @param[out] alarm_id The alarm ID that uniquely identifies an alarm
108 * @return @c 0 on success,
109 * otherwise a negative error value
110 * @retval #ALARM_ERROR_NONE Successful
111 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
112 * @retval #ALARM_ERROR_INVALID_TIME Triggered time is invalid
113 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
114 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
115 * @retval #ALARM_ERROR_NOT_PERMITTED_APP @a app_control is not permitted
116 * @see alarm_cancel()
117 * @see alarm_cancel_all()
118 * @see alarm_get_scheduled_date()
119 * @see alarm_get_scheduled_period()
120 * @see alarm_schedule_once_after_delay()
122 int alarm_schedule_after_delay(app_control_h app_control, int delay, int period, int *alarm_id);
126 * @deprecated Deprecated since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif. [Use alarm_schedule_once_at_date() instead]
127 * @brief Sets an alarm to be triggered at a specific time.
128 * @details The @a date describes the time of the first occurrence.
129 * If @a period is bigger than @c 0, the alarm will be scheduled after the @a period time.
130 * If @a period is set to @c 0, the alarm will go off just once without repetition.
131 * To cancel the alarm, call alarm_cancel() with @a alarm_id.
132 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
134 * @privilege %http://tizen.org/privilege/alarm.set
135 * @remarks If application is uninstalled after setting an alarm, the alarm is cancelled automatically.
136 * If the operation of @a app_control is not specified, #APP_CONTROL_OPERATION_DEFAULT is used for the launch request.
137 * If the operation of @a app_control is #APP_CONTROL_OPERATION_DEFAULT, the package information is mandatory to explicitly launch the application.
139 * @param[in] app_control The destination app_control to perform specific work when the alarm is triggered
140 * @param[in] date The first active alarm time
141 * @param[in] period The amount of time between subsequent alarms(in second)
142 * @param[out] alarm_id The alarm ID that uniquely identifies an alarm
143 * @return @c 0 on success,
144 * otherwise a negative error value
145 * @retval #ALARM_ERROR_NONE Successful
146 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
147 * @retval #ALARM_ERROR_INVALID_DATE Triggered date is invalid
148 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
149 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
150 * @see alarm_cancel()
151 * @see alarm_cancel_all()
152 * @see alarm_get_scheduled_date()
153 * @see alarm_get_scheduled_period()
155 int alarm_schedule_at_date(app_control_h app_control, struct tm *date, int period, int *alarm_id) TIZEN_DEPRECATED_API;
158 * @brief Sets an alarm to be triggered after a specific time.
159 * @details The alarm will go off @a delay seconds later. 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. To cancel the alarm, call alarm_cancel() with @a alarm_id.
191 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
193 * @privilege %http://tizen.org/privilege/alarm.set
194 * @remarks If application is uninstalled after setting an alarm, the alarm is cancelled automatically.
195 * If the operation of @a app_control is not specified, #APP_CONTROL_OPERATION_DEFAULT is used for the launch request.
196 * If the operation of @a app_control is #APP_CONTROL_OPERATION_DEFAULT, the package information is mandatory to explicitly launch the application.
197 * 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.
198 * 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.
199 * When the alarm is expired, Alarm Manager will turn on LCD to prohibit background jobs.
201 * @param[in] app_control The destination app_control to perform specific work when the alarm is triggered
202 * @param[in] date The first active alarm time
203 * @param[out] alarm_id The alarm ID that uniquely identifies an alarm
204 * @return @c 0 on success,
205 * otherwise a negative error value
206 * @retval #ALARM_ERROR_NONE Successful
207 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
208 * @retval #ALARM_ERROR_INVALID_DATE Triggered date is invalid
209 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
210 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
211 * @retval #ALARM_ERROR_NOT_PERMITTED_APP @a app_control is not permitted. @a app_control for UI application is only permitted.
212 * @see alarm_cancel()
213 * @see alarm_cancel_all()
214 * @see alarm_get_scheduled_date()
216 int alarm_schedule_once_at_date(app_control_h app_control, struct tm *date, int *alarm_id);
220 * @brief Sets an alarm to be triggered periodically, starting at a specific time.
221 * @details The @a date describes the time of the first occurrence.
222 * @a week_flag is the repeat value of the days of the week.
223 * If @a week_flag is #ALARM_WEEK_FLAG_TUESDAY, the alarm will repeat every Tuesday at a specific time.
224 * To cancel the alarm, call alarm_cancel() with @a alarm_id.
225 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
227 * @privilege %http://tizen.org/privilege/alarm.set
228 * @remarks If the application is uninstalled after setting an alarm, the alarm is cancelled automatically.
229 * If the operation of @a app_control is not specified, #APP_CONTROL_OPERATION_DEFAULT is used for the launch request.
230 * If the operation of @a app_control is #APP_CONTROL_OPERATION_DEFAULT, the package information is mandatory to explicitly launch the application.
231 * 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.
232 * When the alarm is expired, Alarm Manager will turn on LCD to prohibit background jobs.
233 * 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.
235 * @param[in] app_control The destination app_control to perform specific work when the alarm is triggered
236 * @param[in] date The first active alarm time
237 * @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
238 * @param[out] alarm_id The alarm ID that uniquely identifies an alarm
239 * @return @c 0 on success,
240 * otherwise a negative error value
241 * @retval #ALARM_ERROR_NONE Successful
242 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
243 * @retval #ALARM_ERROR_INVALID_DATE Triggered date is invalid
244 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
245 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
246 * @retval #ALARM_ERROR_NOT_PERMITTED_APP @a app_control is not permitted. @a app_control for UI application is only permitted.
247 * @see alarm_cancel()
248 * @see alarm_cancel_all()
249 * @see alarm_get_scheduled_recurrence_week_flag()
250 * @see alarm_get_scheduled_date()
251 * @see #alarm_week_flag_e
253 int alarm_schedule_with_recurrence_week_flag(app_control_h app_control, struct tm *date, int week_flag, int *alarm_id);
257 * @brief Gets the recurrence days of the week.
258 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
260 * @privilege %http://tizen.org/privilege/alarm.get
261 * @remarks If the given @a alarm_id is not obtained by using the alarm_schedule_with_recurrence_week_flag() function,
262 * an error (error code #ALARM_ERROR_INVALID_PARAMETER) will occur because this alarm is scheduled with no recurrence.
263 * If the operation of @a app_control is not specified, #APP_CONTROL_OPERATION_DEFAULT is used for the launch request.
264 * If the operation of @a app_control is #APP_CONTROL_OPERATION_DEFAULT, the package information is mandatory to explicitly launch the application.
265 * @param[in] alarm_id The alarm ID returned when the alarm is scheduled
266 * @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
267 * @return @c 0 on success,
268 * otherwise a negative error value
269 * @retval #ALARM_ERROR_NONE Successful
270 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
271 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
272 * @see alarm_schedule_with_recurrence_week_flag()
273 * @see #alarm_week_flag_e
275 int alarm_get_scheduled_recurrence_week_flag(int alarm_id, int *week_flag);
279 * @brief Cancels the alarm with the specific alarm ID.
280 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
282 * @privilege %http://tizen.org/privilege/alarm.set
283 * @param[in] alarm_id The alarm ID that is cancelled
284 * @return @c 0 on success,
285 * otherwise a negative error value
286 * @retval #ALARM_ERROR_NONE Successful
287 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
288 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
289 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
290 * @see alarm_schedule_at_date()
291 * @see alarm_schedule_after_delay()
292 * @see alarm_schedule_with_recurrence_week_flag()
293 * @see alarm_cancel_all()
295 int alarm_cancel(int alarm_id);
299 * @brief Cancels all scheduled alarms that are registered by the application that calls this API.
300 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
302 * @privilege %http://tizen.org/privilege/alarm.set
303 * @return @c 0 on success,
304 * otherwise a negative error value
305 * @retval #ALARM_ERROR_NONE Successful
306 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
307 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
308 * @see alarm_schedule_at_date()
309 * @see alarm_schedule_after_delay()
310 * @see alarm_schedule_with_recurrence_week_flag()
311 * @see alarm_cancel()
313 int alarm_cancel_all(void);
317 * @brief Retrieves the IDs of all registered alarms by invoking a callback once for each scheduled alarm.
318 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
320 * @privilege %http://tizen.org/privilege/alarm.get
321 * @param[in] callback The callback function to invoke
322 * @param[in] user_data The user data to be passed to the callback function
323 * @return @c 0 on success,
324 * otherwise a negative error value
325 * @retval #ALARM_ERROR_NONE Successful
326 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
327 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
328 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
329 * @post This function invokes alarm_registered_alarm_cb() repeatedly for each registered alarm.
330 * @see alarm_registered_alarm_cb()
332 int alarm_foreach_registered_alarm(alarm_registered_alarm_cb callback, void *user_data);
336 * @brief Gets the scheduled time from the given alarm ID in C standard time struct.
337 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
339 * @privilege %http://tizen.org/privilege/alarm.get
340 * @param[in] alarm_id The alarm ID returned when the alarm is scheduled
341 * @param[out] date The time value of the next alarm event
342 * @return @c 0 on success,
343 * otherwise a negative error value
344 * @retval #ALARM_ERROR_NONE Successful
345 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
346 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
347 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
348 * @see alarm_schedule_at_date()
349 * @see alarm_schedule_after_delay()
350 * @see alarm_schedule_with_recurrence_week_flag()
352 int alarm_get_scheduled_date(int alarm_id, struct tm *date);
356 * @brief Gets the period of time between the recurrent alarms.
357 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
359 * @privilege %http://tizen.org/privilege/alarm.get
360 * @remarks If the given @a alarm_id is not obtained by using the alarm_schedule_at_date() or alarm_schedule_after_delay() function,
361 * an error (error code #ALARM_ERROR_INVALID_PARAMETER) will occur.
362 * @param[in] alarm_id The alarm ID returned when the alarm is scheduled
363 * @param[out] period The period of time between recurrent alarms in seconds
364 * @return @c 0 on success,
365 * otherwise a negative error value
366 * @retval #ALARM_ERROR_NONE Successful
367 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
368 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
369 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
370 * @see alarm_schedule_at_date()
371 * @see alarm_schedule_after_delay()
372 * @see alarm_schedule_with_recurrence_week_flag()
374 int alarm_get_scheduled_period(int alarm_id, int *period);
378 * @brief Gets the current system time using C standard time struct.
379 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
380 * @param[out] date The current system time
381 * @return @c 0 on success,
382 * otherwise a negative error value
383 * @retval #ALARM_ERROR_NONE Successful
384 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
385 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
387 int alarm_get_current_time(struct tm *date);
391 * @brief Gets the app_control to be invoked when the alarm is triggered.
392 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
394 * @privilege %http://tizen.org/privilege/alarm.get
395 * @remarks The @a app_control must be released using app_control_destroy().
396 * @param[in] alarm_id The alarm ID uniquely identifies an alarm
397 * @param[out] app_control The app_control handle to launch when the alarm is triggered
398 * @return @c 0 on success,
399 * otherwise a negative error value
400 * @retval #ALARM_ERROR_NONE Successful
401 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
402 * @retval #ALARM_ERROR_OUT_OF_MEMORY Out of memory
403 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
404 * @see alarm_schedule_at_date()
405 * @see alarm_schedule_after_delay()
406 * @see alarm_schedule_with_recurrence_week_flag()
408 int alarm_get_app_control(int alarm_id, app_control_h *app_control);
412 * @brief Sets global flag in the alarm.
413 * @details Sets @a global flag to set/unset alarm globally.
416 * @privilege %http://tizen.org/privilege/alarm.set
417 * @remarks The @a alarm_id must be id of alarm which will launch global application.
418 * The function returns an error (error code #ALARM_ERROR_NOT_PERMITTED_APP) if it is not.
419 * Note that the application which is launched by global alarm runs in the user session that is logged in currently.
420 * It doesn't run in the session for the user who registers the global alarm.
421 * 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.
422 * Therefore, We recommend to contain all the data for the alarm to the app_control handle for the global alarm.
423 * Then, the launched application would be able to use the data to show proper alarm UX to the user.
424 * @param[in] alarm_id The alarm ID uniquely identifies an alarm
425 * @param[in] global The global flag to set/unset alarm globally
426 * @return @c 0 on success,
427 * otherwise a negative error value
428 * @retval #ALARM_ERROR_NONE Successful
429 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
430 * @retval #ALARM_ERROR_NOT_PERMITTED_APP @a alarm_id is not permitted
431 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
432 * @see alarm_schedule_at_date()
433 * @see alarm_schedule_after_delay()
434 * @see alarm_schedule_with_recurrence_week_flag()
436 int alarm_set_global(int alarm_id, bool global);
440 * @brief Gets whether the alarm will launch global application or not.
443 * @privilege %http://tizen.org/privilege/alarm.get
444 * @param[in] alarm_id The alarm ID uniquely identifies an alarm
445 * @param[out] global Whether the alarm will launch global application or not
446 * @return @c 0 on success,
447 * otherwise a negative error value
448 * @retval #ALARM_ERROR_NONE Successful
449 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
450 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
451 * @see alarm_set_global()
453 int alarm_get_global(int alarm_id, bool *global);
457 * @brief Sets a notification alarm to be triggered at a specific time.
458 * @details The @a date describes the time of the alarm occurrence.
459 * To cancel the alarm, call alarm_cancel() with @a alarm_id.
462 * @privilege %http://tizen.org/privilege/alarm.set
463 * @privilege %http://tizen.org/privilege/notification
464 * @remarks If application is uninstalled after setting an alarm, the alarm is cancelled automatically.
465 * When the alarm goes off, Alarm Manager will turn on LCD to prohibit background jobs.
467 * @param[in] noti The notification to be posted when the alarm is triggered
468 * @param[in] date The active alarm time
469 * @param[out] alarm_id The ID which uniquely identifies the scheduled alarm
470 * @return @c 0 on success,
471 * otherwise a negative error value
472 * @retval #ALARM_ERROR_NONE Successful
473 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
474 * @retval #ALARM_ERROR_INVALID_DATE Triggered date is invalid
475 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
476 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
477 * @see alarm_cancel()
478 * @see alarm_cancel_all()
479 * @see alarm_get_scheduled_date()
481 int alarm_schedule_noti_once_at_date(notification_h noti, struct tm *date, int *alarm_id);
484 * @brief Sets a notification alarm to be triggered after a specific delay.
485 * @details The alarm will first go off after @a delay seconds.
486 * The alarm will then go off every period seconds until canceled.
487 * To cancel the alarm, call alarm_cancel() with @a alarm_id.
490 * @privilege %http://tizen.org/privilege/alarm.set
491 * @privilege %http://tizen.org/privilege/notification
492 * @remarks If the application is uninstalled after setting an alarm, the alarm is cancelled automatically.
493 * This function is a minimally intrusive way to trigger alarms when precision is not important.
494 * The system will adjust the @a delay and @a period requests to suit internal needs; the requests
495 * will be treated as minimum values. Note that @a period cannot be less than 600 seconds, if
496 * a smaller request is supplied it will be silently adjusted to a request of 600.
497 * When the alarm goes off, Alarm Manager will turn on LCD to prohibit background jobs.
499 * @param[in] noti The notification to be posted when the alarm is triggered
500 * @param[in] delay The amount of time before the first execution (in seconds).
501 * @param[in] period The amount of time between subsequent alarms (in seconds).
502 * @param[out] alarm_id The ID which uniquely identifies the scheduled alarm
503 * @return @c 0 on success,
504 * otherwise a negative error value
505 * @retval #ALARM_ERROR_NONE Successful
506 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
507 * @retval #ALARM_ERROR_INVALID_TIME Triggered time is invalid
508 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
509 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
510 * @see alarm_cancel()
511 * @see alarm_cancel_all()
512 * @see alarm_get_scheduled_date()
513 * @see alarm_get_scheduled_period()
514 * @see alarm_schedule_noti_once_after_delay()
516 int alarm_schedule_noti_after_delay(notification_h noti, int delay, int period, int *alarm_id);
519 * @brief Sets a notification alarm to be triggered after a specific delay.
520 * @details The alarm will go off @a delay seconds later.
521 * To cancel the alarm, call alarm_cancel() with @a alarm_id.
524 * @privilege %http://tizen.org/privilege/alarm.set
525 * @privilege %http://tizen.org/privilege/notification
526 * @remarks If the application is uninstalled after setting an alarm, the alarm is cancelled automatically.
527 * When the alarm goes off, Alarm Manager will turn on LCD to prohibit background jobs.
529 * @param[in] noti The notification to be posted when the alarm is triggered
530 * @param[in] delay The amount of time before the execution (in seconds)
531 * @param[out] alarm_id The ID which uniquely identifies the scheduled alarm
532 * @return @c 0 on success,
533 * otherwise a negative error value
534 * @retval #ALARM_ERROR_NONE Successful
535 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
536 * @retval #ALARM_ERROR_INVALID_TIME Triggered time is invalid
537 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
538 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
539 * @see alarm_cancel()
540 * @see alarm_cancel_all()
541 * @see alarm_get_scheduled_date()
543 int alarm_schedule_noti_once_after_delay(notification_h noti, int delay, int *alarm_id);
546 * @brief Sets a notification to be triggered periodically, starting at a specific time.
547 * @details The @a date describes the time of the first occurrence.
548 * @a week_flag describes the day(s) of the week when the notification recurs.
549 * If @a week_flag is #ALARM_WEEK_FLAG_TUESDAY, the alarm will repeat every Tuesday at a specific time.
550 * If @a week_flag is less than or equal to zero, the alarm is not repeated.
551 * To cancel the alarm, call alarm_cancel() with @a alarm_id.
554 * @privilege %http://tizen.org/privilege/alarm.set
555 * @privilege %http://tizen.org/privilege/notification
556 * @remarks If the application is uninstalled after setting an alarm, the alarm is cancelled automatically.
558 * @param[in] noti The notification to be posted when the alarm is triggered
559 * @param[in] date The first active alarm time
560 * @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
561 * @param[out] alarm_id The ID which uniquely identifies the scheduled alarm
562 * @return @c 0 on success,
563 * otherwise a negative error value
564 * @retval #ALARM_ERROR_NONE Successful
565 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
566 * @retval #ALARM_ERROR_INVALID_DATE Triggered date is invalid
567 * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
568 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
569 * @see alarm_cancel()
570 * @see alarm_cancel_all()
571 * @see alarm_get_scheduled_recurrence_week_flag()
572 * @see alarm_get_scheduled_date()
573 * @see #alarm_week_flag_e
575 int alarm_schedule_noti_with_recurrence_week_flag(notification_h noti, struct tm *date, int week_flag, int *alarm_id);
578 * @brief Gets the notification to be posted when an alarm is triggered.
581 * @privilege %http://tizen.org/privilege/alarm.get
582 * @remarks @a noti must be released using notification_free().
584 * @param[in] alarm_id The ID which uniquely identifies a scheduled alarm
585 * @param[out] noti The notification to be posted when the alarm is triggered
586 * @return @c 0 on success,
587 * otherwise a negative error value
588 * @retval #ALARM_ERROR_NONE Successful
589 * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
590 * @retval #ALARM_ERROR_OUT_OF_MEMORY Out of memory
591 * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
592 * @see alarm_schedule_noti_once_at_date()
593 * @see alarm_schedule_noti_after_delay()
594 * @see alarm_schedule_noti_once_after_delay()
595 * @see alarm_schedule_noti_with_recurrence_week_flag()
597 int alarm_get_notification(int alarm_id, notification_h *noti);
607 #endif /* __TIZEN_APPFW_ALARM_H__ */