EfentoBluetooth

This object is used to initialize Efento bluetooth library as well as is an entry point for all bluetooth operations.

First, use init to initialize the library. Then use scanner to create and start bluetooth scan. Finally use sensorConnection to perform command on already scanned Efento device.

Note: Attempt to use scanner or sensorConnection without running init first, will result in IllegalStateException.

Functions

Link copied to clipboard

Creates and configures a BootloaderConnection instance for Efento device. This method prepares the parameters required for establishing a connection, but does not initiate the connection itself.

Link copied to clipboard
fun gatewayConnection(deviceID: DeviceID, bluetoothMacAddress: BluetoothMacAddress, password: String = ""): GatewayConnection

Creates and configures a GatewayConnection instance for a non-legacy Efento gateway. This method prepares the parameters required for establishing a connection, but does not initiate the connection itself. Use this for gateways where the Gateway.isLegacy flag is false.

Link copied to clipboard
fun gatewayLegacyConnection(deviceID: DeviceID, bluetoothMacAddress: BluetoothMacAddress, password: String = ""): GatewayLegacyConnection

Creates and configures a GatewayConnection instance for a legacy Efento gateway. This method prepares the parameters required for establishing a connection, but does not initiate the connection itself. Use this for gateways where the Gateway.isLegacy flag is true.

Link copied to clipboard
fun init(context: ApplicationContext, logger: BluetoothLogListener? = null)

Initialize Efento bluetooth library.

Link copied to clipboard
fun scanner(allowedDevices: Set<BluetoothMacAddress> = emptySet(), legacyDevices: Set<BluetoothMacAddress> = emptySet(), encryptionKeys: Map<BluetoothMacAddress, String> = emptyMap(), defaultEncryptionKeys: Set<String> = emptySet(), updateInterval: Duration = 30.seconds): Scanner

Creates and configures a Scanner instance for Efento devices.

Link copied to clipboard
fun sensorConnection(deviceID: DeviceID, bluetoothMacAddress: BluetoothMacAddress, resetCode: Int = -1, encryptionKey: String = ""): SensorConnection

Creates and configures a SensorConnection instance for a non-legacy Efento sensor. This method prepares the parameters required for establishing a connection, but does not initiate the connection itself. Use this for sensors where the Sensor.isLegacy flag is false.

Link copied to clipboard
fun sensorLegacyConnection(deviceID: DeviceID, bluetoothMacAddress: BluetoothMacAddress, resetCode: Int = -1, encryptionKey: String = ""): SensorLegacyConnection

Creates and configures a SensorConnection instance for a legacy Efento sensor. This method prepares the parameters required for establishing a connection, but does not initiate the connection itself. Use this for sensors where the Sensor.isLegacy flag is true.