Closed mk-prins closed 3 years ago
Hi @mk-prins, In case of BLE, SDK does not connect with the device. Whenever ESPProvisionManager.shared.createESPDevice
is called, it actually scan for available BLE device with the name given in parameter. ESPDevice then keep the instance of CBPeripheral in order to connect and make communication using other APIs. There are particular two reason for using this flow:
ESPDevice.connect
is called and thus reducing scope for failure.@vikas-chandra-mnnit Thanks for the explanation. I do think the ability to create an ESPDevice instance without initially having the Peripheral available would be nice to have. If i'm not mistaken this is actually already the case in the Android version of this SDK. At least when using the createESPDevice
method.
A somewhat unrelated question; If there happen to be two EspDevices with the same name
, transport
and security
parameters and only have the pop
be different. It will probably find both devices and essentially select the first in the list, ignoring the specified pop
value. Is this assumption correct (for both the iOS and Android SDK)?
@mk-prins
connect
will not work in Android as it also need Bluetooth peripheral internally. For your use case in iOS I can suggest that you try to add new method in ESPProvisionManager
class using extension.Closing this issue since appropriate solution has been provided. Please fell free to reopen/file new issues if required.
When creating an
ESPDevice
usingESPProvisionManager.shared.createESPDevice
when usingsoftap
as the transport protocol, anESPDevice
device instance is successfully created. However when usingble
as the transport protocol it first tries to connect to the device and if that connection fails it will not return theESPDevice
instance. Is there a specific reason for trying to connect to the device in the case ofble
?To give some context; My use-case requires me to create an
ESPDevice
instance before the device is connected to any power source and therefore not available. Now if I were to only have to create anESPDevice
manually this wouldn't be too much of a problem. However my use-case requires me to create the ESPDevices using a QR code. ThescanQRCode
method eventually makes use of thecreateESPDevice
method to create and return theESPDevice
instance, causing me to run into the same problem.