/*
* 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.
#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);
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 =
/*
* 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.
#include <glib.h>
#include <vconf.h>
#include <tcore.h>
-#include <sysman.h>
-
+#include <dd-deviced.h>
#include "common.h"
#include "time_update.h"
#include "citylist.h"
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();
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;
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);
/*
* - 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];
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);
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