RxFitbitGatt / com.fitbit.bluetooth.fbgatt.rx.client / BitGattPeer

BitGattPeer

class BitGattPeer

Interface representing a BLE peer (remote) device and operations that can be carried on it.

Constructors

<init>

BitGattPeer(gattConnection: GattConnection, clientTransactionProvider: ClientTransactionProvider = ClientTransactionProvider())

Interface representing a BLE peer (remote) device and operations that can be carried on it.

Properties

fitbitDevice

val fitbitDevice: FitbitBluetoothDevice

Gets the fitbitDevice associated with the peer This assumes we are connected to the peer.

gattConnection

val gattConnection: GattConnection

isConnected

val isConnected: Boolean

Whether or not the GattConnection is connected

services

val services: List<BluetoothGattService>?

Gets the list of all services on the peer. Prior to this service discovery needs to be performed. This assumes we are connected to the peer.

Functions

connect

fun connect(): Single<BluetoothGatt>

Establishes a BLE connection with a peer device. Returns a BluetoothGatt object.

discoverServices

fun discoverServices(): Single<List<BluetoothGattService>>

Performs service discovery on the peer This assumes we are connected to the peer.

getService

fun getService(uuid: UUID): Maybe<BluetoothGattService>

Gets the service matching a specific UUID. Prior to this service discovery needs to be performed. This assumes we are connected to the peer.

readDescriptor

fun readDescriptor(descriptor: BluetoothGattDescriptor): Single<BluetoothGattDescriptor>

Reads the descriptor of a characteristic This assumes we are connected to the peer.

requestConnectionPriority

fun requestConnectionPriority(priority: Int): Single<Boolean>

Requests connection priority as described in the BluetoothGatt object. This assumes we are connected to the peer.

requestMtu

fun requestMtu(mtu: Int): Single<Int>

Requests an MTU This assumes we are connected to the peer.

setupNotifications

fun setupNotifications(characteristic: BluetoothGattCharacteristic, subscribe: Boolean, isIndication: Boolean = false): Single<BluetoothGattCharacteristic>

Combined operation to set up notifications on a characteristic (enables notifications + writes to descriptor This assumes we are connected to the peer.