B4R Question Can an accesspoint be stopped without powering down?

RJB

Active Member
Licensed User
Longtime User
in B4R is it possible to start and accesspoint, use it and then stop it so that it is no longer visible/ accessible?
Thanks
 

kolbe

Active Member
Licensed User
Longtime User
This inline code works for me on the esp32.

B4X:
void ap_off (B4R::Object* unused)
{
    WiFi.disconnect();
    WiFi.mode(WIFI_OFF);
    Serial.println("AP OFF");
}
 
Upvote 0

RJB

Active Member
Licensed User
Longtime User
This inline code works for me on the esp32.

B4X:
void ap_off (B4R::Object* unused)
{
    WiFi.disconnect();
    WiFi.mode(WIFI_OFF);
    Serial.println("AP OFF");
}
Thanks Kolbe, but won't that turn the wifi off rather than the AP?
I didn't make it clear but I need the wifi to be left on but the AP off.
 
Upvote 0

RJB

Active Member
Licensed User
Longtime User
You should call this method with inline C:
B4X:
WiFi.softAPdisconnect(true);
Thanks That worked great.
I was trying to find details on the web but couldn't, is there a good URL?
for reference this is what I used (not being a C programmer):
B4X:
public Sub StopAP
Log("Stop AP")
 RunNative("stopAP", Null)
End Sub
#if C
  #include <ESP8266WiFi.h>
  void stopAP (B4R::Object* u) {
  WiFi.softAPdisconnect(1);
  }
#end if
For information I'm using it to allow multiple 8266s to be configured (using something similar to your configurator). If all are powered up at the same time then the B4a end selects one which is configured to the wifi. Then the AP is disable. The B4a then selects another which can be configured. I send a command to flash the LED on the 8266 to identify which one is currently connected.
 
Upvote 0
Top