diff --git a/NetworkManagerGnomeProxy.cpp b/NetworkManagerGnomeProxy.cpp index f00a750b..1e8dcea0 100644 --- a/NetworkManagerGnomeProxy.cpp +++ b/NetworkManagerGnomeProxy.cpp @@ -555,7 +555,7 @@ namespace WPEFramework string tmpssidlist{}; while (ssids->Next(tmpssidlist) == true) { - scanForSsidslist.push_back(tmpssidlist); + scanForSsidslist.push_back(tmpssidlist.c_str()); } } diff --git a/NetworkManagerImplementation.cpp b/NetworkManagerImplementation.cpp index ae8530e0..66556040 100644 --- a/NetworkManagerImplementation.cpp +++ b/NetworkManagerImplementation.cpp @@ -492,10 +492,9 @@ namespace WPEFramework void NetworkManagerImplementation::filterScanResults(JsonArray &ssids) { JsonArray result; - if (scanForSsidslist) - std::unordered_set scanForSsidsSet(scanForSsidslist.begin(), scanForSsidslist.end()); + std::unordered_set scanForSsidsSet(scanForSsidslist.begin(), scanForSsidslist.end()); - if ((scanForSsidslist && !scanForSsidslist->empty()) || (scanForFreq && !scanForFreq->empty())) { + if (!scanForSsidslist.empty() && !scanForFreq.empty()) { for (int i = 0; i < ssids.Length(); i++) { diff --git a/NetworkManagerJsonRpc.cpp b/NetworkManagerJsonRpc.cpp index b9f163a4..073f07b7 100644 --- a/NetworkManagerJsonRpc.cpp +++ b/NetworkManagerJsonRpc.cpp @@ -670,32 +670,35 @@ namespace WPEFramework { LOG_INPARAM(); uint32_t rc = Core::ERROR_GENERAL; + string frequency{}; + Exchange::INetworkManager::IStringIterator* ssids = NULL; if (parameters.HasLabel("frequency")) - string frequency = parameters["frequency"].String(); + { + frequency = parameters["frequency"].String(); + NMLOG_INFO("Received frequency string : %s", frequency.c_str()); + } if (parameters.HasLabel("ssid")) + { JsonArray array = parameters["ssid"].Array(); + std::vector tmpssidslist; + JsonArray::Iterator index(array.Elements()); - Exchange::INetworkManager::IStringIterator* ssids = NULL; - std::vector tmpssidslist; - - JsonArray::Iterator index(array.Elements()); - while (index.Next() == true) - { - if (Core::JSON::Variant::type::STRING == index.Current().Content()) - { - tmpssidslist.push_back(index.Current().String().c_str()); - } - else + while (index.Next() == true) { - NMLOG_DEBUG("Unexpected variant type"); - returnJson(rc); + if (Core::JSON::Variant::type::STRING == index.Current().Content()) + { + tmpssidslist.push_back(index.Current().String().c_str()); + } + else + { + NMLOG_DEBUG("Unexpected variant type"); + returnJson(rc); + } } - } - ssids = (Core::Service::Create(tmpssidslist)); - - NMLOG_INFO("Received frequency string : %s", frequency.c_str()); + ssids = (Core::Service::Create(tmpssidslist)); + } if (_networkManager) rc = _networkManager->StartWiFiScan(frequency, ssids); diff --git a/NetworkManagerRDKProxy.cpp b/NetworkManagerRDKProxy.cpp index c25cf660..38e96e7d 100644 --- a/NetworkManagerRDKProxy.cpp +++ b/NetworkManagerRDKProxy.cpp @@ -1030,7 +1030,7 @@ const string CIDR_PREFIXES[CIDR_NETMASK_IP_LEN+1] = { string tmpssidlist{}; while (ssids->Next(tmpssidlist) == true) { - scanForSsidslist.push_back(tmpssidlist); + scanForSsidslist.push_back(tmpssidlist.c_str()); NMLOG_INFO("SSID added to scanForSsidslist: %s", tmpssidlist.c_str()); } }