WiFiFlutter icon indicating copy to clipboard operation
WiFiFlutter copied to clipboard

ESP8266 in AP mode - No connection

Open laguierre opened this issue 2 years ago • 4 comments

I am using wifi_scan explample to list all the near by WiFi network. My idea is when I tap on the network ESP8266 in AP mode, next connect the selected WiFi. An pop up "Do you want to conect....", tap on "connect" and ESP8266 "is conected" throught WiFi. However I have not been successful. The final idea is select an WiFi AP made with ESP8266 and access the info throght 192.168.4.1... Thank!

1 2

ListTile(
      visualDensity: VisualDensity.compact,
      leading: Icon(signalIcon),
      title: Text(title),
      subtitle: Text(widget.accessPoint.capabilities),
      onTap: () async {
          print(widget.accessPoint.ssid);
          bool connect = await WiFiForIoTPlugin.connect(
          widget.accessPoint.ssid,
          joinOnce: true,
          isHidden: false,
          withInternet: false,
          //password: 'none',
          security: NetworkSecurity.NONE,
        );
       print('Conected: $connect');
        await WiFiForIoTPlugin.forceWifiUsage(true);
        await WiFiForIoTPlugin.setEnabled(true);//, shouldOpenSettings: true);

        print(await WiFiForIoTPlugin.isConnected());
        setState(() {});
      },
    );

laguierre avatar Dec 30 '22 21:12 laguierre

WiFiForIoTPlugin.connect(SSID, bssid: bssid, password: password, security: network security.WPA) Try this API, If you need to create a connection, you need bssid and security

Gobink6 avatar Jan 02 '23 09:01 Gobink6

I try the API... in my case the connection is open and it doesn't have password. My question is, will I be able to use the API? Also if I use security.WPA the APP crashed. Any other idea?

I/flutter ( 8669): EM E/AndroidRuntime( 8669): FATAL EXCEPTION: Thread-6 E/AndroidRuntime( 8669): Process: com.example.wifi, PID: 8669 E/AndroidRuntime( 8669): java.lang.NullPointerException E/AndroidRuntime( 8669): at com.android.wifi.x.com.android.internal.util.Preconditions.checkNotNull(Preconditions.java:147) E/AndroidRuntime( 8669): at android.net.wifi.WifiNetworkSpecifier$Builder.setWpa2Passphrase(WifiNetworkSpecifier.java:280) E/AndroidRuntime( 8669): at com.alternadom.wifiiot.WifiIotPlugin.connectTo(WifiIotPlugin.java:1389) E/AndroidRuntime( 8669): at com.alternadom.wifiiot.WifiIotPlugin.access$400(WifiIotPlugin.java:54) E/AndroidRuntime( 8669): at com.alternadom.wifiiot.WifiIotPlugin$7.run(WifiIotPlugin.java:903) I/Process ( 8669): Sending signal. PID: 8669 SIG: 9 Lost connection to device.

laguierre avatar Jan 03 '23 01:01 laguierre

Hi, Still can't connect. My source (https://github.com/laguierre/wifi) bool connect = await WiFiForIoTPlugin.connect(  widget.accessPoint.ssid,  bssid: widget.accessPoint.bssid,  joinOnce: true,  isHidden: false,  withInternet: false,  //password: '',  security: NetworkSecurity.NONE,  //withInternet: true,);//bool connect = await WiFiForIoTPlugin.connect(SSID, bssid: bssid, password: password, security: network security.WPA)print('Conected: $connect');await WiFiForIoTPlugin.forceWifiUsage(true);await WiFiForIoTPlugin.setEnabled(true); //, shouldOpenSettings: true);  Regards   Enviado desde Correo para Windows 

De: Gobink6Enviado: martes, 3 de enero de 2023 06:37Para: flutternetwork/WiFiFlutterCC: Leandro Aguierre; AuthorAsunto: Re: [flutternetwork/WiFiFlutter] ESP8266 in AP mode - No connection (Issue #319) 

Try connection use this comment for make API callawait _wifiHandler.forceWifiUage(true);

laguierre avatar Jan 03 '23 14:01 laguierre

This plugin just fails with ESP AP mode, tried with encrypted and without, the phone Android 11 just claims about unsecure wifi policy. I I enable ESP SSID manually from android wifi setup, everything works as it should be, the plugin forceWifiUsage does not help either. Seems to be a bug somewhere.

kadarpik avatar Mar 12 '23 22:03 kadarpik