From 85024fa7e299887a0ca2fb4e3048c74d537aee05 Mon Sep 17 00:00:00 2001 From: Jiwoong Im Date: Wed, 27 Apr 2016 21:32:07 +0900 Subject: merge async api from tizen 2.4 - alarmmgr_set_systime_async - alarmmgr_set_systime_with_propagation_delay_async Change-Id: I37ecfcbb4207478df698497a0cd80090db664973 Signed-off-by: Jiwoong Im --- include/alarm-internal.h | 13 +++++++++++++ include/alarm.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) (limited to 'include') diff --git a/include/alarm-internal.h b/include/alarm-internal.h index 69c9c4e..6214b6c 100644 --- a/include/alarm-internal.h +++ b/include/alarm-internal.h @@ -91,6 +91,17 @@ typedef struct { alarm_repeat_mode_t repeat; /**< repeat mode */ } alarm_mode_t; +typedef struct { + alarm_set_time_cb_t callback; + void *user_data; + GDBusProxy *proxy; +} alarm_set_time_data_t; + +enum async_param_type { + SET_SYSTIME = 0, + SET_SYSTIME_WITH_PROPAGATION_DELAY, +}; + /** * This enumeration has alarm type @@ -137,9 +148,11 @@ bool _load_alarms_from_registry(); bundle *_send_alarm_get_appsvc_info(alarm_context_t context, alarm_id_t alarm_id, int *error_code); bool _send_alarm_set_rtc_time(alarm_context_t context, alarm_date_t *time, int *error_code); bool _send_alarm_set_time_with_propagation_delay(alarm_context_t context, unsigned int new_sec, unsigned int new_nsec, unsigned int req_sec, unsigned int req_nsec, int *error_code); +bool _send_alarm_set_time_with_propagation_delay_async(alarm_context_t context, unsigned int new_sec, unsigned int new_nsec, unsigned int req_sec, unsigned int req_nsec, alarm_set_time_cb_t result_cb, void *user_data); bool _send_alarm_set_timezone(alarm_context_t context, char *tzpath_str, int *error_code); bool _send_alarm_create_periodic(alarm_context_t context, int interval, int is_ref, int method, alarm_id_t *alarm_id, int *error_code); bool _send_alarm_set_time(alarm_context_t context, int new_time, int *error_code); +bool _send_alarm_set_time_async(alarm_context_t context, int new_time, alarm_set_time_cb_t result_cb, void *user_data); bool _send_alarm_set_global(alarm_context_t context, int alarm_id, bool global, int *error_code); bool _send_alarm_get_global(alarm_context_t context, int alarm_id, bool *global, int *error_code); diff --git a/include/alarm.h b/include/alarm.h index 0edd294..1bbc389 100644 --- a/include/alarm.h +++ b/include/alarm.h @@ -165,6 +165,8 @@ typedef int alarm_id_t; * The prototype of alarm handler. * param [in] alarm_id the id of expired alarm */ +typedef int (*alarm_set_time_cb_t) (int result, void *user_param); + typedef int (*alarm_cb_t) (alarm_id_t alarm_id, void *user_param); typedef int (*alarm_enum_fn_t) (alarm_id_t alarm_id, void *user_param); @@ -1379,6 +1381,19 @@ int alarmmgr_set_rtc_time(alarm_date_t *time); */ int alarmmgr_set_systime(int new_time); +/** + * This function asynchronously changes the system time which tranferred by other module + * @param [in] new_time epoch time to be set + * @param [in] result_cb The asynchronous callback function to get the result + * @param [in] user_param User parameter to be passed to the callback function + * + * @return @c ALARMMGR_RESULT_SUCCESS on success, + * otherwise a negative error value + * @retval #ALARMMGR_RESULT_SUCCESS Successful + * @retval #ERR_ALARM_SYSTEM_FAIL System failure + */ +int alarmmgr_set_systime_async(int new_time, alarm_set_time_cb_t result_cb, void *user_param); + /** * This function changes the system time and compensates the time using propagation delay. * @param [in] new_time system time to be set (seconds, nanoseconds) @@ -1392,6 +1407,21 @@ int alarmmgr_set_systime(int new_time); */ int alarmmgr_set_systime_with_propagation_delay(struct timespec new_time, struct timespec req_time); +/** + * This function asynchronously changes the system time and compensates the time using propagation delay. + * @param [in] new_time system time to be set (seconds, nanoseconds) + * @param [in] req_time time to request to change the system time (seconds, nanoseconds) + * @param [in] result_cb The asynchronous callback function to get the result + * @param [in] user_param User parameter to be passed to the callback function + * + * @return @c ALARMMGR_RESULT_SUCCESS on success, + * otherwise a negative error value + * @retval #ALARMMGR_RESULT_SUCCESS Successful + * @retval #ERR_ALARM_SYSTEM_FAIL System failure + * @retval #ERR_ALARM_INVALID_PARAM invalid parameter + */ +int alarmmgr_set_systime_with_propagation_delay_async(struct timespec new_time, struct timespec req_time, alarm_set_time_cb_t result_cb, void *user_param); + /** * This function changes the timezone which tranferred by other module * @param [in] tzpath_str the path to timezone definition file -- cgit v1.2.3