Scan without connecting to AP

Dmytro_Medvid
Posts: 5
Joined: Tue Sep 04, 2018 6:39 am

Scan without connecting to AP

Postby Dmytro_Medvid » Tue Sep 18, 2018 8:45 am

Hi, everybody!

Is it possible to start scanning of available Wi-Fi network without connection to AP in STA mode? I always got next error:

Code: Select all

W (3298) wifi: Now is connecting, user scan invalid now!

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: Scan without connecting to AP

Postby fly135 » Tue Sep 18, 2018 3:02 pm

Totally possible. I do it all the time and send all the scanned APs to a phone app, which then allows the user to assign the SSID and password. It's not even possible to be connected since I don't have the SSID and password in the beginning.

John A

Dmytro_Medvid
Posts: 5
Joined: Tue Sep 04, 2018 6:39 am

Re: Scan without connecting to AP

Postby Dmytro_Medvid » Wed Sep 19, 2018 7:21 am

May you send your code of Wi-Fi initializing and sanning process?

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: Scan without connecting to AP

Postby fly135 » Wed Sep 19, 2018 3:43 pm

Dmytro_Medvid wrote:May you send your code of Wi-Fi initializing and sanning process?
It's already on your computer....

$IDF_PATH\examples\wifi\scan\main

That example seems incomplete. I put this in the event handler...

Code: Select all

        case SYSTEM_EVENT_SCAN_DONE:
          wifiScanCallback(event->event_info.scan_done.number);
          break;
In the callback routine I process all the records...

Code: Select all

  uint16_t apCount;
  esp_wifi_scan_get_ap_num(&apCount);
  //printf("Number of access points found: %d:%d\n",apCount,num_ap);
  if (apCount == 0) {
    xTaskNotifyGive(l_scanning_task);
    return;
  }
  wifi_ap_record_t *list = (wifi_ap_record_t *)malloc(sizeof(wifi_ap_record_t) * apCount);
  ESP_ERROR_CHECK(esp_wifi_scan_get_ap_records(&apCount, list));
I really can't post all the code because it belongs to my employer.

John A

Who is online

Users browsing this forum: No registered users and 144 guests