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

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

Calling searchESPDevices() returns no devices, XPC connection invalid #31

Closed grasmash closed 10 months ago

grasmash commented 10 months ago

Hi,

I'm trying to get a simple implementation of this library working:

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

const ConnectToPedalAccessPoint = async () => {
  try {
    let prefix = '';
    let transport = ESPTransport.ble;
    const devices = ESPProvisionManager.searchESPDevices(prefix, transport);
    console.log('devices', devices);
  } catch (err) {
    console.error(err);
  }
}

await ConnectToPedalAccessPoint();

Running this returns an empty object

{"_h": 0, "_i": 0, "_j": null, "_k": null}

and produces the following error: XPC connection invalid

Any suggestions on resolving this? I'd like to start with list all nearby BLE devices regardless of prefix. However, I've also tried this with values of prefix that I know have matching nearby devices.

grasmash commented 10 months ago

It occurred to me that I may need to await the search. From searches in Google, the empty object resembles an unfulfilled promise. The example in the README does not use await, but example app does. Will try this when I’m back at my dev machine.

I’ll have to submit a PR to update the README once I had a working example.

grasmash commented 10 months ago

That was it.