unicloudvn / esp_provisioning

Flutter Provisioning library for ESP-IDF ESP32 Unified provisioning
https://unicloudgroup.dev
Apache License 2.0
65 stars 52 forks source link

with your example i can't find the esp32 ble provision device #4

Open williamz64 opened 4 years ago

williamz64 commented 4 years ago

with your example i can't find the esp32 ble provision device, have any advice?

trannhoduc commented 4 years ago

I have the same situation as you Do you think this provision is different from a regular provision? As far as I know it consists of steps:

  1. Disconnect with the node
  2. Try to reconnect with the node
  3. Connect successfully and discover ESP-BLE-MESH GATT Service
  4. Get Composition Data of the node and add AppKey to it

But the API is : EspProv prov = EspProv( transport: TransportBLE(ble_peripheral), security: Security1(pop: pop)); var success = await prov.establishSession(); await prov.sendWifiConfig(ssid: event.ssid, password: event.password); await prov.applyWifiConfig();

I don't know why we have WIFI here ?

saps1063 commented 3 years ago

I have the same issue. It's because of they are scanning particular service uuid on ble_service file.

return _bleManager.startPeripheralScan( uuids: [TransportBLE.PROV_BLE_SERVICE], scanMode: ScanMode.opportunistic, allowDuplicates: true);

Scanning without uuid show me esp device in scan list. But it's not going further for the provisioning.

SamKlim commented 2 years ago

@saps1063 I am working on this too, once i removed the particular service uuid, the next error i faced was :

Error conencting to device NoSuchMethodError: The method 'isConnected' was called on null. If this was the error you received, the fix is to in the startProvisioning() method, the fix is to move Peripheral p = peripheral ?? selectedPeripheral; below await _bleManager.stopPeripheralScan(). Have you worked on this further?

MurtuzaSrashtaSoft commented 2 years ago

show bottom sheet after 2 send delay.

example/lib/ble_screen/ble_screen.dart


 if (state is BleStateLoaded) {
              return ScanList(state.bleDevices, Icons.bluetooth, onTap:
                  (Map<String, dynamic> item, BuildContext _context) async {
                BlocProvider.of<BleBloc>(_context).add(BleEventSelect(item));
                BlocProvider.of<BleBloc>(_context).add(BleEventStopScan());
                await Future.delayed(Duration(seconds: 2));
                _showBottomSheet(item, context);
              });
            }
skashok commented 2 years ago

Hi, I am also working on the same. after giving empty UUID list it list the my device, when I select it, It throws this exception

2022-05-30 16:24:59.478540+0530 Runner[1381:48973] flutter: \^[[38;5;196m│ ⛔ Error conencting to device NoSuchMethodError: The method 'securitySession' was called on null.<…> 2022-05-30 16:24:59.478598+0530 Runner[1381:48973] flutter: \^[[38;5;196m│ ⛔ Receiver: null<…> 2022-05-30 16:24:59.478652+0530 Runner[1381:48973] flutter: \^[[38;5;196m│ ⛔ Tried calling: securitySession(null)<…> 2022-05-30 16:24:59.478708+0530 Runner[1381:48973] flutter: \^[[38;5;196m└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<…> 2022-05-30 16:24:59.479583+0530 Runner[1381:48973] flutter: \^[[38;5;196m┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<…> 2022-05-30 16:24:59.479660+0530 Runner[1381:48973] flutter: \^[[38;5;196m│ #0 WifiBloc._mapLoadToState (package:esp_provisioning_example/wifi_screen/wifi_bloc.dart:50:1<…> 2022-05-30 16:24:59.479707+0530 Runner[1381:48973] flutter: \^[[38;5;196m│ #1 <asynchronous suspensio<…> 2022-05-30 16:24:59.479773+0530 Runner[1381:48973] flutter: \^[[38;5;196m├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄<…> 2022-05-30 16:24:59.479975+0530 Runner[1381:48973] flutter: \^[[38;5;196m│ ⛔ Error scan WiFi network NoSuchMethodError: The method 'startScanWiFi' was called on null.<…> 2022-05-30 16:24:59.480380+0530 Runner[1381:48973] flutter: \^[[38;5;196m│ ⛔ Receiver: null<…> 2022-05-30 16:24:59.480466+0530 Runner[1381:48973] flutter: \^[[38;5;196m│ ⛔ Tried calling: startScanWiFi()<…> 2022-05-30 16:24:59.480525+0530 Runner[1381:48973] flutter: \^[[38;5;196m└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<…>

I have the same issue. It's because of they are scanning particular service uuid on ble_service file.

return _bleManager.startPeripheralScan( uuids: [TransportBLE.PROV_BLE_SERVICE], scanMode: ScanMode.opportunistic, allowDuplicates: true);

Scanning without uuid show me esp device in scan list. But it's not going further for the provisioning.

skashok commented 2 years ago

Hi, I am also working on the same. after giving empty UUID list it list the my device, when I select it, It throws this exception

2022-05-30 16:24:59.478540+0530 Runner[1381:48973] flutter: ^[[38;5;196m│ ⛔ Error conencting to device NoSuchMethodError: The method 'securitySession' was called on null.<…> 2022-05-30 16:24:59.478598+0530 Runner[1381:48973] flutter: ^[[38;5;196m│ ⛔ Receiver: null<…> 2022-05-30 16:24:59.478652+0530 Runner[1381:48973] flutter: ^[[38;5;196m│ ⛔ Tried calling: securitySession(null)<…> 2022-05-30 16:24:59.478708+0530 Runner[1381:48973] flutter: ^[[38;5;196m└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<…> 2022-05-30 16:24:59.479583+0530 Runner[1381:48973] flutter: ^[[38;5;196m┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<…> 2022-05-30 16:24:59.479660+0530 Runner[1381:48973] flutter: ^[[38;5;196m│ #0 WifiBloc._mapLoadToState (package:esp_provisioning_example/wifi_screen/wifi_bloc.dart:50:1<…> 2022-05-30 16:24:59.479707+0530 Runner[1381:48973] flutter: ^[[38;5;196m│ https://github.com/unicloudvn/esp_provisioning/issues/1 <asynchronous suspensio<…> 2022-05-30 16:24:59.479773+0530 Runner[1381:48973] flutter: ^[[38;5;196m├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄<…> 2022-05-30 16:24:59.479975+0530 Runner[1381:48973] flutter: ^[[38;5;196m│ ⛔ Error scan WiFi network NoSuchMethodError: The method 'startScanWiFi' was called on null.<…> 2022-05-30 16:24:59.480380+0530 Runner[1381:48973] flutter: ^[[38;5;196m│ ⛔ Receiver: null<…> 2022-05-30 16:24:59.480466+0530 Runner[1381:48973] flutter: ^[[38;5;196m│ ⛔ Tried calling: startScanWiFi()<…> 2022-05-30 16:24:59.480525+0530 Runner[1381:48973] flutter: ^[[38;5;196m└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<…>