From 538e45d97eeb7293dc2fba178f4623a1c389270c Mon Sep 17 00:00:00 2001 From: Andrzej Popowski Date: Fri, 7 Aug 2015 13:58:38 +0200 Subject: [PATCH] [Systeminfo] - getting wifi mac address change reverted Change-Id: I14a6f9beebd135e9da6654bbdc7e27af5f77531d Signed-off-by: Andrzej Popowski --- src/systeminfo/systeminfo-utils.cpp | 47 +++++++++++++++-------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/src/systeminfo/systeminfo-utils.cpp b/src/systeminfo/systeminfo-utils.cpp index 5ed7050e..e8d52d80 100644 --- a/src/systeminfo/systeminfo-utils.cpp +++ b/src/systeminfo/systeminfo-utils.cpp @@ -2184,6 +2184,18 @@ PlatformResult SysteminfoUtils::ReportWifiNetwork(picojson::object& out) { connection_handle_ptr(connection_handle, &connection_destroy); // automatically release the memory + char* mac = nullptr; + error = connection_get_mac_address(connection_handle, CONNECTION_TYPE_WIFI, &mac); + if (CONNECTION_ERROR_NONE == error && nullptr != mac) { + SLoggerD("MAC address fetched: %s", mac); + result_mac_address = mac; + free(mac); + } else { + std::string log_msg = "Failed to get mac address: " + std::to_string(error); + LoggerE("%s", log_msg.c_str()); + return PlatformResult(ErrorCode::UNKNOWN_ERR, log_msg); + } + error = connection_get_type(connection_handle, &connection_type); if (CONNECTION_ERROR_NONE != error) { std::string log_msg = "Cannot get connection type: " + std::to_string(error); @@ -2191,17 +2203,6 @@ PlatformResult SysteminfoUtils::ReportWifiNetwork(picojson::object& out) { return PlatformResult(ErrorCode::UNKNOWN_ERR, log_msg); } if (CONNECTION_TYPE_WIFI == connection_type) { - char* mac = nullptr; - error = connection_get_mac_address(connection_handle, CONNECTION_TYPE_WIFI, &mac); - if (CONNECTION_ERROR_NONE == error && nullptr != mac) { - SLoggerD("MAC address fetched: %s", mac); - result_mac_address = mac; - free(mac); - } else { - std::string log_msg = "Failed to get mac address: " + std::to_string(error); - LoggerE("%s", log_msg.c_str()); - return PlatformResult(ErrorCode::UNKNOWN_ERR, log_msg); - } result_status = true; //gathering profile @@ -2335,6 +2336,18 @@ PlatformResult SysteminfoUtils::ReportEthernetNetwork(picojson::object& out) { break; } + char* mac = nullptr; + error = connection_get_mac_address(connection_handle, CONNECTION_TYPE_ETHERNET, &mac); + if (CONNECTION_ERROR_NONE == error && nullptr != mac) { + SLoggerD("MAC address fetched: %s", mac); + result_mac_address = mac; + free(mac); + } else { + std::string log_msg = "Failed to get mac address: " + std::to_string(error); + LoggerE("%s", log_msg.c_str()); + return PlatformResult(ErrorCode::UNKNOWN_ERR, log_msg); + } + error = connection_get_type(connection_handle, &connection_type); if (CONNECTION_ERROR_NONE != error) { std::string log_msg = "Cannot get connection type: " + std::to_string(error); @@ -2343,18 +2356,6 @@ PlatformResult SysteminfoUtils::ReportEthernetNetwork(picojson::object& out) { } if (CONNECTION_TYPE_ETHERNET == connection_type) { - char* mac = nullptr; - error = connection_get_mac_address(connection_handle, CONNECTION_TYPE_ETHERNET, &mac); - if (CONNECTION_ERROR_NONE == error && nullptr != mac) { - SLoggerD("MAC address fetched: %s", mac); - result_mac_address = mac; - free(mac); - } else { - std::string log_msg = "Failed to get mac address: " + std::to_string(error); - LoggerE("%s", log_msg.c_str()); - return PlatformResult(ErrorCode::UNKNOWN_ERR, log_msg); - } - //gathering profile error = connection_get_current_profile(connection_handle, &profile_handle); if (CONNECTION_ERROR_NONE != error) { -- 2.34.1