From: Dongchul Lim Date: Tue, 17 Mar 2015 04:52:41 +0000 (+0900) Subject: Code Sync up from tizen_2.4 X-Git-Tag: submit/tizen_mobile/20150326.075116~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2f5eecf642ce36c553d57822469b63c97b3a278c;p=platform%2Fcore%2Ftelephony%2Ftel-plugin-nitz.git Code Sync up from tizen_2.4 Change-Id: Ic493283fb57dd52dd7abf65d1207d149a0dabf5e --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 55c2a09..9be36c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ SET(INCLUDEDIR "\${prefix}/include") # Set required packages INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs REQUIRED glib-2.0 gio-2.0 tcore tel-headers vconf sysman) +pkg_check_modules(pkgs REQUIRED glib-2.0 gio-2.0 tcore vconf deviced) FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") diff --git a/LICENSE b/LICENSE index d6fbf45..8534b2c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved. +Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved. Apache License Version 2.0, January 2004 diff --git a/packaging/tel-plugin-nitz.spec b/packaging/tel-plugin-nitz.spec index 1a6bfa5..c3544a0 100644 --- a/packaging/tel-plugin-nitz.spec +++ b/packaging/tel-plugin-nitz.spec @@ -1,7 +1,6 @@ -%define major 3 -%define minor 0 -%define patchlevel 1 - +%define major 0 +%define minor 1 +%define patchlevel 19 Name: tel-plugin-nitz Summary: nitz plugin for telephony Version: %{major}.%{minor}.%{patchlevel} @@ -15,9 +14,8 @@ BuildRequires: cmake BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(gio-2.0) BuildRequires: pkgconfig(tcore) -BuildRequires: pkgconfig(tel-headers) BuildRequires: pkgconfig(vconf) -BuildRequires: pkgconfig(sysman) +BuildRequires: pkgconfig(deviced) %description nitz plugin for telephony diff --git a/src/citylist.c b/src/citylist.c index 1e9b3c3..76693e3 100644 --- a/src/citylist.c +++ b/src/citylist.c @@ -1,7 +1,7 @@ /* * tel-plugin-nitz * - * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/citylist.h b/src/citylist.h index d3d42ac..8e8bfaf 100644 --- a/src/citylist.h +++ b/src/citylist.h @@ -1,7 +1,7 @@ /* * tel-plugin-nitz * - * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/common.h b/src/common.h index 118ab04..ebab6d6 100644 --- a/src/common.h +++ b/src/common.h @@ -1,7 +1,7 @@ /* * tel-plugin-nitz * - * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/desc-nitz.c b/src/desc-nitz.c index 0aebedd..341321b 100644 --- a/src/desc-nitz.c +++ b/src/desc-nitz.c @@ -1,7 +1,7 @@ /* * tel-plugin-nitz * - * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,17 +35,19 @@ #define PLUGIN_VERSION 1 #endif -static TcoreHookReturn on_hook_network_timeinfo(TcorePlugin *source, - TcoreNotification command, - guint data_len, void *data, void *user_data) +static enum tcore_hook_return on_hook_network_timeinfo(Server *s, + CoreObject *source, + enum tcore_notification_command command, + unsigned int data_len, void *data, void *user_data) { - TelNetworkNitzInfoNoti *timeinfo = data; + struct tnoti_network_timeinfo *timeinfo = data; gboolean flag_auto_update = FALSE; - filelog("NITZ !! (time(NULL) = %u)", (guint)time(NULL)); - dbg("+- %04d-%02d-%02d %02d:%02d:%02d", + filelog("NITZ !! (time(NULL) = %u)", (unsigned int)time(NULL)); + dbg("+- %04d-%02d-%02d %02d:%02d:%02d wday=%d", timeinfo->year, timeinfo->month, timeinfo->day, - timeinfo->hour, timeinfo->minute, timeinfo->second); + timeinfo->hour, timeinfo->minute, timeinfo->second, + timeinfo->wday); dbg("+- GMT-offset:%d, DST-offset:%d, is_dst:%d", timeinfo->gmtoff, timeinfo->dstoff, timeinfo->isdst); @@ -59,81 +61,32 @@ static TcoreHookReturn on_hook_network_timeinfo(TcorePlugin *source, return TCORE_HOOK_RETURN_CONTINUE; } -static TcoreHookReturn on_hook_modem_plugin_added(Server *s, - TcoreServerNotification command, - guint data_len, void *data, void *user_data) -{ - TcorePlugin *modem_plugin; - - modem_plugin = (TcorePlugin *)data; - tcore_check_return_value_assert(NULL != modem_plugin, TCORE_HOOK_RETURN_STOP_PROPAGATION); - - tcore_plugin_add_notification_hook(modem_plugin, TCORE_NOTIFICATION_NETWORK_TIMEINFO, - on_hook_network_timeinfo, NULL); - - return TCORE_HOOK_RETURN_CONTINUE; -} - -static TcoreHookReturn on_hook_modem_plugin_removed(Server *s, - TcoreServerNotification command, - guint data_len, void *data, void *user_data) -{ - TcorePlugin *modem_plugin; - - modem_plugin = (TcorePlugin *)data; - tcore_check_return_value_assert(NULL != modem_plugin, TCORE_HOOK_RETURN_STOP_PROPAGATION); - - tcore_plugin_remove_notification_hook(modem_plugin, TCORE_NOTIFICATION_NETWORK_TIMEINFO, - on_hook_network_timeinfo); - - return TCORE_HOOK_RETURN_CONTINUE; -} - static gboolean on_load() { dbg("Load!!!"); + return TRUE; } -static gboolean on_init(TcorePlugin *plugin) +static gboolean on_init(TcorePlugin *p) { Server *s; - GSList *list = NULL; - TcorePlugin *modem_plugin; - - tcore_check_return_value_assert(NULL != plugin, FALSE); dbg("Init!!!"); - s = tcore_plugin_ref_server(plugin); - list = tcore_server_get_modem_plugin_list(s); - while (list) { /* Process for pre-loaded Modem Plug-in */ - modem_plugin = list->data; - if ( NULL != modem_plugin) - tcore_plugin_add_notification_hook(modem_plugin, TCORE_NOTIFICATION_NETWORK_TIMEINFO, + s = tcore_plugin_ref_server(p); + if (s == NULL) + return FALSE; + + tcore_server_add_notification_hook(s, TNOTI_NETWORK_TIMEINFO, on_hook_network_timeinfo, NULL); - list = g_slist_next(list); - } - g_slist_free(list); - - /* Register for post-loaded Modem Plug-ins */ - tcore_server_add_notification_hook(s, TCORE_SERVER_NOTIFICATION_ADDED_MODEM_PLUGIN, - on_hook_modem_plugin_added, NULL); - tcore_server_add_notification_hook(s, TCORE_SERVER_NOTIFICATION_REMOVED_MODEM_PLUGIN, - on_hook_modem_plugin_removed, NULL); + return TRUE; } -static void on_unload(TcorePlugin *plugin) +static void on_unload(TcorePlugin *p) { - Server *s; - - tcore_check_return_assert(NULL != plugin); dbg("Unload"); - - s = tcore_plugin_ref_server(plugin); - tcore_server_remove_notification_hook(s, on_hook_modem_plugin_added); - tcore_server_remove_notification_hook(s, on_hook_modem_plugin_removed); } EXPORT_API struct tcore_plugin_define_desc plugin_define_desc = diff --git a/src/time_update.c b/src/time_update.c index 2d6ae70..29d1438 100644 --- a/src/time_update.c +++ b/src/time_update.c @@ -1,7 +1,7 @@ /* * tel-plugin-nitz * - * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,8 +31,7 @@ #include #include #include -#include - +#include #include "common.h" #include "time_update.h" #include "citylist.h" @@ -53,7 +52,7 @@ int nitz_apply_tzfile(const char *tzfilename, gboolean mode_auto) snprintf(buf, BUF_SIZE, "%s/%s", PATH_ZONEINFO, tzfilename); - ret = sysman_set_timezone(buf); + ret = deviced_set_timezone(buf); filelog("set (%s) timezone file. ret=%d", buf, ret); sync(); @@ -77,7 +76,8 @@ long nitz_get_uptime() return 0; } -static gboolean update_time(const TelNetworkNitzInfoNoti *ti, gboolean mode_auto) +static gboolean update_time(const struct tnoti_network_timeinfo *ti, + gboolean mode_auto) { struct tm tm_time; time_t tt_gmt_nitz; @@ -90,6 +90,7 @@ static gboolean update_time(const TelNetworkNitzInfoNoti *ti, gboolean mode_auto tm_time.tm_sec = ti->second; tm_time.tm_min = ti->minute; tm_time.tm_hour = ti->hour; + tm_time.tm_wday = ti->wday; tm_time.tm_isdst = ti->dstoff; tt_gmt_nitz = timegm(&tm_time); @@ -106,20 +107,21 @@ static gboolean update_time(const TelNetworkNitzInfoNoti *ti, gboolean mode_auto /* * - Apply system time (GMT) */ - ret = sysman_set_datetime(tt_gmt_nitz); + ret = deviced_set_datetime(tt_gmt_nitz); if (ret < 0) { - filelog("sysman_set_datetime(%ld) failed. ret = %d", + filelog("deviced_set_datetime(%ld) failed. ret = %d", tt_gmt_nitz, ret); return FALSE; } else { - filelog("sysman_set_datetime(%ld) success. ret = %d", + filelog("deviced_set_datetime(%ld) success. ret = %d", tt_gmt_nitz, ret); } return TRUE; } -static gboolean update_timezone(const TelNetworkNitzInfoNoti *ti, gboolean mode_auto) +static gboolean update_timezone(const struct tnoti_network_timeinfo *ti, + gboolean mode_auto) { int mcc; char mcc_str[4]; @@ -130,7 +132,7 @@ static gboolean update_timezone(const TelNetworkNitzInfoNoti *ti, gboolean mode_ mcc = atoi(mcc_str); dbg("MCC: [%d]", mcc); - if (mcc > 0) { + if (mcc >= 0) { m = nitz_find_tzinfo(mcc, ti->gmtoff, ti->dstoff, ti->isdst); if (m) { dbg("Country: [%s] (ISO 3166)", m->country); @@ -145,7 +147,8 @@ static gboolean update_timezone(const TelNetworkNitzInfoNoti *ti, gboolean mode_ return ret; } -gboolean nitz_time_update(const TelNetworkNitzInfoNoti *time_info, gboolean mode_auto) +gboolean nitz_time_update(const struct tnoti_network_timeinfo *time_info, + gboolean mode_auto) { if (time_info->year == 0 && time_info->month == 0 diff --git a/src/time_update.h b/src/time_update.h index a05cb1a..5c2f758 100644 --- a/src/time_update.h +++ b/src/time_update.h @@ -1,7 +1,7 @@ /* * tel-plugin-nitz * - * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,6 @@ int nitz_apply_tzfile(const char *tzfilename, gboolean mode_auto); long nitz_get_uptime(); -gboolean nitz_time_update(const TelNetworkNitzInfoNoti *time_info, gboolean mode_auto); +gboolean nitz_time_update(const struct tnoti_network_timeinfo *time_info, gboolean mode_auto); #endif