From f6a076f96b29098d28fa5b53030187772bef79f8 Mon Sep 17 00:00:00 2001 From: amolch Date: Thu, 7 Dec 2023 10:14:04 -0500 Subject: [PATCH 1/2] Replication commit. 03/06 --- .../goldengate/RxFitbitGatt/build.gradle | 1 + .../rx/server/GattCharacteristicNotifier.kt | 29 ++++++++++--------- platform/android/goldengate/gradle.properties | 1 + 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/platform/android/goldengate/RxFitbitGatt/build.gradle b/platform/android/goldengate/RxFitbitGatt/build.gradle index c3677e35..2ab79169 100644 --- a/platform/android/goldengate/RxFitbitGatt/build.gradle +++ b/platform/android/goldengate/RxFitbitGatt/build.gradle @@ -25,6 +25,7 @@ dependencies { implementation "com.github.fitbit:bitgatt:$BITGATT_COMMIT_VERSION" implementation "org.jetbrains.kotlin:kotlin-stdlib:$KOTLIN_VERSION" implementation "androidx.appcompat:appcompat:$ANDROIDX_APPCOMPAT_VERSION" + implementation "androidx.annotation:annotation:$ANDROIDX_ANNOTATION_VERSION" implementation "com.jakewharton.timber:timber:$TIMBER_VERSION" implementation "io.reactivex.rxjava2:rxjava:$RXJAVA_VERSION" implementation "io.reactivex.rxjava2:rxandroid:$RXANDROID_VERSION" diff --git a/platform/android/goldengate/RxFitbitGatt/src/main/java/com/fitbit/bluetooth/fbgatt/rx/server/GattCharacteristicNotifier.kt b/platform/android/goldengate/RxFitbitGatt/src/main/java/com/fitbit/bluetooth/fbgatt/rx/server/GattCharacteristicNotifier.kt index 94288ffc..b78fc7dd 100644 --- a/platform/android/goldengate/RxFitbitGatt/src/main/java/com/fitbit/bluetooth/fbgatt/rx/server/GattCharacteristicNotifier.kt +++ b/platform/android/goldengate/RxFitbitGatt/src/main/java/com/fitbit/bluetooth/fbgatt/rx/server/GattCharacteristicNotifier.kt @@ -5,6 +5,7 @@ package com.fitbit.bluetooth.fbgatt.rx.server import android.bluetooth.BluetoothDevice import android.bluetooth.BluetoothGattCharacteristic +import androidx.annotation.OpenForTesting import com.fitbit.bluetooth.fbgatt.FitbitBluetoothDevice import com.fitbit.bluetooth.fbgatt.FitbitGatt import com.fitbit.bluetooth.fbgatt.GattServerConnection @@ -28,15 +29,16 @@ import timber.log.Timber /** * Notify GATT Characteristic change */ -class GattCharacteristicNotifier constructor( - private val fitbitDevice: FitbitBluetoothDevice, - private val bitgatt: FitbitGatt = FitbitGatt.getInstance(), - private val getGattServerServices: (serverConnection: GattServerConnection) -> GetGattServerServices = { serverConnection -> - GetGattServerServices(serverConnection) - }, - private val notifyTransactionProvider: NotifyGattServerCharacteristicTransactionProvider = NotifyGattServerCharacteristicTransactionProvider(), - private val scheduler: Scheduler = GattCharacteristicNotifierProvider.scheduler, - private val notifierLock: Semaphore = GattCharacteristicNotifierLock.lock +@OpenForTesting +open class GattCharacteristicNotifier constructor( + private val fitbitDevice: FitbitBluetoothDevice, + private val bitgatt: FitbitGatt = FitbitGatt.getInstance(), + private val getGattServerServices: (serverConnection: GattServerConnection) -> GetGattServerServices = { serverConnection -> + GetGattServerServices(serverConnection) + }, + private val notifyTransactionProvider: NotifyGattServerCharacteristicTransactionProvider = NotifyGattServerCharacteristicTransactionProvider(), + private val scheduler: Scheduler = GattCharacteristicNotifierProvider.scheduler, + private val notifierLock: Semaphore = GattCharacteristicNotifierLock.lock ) { constructor(device: BluetoothDevice) : this(FitbitBluetoothDevice(device)) @@ -52,10 +54,11 @@ class GattCharacteristicNotifier constructor( * @throws [GattServiceNotFoundException] if GATT service was not found * @throws [GattCharacteristicException] if GATT Characteristic is not found */ - fun notify( - serviceId: UUID, - characteristicId: UUID, - data: ByteArray + @OpenForTesting + open fun notify( + serviceId: UUID, + characteristicId: UUID, + data: ByteArray ): Completable { return bitgatt.server?.let { serverConnection -> notify(serverConnection, serviceId, characteristicId, data) diff --git a/platform/android/goldengate/gradle.properties b/platform/android/goldengate/gradle.properties index 13760bba..6100f44a 100644 --- a/platform/android/goldengate/gradle.properties +++ b/platform/android/goldengate/gradle.properties @@ -28,6 +28,7 @@ SDK_VERSIONS_GRADLE = ../sdk_versions.gradle # Library versions KOTLIN_VERSION = 1.4.31 +ANDROIDX_ANNOTATION_VERSION = 1.7.0 ANDROIDX_APPCOMPAT_VERSION = 1.2.0 ANDROIDX_LEGACY_SUPPORT_V4_VERSION = 1.0.0 ANDROIDX_RECYCLEVIEW_VERSION = 1.2.0 From c0ceefd2733402da00cbdd0e60b547961f04d752 Mon Sep 17 00:00:00 2001 From: axelmolch Date: Thu, 7 Dec 2023 10:55:47 -0500 Subject: [PATCH 2/2] Kotlin version change --- platform/android/goldengate/gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/android/goldengate/gradle.properties b/platform/android/goldengate/gradle.properties index 6100f44a..3b348216 100644 --- a/platform/android/goldengate/gradle.properties +++ b/platform/android/goldengate/gradle.properties @@ -27,8 +27,8 @@ CMAKE_VERSION = 3.10.2 SDK_VERSIONS_GRADLE = ../sdk_versions.gradle # Library versions -KOTLIN_VERSION = 1.4.31 -ANDROIDX_ANNOTATION_VERSION = 1.7.0 +KOTLIN_VERSION = 1.8.0 +ANDROIDX_ANNOTATION_VERSION = 1.6.0 ANDROIDX_APPCOMPAT_VERSION = 1.2.0 ANDROIDX_LEGACY_SUPPORT_V4_VERSION = 1.0.0 ANDROIDX_RECYCLEVIEW_VERSION = 1.2.0