Add alarm api to support global alarm 48/56548/9 submit/tizen/20160422.045948
authorJiwoong Im <jiwoong.im@samsung.com>
Mon, 11 Jan 2016 05:54:54 +0000 (14:54 +0900)
committerJiwoong Im <jiwoong.im@samsung.com>
Mon, 18 Apr 2016 05:59:13 +0000 (22:59 -0700)
- alarm_set_global
  alarm_get_global

Change-Id: Ie804a7c23ac4acaab368406d6b736ac8c25591ef
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
alarm/alarm.c
include/app_alarm.h

index 2d7863f..f0c4d98 100644 (file)
@@ -510,3 +510,20 @@ int alarm_get_app_control(int alarm_id, app_control_h *app_control)
        return ALARM_ERROR_NONE;
 }
 
+int alarm_set_global(int alarm_id, bool global)
+{
+       int ret;
+
+       ret = alarmmgr_set_global(alarm_id, glbal);
+
+       return convert_error_code_to_alarm(__FUNCTION__, ret);
+}
+
+int alarm_get_global(int alarm_id, bool *global)
+{
+       int ret;
+
+       ret = alarmmgr_get_global(alarm_id, global);
+
+       return convert_error_code_to_alarm(__FUNCTION__, ret);
+}
index c29862a..8aac216 100644 (file)
@@ -407,6 +407,51 @@ int alarm_get_current_time(struct tm *date);
  */
 int alarm_get_app_control(int alarm_id, app_control_h *app_control);
 
+
+/**
+ * @brief Sets global flag in the alarm.
+ * @details Sets @a global flag to set/unset alarm globally.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/alarm.set
+ * @remarks The @a alarm_id must be id of alarm which will launch global application.
+ *             The function returns an error (error code #ALARM_ERROR_NOT_PERMITTED) if it is not.
+ *             Note that the application which is launched by global alarm runs in the user session that is logined currently.
+ *             It doesn't run in the session for the user who registers the global alarm.
+ *             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.
+ *             Therefore, We recommend to contain all the data for the alarm to the app_control handle for the global alarm.
+ *             Then, the launched application would be able to use the data to show proper alarm UX to the user.
+ * @param[in] alarm_id The alarm ID uniquely identifies an alarm
+ * @param[in] global The global flag to set/unset alarm globally
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ALARM_ERROR_NONE Successful
+ * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ALARM_ERROR_NOT_PERMITTED @a alarm_id is not permitted.
+ * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
+ * @see alarm_schedule_at_date()
+ * @see alarm_schedule_after_delay()
+ * @see alarm_schedule_with_recurrence_week_flag()
+ */
+int alarm_set_global(int alarm_id, bool global);
+
+
+/**
+ * @brief Gets whether the alarm will launch global application or not.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/alarm.get
+ * @param[in] alarm_id The alarm ID uniquely identifies an alarm
+ * @param[out] global Whether the alarm will launch global application or not.
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ALARM_ERROR_NONE Successful
+ * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
+ * @see alarm_set_global();
+ */
+int alarm_get_global(int alarm_id, bool *global);
+
 /**
  * @}
  */