/*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2016 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.
* You may obtain a copy of the License at
#include <vconf.h>
-bool g_is_connected;
-
-bool ttsd_network_is_connected()
+int ttsd_network_initialize()
{
- return g_is_connected;
+ return 0;
}
-void __net_config_change_cb(keynode_t* node, void *data)
+int ttsd_network_finalize()
{
- int network_configuration = 0;
- vconf_get_int(VCONFKEY_NETWORK_CONFIGURATION_CHANGE_IND , &network_configuration);
- SLOG(LOG_DEBUG, get_tag(), "[Network DEBUG] Network configuration : %d", network_configuration);
-
- if (network_configuration == 0) {
- SLOG(LOG_DEBUG, get_tag(), "[Network] Notification : Network connection is OFF ");
- g_is_connected = false;
- } else {
- SLOG(LOG_DEBUG, get_tag(), "[Network] Notification : Network connection is ON ");
- g_is_connected = true;
-
- /* need to notify changing net to engine. */
- }
-
- return;
+ return 0;
}
-int ttsd_network_initialize()
-{
- int network_configuration = 0;
- vconf_get_int(VCONFKEY_NETWORK_CONFIGURATION_CHANGE_IND , &network_configuration);
- SLOG(LOG_DEBUG, get_tag(), "[Network DEBUG] Network configuration : %d", network_configuration);
-
- if (network_configuration == 0) {
- /* "0" means the network configuration is not set.
- * It could be network connection is not open
- */
-
- int network_status = 0;
- vconf_get_int(VCONFKEY_NETWORK_STATUS, &network_status);
- if(network_status == VCONFKEY_NETWORK_OFF){
- SLOG(LOG_DEBUG, get_tag(), "[Network] Current network connection is OFF.");
- }
- else{
- /*
- * This is the problem of network connection
- * Just terminate the application, network f/w will fix the problem automatically.
- */
- SLOG(LOG_WARN, get_tag(), "network status is wrong or IP is not set\n");
- SLOG(LOG_WARN, get_tag(), "network has problem, try again\n");
- return -1;
- }
-
- g_is_connected = false;
- } else {
- SLOG(LOG_DEBUG, get_tag(), "[Network] Current network connection is ON.");
+bool ttsd_network_is_connected()
+{
+ /* Check network */
+ int network_status = 0;
+ vconf_get_int(VCONFKEY_NETWORK_STATUS, &network_status);
- g_is_connected = true;
+ if (network_status == VCONFKEY_NETWORK_OFF) {
+ SLOG(LOG_WARN, tts_tag(), "[Network] Current network connection is OFF.");
+ return false;
}
- vconf_notify_key_changed(VCONFKEY_NETWORK_CONFIGURATION_CHANGE_IND, __net_config_change_cb, NULL);
-
- SLOG(LOG_DEBUG, get_tag(), "[Network SUCCESS] Initialize network ...\n");
-
- return 0;
-}
-
-int ttsd_network_finalize()
-{
- vconf_ignore_key_changed(VCONFKEY_NETWORK_CONFIGURATION_CHANGE_IND, __net_config_change_cb);
-
- return 0;
-}
+ SLOG(LOG_DEBUG, tts_tag(), "[Network] Network status is %d", network_status);
+ return true;
+}
\ No newline at end of file