2.28.0 and Later¶
Locking/Unlocking API changes¶
The behavior of TKMDefaultTriggerLockCommand
has changed. It used to let the locking device choose, which trigger lock action to take, but now always executes the lock's default action. The former behavior is available through the new TKMAutoTriggerLockCommand
and TKMAutoTriggerLockCommandBuilder
, which behave equally to the old and new version of TKMDefaultTriggerLockCommand
when used with locking devices implementing protocol version 0x3E or earlier. However, when used with newer locking devices, the TKMAutoTriggerLockCommand
lets the lock choose which action to take while the TKMDefaultTriggerLockCommand
requests the lock to execute its default action type.
In order to properly deal with differences between different versions of locking devices, the use of the new TKMCompatTriggerLockCommandBuilder
is encouraged instead of using TKMAutoTriggerLockCommand
or TKMDefaultTriggerLockCommand
.
The following table outlines the differences between the three:
Lock's Protocol Version | DefaultTriggerLockCommandB. | AutoTriggerLockCommandB. | CompatTriggerLockCommandB. |
---|---|---|---|
< 0x3E (locks only support the default command) | Default command | Default command | Default command |
0x3E | Default command | Default command | Builder chooses based on the user's permission |
>= 0x3F | Default command | Lock chooses based on the user's permissions | Lock chooses based on the user's |
Where no custom properties need to be passed, it's encouraged to use TKMCommandExecutionFacade.triggerLockAsync()
instead of TKMCommandExecutionFacade.executeStandardCommandAsync()
.
Migration¶
Search your code for TKMDefaultTriggerLockCommandBuilder
and replace it with TKMCompatTriggerLockCommandBuilder
. If no special features of TKMCompatTriggerLockCommandBuilder
are used, consider using TKMCommandExecutionFacade.triggerLockAsync
instead of TKMCommandExecutionFacade.executeStandardCommandAsync()
.
return bleLockCommunicator.executeCommandAsync(
bluetoothAddress: bluetoothAddress,
physicalLockId: physicalLockId,
commandFunc: { tlcConnection -> TKMPromise<TKMCommandResult> in
// MIGRATION START
// Replace:
//
// let triggerLockCommand = new TKMDefaultTriggerLockCommandBuilder()
// .build();
//
// return commandExecutionFacade.executeStandardCommandAsync(
// tlcpConnection,
// command: triggerLockCommand,
// cancellationToken: ct);
//
// with:
return commandExecutionFacade.triggerLockAsync(
tlcpConnection,
cancellationToken: ct);
// MIGRATION END
},
cancellationToken: ct)
Simplified KeyManager¶
The interface of the TKMKeyManager
was simplified. The asynchronous method queryLocalKeysAsync(String, TKMCancellationToken)
was replaced with a synchronous method getLocalKeys(String)
.
Migration¶
Replace TKMKeyManager#queryLocalKeysAsync(String, CancellationToken)
with TKMKeyManager#getLocalKeys(String)
.
// Replace:
//self.keyManager.queryLocalKeysAsync(userId: userId, cancellationToken: cancellationToken)
// .continueOnUI { (keys: [TKMKeyDetails]) in
// // display data
// ....
// return nil
// }
// with:
let keys: [TKMKeyDetails] = keyManager.getLocalKeys(userId: userId);
Streamlined representation of lock ID¶
Except for TKMBleLock
, everywhere the Base64-encoded representation of the TLCP lock ID is used. For consistency reasons, the Base64-encoded TLCP lock ID was added to the BleLock
as well and the Data
representation was marked as deprecated. APIs accepting Data
as lock ID were marked as deprecated in favor of the Base64-encoded lock ID.
Migration¶
Replace the usage of TKMBleLock#lockId
with TKMBleLock.physicalLockId()
// Replace:
// let lockId: Data = bleLock.lockId
// let isNearby: Bool = bleLockScanner.isLockNearby(physicalLockId: lockId)
// let isNearby: Bool = bleLockScanner.isLockNearby(physicalLockId: lockId, rssi: rssi)
// let lock: TKMBleLock = bleLockScanner.getLock(physicalLockId: lockId)
// let locks: [TKMBleLock] = bleLockScanner.getLocks(physicalLockId: lockId)
// bleLockCommunicator.executeCommandAsync(
// bluetoothAddress: bluetoothAddress, physicalLockId: String(data: lockId, encoding: .utf8), commandFunc: tlcpConnection -> { ...
let lockId: String = bleLock.physicalLockId
let isNearby: Bool = bleLockScanner.isLockNearby(physicalLockId: lockId)
let isNearby: Bool = bleLockScanner.isLockNearby(physicalLockId: lockId, rssi: rssi)
let lock: TKMBleLock = bleLockScanner.getLock(physicalLockId: lockId)
let locks: [TKMBleLock] = bleLockScanner.getLocks(physicalLockId: lockId)
bleLockCommunicator.executeCommandAsync(
bluetoothAddress: bluetoothAddress, physicalLockId: lockId, commandFunc: tlcpConnection -> { ...