X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=server%2Fttsd_network.c;h=748a345fe9aceb53e780ae9d808637c3143b76c0;hb=c370c07420eccd878f9ea17b3f59e5fe952a696d;hp=cc1febf09ef57b384803db30aace69fee7995d7c;hpb=0f6ac38f1505456484dd16f18dc8c4615131512e;p=platform%2Fcore%2Fuifw%2Ftts.git diff --git a/server/ttsd_network.c b/server/ttsd_network.c index cc1febf..748a345 100644 --- a/server/ttsd_network.c +++ b/server/ttsd_network.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011 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 @@ -17,79 +17,29 @@ #include -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, TAG_TTSD, "[Network DEBUG] Network configuration : %d", network_configuration); - - if (network_configuration == 0) { - SLOG(LOG_DEBUG, TAG_TTSD, "[Network] Notification : Network connection is OFF "); - g_is_connected = false; - } else { - SLOG(LOG_DEBUG, TAG_TTSD, "[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, TAG_TTSD, "[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){ - printf("Current network connection is OFF!! \n"); - SLOG(LOG_DEBUG, TAG_TTSD, "[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. - */ - printf("network status is wrong or IP is not set\n"); - printf("network has problem, try again\n"); - return -1; - } - - g_is_connected = false; - } else { - printf("Current network connection is ON. \n"); - SLOG(LOG_DEBUG, TAG_TTSD, "[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, TAG_TTSD, "[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