File tree Expand file tree Collapse file tree 4 files changed +29
-0
lines changed
libraries/ESP8266WiFi/src Expand file tree Collapse file tree 4 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -607,6 +607,18 @@ uint8_t* ESP8266WiFiSTAClass::BSSID(void) {
607607 return reinterpret_cast <uint8_t *>(conf.bssid );
608608}
609609
610+ /* *
611+ * Fill the current bssid / mac associated with the network if configured
612+ * @param bssid pointer to uint8_t array with length WL_MAC_ADDR_LENGTH
613+ * @return bssid uint8_t *
614+ */
615+ uint8_t * ESP8266WiFiSTAClass::BSSID (uint8_t * bssid) {
616+ struct station_config conf;
617+ wifi_station_get_config (&conf);
618+ memcpy (bssid, conf.bssid , WL_MAC_ADDR_LENGTH);
619+ return bssid;
620+ }
621+
610622/* *
611623 * Return the current bssid / mac associated with the network if configured
612624 * @return String bssid mac
Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ class ESP8266WiFiSTAClass: public LwipIntf {
7979 String psk () const ;
8080
8181 uint8_t * BSSID ();
82+ uint8_t * BSSID (uint8_t * bssid);
8283 String BSSIDstr ();
8384
8485 int8_t RSSI ();
Original file line number Diff line number Diff line change @@ -259,6 +259,21 @@ uint8_t * ESP8266WiFiScanClass::BSSID(uint8_t i) {
259259 return it->bssid ;
260260}
261261
262+ /* *
263+ * fill MAC / BSSID of scanned wifi
264+ * @param i specify from which network item want to get the information
265+ * @param bssid pointer to uint8_t array with length WL_MAC_ADDR_LENGTH
266+ * @return uint8_t * MAC / BSSID of scanned wifi
267+ */
268+ uint8_t * ESP8266WiFiScanClass::BSSID (uint8_t i, uint8_t * bssid) {
269+ struct bss_info * it = reinterpret_cast <struct bss_info *>(_getScanInfoByIndex (i));
270+ if (!it) {
271+ return 0 ;
272+ }
273+ memcpy (bssid, it->bssid , WL_MAC_ADDR_LENGTH);
274+ return bssid;
275+ }
276+
262277/* *
263278 * return MAC / BSSID of scanned wifi
264279 * @param i specify from which network item want to get the information
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ class ESP8266WiFiScanClass {
4848 uint8_t encryptionType (uint8_t networkItem);
4949 int32_t RSSI (uint8_t networkItem);
5050 uint8_t * BSSID (uint8_t networkItem);
51+ uint8_t * BSSID (uint8_t networkItem, uint8_t * bssid);
5152 String BSSIDstr (uint8_t networkItem);
5253 int32_t channel (uint8_t networkItem);
5354 bool isHidden (uint8_t networkItem);
You can’t perform that action at this time.
0 commit comments