Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replication commit. 03/06 #78

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions platform/android/goldengate/RxFitbitGatt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))
Expand All @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion platform/android/goldengate/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ CMAKE_VERSION = 3.10.2
SDK_VERSIONS_GRADLE = ../sdk_versions.gradle

# Library versions
KOTLIN_VERSION = 1.4.31
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
Expand Down
Loading