From 1a9948a97d66cfe6e512491a838eaa9b2d347d85 Mon Sep 17 00:00:00 2001 From: "seungha.son" Date: Thu, 28 Jul 2016 08:04:33 +0900 Subject: [PATCH] Remove alarm-manager dependency - Move function for set alarm to data-provider-master : https://review.tizen.org/gerrit/#/c/81679/ Signed-off-by: seungha.son Change-Id: I6c411685d8be0f77544ebfe07c3d04cd4040d4d4 --- CMakeLists.txt | 1 - include/notification_setting_service.h | 2 - packaging/notification.spec | 1 - src/notification_setting_service.c | 91 ---------------------------------- 4 files changed, 95 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c323b8..9cae911 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,6 @@ pkg_check_modules(pkgs REQUIRED libtzplatform-config glib-2.0 gio-2.0 - alarm-service ) FOREACH(flag ${pkgs_CFLAGS}) diff --git a/include/notification_setting_service.h b/include/notification_setting_service.h index b9483da..2181044 100644 --- a/include/notification_setting_service.h +++ b/include/notification_setting_service.h @@ -19,7 +19,6 @@ #include #include -#include #ifdef __cplusplus extern "C" { @@ -39,7 +38,6 @@ int notification_setting_db_update_do_not_disturb(int do_not_disturb, uid_t uid) int noti_setting_service_get_setting_by_package_name(const char *package_name, notification_setting_h *setting, uid_t uid); int noti_setting_get_setting_array(notification_setting_h *setting_array, int *count, uid_t uid); int noti_system_setting_load_system_setting(notification_system_setting_h *system_setting, uid_t uid); -int noti_system_setting_set_alarm(int week_flag, int hour, int min, alarm_cb_t handler, alarm_id_t *dnd_schedule_alarm_id); #ifdef __cplusplus } diff --git a/packaging/notification.spec b/packaging/notification.spec index 01f3105..0295744 100755 --- a/packaging/notification.spec +++ b/packaging/notification.spec @@ -23,7 +23,6 @@ BuildRequires: pkgconfig(pkgmgr-info) BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(gio-2.0) BuildRequires: pkgconfig(glib-2.0) -BuildRequires: pkgconfig(alarm-service) BuildRequires: cmake Requires(post): /sbin/ldconfig diff --git a/src/notification_setting_service.c b/src/notification_setting_service.c index 3ce82fe..be6438a 100644 --- a/src/notification_setting_service.c +++ b/src/notification_setting_service.c @@ -32,7 +32,6 @@ #include #include - static int _get_table_field_data_int(char **table, int *buf, int index) { if ((table == NULL) || (buf == NULL) || (index < 0)) { @@ -89,21 +88,6 @@ out: return ret; } -static int _get_current_time(struct tm *date) -{ - time_t now; - - if (date == NULL) { - NOTIFICATION_ERR("NOTIFICATION_ERROR_INVALID_PARAMETER"); - return NOTIFICATION_ERROR_INVALID_PARAMETER; - } - - time(&now); - localtime_r(&now, date); - - return NOTIFICATION_ERROR_NONE; -} - EXPORT_API int noti_setting_service_get_setting_by_package_name(const char *package_name, notification_setting_h *setting, uid_t uid) { @@ -526,79 +510,4 @@ return_close_db: } /* LCOV_EXCL_STOP */ -EXPORT_API -int noti_system_setting_set_alarm(int week_flag, int hour, int min, alarm_cb_t handler, alarm_id_t *dnd_schedule_alarm_id) -{ - int err = NOTIFICATION_ERROR_NONE; - struct tm struct_time; - alarm_entry_t *alarm_info = NULL; - alarm_date_t alarm_time; - alarm_id_t alarm_id = -1; - - err = alarmmgr_init("notification"); - if (err < 0) { - NOTIFICATION_ERR("alarmmgr_init failed (%d)", err); - goto out; - } - - err = alarmmgr_set_cb(handler, NULL); - if (err < 0) { - NOTIFICATION_ERR("alarmmgr_set_cb failed (%d)", err); - goto out; - } - - err = _get_current_time(&struct_time); - if (err != NOTIFICATION_ERROR_NONE) { - NOTIFICATION_ERR("get_current_time failed"); - goto out; - } - - alarm_info = alarmmgr_create_alarm(); - if (alarm_info == NULL) { - NOTIFICATION_ERR("alarmmgr_create_alarm failed"); - goto out; - } - - alarm_time.year = struct_time.tm_year + 1900; - alarm_time.month = struct_time.tm_mon + 1; - alarm_time.day = struct_time.tm_mday; - alarm_time.hour = hour; - alarm_time.min = min; - alarm_time.sec = 0; - - err = alarmmgr_set_time(alarm_info, alarm_time); - if (err != ALARMMGR_RESULT_SUCCESS) { - NOTIFICATION_ERR("alarmmgr_set_time failed (%d)", err); - goto out; - } - if (week_flag) { - err = alarmmgr_set_repeat_mode(alarm_info, ALARM_REPEAT_MODE_WEEKLY, week_flag); - if (err != ALARMMGR_RESULT_SUCCESS) { - NOTIFICATION_ERR("alarmmgr_set_repeat_mode failed (%d)", err); - goto out; - } - } - - err = alarmmgr_set_type(alarm_info, ALARM_TYPE_VOLATILE); - if (err != ALARMMGR_RESULT_SUCCESS) { - NOTIFICATION_ERR("alarmmgr_set_type failed (%d)", err); - goto out; - } - - err = alarmmgr_add_alarm_with_localtime(alarm_info, NULL, &alarm_id); - if (err != ALARMMGR_RESULT_SUCCESS) { - NOTIFICATION_ERR("alarmmgr_add_alarm_with_localtime failed (%d)", err); - goto out; - } - - *dnd_schedule_alarm_id = alarm_id; - - NOTIFICATION_DBG("alarm_id [%d]", *dnd_schedule_alarm_id); - -out: - if (alarm_info) - alarmmgr_free_alarm(alarm_info); - - return err; -} -- 2.7.4