-
Notifications
You must be signed in to change notification settings - Fork 3
initializePeripheral is broken #3
Comments
I think you are right, I can't test right now though. It feels a bit not intuitive to me because "initialize" usually refers to a 1 time action with only 1 callback needed. Merged your PR, thanks. |
Thanks. I've tested this with actual hardware, and can confirm it works. I agree that the naming is a bit misleading, I suspect it was a shortcut taken by the Cordova plugin developer. |
Alright, will dig into that when I'm going back to this plugin. |
This... this <3. You sir, are a lifesaver! Btw, it would do you good if you specify the methods available right on the readme as how randdusing does. Maaan, I almost skipped this one because I thought this doesn't support peripheral mode, All hail somq~! |
I really hope this plugin gets more support from the ionic community 👍 |
Hi @laaaaanceeee , I've just made a pull request on ionic-native repo. It contains any available methods and all of them are documented! Tomorrow I will update this repo btw |
initializePeripheral returns a Promise<{...}>, which is used as callback for any incoming data on the Gatt server. However, Promise allows invocation of the then()-callback only once, which will make it work the first time, but not for subsequent callbacks. Therefore it will trigger a callback to say that initializePeripheral succeeded, but after that the callback is never triggered again.
The fix is to change the return type in
ionic-plugin-bluetoothle/dist/@ionic-native/bluetooth-le/index.d.ts
Line 237 in 1c4ed9d
The text was updated successfully, but these errors were encountered: