X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Falarm-lib-stub.c;h=0b910671c4614a6f33d6f1f660c51e784aabf26b;hb=290565bdf4c1c7e017eca9df974d59a68acbc698;hp=b773f08055e306202c374a9f98c98f3285dcf5d9;hpb=0c5e5c06455e4650bfd57d571fcd9f2cf02a6f66;p=framework%2Fappfw%2Falarm-manager.git diff --git a/src/alarm-lib-stub.c b/src/alarm-lib-stub.c index b773f08..0b91067 100644 --- a/src/alarm-lib-stub.c +++ b/src/alarm-lib-stub.c @@ -122,6 +122,7 @@ bool _send_alarm_create_appsvc(alarm_context_t context, alarm_info_t *alarm_info alarm_info->end.month, alarm_info->end.day, alarm_info->mode.u_interval.day_of_week, + alarm_info->mode.u_interval.interval, alarm_info->mode.repeat, alarm_info->alarm_type, alarm_info->reserved_info, @@ -132,7 +133,10 @@ bool _send_alarm_create_appsvc(alarm_context_t context, alarm_info_t *alarm_info /* error_code should be set */ ALARM_MGR_EXCEPTION_PRINT( "alarm_manager_call_alarm_create_appsvc_sync()failed. alarm_id[%d], return_code[%d].", alarm_id, return_code); - ALARM_MGR_EXCEPTION_PRINT("error->message is %s.", error->message); + if (error) { + ALARM_MGR_EXCEPTION_PRINT("dbus error message: %s", error->message); + g_error_free(error); + } } g_free(e_cookie); @@ -201,7 +205,10 @@ bool _send_alarm_create(alarm_context_t context, alarm_info_t *alarm_info, /* error_code should be set */ ALARM_MGR_EXCEPTION_PRINT( "alarm_manager_call_alarm_create_sync()failed. alarm_id[%d], return_code[%d]", alarm_id, return_code); - ALARM_MGR_EXCEPTION_PRINT("error->message is %s", error->message); + 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; } @@ -245,12 +252,13 @@ bool _send_alarm_create_periodic(alarm_context_t context, int interval, int is_r if (!alarm_manager_call_alarm_create_periodic_sync((AlarmManager*)context.proxy, g_quark_to_string(context.quark_app_service_name), g_quark_to_string(context.quark_app_service_name_mod), - interval, is_ref, method, - e_cookie, - alarm_id, &return_code, NULL, &error)) { + interval, is_ref, method, e_cookie, alarm_id, &return_code, NULL, &error)) { ALARM_MGR_EXCEPTION_PRINT("alarm_manager_call_alarm_create_periodic_sync()failed. alarm_id[%d], return_code[%d]", alarm_id, return_code); - ALARM_MGR_EXCEPTION_PRINT("error->message is %s", error->message); + 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; } @@ -277,7 +285,6 @@ bundle *_send_alarm_get_appsvc_info(alarm_context_t context, alarm_id_t alarm_id bundle *b = NULL; char *e_cookie = NULL; gchar *b_data = NULL; - int len = 0; e_cookie = __get_cookie(error_code); if (e_cookie == NULL) { @@ -290,7 +297,10 @@ bundle *_send_alarm_get_appsvc_info(alarm_context_t context, alarm_id_t alarm_id /* g_dbus_proxy_call_sync error */ /*error_code should be set */ ALARM_MGR_EXCEPTION_PRINT("alarm_manager_call_alarm_get_appsvc_info_sync() failed. alarm_id[%d], return_code[%d].", alarm_id, 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; } @@ -325,6 +335,7 @@ bundle *_send_alarm_get_appsvc_info(alarm_context_t context, alarm_id_t alarm_id bool _send_alarm_set_rtc_time(alarm_context_t context, alarm_date_t *time, int *error_code){ GError *error = NULL; + int return_code = 0; char *e_cookie = NULL; e_cookie = __get_cookie(error_code); @@ -334,12 +345,15 @@ bool _send_alarm_set_rtc_time(alarm_context_t context, alarm_date_t *time, int * } if (!alarm_manager_call_alarm_set_rtc_time_sync - ((AlarmManager*)context.proxy, context.pid, - time->year, time->month, time->day, - time->hour, time->min, time->sec, - e_cookie, NULL, NULL, &error)) { + ((AlarmManager*)context.proxy, context.pid, time->year, time->month, time->day, + time->hour, time->min, time->sec, e_cookie, &return_code, NULL, &error)) { /* g_dbus_proxy_call_sync error */ /*error_code should be set */ + ALARM_MGR_EXCEPTION_PRINT("alarm_manager_call_alarm_set_rtc_time() failed. 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; } @@ -350,6 +364,13 @@ bool _send_alarm_set_rtc_time(alarm_context_t context, alarm_date_t *time, int * g_free(e_cookie); + if (return_code != 0) { + if (error_code) { + *error_code = return_code; + } + return false; + } + return true; } @@ -370,6 +391,10 @@ bool _send_alarm_delete(alarm_context_t context, alarm_id_t alarm_id, int *error /* g_dbus_proxy_call_sync error */ /*error_code should be set */ ALARM_MGR_EXCEPTION_PRINT("alarm_manager_call_alarm_delete_sync() failed. alarm_id[%d], return_code[%d]", alarm_id, 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; } @@ -407,6 +432,10 @@ bool _send_alarm_delete_all(alarm_context_t context, int *error_code) /* g_dbus_proxy_call_sync error */ /*error_code should be set */ ALARM_MGR_EXCEPTION_PRINT("alarm_manager_call_alarm_delete_all_sync() failed. 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; } @@ -434,7 +463,6 @@ bool _send_alarm_get_list_of_ids(alarm_context_t context, int maxnum_of_ids, GError *error = NULL; GVariant *alarm_array = NULL; int return_code = 0; - int i = 0; if (!alarm_manager_call_alarm_get_list_of_ids_sync((AlarmManager*)context.proxy, context.pid, maxnum_of_ids, &alarm_array, @@ -442,7 +470,11 @@ bool _send_alarm_get_list_of_ids(alarm_context_t context, int maxnum_of_ids, /* g_dbus_proxy_call_sync error */ /*error_code should be set */ ALARM_MGR_EXCEPTION_PRINT( - "alarm_manager_call_alarm_get_list_of_ids_sync() failed by dbus. alarm_id[%d], return_code[%d]\n", alarm_id, return_code); + "alarm_manager_call_alarm_get_list_of_ids_sync() failed by dbus. alarm_id[%d], return_code[%d]", alarm_id, 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; } @@ -490,10 +522,11 @@ bool _send_alarm_get_number_of_ids(alarm_context_t context, int *num_of_ids, if (!alarm_manager_call_alarm_get_number_of_ids_sync((AlarmManager*)context.proxy, context.pid, e_cookie, num_of_ids, &return_code, NULL, &error)) { /* g_dbus_proxy_call_sync error */ /* error_code should be set */ - ALARM_MGR_EXCEPTION_PRINT( - "alarm_manager_call_alarm_get_number_of_ids_sync() failed by dbus. return_code[%d], return_code[%s].", - return_code, error->message); - + ALARM_MGR_EXCEPTION_PRINT("alarm_manager_call_alarm_get_number_of_ids_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; } @@ -535,7 +568,11 @@ bool _send_alarm_get_info(alarm_context_t context, alarm_id_t alarm_id, /* g_dbus_proxy_call_sync error */ /* error_code should be set */ ALARM_MGR_EXCEPTION_PRINT( - "alarm_manager_call_alarm_get_info_sync() failed by dbus. alarm_id[%d], return_code[%d]\n", alarm_id, return_code); + "alarm_manager_call_alarm_get_info_sync() failed by dbus. alarm_id[%d], return_code[%d]", alarm_id, 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; } @@ -570,11 +607,15 @@ bool _send_alarm_get_next_duetime(alarm_context_t context, } if (!alarm_manager_call_alarm_get_next_duetime_sync((AlarmManager*)context.proxy, - context.pid, alarm_id, e_cookie, duetime, &return_code, NULL, &error)) { + context.pid, alarm_id, e_cookie, (gint *)duetime, &return_code, NULL, &error)) { /*g_dbus_proxy_call_sync error */ /*error_code should be set */ ALARM_MGR_EXCEPTION_PRINT( - "alarm_manager_call_alarm_get_next_duetime_sync() failed by dbus. alarm_id[%d], return_code[%d]\n", alarm_id, return_code); + "alarm_manager_call_alarm_get_next_duetime_sync() failed by dbus. alarm_id[%d], return_code[%d]", alarm_id, 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; } @@ -609,7 +650,11 @@ bool _send_alarm_get_all_info(alarm_context_t context, char ** db_path, int *err if (!alarm_manager_call_alarm_get_all_info_sync((AlarmManager*)context.proxy, context.pid, e_cookie, db_path, &return_code, NULL, &error)) { /*g_dbus_proxy_call_sync error */ /*error_code should be set */ - ALARM_MGR_EXCEPTION_PRINT("alarm_manager_call_alarm_get_all_info_sync() failed by dbus. return_code[%d][%s]", return_code, error->message); + ALARM_MGR_EXCEPTION_PRINT("alarm_manager_call_alarm_get_all_info_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; } @@ -637,7 +682,41 @@ bool _send_alarm_set_time(alarm_context_t context, int new_time, int *error_code 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][%s]", return_code, error->message); + 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; + int return_code = 0; + + if (!alarm_manager_call_alarm_set_time_with_propagation_delay_sync((AlarmManager*)context.proxy, new_sec, new_nsec, req_sec, req_nsec, &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_with_propagation_delay_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; } @@ -662,7 +741,11 @@ bool _send_alarm_set_timezone(alarm_context_t context, char *tzpath_str, int *er if (!alarm_manager_call_alarm_set_timezone_sync((AlarmManager*)context.proxy, tzpath_str, &return_code, NULL, &error)) { /*g_dbus_proxy_call_sync error */ /*error_code should be set */ - ALARM_MGR_EXCEPTION_PRINT("alarm_manager_call_alarm_set_timezone_sync() failed by dbus. return_code[%d][%s]", return_code, error->message); + ALARM_MGR_EXCEPTION_PRINT("alarm_manager_call_alarm_set_timezone_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; }