[Info] Contrasting getting a list of access points vs getting a list of connected stations

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

[Info] Contrasting getting a list of access points vs getting a list of connected stations

Postby kolban » Sat Oct 08, 2016 11:26 pm

Studying the ESP-IDF APIs I was contrasting two distinct techniques for working with data. The first is the notion of getting the list of access points following a scan. When we know a scan has completed, we can:

1. esp_wifi_get_ap_num() to get the number of access points available.
2. malloc enough storage
3. esp_wifi_get_ap_list() to populate the storage
4. Work with the list as an indexed array
5. free the storage we previously allocated

This feels like a common C language technique for getting data.

Now let us look at how we work with the list of connected stations

1. esp_wifi_get_station_list() which returns a pointer to storage
2. Work with the storage as a linked list
3. esp_wifi_free_station_list() to release the resources

A very distinct story. The connected stations story also doesn't appear to be "safe" as the station list seems to be a singleton and I don't get to specify "which" station list I want to release. Off the two techniques of working with retrievable lists of data, my "preference" is the first technique. Maybe the interface for working with station lists could be changed and modeled after how we work with access points?

Part of my thinking in this post is that we are in very early days off ESP32 existence and, as such, have opportunities to alter interfaces should "better" ones come to light without too much damage to producers of solutions. Might this be an opportunity/instance where we can or should change the interface for working with stations lists to make the techniques consistent and consumable?

Let us also remember that my opinion is just that ... an opinion ... a data point. So nothing should ever be changed based on one comment. If you have an opinion please feel free to post back with your thoughts.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

Who is online

Users browsing this forum: Bing [Bot], derricksenva, Google [Bot] and 233 guests