Skip to content

Commit

Permalink
Update requied changes for SSID & frequency filltering
Browse files Browse the repository at this point in the history
  • Loading branch information
tabbas651 committed Nov 13, 2024
1 parent b231883 commit 8ae3425
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 23 deletions.
2 changes: 1 addition & 1 deletion NetworkManagerGnomeProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ namespace WPEFramework
string tmpssidlist{};
while (ssids->Next(tmpssidlist) == true)
{
scanForSsidslist.push_back(tmpssidlist);
scanForSsidslist.push_back(tmpssidlist.c_str());
}
}

Expand Down
5 changes: 2 additions & 3 deletions NetworkManagerImplementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,9 @@ namespace WPEFramework
void NetworkManagerImplementation::filterScanResults(JsonArray &ssids)
{
JsonArray result;
if (scanForSsidslist)
std::unordered_set<std::string> scanForSsidsSet(scanForSsidslist.begin(), scanForSsidslist.end());
std::unordered_set<std::string> 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++)
{
Expand Down
39 changes: 21 additions & 18 deletions NetworkManagerJsonRpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> tmpssidslist;
JsonArray::Iterator index(array.Elements());

Exchange::INetworkManager::IStringIterator* ssids = NULL;
std::vector<std::string> 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<RPC::StringIterator>::Create<RPC::IStringIterator>(tmpssidslist));

NMLOG_INFO("Received frequency string : %s", frequency.c_str());
ssids = (Core::Service<RPC::StringIterator>::Create<RPC::IStringIterator>(tmpssidslist));
}

if (_networkManager)
rc = _networkManager->StartWiFiScan(frequency, ssids);
Expand Down
2 changes: 1 addition & 1 deletion NetworkManagerRDKProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Expand Down

0 comments on commit 8ae3425

Please sign in to comment.