BleTerminalDelegate
Protocol: BleTerminalDelegate : AnyObject
The callbacks of a BleTerminal. They all come on the main thread.
Methods
bleTerminalDidSavedKey(terminal:error:)
func bleTerminalDidSavedKey(terminal: BleTerminal, error: BleError?)
Called right after saveAuthKey(authKey:).
Parameters
terminal: BleTerminal- The terminal instanceerror: BleError?- Error if save failed, nil if successful
bleTerminalDidConnect(terminal:error:)
func bleTerminalDidConnect(terminal: BleTerminal, error: BleError?)
Called once per connect(timeout:): without an error once the terminal accepted the key and the SDK read the lock state, or gave up on reading it, or with the error that ended the attempt. Also called with ctgError(45, 23) when the terminal refuses the keep-alive the SDK sends every 7 seconds to an established connection.
Parameters
terminal: BleTerminal- The terminal instanceerror: BleError?- Error if connection failed, nil if successful
bleTerminalDidAction(terminal:action:error:)
func bleTerminalDidAction(terminal: BleTerminal, action: BleAction, error: BleError?)
Called once per sendAction(_:), with ctgError(actionCode, 22) when the terminal did not answer within the timeout passed to connect(timeout:).
Parameters
terminal: BleTerminal- The terminal instanceaction: BleAction- The action that was executederror: BleError?- Error if action failed, nil if successful. For.lockand.unlock, nil means the terminal accepted the command; readterminal.lockStatefor the state it reported afterwards.
bleTerminalDisconnected(terminal:)
func bleTerminalDisconnected(terminal: BleTerminal)
Called when a connection reported by bleTerminalDidConnect(terminal:error:) ends, including after disconnect(), and once when disconnect() cancels a connection attempt. A failed attempt reports through bleTerminalDidConnect(terminal:error:) only.
Parameters
terminal: BleTerminal- The terminal instance
bleTerminalSignalUpdate(rssi:strength:)
func bleTerminalSignalUpdate(rssi: Int, strength: BleSignalStrength)
Called every second while connected.
Parameters
rssi: Int- The RSSI value in dBmstrength: BleSignalStrength- The interpreted signal strength level
bleTerminalDidGetVehicleStats(terminal:vehicleStats:error:)
func bleTerminalDidGetVehicleStats(terminal: BleTerminal, vehicleStats: VehicleStats?, error: BleError?)
Called once per getVehicleStats(), with ctgError(33, 22) when the terminal did not answer within the timeout passed to connect(timeout:).
Parameters
terminal: BleTerminal- The terminal instancevehicleStats: VehicleStats?- The vehicle statistics if successfulerror: BleError?- Error if request failed, nil if successful
See Also
- BleTerminal - Terminal interface
- BleError - Error types
- BleAction - Available actions
- VehicleStats - Vehicle statistics model
- BleSignalStrength - Signal strength levels