BleTerminal

class BleTerminal(context: Context, val terminalId: String)

Represents a terminal that interact with the bluetooth BleCentral and peripheral BlePeripheral to send commands to the CTG device.

Parameters

context
terminalId

Constructors

Link copied to clipboard
fun BleTerminal(context: Context, terminalId: String)

Functions

Link copied to clipboard

Disconnects the peripheral from the BleTerminal.

Link copied to clipboard

Retrieves the encrypted authentication key from Shared Preferences, decrypts it, and returns it.

Link copied to clipboard

Retrieves the Bluetooth Low Energy (BLE) connection state of the device.

Link copied to clipboard

Gets the current lock state of the vehicle.

Link copied to clipboard

Checks if a terminal authentication key is available for secure communication.

Link copied to clipboard

Removes the authentication key from Shared Preferences.

Link copied to clipboard

Encrypts the authentication key and saves it to Shared Preferences

Link copied to clipboard
fun scanAndConnectToPeripheral(timeout: Long = 10000)

Connects to a BleTerminal device.

Link copied to clipboard
fun sendAction(action: BleAction)

Executes a Bluetooth Low Energy (BLE) action on the connected peripheral.

Properties

Link copied to clipboard

Represents as a callback to show the result from the BleTerminal process.

Link copied to clipboard

Represents current connected terminalId