Bridge Delegate
IDOBridgeDelegate
is used to bridge the Bluetooth library and protocol library to implement Bluetooth data and status transmission
Methods
listenStatusNotification(status:)
Listening status notification ( SDK)
- Parameters:
- status: IDOStatusNotification
listenDeviceNotification(model:)
Listen to device active notification/control events (device)
- Parameters:
- model: IDODeviceNotificationModel Device notification entity
checkDeviceBindState(macAddress:)
Query binding status by device Mac address (provided by the App). true: bound; false: not bound. Called when the device connects over Bluetooth; returning true runs the bound-device quick configuration (function table, device info, firmware version, watch time, etc.).
Cross-phone encrypted auth: on phone B, call setEncryptedAuthData first, persist the device as bound locally, then connect so this method returns true for that Mac (see IDOBindDevice).
- Parameters:
- macAddress: The Mac address of the currently connected device
listenWaitingOtaDevice(otaDevice: IDOOtaDeviceModel)
Listen to the devices in the scanned list that are in ota mode. The business end needs to execute ota
- Parameters:
- otaDevice: ota device information
Proxy implementation
Swift:
// Implement proxy
extension SomeClass: IDOBridgeDelegate {
// Listen to SDK status notification
func listenStatusNotification(status: IDOStatusNotification) {
print("StatusNotification: \(status)")
NotificationCenter.default.post(name: "onSdkStatusChanged", object: status)
}
// Listen for device active notification/control events
func listenDeviceNotification(model: IDODeviceNotificationModel) {
print("DeviceNotification: \(model)")
NotificationCenter.default.post(name: "onSdkDeviceStateChanged", object : model)
}
// App provides bind state; return true for bound-device quick configuration.
// Cross-phone auth: setEncryptedAuthData first and persist local bound, then connect.
func checkDeviceBindState(macAddress: String) -> Bool {
let isBinded = UserDefaults.standard.isBind(macAddress)
print("checkDeviceBindState mac\(macAddress) isBinded:\(isBinded)")
return isBinded
}
}
Kotlin:
class BleData : IDOBridgeDelegate {
// Listen to SDK status notification
override fun listenStatusNotification(status: IDOStatusNotification) {
println("listenStatusNotification $status") ;
}
// Listen for device active notification/control events
override fun listenDeviceNotification(status: IDODeviceNotificationModel) {
println("listenDeviceNotification $status");
}
// App provides bind state; return true for bound-device quick configuration.
// Cross-phone auth: setEncryptedAuthData first and persist local bound, then connect.
override fun checkDeviceBindState(macAddress: String): Boolean {
return bindState( )
}
}