ProxyDevice

class ProxyDevice(var peripheral: BluetoothDevice, var deviceId: UInt, var proxyTaskQueue: TaskQueue = TaskQueue(), var internalCache: BridgeCache = BridgeCache(), val taskExecutor: DeviceTaskExecutor = DeviceTaskExecutor(), var batteryStatusLow: Boolean = false, cachedDevicePayloadChunks: MutableList<ByteArray> = mutableListOf(), var lastSuccessfulOOBTimestamp: Long? = null, var lastDiscoveryTime: Instant? = null, var isBlacklisted: Boolean = false, var inInstallMode: Boolean = false, var inDFUMode: Boolean = false, var lastHeartbeatSentTime: Long? = null, var lastHeartbeatAdvData: ByteArray? = null, var lastRssi: Int? = null)

Represents a BLE Device and its associated properties and operations.

Constructors

Link copied to clipboard
constructor(peripheral: BluetoothDevice, deviceId: UInt, proxyTaskQueue: TaskQueue = TaskQueue(), internalCache: BridgeCache = BridgeCache(), taskExecutor: DeviceTaskExecutor = DeviceTaskExecutor(), batteryStatusLow: Boolean = false, cachedDevicePayloadChunks: MutableList<ByteArray> = mutableListOf(), lastSuccessfulOOBTimestamp: Long? = null, lastDiscoveryTime: Instant? = null, isBlacklisted: Boolean = false, inInstallMode: Boolean = false, inDFUMode: Boolean = false, lastHeartbeatSentTime: Long? = null, lastHeartbeatAdvData: ByteArray? = null, lastRssi: Int? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var lastDiscoveryTime: Instant?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Latest RSSI from BLE advertisements; appended to heartbeats sent to the server.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
Link copied to clipboard

Adds an event to the device's task queue

Link copied to clipboard

Returns proxy operation type for a given blueLink operation type.

Link copied to clipboard
fun clearAcceptedPayloads(currentDSC: Int, currentSSC: Int)

Clears accepted payloads from the map based on their type:

Link copied to clipboard
Link copied to clipboard

Removes all events of specific operation types

Link copied to clipboard

Deletes a specific event from the task queue.

Link copied to clipboard
Link copied to clipboard

Helper function to fetch the corresponding event from the proxy queue

Link copied to clipboard
fun getQueueEvents(operation: DeviceOperation? = null, state: TaskElementState? = null): List<TaskElement>

Fetches events from the task queue based on their state and operation type.

Link copied to clipboard

Increments a payload count. If the payload isn't yet tracked, it logs a warning and returns 0 (this is an error) If already tracked, increments the count.

Link copied to clipboard
fun trackPayload(payload: ByteArray, isAck: Boolean = false, dsc: Int? = null, psc: Int = 0)

Tracks a payload count. If the payload isn't yet tracked, adds it at 0 (does NOT increment it), else does nothing.