@@ -292,6 +292,7 @@ CNetIf::CNetIf(NetworkDriver *driver)
292
292
}
293
293
294
294
int CNetIf::begin (const IPAddress &ip, const IPAddress &nm, const IPAddress &gw) {
295
+ CLwipIf::getInstance (); // This call is required in order to setup the network stack
295
296
driver->begin ();
296
297
297
298
ip_addr_t _ip = fromArduinoIP (ip);
@@ -631,6 +632,23 @@ int CWifiStation::connectToAP(const char* ssid, const char *passphrase) {
631
632
return rv;
632
633
}
633
634
635
+ int CWifiStation::scanForAp () {
636
+ // arduino::lock();
637
+ access_points.clear (); // FIXME create access_points vector
638
+
639
+ int res = CEspControl::getInstance ().getAccessPointScanList (access_points);
640
+ if (res == ESP_CONTROL_OK) {
641
+ res = WL_SCAN_COMPLETED;
642
+ }
643
+ // else {
644
+ // res = WL_NO_SSID_AVAIL; // TODO
645
+ // }
646
+
647
+ // arduino::unlock();
648
+
649
+ return res;
650
+ }
651
+
634
652
// disconnect
635
653
int CWifiStation::disconnectFromAp () {
636
654
return CEspControl::getInstance ().disconnectAccessPoint ();
@@ -880,10 +898,6 @@ int CWifiSoftAp::startSoftAp(const char* ssid, const char* passphrase, uint8_t c
880
898
return rv;
881
899
}
882
900
883
- int CWifiSoftAp::stopSoftAp () {
884
-
885
- }
886
-
887
901
err_t CWifiSoftAp::init (struct netif * ni) {
888
902
// Setting up netif
889
903
#if LWIP_NETIF_HOSTNAME
@@ -922,7 +936,7 @@ err_t CWifiSoftAp::output(struct netif* _ni, struct pbuf* p) {
922
936
// p may be a chain of pbufs
923
937
if (p->next != nullptr ) {
924
938
buf = (uint8_t *) malloc (size*sizeof (uint8_t ));
925
- if (buf == nullptr ) {\
939
+ if (buf == nullptr ) {
926
940
// NETIF_STATS_INCREMENT_ERROR(this->stats, ERR_MEM);
927
941
// NETIF_STATS_INCREMENT_TX_TRANSMIT_FAILED_CALLS(this->stats);
928
942
errval = ERR_MEM;
0 commit comments