-
Notifications
You must be signed in to change notification settings - Fork 589
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[#165] Added support for native BluetoothGattCallback usage in custom… #237
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
6a5a05d
to
12c9b5a
Compare
Cool! Can this be used for a long-running task concurrently with other usages of |
@6bangs no, it's not recommended. When the operation is completed we are releasing the radio lock. Having multiple bluetooth operations not synchronized may cause abnormal behaviors. Anyway, the native callback is automatically released when the operation is finished. Is there any reason you wanted to use it that way? |
Yep. We deliver OTA updates transparently to our users while the device is otherwise in use (reading heart rate, etc). It works great currently, but it takes 4-6 hours to complete. Maybe we could use this if we opened a second |
Hello @6bangs Edit: And to answer your question - it is only possible to have a single |
Of course. Our device uses characteristics not defined in the BLE spec for both OTA and heart rate measurement (among other things). We set up notifications for heart rate measurement via the usual We can perform all of these operations concurrently, and it's working really well. OTA just takes forever due to RxJava overhead. With regard to |
Yep, exactly. Sorry, I forgot that detail; wrote that code almost a year ago. If I recall, I found it in an |
@6bangs The It is possible to achieve what you want but you would need to put the OTA and updating the state of the peripheral in the same |
Ah, cool. Will look into that. |
Added support for native BluetoothGattCallback usage in custom operations.
Really silly performance test:
RxJava API @ 1000000 calls => 7905ms (0.008ms/call)
Native API @ 1000000 calls => 2076ms (0.002ms/call)