summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHwankyu Jhun <h.jhun@samsung.com>2015-12-07 17:34:45 +0900
committerJiwoong Im <jiwoong.im@samsung.com>2015-12-08 14:32:07 +0900
commitaecbea763fc4c9bbaf48faacd0014b1ad378fdc8 (patch)
tree2b1b02f2546dc0a5e49f911c38cc8c451b0f486a /src
parentbb5484a3a939f06edb4bb5478cc234aa995af52b (diff)
downloadalarm-manager-aecbea763fc4c9bbaf48faacd0014b1ad378fdc8.tar.gz
alarm-manager-aecbea763fc4c9bbaf48faacd0014b1ad378fdc8.tar.bz2
alarm-manager-aecbea763fc4c9bbaf48faacd0014b1ad378fdc8.zip
- Add dbus activation feature - Revert settime api ti do not user compensating latency - Expire alarms forcibly when real duetime is same to current time - Fix prevent issue Change-Id: I09c51cb395cbe340c646ea24bd75882761b080ab Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
Diffstat (limited to 'src')
-rw-r--r--src/alarm-lib-stub.c30
-rw-r--r--src/alarm-lib.c7
2 files changed, 32 insertions, 5 deletions
diff --git a/src/alarm-lib-stub.c b/src/alarm-lib-stub.c
index 81eb4b9..9e0949d 100644
--- a/src/alarm-lib-stub.c
+++ b/src/alarm-lib-stub.c
@@ -555,6 +555,36 @@ bool _send_alarm_get_all_info(alarm_context_t context, char ** db_path, int *err
return true;
}
+bool _send_alarm_set_time(alarm_context_t context, int new_time, int *error_code)
+{
+ GError *error = NULL;
+ int return_code = 0;
+
+ if (!alarm_manager_call_alarm_set_time_sync((AlarmManager *)context.proxy, new_time, &return_code, NULL, &error)) {
+ /*g_dbus_proxy_call_sync error */
+ /*error_code should be set */
+ ALARM_MGR_EXCEPTION_PRINT("alarm_manager_call_alarm_set_time_sync() failed by dbus. return_code[%d]", return_code);
+ if (error) {
+ ALARM_MGR_EXCEPTION_PRINT("dbus error message: %s", error->message);
+ g_error_free(error);
+ }
+ if (error_code) {
+ *error_code = ERR_ALARM_SYSTEM_FAIL;
+ }
+ return false;
+ }
+
+ if (return_code != ALARMMGR_RESULT_SUCCESS) {
+ if (error_code) {
+ *error_code = return_code;
+ }
+ return false;
+ }
+
+ return true;
+}
+
+
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)
{
GError *error = NULL;
diff --git a/src/alarm-lib.c b/src/alarm-lib.c
index b829fcf..c8b7058 100644
--- a/src/alarm-lib.c
+++ b/src/alarm-lib.c
@@ -1189,7 +1189,6 @@ EXPORT_API int alarmmgr_remove_alarm(alarm_id_t alarm_id)
int error_code;
int ret;
alarm_cb_info_t *info;
- alarm_info_t alarm;
ret = __sub_init();
if (ret < 0)
@@ -1530,16 +1529,14 @@ EXPORT_API int alarmmgr_add_reference_periodic_alarm_withcb(int interval,
EXPORT_API int alarmmgr_set_systime(int new_time)
{
int error_code;
- struct timespec req_time = {0,};
ALARM_MGR_LOG_PRINT("[alarm-lib]:alarmmgr_set_systime(%d) is called.", new_time);
if (__sub_init() < 0) {
return ERR_ALARM_SYSTEM_FAIL;
}
- clock_gettime(CLOCK_REALTIME, &req_time);
- if (!_send_alarm_set_time_with_propagation_delay(alarm_context, new_time, 0, req_time.tv_sec, req_time.tv_nsec, &error_code)) {
- ALARM_MGR_EXCEPTION_PRINT("Failed to set time with propagation delay. error: %d", error_code);
+ if (!_send_alarm_set_time(alarm_context, new_time, &error_code)) {
+ ALARM_MGR_EXCEPTION_PRINT("Failed to set time. error: %d", error_code);
return error_code;
}