wifi/wifi_scan/main.c
/*******************************************************************************
* # License
* Copyright 2019 Silicon Laboratories Inc. www.silabs.com
*******************************************************************************
*
* The licensor of this software is Silicon Laboratories Inc. Your use of this
* software is governed by the terms of Silicon Labs Master Software License
* Agreement (MSLA) available at
* www.silabs.com/about-us/legal/master-software-license-agreement. This
* software is distributed to you in Source Code format and is governed by the
* sections of the MSLA applicable to Source Code.
*
******************************************************************************/
/* Documentation for this app is available online.
* See https://docs.silabs.com/gecko-os/4/standard/latest/sdk/examples/wifi/scan
*/
#include "gos.h"
#define SCAN_PERIOD_MS (15000) // ms
#define SCAN_INITIAL_DELAY_MS (100) //ms
#define APPLICATION_START_LINE "\r\nWifi Scan example starting ..."
/*************************************************************************************************/
{
GOS_LOG(APPLICATION_START_LINE);
gos_rtos_delay_milliseconds(SCAN_INITIAL_DELAY_MS);
}
/*************************************************************************************************/
static void scan_event_handler(void *arg)
{
gos_result_t ret;
gos_scan_result_t *scan_results;
int i = 0;
GOS_LOG( "Scanning for Wi-Fi networks ..." );
{
GOS_LOG("Failed to issue scan: %d", ret);
return;
}
GOS_LOG(" # Type BSSID RSSI Rate Chan Security SSID" );
GOS_LOG("--------------------------------------------------------------------" );
{
print_scan_result(i, result);
}
}
/*************************************************************************************************/
{
char buffer[196], mac[32];
gos_fpi_str_buffer_t data_rate_str;
char *ptr = buffer;
ptr += sprintf(ptr, " %2d", index);
ptr += sprintf(ptr, " %-5s", data_rate_str);
"Unknown" );
ptr += sprintf(ptr, " ");
{
}
else
{
strcpy(ptr, "<ssid hidden>");
}
GOS_LOG("%s", buffer);
}