Package com.tomtom.ivi.sdk.communications.blecommon

This library contains common components used by the server and client side Bluetooth Low Energy connectivity implementation.

Types

Link copied to clipboard
class BleConnectivityProtocolDefinitions

Definitions for the BLE connectivity protocol.

Link copied to clipboard
class BluetoothAvailabilityHelper(coroutineScope: CoroutineScope, stateUpdateCallback: (bluetoothAvailable: Boolean) -> Unit)

Helper for getting the state of the bluetooth adapter availability.

Link copied to clipboard
data class CharacteristicId(val value: UUID)

Uniquely identifies a characteristic.

Link copied to clipboard
data class DescriptorId(val value: UUID)

Uniquely identifies a descriptor.

Link copied to clipboard
interface DeviceConnectionId : ServiceConnectionId

Uniquely identifies a connection to a device.

Link copied to clipboard
data class DeviceId(val address: String) : DeviceConnectionId

Uniquely identifies a device.

Link copied to clipboard
class ExclusiveCallbackHelper<T>(coroutineScope: CoroutineScope, mutex: Mutex)

Helper for a re-occurring pattern where we need to suspend to wait for a result of an asynchronous call and during this wait no other call is allowed to be made.

Link copied to clipboard
class Packet(    val payload: ByteArray,     var sequenceNumber: UShort,     var acknowledgeSequenceNumber: UShort? = null,     var expirationTime: Instant = Instant.now())

Represents a data packet that carries the specified payload. It has the specified sequenceNumber and optionally acknowledges the specified acknowledgeSequenceNumber to the remote peer. The specified expirationTime indicates when the packet is due for (re)transmission.

Link copied to clipboard
class ReliableDataTransferProtocolHandler(    var maximumTransferUnitSizeInBytes: Int = BleConnectivityProtocolDefinitions.defaultMaximumTransferUnitSizeInBytes,     windowSizeInNumberOfPackets: Int = 8,     coroutineScope: CoroutineScope = MainScope())

Implements a reliable data transfer protocol based on automatic repeat requests (ARQ).

Link copied to clipboard
class ReliableWindowBuffer(    coroutineScope: CoroutineScope,     windowSize: Int = 16,     resendTimeout: Duration = 10.toDuration(DurationUnit.SECONDS),     initialSequenceNumber: UShort = 0.toUShort())

This implements an asynchronous transfer window buffer with automatic repeat request (ARQ) semantics.

Link copied to clipboard
data class SessionId(val data: ByteArray)

Represents a session ID.

Functions

Link copied to clipboard
fun UUID.toCharacteristicId(): CharacteristicId

Create a characteristic ID from a UUID.

Link copied to clipboard
fun UUID.toDescriptorId(): DescriptorId

Creates a descriptor ID from a UUID.

Link copied to clipboard
fun String.toDeviceId(): DeviceId

Creates a device ID from a String.

Link copied to clipboard
fun ByteArray.toSessionId(): SessionId