react-native-esp-idf-provisioning icon indicating copy to clipboard operation
react-native-esp-idf-provisioning copied to clipboard

Support SoftAP mode

Open mateogianolio opened this issue 2 years ago • 13 comments

We currently do not have a device to test SoftAP provisioning with so any help appreciated!

mateogianolio avatar Oct 03 '23 11:10 mateogianolio

Hello, i have installed your library and I like it very much. I have a device for testing. Let's talk

toni1703 avatar Dec 20 '23 09:12 toni1703

Fantastic! I'm on vacation until January 2nd, if I have time before that I'll look through the code and compile a list of what needs to be tested.

mateogianolio avatar Dec 21 '23 12:12 mateogianolio

Fantastic! I'm on vacation until January 2nd, if I have time before that I'll look through the code and compile a list of what needs to be tested.

Hi again, Do you have time to test this?

toni1703 avatar Jan 15 '24 14:01 toni1703

Sure, we should be able to test it in the example app.

As far as I can tell we need to adjust some code in createESPDevice on Android because now it assumes BLE transport (checks for espDevice?.bluetoothDevice). But it might work if you scan for devices first like this:

let prefix = 'PROV_';
let transport = ESPTransport.softap;
let security = ESPSecurity.secure2;
const devices = await ESPProvisionManager.searchESPDevices(
  prefix,
  transport,
  security
);

// ... get device from list...

On iOS it should work with current code, but they say "SoftAP search is not supported in iOS currently." so you would need to configure the device like this:

import {
  ESPDevice,
  ESPTransport,
  ESPSecurity,
} from '@orbital-systems/react-native-esp-idf-provisioning';

const device = new ESPDevice({
  name: 'name',
  transport: ESPTransport.softap,
  security: ESPSecurity.secure2,
});

Then, on both Android and iOS connect with:

const proofOfPossession = 'proof of possession'; // or null if ESPSecurity.unsecure
const softAPPassword = 'softAPPassword';
const username = 'username'; // or null if ESPSecurity.unsecure or ESPSecurity.secure1

await device.connect(proofOfPossession, softAPPassword, username)

mateogianolio avatar Jan 16 '24 07:01 mateogianolio

Did you ever get this to work for Soft AP?

fullychargedup avatar Apr 15 '24 19:04 fullychargedup

Hey there! Unfortunately, we haven't had time to try it yet because we only do BLE setup at the company. So the above code might or might not work.

mateogianolio avatar Apr 17 '24 07:04 mateogianolio

Hi, any updates on this?

egidiusmengelberg avatar Jul 19 '24 10:07 egidiusmengelberg

Version 0.4.2 includes bugfixes for SoftAP on android. Please try that version.

mateogianolio avatar Sep 25 '24 09:09 mateogianolio

Just wanted to check on the status of softAP mode? I am happy to help test and update the code as needed for this. I have an ESP32 device that currently uses the Espressif App for SoftAP Provisioning. Currently when I setup to test with a known device (no scanning) I get failed to connect to the device: Failed to connect device SoftAP network.

digimatt22 avatar Nov 25 '24 22:11 digimatt22

That's great @digimatt22! You can follow the instructions in the example's README to build the example yourself.

The relevant code for connecting to SoftAP with a known device is:

android createESPDevice: https://github.com/orbital-systems/react-native-esp-idf-provisioning/blob/master/android/src/main/java/com/espidfprovisioning/EspIdfProvisioningModule.kt#L213-L364 connect: https://github.com/orbital-systems/react-native-esp-idf-provisioning/blob/master/android/src/main/java/com/espidfprovisioning/EspIdfProvisioningModule.kt#L368-L414

ios createESPDevice: https://github.com/orbital-systems/react-native-esp-idf-provisioning/blob/master/ios/EspIdfProvisioning.swift#L54-L80 connect: https://github.com/orbital-systems/react-native-esp-idf-provisioning/blob/master/ios/EspIdfProvisioning.swift#L82-L108

I can see now that we do a premature permission check for bluetooth in createESPDevice for android (permission check should instead be inside the BLE block), but that shouldn't cause the issue you are experiencing.

Do you have any more logs on your side?

mateogianolio avatar Nov 26 '24 14:11 mateogianolio

I am not running the new React Native Architecture yet, maybe that will be the holiday project is to port this project to it. However I was able to create a quick mock up in my existing app. I was able to successfully provision a known device over SoftAP with Secure1. I will work to expand the application and do more testing but the basics seem to be in place and working.

digimatt22 avatar Nov 26 '24 20:11 digimatt22

Hello, trying to use your library with softAP and get some troubles with android. For test i scan qr and crashing on android with error. Ios not tested with device, but on qr of other device i get normal error without crash

Image

Qallitix avatar Mar 10 '25 13:03 Qallitix

Hey, thank you for testing this library! Are you able to successfully complete setup with the ESP SoftAP Provisioning app?

mateogianolio avatar Mar 19 '25 13:03 mateogianolio