X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fconnection.c;h=e01c914f95bf757c27a66d9151ce115ebdd68359;hb=7d8ee44647a5b0126d1f1398f4fccceea4ba166a;hp=3901e2e826bd65037a9d8ca15ed0ea647a63d1b1;hpb=2ee2ccf0b84fdcce145d1a4e5004e3be4caef254;p=platform%2Fcore%2Fapi%2Fconnection.git diff --git a/src/connection.c b/src/connection.c index 3901e2e..e01c914 100755 --- a/src/connection.c +++ b/src/connection.c @@ -16,12 +16,15 @@ #include #include +#include #include #include +#include #include "net_connection_private.h" static __thread GSList *conn_handle_list = NULL; +static int tv_profile = -1; // Unknown //LCOV_EXCL_START static int __connection_convert_net_state(int status) @@ -556,37 +559,46 @@ EXPORT_API int connection_get_mac_address(connection_h connection, connection_ty switch (type) { case CONNECTION_TYPE_WIFI: -#if defined TIZEN_TV - fp = fopen(WIFI_MAC_INFO_FILE, "r"); - if (fp == NULL) { - CONNECTION_LOG(CONNECTION_ERROR, "Failed to open file %s", WIFI_MAC_INFO_FILE); //LCOV_EXCL_LINE - return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE + if (__builtin_expect(tv_profile == -1, 0)) { + char *profileName; + system_info_get_platform_string("http://tizen.org/feature/profile", &profileName); + if (*profileName == 't' || *profileName == 'T') + tv_profile = 1; + else + tv_profile = 0; + free(profileName); } + if (tv_profile == 1) { + fp = fopen(WIFI_MAC_INFO_FILE, "r"); + if (fp == NULL) { + CONNECTION_LOG(CONNECTION_ERROR, "Failed to open file %s", WIFI_MAC_INFO_FILE); //LCOV_EXCL_LINE + return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE + } - if (fgets(buf, sizeof(buf), fp) == NULL) { - CONNECTION_LOG(CONNECTION_ERROR, "Failed to get MAC info from %s", WIFI_MAC_INFO_FILE); //LCOV_EXCL_LINE - fclose(fp); //LCOV_EXCL_LINE - return CONNECTION_ERROR_OPERATION_FAILED; - } + if (fgets(buf, sizeof(buf), fp) == NULL) { + CONNECTION_LOG(CONNECTION_ERROR, "Failed to get MAC info from %s", WIFI_MAC_INFO_FILE); //LCOV_EXCL_LINE + fclose(fp); //LCOV_EXCL_LINE + return CONNECTION_ERROR_OPERATION_FAILED; + } - CONNECTION_LOG(CONNECTION_INFO, "%s : %s", WIFI_MAC_INFO_FILE, buf); + CONNECTION_LOG(CONNECTION_INFO, "%s : %s", WIFI_MAC_INFO_FILE, buf); - *mac_addr = (char *)malloc(CONNECTION_MAC_INFO_LENGTH + 1); - if (*mac_addr == NULL) { - CONNECTION_LOG(CONNECTION_ERROR, "malloc() failed"); //LCOV_EXCL_LINE - fclose(fp); //LCOV_EXCL_LINE - return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE - } - g_strlcpy(*mac_addr, buf, CONNECTION_MAC_INFO_LENGTH + 1); - fclose(fp); -#else - *mac_addr = vconf_get_str(VCONFKEY_WIFI_BSSID_ADDRESS); + *mac_addr = (char *)malloc(CONNECTION_MAC_INFO_LENGTH + 1); + if (*mac_addr == NULL) { + CONNECTION_LOG(CONNECTION_ERROR, "malloc() failed"); //LCOV_EXCL_LINE + fclose(fp); //LCOV_EXCL_LINE + return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE + } + g_strlcpy(*mac_addr, buf, CONNECTION_MAC_INFO_LENGTH + 1); + fclose(fp); + } else { + *mac_addr = vconf_get_str(VCONFKEY_WIFI_BSSID_ADDRESS); - if (*mac_addr == NULL) { - CONNECTION_LOG(CONNECTION_ERROR, "Failed to get vconf from %s", VCONFKEY_WIFI_BSSID_ADDRESS); //LCOV_EXCL_LINE - return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE + if (*mac_addr == NULL) { + CONNECTION_LOG(CONNECTION_ERROR, "Failed to get vconf from %s", VCONFKEY_WIFI_BSSID_ADDRESS); //LCOV_EXCL_LINE + return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE + } } -#endif break; //LCOV_EXCL_START case CONNECTION_TYPE_ETHERNET: