orbital-systems / react-native-esp-idf-provisioning

ESP IDF provisioning and custom data library for react-native
MIT License
24 stars 5 forks source link

variable name typo leads to unable to create device session #34

Closed tri-bao closed 8 months ago

tri-bao commented 8 months ago

Both our app and the example app in this repo could't pass the wifi scan after connecting to a device. In the example app, we can scan for the list of devices; we can select a device; but after selecting BLE, Secure1 and entering PoP, we're unable to scan Wifi.

The error message that toasted on the screen was Failed to create session

The native log in logcat was onCharacteristicWrite, status : 4 The native stack trace was

java.lang.Exception: Write to BLE failed
at com.espressif.provisioning.transport.BLETransport$1.onCharacteristicWrite(BLETransport.java:377)
at android.bluetooth.BluetoothGatt$1$7.run(BluetoothGatt.java:562)
at android.bluetooth.BluetoothGatt.runOrQueueCallback(BluetoothGatt.java:959)
at android.bluetooth.BluetoothGatt.-$$Nest$mrunOrQueueCallback(Unknown Source:0)
at android.bluetooth.BluetoothGatt$1.onCharacteristicWrite(BluetoothGatt.java:557)
at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:279)
at android.os.Binder.execTransactInternal(Binder.java:1351)
at android.os.Binder.execTransact(Binder.java:1310)

After much of debugging, I found the cause at file NativeEspIdfProvisioning.ts, method createESPDevice. The argument proofOfPossesion is misspelled (missing one s), here is it. While its koltlin counterpart in class EspIdfProvisioningModule is proofOfPossession. That make the PoP always passed to the native code as empty string which cause the session creation fails.

Could you help fix this and pump a new version? Otherwise, the plugin won't work with any secured BLE devices

tri-bao commented 8 months ago

It turns out the issue is difference. Named parameter is not used in this style thus the typo won't impact.

I described the real issue here: https://github.com/orbital-systems/react-native-esp-idf-provisioning/issues/35