don / cordova-plugin-ble-central

Bluetooth Low Energy (BLE) Central plugin for Apache Cordova (aka PhoneGap)
Apache License 2.0
941 stars 601 forks source link

Update android dfu 1.11.1 #980

Closed QuentinFarizon closed 11 months ago

peitschie commented 11 months ago

Just as a mental exercise, it seems like on Android the only thing needed from the BLE plugin is the mac address of the device the upload should connect with. On iOS, it looks like it needs the peripheral object itself based on the device address.

On Android, you could easily create a fully standalone plugin in this case simply by passing the device address from this plugin to a DFU upgrade one via JavaScript.

E.g.,

ble.connect(deviceId, data => dfu.upgradeFirmware(deviceId), console.error);

On iOS, if I exposed a single method to allow the peripheral to be retrieved based on a device ID, you could then support a similar workflow on iOS too.

Would the above be of any interest to you perhaps @QuentinFarizon ? I figure it would allow you to use the main version of this plugin, so you don't need to rebase all the time 🙂

QuentinFarizon commented 11 months ago

Hello @peitschie and sorry for the PRs (I blame Github's interface, way too easy to create PRs on other repos without realising that's what you're doing).

In fact, I don't think it would require new functions for your plugin to be able to separate this upgradeFirmware to another plugin, since I already pass it the same deviceId I pass to ble.connect
It may be simpler indeed to move it to a separate plugin, it's just a bit of work.

peitschie commented 11 months ago

@QuentinFarizon it's absolutely not an issue at all 😃

I enjoy the occasional reminder that your work exists.

Was just asking in case it made life any easier for you 🙂. Don't feel any pressure to change what you are doing.

QuentinFarizon commented 11 months ago

Thanks @peitschie for the goodwill and all your work !
We are indeed heavy users of this plugin