{IDO Device Binding Interface Description}
1. Function Overview
Provides the ability to check binding status, initiate binding and unbinding, and listen for binding mode.
2. Interface Capability
1. Check Binding Status:
1.1 Function Summary:
None
1.2 API ID:
Future<bool> get isBinded;
1.3 API Parameter Description:
@return: isBinded - Binding status flag, bool type, false: not bound, true: bound.
2. Check if Currently in Binding Mode:
2.1 Function Summary:
In binding mode, switching devices will be restricted.
2.2 API ID:
bool get isBinding;
2.3 API Parameter Description:
@return: isBinding - Flag indicating whether in binding mode, bool type, false: not in binding mode, true: in binding mode.
3. Initiate Binding:
3.1 Function Summary:
Initiates the binding process. After successful binding, the device information and function table information of the device are returned via a callback. ////TODO
3.2 API ID:
/// Initiate binding
/// osVersion: System version (take the major version number)
/// userId: User ID, maximum 14 bytes (more than 14 bytes will extract the last 14 bytes)
/// encryptedAuthData: Encrypted authorization data callback (triggered only on supported devices, ignore if not switching phones)
Stream<BindStatus> startBind(
{required int osVersion,
required BindValueCallback<IDODeviceInfo> deviceInfo,
required BindValueCallback<IDOFunctionTable> functionTable,
String? userId,
BindValueCallback<IDOEncryptedAuthData>? encryptedAuthData});
3.3 API Parameter Description:
@param: osVersion - System version, take the major version number.
@param: deviceInfo - Callback for device information after binding is initiated.
@param: functionTable - Callback for function table information of the device after binding is initiated.
@param: userId - User ID, maximum 14 bytes (more than 14 bytes will extract the last 14 bytes).
@param: encryptedAuthData - Encrypted authorization data callback (triggered only on supported devices, see IDOEncryptedAuthData Model Description).
4. Initiate Unbinding:
4.1 Function Summary:
Initiates the unbinding process for the specified MAC address. The device can be forcefully unbound.
4.2 API ID:
Future<bool> unbind({required String macAddress, bool isForceRemove = false});
4.3 API Parameter Description:
@param: macAddress - MAC address.
@param: isForceRemove - Whether to forcefully unbind the device, even if the device does not respond. Set to true to forcefully unbind and remove the device. Default is false.
5. Initiate Authorization Code Binding:
5.1 Function Summary:
None
5.2 API ID:
Stream<bool> setAuthCode(String code, int osVersion);
5.3 API Parameter Description:
@param: code - Pairing code.
@param: osVersion - System version (take the major version number).
6. Set Encrypted Authorization Data:
6.1 Function Summary:
Valid only for supported devices. Note: Needs to be executed before calling libManager.markConnectedDeviceSafe(...), and isBinded=true is required for it to be effective.
6.2 API ID:
Future<bool> setEncryptedAuthData(String macAddress, IDOEncryptedAuthData data);
6.3 API Parameter Description:
@param: macAddress - MAC address.
@param: data - Encrypted authorization data, see IDOEncryptedAuthData Model Description.
7. Register Update Mode Monitoring Callback:
7.1 Function Summary:
Registers a callback method for monitoring the current update mode. ////TODO
7.2 API ID:
StreamSubscription listenUpdateSetModeNotification(
void Function(int mode) func);
7.3 API Parameter Description:
@param: func - Callback method. The mode includes: 0 None Binding, 1 Already Binding, 2 Firmware Upgrade Mode, 3 Reconnection, 4 Realtek
8. IDOEncryptedAuthData Model Description:
8.1 Function Summary:
Encrypted authorization data model, used to synchronize encrypted authorization data during the binding process or before connection.
8.2 Model Definition:
class IDOEncryptedAuthData {
/// Auth data (12 bytes)
final List<int> authData;
/// Encryption version (0: legacy, 0x10: new)
final int encryptedVersion;
/// Auth data length
final int authLength;
}
8.3 Field Description:
- authData:
List<int>type, contents of authorization data, fixed at 12 bytes. - encryptedVersion:
inttype, encryption version.0for the old version,0x10for the new version. - authLength:
inttype, length of the authorization data content (usually 12).