Releases: Beepiz/BleGattCoroutines
0.5.0
Version 0.5.0 (2022-02-25)
Updates
BleGattCoroutines was using Deprecated kotlinx.coroutines APIs.
Since this release, it is no longer the case, the library moved to shared flows to replace BroadcastChannel
usages.
Deprecations
The APIs that were returning a ReceiveChannel
have been deprecated in favor of new APIs that return a Flow
instead.
We added ReplaceWith
clauses, so Android Studio can do the replacements for you.
Fixes
Previously, if you were using the openNotificationSubscription
and the device got disconnected before the channel gets closed, the app would crash when the channel is closed.
The openNotificationSubscription
has been deprecated, delegating to its replacement, notifications
, which will no longer crash the app in an unrecoverable way, throwing against the Flow
collector instead, so that you can catch it if disconnection happens.
See the issue #58 for details.
BleGattCoroutines v0.4.1
Version 0.4.0 publication was broken because gradle metadata was not enabled, and any
usage would lead to gradle sync and gradle build fails on consumer projects.
This has now been fixed. Sorry for the inconvenience.
BleGattCoroutines v0.4.0
Publication of this version is broken, use 0.4.1 or newer instead.
Compiled with Kotlin 1.3.31 (and kotlinx.coroutines 1.2.1).
This is an important release for BleGattCoroutines that includes fixes, improvements & new features.
Fixes
- Fix rare hard to track uncaught exceptions caused by
offer
called on closed channels. (744e862) - Automatically request disconnect on close by default. Avoids issue where connection is not stopped by close on Android's side and prevents subsequent connections.
New features
- Add a public
bluetoothDevice
property to theGattConnection
interface, thanks to Brian Parma contribution. - Add
requestMtu
function onGattConnection
, thanks to Bill Cauchois contribution. - Add first-class notifications enabling on remote device with
setCharacteristicNotificationsEnabledOnRemoteDevice
. This was the most requested feature. - Add
openNotificationSubscription
function to receive notifications only for a specific characteristic. This can replace usage of thenotifyChannel
property.
Changes
- The
notifyChannel
property now returns a new subscription each time, so it is possible to have multiple consumers. - Exceptions to catch are now mentioned in
GattConnection
KDoc. (b85c9be) - Add workaround for
Dispatchers.Main
initialization doing blocking I/O (8783db9). - Drop main thread usage requirement. You can now use the dispatcher you want.
- Samples and
@RequiresApi
annotations migrated to AndroidX. - Samples now properly request runtime permissions, with a single suspending function call thanks to Splitties permissions.
- Minor doc improvements.
BleGattCoroutines v0.3.0
Kotlin 1.3
This release is compiled with Kotlin 1.3.10 (and kotlinx.coroutines 1.0.1), which
means it is now using stable coroutines. The Splitties
artifacts have also been updated to version 2.0.0.
Changes
- Now uses stable coroutines.
- All the package names changed, dropping
experimental
from the hierarchy. - The API is still experimental, and is annotated accordingly.
BleGattCoroutines v0.2.0
This release is compiled with Kotlin 1.2.71 and relies on the version 0.30.2
of kotlinx.coroutines.
It also relies on three Splitties
artifacts (App Context, Main Thread & Checked Lazy) of the version 2.0.0-alpha06.
Changes
GattConnection
is now an interface (was previously a class). You can still instantiate it
with constructor-like syntax.- Instead of suspending any pending request when a disconnection has occured, a
ConnectionClosedException
will be thrown. Note that it is a subclass ofCancellationException
,
so it will cancel the coroutine without crashing your application, but you should still handle it
properly, especially if you want to retry or recover. - You can pass
ConnectionSettings
when creating aGattConnection
instance. With this, you can
change transport, physical layer (aka. PHY) and enable auto connect. requireXxx
extension functions forGattConnection
,BluetoothGattService
and
BluetoothGattCharacteristic
thanks to @Miha-x64 contribution.
BleGattCoroutines v0.1.0
This is the first release of BleGattCoroutines.
Said otherwise, this was the start of the Make Gatt Great Again! campaign.
This version targets experimental coroutines from Kotlin 1.2.30 and
relies on the version 0.22.5 of kotlinx.coroutines.
Its target Android SDK is API level 27.