TKMBleLockCommunicator

public protocol TKMBleLockCommunicator

The BLE (Bluetooth Low Energy) lock communicator provides means to communicate with Tapkey locks via BLE. It can be used to send commands to locks.

Use TKMServiceFactory to retrieve an instance of BleLockCommunicator.

  • Executes a command on the specified lock. This method takes a command function that uses the TKMCommandExecutionFacade and executes it on the Tapkey lock with the specified Bluetooth address. To ensure that the device at the specified Bluetooth address is the intended Tapkey lock, the lock’s physical lock ID can be passed and will be validated before executing the command. In case verification fails, the returned Promise will resolve to null. Verifying the lock’s ID does not impose a runtime penalty.

    Declaration

    Swift

    func executeCommandAsync<TOut>(bluetoothAddress: String, physicalLockId: String?, commandFunc: @escaping (TKMTlcpConnection) -> TKMPromise<TOut>, cancellationToken: TKMCancellationToken) -> TKMPromise<TOut>

    Parameters

    bluetoothAddress

    the Bluetooth address of the lock to execute the command on.

    physicalLockId

    an optional parameter to verify that the device at bluetoothAddress is a Tapkey lock with the given physical lock ID. Set to null if verification is not required.

    commandFunc

    the command to execute on the lock. Usually implemented using TKMCommandExecutionFacade.

    cancellationToken

    a cancellation token to be used for cancellation. The token should be forwarded to TKMCommandExecutionFacade

    Return Value

    a Promise that resolves to the command’s result, or null if a physical lock ID was passed and verification failed.