Skip to content

Commit

Permalink
Merge pull request ARMmbed#80 from linlingao/fix_scan
Browse files Browse the repository at this point in the history
Fix scan when the count is non-zero
  • Loading branch information
linlingao authored Nov 2, 2018
2 parents b9292f2 + b1d5601 commit 878b544
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,6 @@ int CC3200_SIMPLELINK::scan(WiFiAccessPoint *res, unsigned count)
* The scan parameters would be according to the system persistent settings on enabled channels.
* For more information, see: <simplelink user guide, page: pr.>
*/
if (ret > 0)
{
return ret;
}

if(SL_ERROR_WLAN_GET_NETWORK_LIST_EAGAIN == ret)
{
Expand Down Expand Up @@ -410,12 +406,13 @@ int CC3200_SIMPLELINK::scan(WiFiAccessPoint *res, unsigned count)
}
}
}
if (triggeredScanTrials == MAX_SCAN_ATTEMPTS)
if (ret <= 0)
{
printf("\n\r[scan] : Unable to retrieve the network list\n\r");
return 0;
}
if ((ret > 0) && res)
// scan is successful if code reaches here.
if (res && count)
{
unsigned i;

Expand Down Expand Up @@ -451,8 +448,12 @@ int CC3200_SIMPLELINK::scan(WiFiAccessPoint *res, unsigned count)
ap.channel = netEntries[i].Channel;
res[i] = WiFiAccessPoint(ap);
}
return count;
}
else // Either res == NULL or count == 0, return the number of scanned networks
{
return ret;
}
return count;
}

nsapi_error_t CC3200_SIMPLELINK::set_channel(int channel)
Expand Down

0 comments on commit 878b544

Please sign in to comment.