abobija / esp-smartconfig-dart

EspTouch and EspTouchV2 implementations of SmartConfig provisioning protocols. Plain Dart. All platforms.
https://pub.dev/packages/esp_smartconfig
MIT License
46 stars 11 forks source link

SmartConfig is not working on Android #19

Closed XuanTung95 closed 9 months ago

XuanTung95 commented 9 months ago

I used ESP-32 WIFI + Bluetooth run on Arduino. Code Arduino:

    WiFi.mode(WIFI_AP_STA);
    WiFi.beginSmartConfig();

    //Wait for SmartConfig packet from mobile
    Serial.println("Waiting for SmartConfig.");
    while (!WiFi.smartConfigDone()) {
      delay(500);
      Serial.print(".");
    }

    Serial.println("");
    Serial.println("SmartConfig received.");

Code Flutter:

init() {
      provisioner = Provisioner.espTouch();
      provisioner.listen((response) {}, onError: (e) {});
}

onClick() async {
        await provisioner.start(ProvisioningRequest.fromStrings(
                      ssid: "123 12345",
                      bssid: "c8:e7:d8:a6:80:d6",
                      password: "12345678",
                    ));
}

There is no error in Android side but WiFi.smartConfigDone() in the Arduino is not working. Do you know what did I do wrong?

XuanTung95 commented 9 months ago

Never mind, the problem is from another plugin "network_info_plus" which returns ssid as "\"my_ssid\"" instead of "my_ssid". I close this ticket.

PS: I see that you send the Uint8List(blocks[_blockIndex++]) which are all 0 list but the Android native code of EsptouchForAndroid sends all 49 (char '1'). Maybe it's not important.

abobija commented 9 months ago

Thanks @XuanTung95, only the length of Uint8List(blocks[_blockIndex++]) is actually important.