LockConnectionManager

Lock connection manager. Manages connection with Tedee lock. To establish successful connection with lock you need to provide serial number, device certificate and mobile public key.

Constructors

Link copied to clipboard
constructor(context: Context)

Create empty Lock bluetooth server

Properties

Link copied to clipboard

Provider for signed date-time, used in securing lock interactions. This property should be set to an instance of an ISignedTimeProvider implementation. If this property is not set, NotProvidedSignedTime error will be return.

Functions

Link copied to clipboard
open override fun clear()

Clear all resources and close active connection

Link copied to clipboard
open suspend override fun closeLock(param: Byte)

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

Link copied to clipboard
open override fun connect(serialNumber: String, deviceCertificate: DeviceCertificate, keepConnection: Boolean, secureConnectionListener: ILockConnectionListener)

Initiates a secure connection to the lock.

Link copied to clipboard
open override fun disconnect()

Disconnect from the lock and notify the listener

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

Retrieves the device settings from the lock.

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

Retrieves the firmware version from the lock.

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

Sends a GET_STATE (0x5A) command to the lock. The response is a ByteArray representing the lock's status, structured as follows: [COMMAND, COMMAND_RESULT_STATUS, ACTUAL_LOCK_STATE, LOCK_STATUS].

Link copied to clipboard
open suspend override fun openLock(param: Byte)

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

Link copied to clipboard
open suspend override fun pullSpring()

Sends a PULL_SPRING (0x52) command to pull the spring Before sending the command, this function checks the state of Bluetooth and location services:

Link copied to clipboard
open suspend override fun sendCommand(message: Byte, params: ByteArray?): ByteArray?

Send any command to the Lock.

Link copied to clipboard
open suspend override 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
open suspend override fun waitForLockStatusChange(lockState: Byte, timeoutInSeconds: Long)

Waits for lock state change.