TKMBleLockScanner
public protocol TKMBleLockScanner
The BLE (Bluetooth Low Energy) lock scanner provides means to scan for Tapkey locks via BLE. It can be used to scan for nearby locks and to determine whether a specific lock is nearby.
Use TKMServiceFactory
to retrieve an instance of BleLockScanner.
-
Returns an Observable of a list of nearby locks along with their Bluetooth address. The observable will fire every time a new lock is discovered or a lock disappeared.
The observable returns a Map of BleLocks with their Bluetooth addresses as keys. The Bluetooth address is a 48-bit identifier represented as a String of 6 bytes in hexadecimal separated by colons. For example,
00:11:22:AA:BB:CC
Declaration
Swift
var observable: TKMObservable<[String : TKMBleLock]> { get }
-
Returns a map of nearby locks along with their Bluetooth address. The Bluetooth address is a 48-bit identifier represented as a String of 6 bytes in hexadecimal separated by colons. For example,
00:11:22:AA:BB:CC
. The lock is returned as an object ofTKMBleLock
.See also
TKMBleLock
Declaration
Swift
var locks: [String : TKMBleLock] { get }
-
Starts scanning for nearby Tapkey locks. Results can be retrieved using
TKMBleLockScanner.locks
andTKMBleLockScanner.observable
.Declaration
Swift
func startForegroundScan() -> TKMObserverRegistration
Return Value
an observer registration that can be used to stop scanning.
-
Returns the BLE lock representation of the lock with the specified lock ID.
The physicalLockID parameter takes a base64-encoded representation of the lock’s physical lock ID.
Declaration
Swift
func getLock(physicalLockId: String) -> TKMBleLock?
Parameters
physicalLockId
the lock’s physical lock ID.
Return Value
the BleLock for the given physicalLockId or null, if the lock is not nearby.
-
Returns the BLE lock representation of the lock with the specified lock ID.
The physicalLockID parameter takes the lock ID in Data representation.
Declaration
Swift
func getLock(physicalLockId: Data) -> TKMBleLock?
Parameters
physicalLockId
the lock’s physical lock ID.
Return Value
the BleLock for the given physicalLockId or null, if the lock is not nearby.
-
Returns whether the Tapkey lock with the specified physical lock ID is nearby.
The physicalLockID parameter takes a base64-encoded representation of the lock’s physical lock ID.
Declaration
Swift
func isLockNearby(physicalLockId: String) -> Bool
Parameters
physicalLockId
the lock’s physical lock ID.
Return Value
true if the lock with the specified ID is nearby, false if not.
-
Same as
TKMBleLockScanner.isLockNearby(physicalLockId:)
, but with configurable RSSI threshold. If the specified lock is discovered with an RSSI below rssiThreshold, it will not be reported as nearby. This method can be used to filter out locks with weak signal strength.Declaration
Swift
func isLockNearby(physicalLockId: String, rssiThreshold: Int32) -> Bool
Parameters
physicalLockId
the lock’s physical lock ID.
rssiThreshold
the RSSI threshold for discovered locks in dBm to be reported as nearby. The valid range is [-127, 126].
Return Value
true if the lock with the specified ID is nearby, false if not.
-
Returns whether the Tapkey lock with the specified physical lock ID is nearby.
The physicalLockID parameter takes a base64-encoded representation of the lock’s physical lock ID.
Declaration
Swift
func isLockNearby(physicalLockId: Data) -> Bool
Parameters
physicalLockId
the lock’s physical lock ID. TODO format
Return Value
true if the lock with the specified ID is nearby, false if not.
-
Same as
TKMBleLockScanner.isLockNearby(physicalLockId:)
, but with configurable RSSI threshold. If the specified lock is discovered with an RSSI below rssiThreshold, it will not be reported as nearby. This method can be used to filter out locks with weak signal strength.Declaration
Swift
func isLockNearby(physicalLockId: Data, rssiThreshold: Int32) -> Bool
Parameters
physicalLockId
the lock’s physical lock ID.
rssiThreshold
the RSSI threshold for discovered locks in dBm to be reported as nearby. The valid range is [-127, 126].
Return Value
true if the lock with the specified ID is nearby, false if not.