sendCommand

open suspend override fun sendCommand(message: Byte, params: ByteArray?): ByteArray?

Send any command to the Lock.

Parameters

message
  • message in Byte format ex. 0x50

params
  • list of parameters (in Byte format), there are optional ex. 0x02 as "Force unlock" parameter to "Unlock" command

Before sending the command, this function checks the state of Bluetooth and location services:

  • RxBleClient.State.BLUETOOTH_NOT_AVAILABLE: Bluetooth is unavailable on the device.

  • RxBleClient.State.LOCATION_PERMISSION_NOT_GRANTED: Required location permissions are not granted.

  • RxBleClient.State.BLUETOOTH_NOT_ENABLED: Bluetooth is not enabled.

  • RxBleClient.State.LOCATION_SERVICES_NOT_ENABLED: Location services are disabled. If any preconditions are not met, onError with BluetoothDisabled is called to handle the situation. Otherwise (i.e., RxBleClient.State.READY), lockConnectionWrapper?.sendCommand(<message>, <params>) will be called.