2.35.17 and Later¶
Upgraded to Xcode 14.2¶
The Mobile SDK was upgraded to be used with Xcode 14.2. Because of Swift's missing module stability, older versions of Xcode are not supported anymore.
BluetoothAddress replaced with CBPeripheralId¶
The Tapkey Bluetooth API was slightly refactored to be more aligned with the native Bluetooth API
The string property TKMBleLock#bluetoothAddress
was replaced with the UUID property TKMBleLock#peripheralId
. The TKMBleLockCommunicator#executeCommandAsync
now expects the peripheralId
instead of the bluetoothAddress
.
Migration¶
Where the bluetoothAddress
was used, it must be replaced with the peripheralId
:
Old code:
let discoveredDevice: TKMBleLock
let bluetoothAddress = discoveredDevice.bluetoothAddress
self.bleLockCommunicator.executeCommandAsync(
bluetoothAddress: bluetoothAddress,
physicalLockId: physicalLockId,
commandFunc: COMMAND_FN,
cancellationToken: ct)
.....
New code:
let discoveredDevice: TKMBleLock
let peripheralId = discoveredDevice.peripheralId
self.bleLockCommunicator.executeCommandAsync(
peripheralId: peripheralId,
physicalLockId: physicalLockId,
commandFunc: COMMAND_FN,
cancellationToken: ct)
.....
Custom Bluetooth Scanning¶
In addition to using the TKMBleScanner
class, it is now also possible to implement a custom solution for BLE scanning as well. The Tapkey Mobile SDK for iOS contains utility classes to detect and filter for Tapkey-enabled locks.
Using a custom BLE Scanner gives the application developer finer control over the scanning process and makes its details more transparent. It is therefore the recommended way of implementing BLE scanning functionality.
The SDK provides functionality that allows to obtain a list of UUID
s which can be used with the native BLE scanning functionality. Obtain the list by using the TKMBleAdvertisingFormat
class as follows:
// Retrieve the TKMBleAdvertisingFormat from the TKMServiceFactory instance
let advertisingFormat: TKMBleAdvertisingFormat = tapkeyServiceFactory.bleAdvertisingFormat
// Apply the serviceUUIDs when starting the scan for CBPeripherals
cbCentralManager.scanForPeripherals(withServices: advertisingFormat.serviceUuids)
The TKMBleAdvertisingParser
can be used to detect if the discovered Bluetooth device is a Tapkey-enabled lock and for obtaining its physicalLockId
.
// Get the TKMBleAdvertisingFormat
let advertisingFormat: TKMBleAdvertisingFormat = tapkeyServiceFactory.bleAdvertisingFormat
let advertisingParser: TKMBleAdvertisingParser = advertisingFormat.advertisingParser
// Parse the advertising data of the CBPeripheral
// If the parsed data is not nil, the discovered CBPeripheral is likely to be a Tapkey-enabled locking device.
if let data = advertisingParser.parseAdvertisingData(advertisementData: advertisementData) {
String physicalLockId = data.physicalLockId
}