ILockInteractor

interface ILockInteractor

Interface defining operations for interacting with a lock. This includes connecting to the lock, sending commands, and handling state changes.

Inheritors

Functions

Link copied to clipboard
abstract fun clear()

Clear all resources and close active connection

Link copied to clipboard
abstract suspend fun closeLock(param: Byte = BluetoothConstants.PARAM_NONE)

Sends a CLOSE_LOCK (0x50) command to lock the lock.

Link copied to clipboard
abstract fun connect(serialNumber: String, deviceCertificate: DeviceCertificate, keepConnection: Boolean = true, secureConnectionListener: ILockConnectionListener)

Initiates a secure connection to the lock.

Link copied to clipboard
abstract fun disconnect()

Disconnect from the lock and notify the listener

Link copied to clipboard
abstract suspend fun getDeviceSettings(isLockAdded: Boolean): DeviceSettings?

Retrieves the device settings from the lock.

Link copied to clipboard
abstract suspend fun getFirmwareVersion(isLockAdded: Boolean): FirmwareVersion?

Retrieves the firmware version from the lock.

Link copied to clipboard
abstract suspend fun getLockState(): ByteArray?

Sends a GET_STATE (0x5A) command to the lock.

Link copied to clipboard
abstract suspend fun openLock(param: Byte = BluetoothConstants.PARAM_NONE)

Sends an OPEN_LOCK (0x51) command to unlock the lock.

Link copied to clipboard
abstract suspend fun pullSpring()

Sends a PULL_SPRING (0x52) command to pull the spring. The response is a Byte representing the lock's result, 00 means the command completed successfully.

Link copied to clipboard
abstract suspend fun sendCommand(message: Byte, params: ByteArray? = null): ByteArray?

Send any command to the Lock. The response is a ByteArray, structured as follows: [COMMAND_RESULT_STATUS, OTHER_INFORMATION].

Link copied to clipboard
abstract suspend fun setSignedTime(signedTime: SignedTime): ByteArray?

Sends the SET_SIGNED_TIME (0x71) command to the lock with the provided signed time. This command is crucial for ensuring that the lock's operations are synchronized with a trusted time source, enhancing the security and reliability of its operations.

Link copied to clipboard
abstract suspend fun waitForLockStatusChange(lockState: Byte, timeoutInSeconds: Long = DEFAULT_TIME_TO_WAIT_FOR_STATE)

Waits for lock state change.