juullabs / able Goto Github PK
View Code? Open in Web Editor NEWAble: Android Bluetooth Low Energy library
License: Apache License 2.0
Able: Android Bluetooth Low Energy library
License: Apache License 2.0
It seems the checkConnection() function in Retry never completes,
the line Able.verbose { "checkConnection โ End" }
never runs.
If I use Able without the Retry layer, everything works as expected.
It would be nice to be able to scan BLE devices in a Flow
rather than having to work with ScanCallback
.
Until SharedFlow
is released, development is occurring on internal
branch (built against internal Coroutines publications).
When merging internal
back into develop
, ensure the following has been performed:
STOPSHIP
sThere is currently no special handling when Android Gatt operations (e.g. writeCharacteristic
) returns false
, as such, the Messenger
enters a "deadlock" state because the callback.waitForGattReady()
waits indefinitely.
Instead, should be releasing the GattCallback.gattLock
upon a false
return from an Android Gatt operation.
The false
return for Gatt operations was observed after hardware errors observed on:
Samsung Galaxy A5
05-21 18:07:07.664 2451 4426 E [email protected]_controller: Error reading data from uart
05-21 18:07:07.664 2451 4426 D [email protected]_controller: ReportSocFailure
05-21 18:07:07.664 2451 4426 D [email protected]_controller: ReportSocFailure send soc failure
05-21 18:07:07.665 4344 4427 E bt_hci : [BTCORE] Ctlr H/w error event - code:0xf
05-21 18:07:07.665 4344 4427 E bt_btif : btif_dm_error_reporter_cback : 3
05-21 18:07:07.665 4344 4377 W bt_btif : btif_dm_generic_evt: event=33037
05-21 18:07:07.665 4344 4427 W bt_btif : bta_gattc_conn_cback() - cif=3 connected=0 conn_id=3 reason=0x0003
05-21 18:07:07.665 4344 4427 W bt_btif : bta_gattc_conn_cback() - cif=4 connected=0 conn_id=4 reason=0x0003
05-21 18:07:07.665 4344 4427 W bt_btif : bta_gattc_conn_cback() - cif=5 connected=0 conn_id=5 reason=0x0003
05-21 18:07:07.665 4344 4427 W bt_btif : bta_gattc_conn_cback() - cif=6 connected=0 conn_id=6 reason=0x0003
05-21 18:07:07.665 4344 4427 E bt_btm : btm_acl_removed:1:
05-21 18:07:07.665 4344 4427 E bt_hci : Ctlr H/w error event - code:Tigger SSR
05-21 18:07:07.665 4344 23797 E bt_hci_factory: make_reset :: Send HCI_RESET Command
05-21 18:07:07.666 4344 4377 W bt_btif : btif_dm_generic_evt: event=33038
05-21 18:07:07.666 4344 4377 E bt_btif : BTIF_DM_CB_ERROR_REPORTER : 3
Kable will be multiplatform and supersede Able, providing a more powerful yet simpler API.
JakeWharton/timber#353 may be a good reference, or https://github.com/Kotlin/binary-compatibility-validator.
Instead, we should favor nullable return types or sealed class
es.
http://www.douevencode.com/articles/2018-09/kotlin-error-handling/ summarizes it well.
Exceptions currently (develop
branch) being thrown:
core
RemoteException
ConnectionLostException
OutOfOrderGattCallbackException
GattErrorStatusException
keep-alive
NotReadyException
throw
GattStatusException
RemoteException
ConnectionLostException
Is it possible to tweak connection settings like the interval value?
I saw that normally that is done using
boolean requestConnectionPriority (int connectionPriority)
which I cannot get to work with able.
Even better would be to set the connection time intervals to specific values.
The nRF app does log
Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
when performing such connection parameter changes.
If this is possible, can you provide any code snipped on how to do that?
With #72, the KeepAliveGatt
's internal Gatt
property was changed to be configured prior to invoking the onConnectAction
.
This resolves potential crashes when attempting to invoke KeepAliveGatt
I/O methods from within the connection handler functions, but opens up potential bugs.
If a library consumer performs some critical I/O from within the onConnected
connection handler (and needs those actions to be perform before any other I/O) then allowing I/O operations on KeepAliveGatt
during the onConnected
function could cause hard to track down bugs. It would be preferred that the external I/O threw NotReady
(as that is the expected state until onConnected
handler has completed.
tl;dr Consider reverting 024fc38.
perhaps a sample code to subscribe to notifications would be handy and helpful for newbies...
i'm struggling to subscribe to onCharacteristicChanged. I have already enabled notifications on my device using the below code, however can't seem to figure out how to subscribe to notification using code.
gatt.setCharacteristicNotification(characteristicTx, true)
for (des in characteristicTx.descriptors) {
if (null != des) {
gatt.writeDescriptor(des, BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE)
}
}
I think this could be captured by a try-catch surrounding the subscription.consumeEach
call, but there is likely a cleaner solution also.
I did not authorize any of the apps or any other programs in my phone
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.