{IDO Standardized Flutter Interface Specification}

Flutter API:

1. Send Basic Events

1.1 Function Overview:

An app can use this interface to send specified events to the device, including setting instructions, getting instructions, notifying instructions, controlling instructions, etc., to achieve basic interaction between the app and the device.

1.2 API ID:

Stream<CmdResponse> send({required CmdEvtType evt, String? json = '{}'});

1.3 API Parameter Description:

@Param:evt Basic event number

@Param:json Content of the basic event item in JSON string format

For information on event numbers and corresponding event item content, refer to => IDO Basic Event Field Description

2. Bluetooth Response Data Entry

2.1 Function Overview:

The Bluetooth library parses the received byte data through this interface, and then returns the results as a JSON string format to the app through the registered function callback.

2.2 API ID:

void receiveDataFromBle(Uint8List data, String? macAddress, int type);

2.3 API Parameter Description:

@Param:data Byte data

@Param:macAddress Device MAC address

@Param:type Channel type, 0: BLE 1: SPP

3. Initialize C Library

3.1 Function Overview:

Initialize the C library, including creating timers for the C library, registering parsing functions, creating sending queues, etc., and call it when creating instances.

3.2 API ID:

Future<bool> initClib();

3.3 API Parameter Description:

None

4. Set C Library Log Mode

4.1 Function Overview:

Set the log level of the C library. DEBUG is the debugging mode, and RELEASE is the online version with optimized log output.

4.2 API ID:

void setClibRunMode({required bool isDebug});

4.3 API Parameter Description:

@Param:isDebug Log mode, true: debugging mode, false: release version

4.Registration protocol library(new)

4.1 Function Overview:

Register the protocol library, built-in initialization C library, complete the timer creation of the C library, the registration of the parsing function, and the creation of the send queue. Need to register before using libManager.

4.2 API ID:

static Future<bool> register({
  bool outputToConsole = false,
  bool outputToConsoleClib = false,
  bool isReleaseClib = true}

4.3 API Parameter Description:

@Param:outputToConsole log printed to console

@Param:outputToConsoleClib C library log is printed to the console

@Param:isReleaseClib c library running mode (release only prints important logs)

5. Register Bluetooth Data Sending Function

5.1 Function Overview:

After the app calls the basic event sending interface send(evt,json), the C library will report the converted byte data through the registered Bluetooth sending function.

5.2 API ID:

void registerWriteDataToBle(void Function(CmdRequest data) func);

5.3 API Parameter Description:

@Param:func Bluetooth sending function

6. Bluetooth Data Sending Complete

6.1 Function Overview:

Called when the C library completes the Bluetooth data sending through the Bluetooth sending function.

6.2 API ID:

void writeDataComplete();

6.3 API Parameter Description:

None

7. Mark Device as Connected (called when Bluetooth is connected)

7.1 Function Overview:

Mark the device as connected when connection is established.

7.2 API ID:

Future<bool> markConnectedDeviceSafe({required String uniqueId,required IDOOtaType otaType,required bool isBinded,String? deviceName = ''});

7.3 API Parameter Description:

@Param:uniqueId (Android: MAC address of the connected device), iOS: (MAC address or UUID of the connected device)

@Param:otaMode Set OTA mode

@Param:isBinded Binding status

@Param:deviceName Device name

8. Mark Device as Disconnected (called when Bluetooth is disconnected)

8.1 Function Overview:

Mark the device as disconnected when disconnected.

8.2 API ID:

Future<bool> markDisconnectedDevice({String? macAddress, String? uuid});

8.3 API Parameter Description:

@Param:macAddress MAC address of the disconnected device

@Param:uuid

9. Clear all pending tasks

9.1 Function Overview:

Clear all executed tasks.

9.2 API ID:

void dispose();

9.3 API Parameter Description:

None

11. File Transfer Tool Entry

11.1 Function Overview:

Provides the ability to transfer files.

11.2 API ID:

IDOFileTransfer get transFile;

11.3 API Parameter Description:

Refer to file transfer tool interface description => IDO File Transfer Interface Description

12. Query if the connection is established

12.1 Function Overview:

Used internally by the SDK.

12.2 API ID:

bool get isConnected;

12.3 API Parameter Description:

@Param:isConnected Connection flag, false: not connected, true: connected////TODO

13. Query if in the process of connecting

13.1 Function Overview:

Changing devices will be restricted, and it is not possible to switch devices while connecting.

13.2 API ID:

bool get isConnecting;

13.3 API Parameter Description:

@Param:isConnecting Connecting flag, false: not in the process of connecting, true: connecting.

14. Query if in the process of binding

14.1 Function Overview:

Changing devices will be restricted, and it is not possible to switch devices while binding.

14.2 API ID:

bool get isBinding;

14.3 API Parameter Description:

@Param:isBinding Binding flag, false: not in the process of binding, true: binding.

15. Query if it is in fast configuration mode

15.1 Function Overview:

During fast configuration, external commands will directly return failure.

15.2 API ID:

bool get isFastSynchronizing;

15.3 API Parameter Description:

@Param: isFastSynchronizing Flag for fast configuration, false: not in fast configuration mode, true: in fast configuration mode.

16. Query OTA type

16.1 Function Overview:

None

16.2 API ID:

IDOOtaType get otaType;

16.3 API Parameter Description:

@Param: otaType OTA status, including:

enum IDOOtaType {
  none   = 0,      /// No upgrade
  telink = 1,      /// Telink device OTA
  nordic = 2,      /// Nordic device OTA
}

17. Query the MAC address of the connected device

17.1 Function Overview:

None

17.2 API ID:

String get macAddress;

17.3 API Parameter Description:

@Param: macAddress MAC address of the current device, string. When it is not marked as connected, it will always return "UNKNOWN"

18. Function table entry

18.1 Function Overview:

Provides the ability to query, refresh, and clear the function table.

18.2 API ID:

IDOFunctionTable get funTable;

18.3 API Parameter Description:

Jump to the function table interface description => IDO Function Table Interface Description

19. Data synchronization entry

19.1 Function Overview:

Provides the ability to query data synchronization status, start data synchronization, and end data synchronization.

19.2 API ID:

IDOSyncData get syncData;

19.3 API Parameter Description:

Jump to the data synchronization interface description => IDO Data Synchronization Interface Description

20. Device information entry

20.1 Function Overview:

Provides the ability to externally synchronize and obtain device information.

20.2 API ID:

IDODeviceInfo get deviceInfo;

20.3 API Parameter Description:

Jump to the device information interface description => IDO Device Information Interface Description

21. Device binding entry

21.1 Function Overview:

Provides the ability to query binding status, initiate binding and unbinding, and listen to binding mode.

21.2 API ID:

IDODeviceBind get deviceBind;

21.3 API Parameter Description:

Jump to the device binding interface description => IDO Device Binding Interface Description

22. Message icon entry

22.1 Function Overview:

Provides the ability to set country code, cache server address, APP Key, language member interface, and query and update icon status, APP package name, get & delete local sandbox cache, and send application icon.

22.2 API ID:

IDOMessageIcon get messageIcon;

22.3 API Parameter Description:

Jump to the message icon interface description => IDO Message Icon Interface Description

23. Data exchange entry

23.1 Function Overview:

Provides the ability to initiate data exchanges, listen for BLE device replies, and BLE device initiated data exchanges.

23.2 API ID:

IDOExchangeData get exchangeData;

23.3 API Parameter Description:

Jump to the data exchange interface description => IDO Data Exchange Interface Description

24. Device log entry

24.1 Function Overview:

Provides the ability to query if it supports obtaining firmware logs, query the log directory address, start and cancel getting logs.

24.2 API ID:

IDODeviceLog get deviceLog;

24.3 API Parameter Description:

Jump to the device log interface description => IDO Device Log Interface Description

25. Other tools interface

25.1 Function Overview:

Provides the ability to query if it supports obtaining firmware logs, query the log directory address, start and cancel getting logs.////TODO

25.2 API ID:

IDOTool get tools;

25.3 API Parameter Description:

Jump to the tool interface description => IDO Tool Interface Description

26. Call notice & message entry

26.1 Function Overview:

Provides the ability to notify the device of incoming calls and messages (v2).

26.2 API ID:

IDOCallNotice get callNotice;

26.3 API Parameter Description:

Jump to the call notice and message notice interface description => IDO Call Notice and Message Notice Interface Description

27. Protocol library cache entry

27.1 Function Overview:

Provides the ability to query log, alexa, device cache root directory, export log, load device function table, and connect to device list information.

27.2 API ID:

IDOCache get cache;

27.3 API Parameter Description:

Jump to the protocol library cache interface description => IDO Protocol Library Cache Interface Description

28. Initialize Log

28.1 Overview:

Provides the ability to set log print, file writing permission, and log level.

28.2 API ID:

static Future<bool> initLog(
      {bool outputToConsole = true}) async {
    return _IDOProtocolLibManager.initLog(
        writeToFile: true,
        outputToConsole: outputToConsole,
        logLevel: LoggerLevel.verbose);
  }

28.3 API Parameter:

@param: outputToConsole bool, whether to print to the console, true: print, false: do not print.

29. Listen to Protocol Library Status Notifications

29.1 Overview:

Provides the ability to listen to status notifications and monitor protocol library status.

29.2 API ID:

StreamSubscription listenStatusNotification(
      void Function(IDOStatusNotification status) func);

29.3 API Parameter:

@return: Callback status, including:

enum IDOStatusNotification {

  protocolConnectCompleted            = 0, /// Protocol library completed Bluetooth library bridging, and the cached data is initialized at this time
  functionTableUpdateCompleted        = 1, /// Function table retrieval completed
  deviceInfoUpdateCompleted           = 2, /// Device information retrieval completed
  deviceInfoFwVersionCompleted        = 3, /// Trip version retrieval completed
  unbindOnAuthCodeError               = 4, /// Binding authorization code exception, device forced unbinding
  unbindOnBindStateError              = 5, /// Binding state exception, unbinding is required (triggered when the local binding state is inconsistent with the device information)
  fastSyncCompleted                   = 6, /// Fast configuration completed
  fastSyncFailed                      = 7, /// Fast configuration failed, the business layer needs to trigger fast configuration again
  deviceInfoBtAddressUpdateCompleted  = 8, /// BT MacAddress retrieval completed
  macAddressError                     = 9, /// This error is reported when the macAddress obtained from fast configuration is inconsistent with MarkConnectedDevice
  syncHealthDataIng                   = 10,/// Synchronizing health data
  syncHealthDataCompleted             = 11 /// Synchronization of health data completed
}

30. Listen to Device Notifications/Control Events

30.1 Overview:

Provides the ability to listen to notifications, control events, quick messages, and firmware error codes of watches/wristbands.

30.2 API ID:

StreamSubscription listenDeviceNotification(
      void Function(IDODeviceNotificationModel model) func);

30.3 API Parameter:

@return: IDODeviceNotificationModel go to Device Notification/Control Event Documentation => IDODevice Notification/Control Event Model Instructions

31. Check Alexa Login Status

31.1 Overview:

N/A.

31.2 API ID:

bool get isLogin;

31.3 API Parameter:

@return: Login status flag, bool type, false: not logged in, true: logged in.

32. Check Alexa Current Language

32.1 Overview:

N/A.

32.2 API ID:

AlexaLanguageType get currentLanguage;

32.3 API Parameter:

@return: Return the current country and language of Alexa, including:

enum AlexaLanguageType {
  german('de-DE')         = 0,    /// German
  australia('en-AU')      = 1,    /// English Australia
  canadaEn('en-CA')       = 2,    /// English Canada
  unitedKingdom('en-GB')  = 3,    /// English United Kingdom
  india('en-IN')          = 4,    /// English India
  usa('en-US')            = 5,    /// English USA
  spainEs('es-ES')        = 6,    /// Spanish Spain
  mexico('es-MX')         = 7,    /// Spanish Mexico
  spainUs('es-US')        = 8,    /// Spanish USA
  frenchCanada('fr-CA')   = 9,    /// French Canada
  frenchFrench('fr-FR')   = 10,   /// French France
  hindiIndia('hi-IN')     = 11,   /// Hindi India
  italianItaly('it-IT')   = 12,   /// Italian
  japan('ja-JP')          = 13,   /// Japanese
  portugal('pt-BR')       = 14;   /// Portuguese
}

33. Specify Alexa Delegate ////TODO

33.1 Overview:

Provides the ability to specify an Alexa delegate.////TODO Function and purpose to be supplemented

33.2 API ID:

set delegate(IDOAlexaDelegate delegate)

33.3 API Parameter:

////TODO

34. Register Alexa

34.1 Overview:

Provides the ability to register Alexa and initialize Alexa log permissions.

34.2 API ID:

static Future<void> registerAlexa(
      {required String clientId,
      bool outputToConsole = true}) async {
    await _IDOProtocolAlexa.initLog(
        outputToConsole: outputToConsole);
    await _IDOProtocolAlexa.registerAlexa(clientId: clientId);
  }

34.3 API Parameter:

@param: clientId ID generated by Alexa backend.

@param: outputToConsole bool, whether to print Alexa logs to the console, true: print, false: do not print.

35. Switch Alexa Language

35.1 Overview:

Provides the ability to notify the Alexa server to switch the current language.

35.2 API ID:

static Future<bool> changeLanguage(AlexaLanguageType type)

35.3 API Parameter:

@param: type Language type to be set, including:

enum AlexaLanguageType {
  german('de-DE')         = 0,    /// German
  australia('en-AU')      = 1,    /// English Australia
  canadaEn('en-CA')       = 2,    /// English Canada
  unitedKingdom('en-GB')  = 3,    /// English United Kingdom
  india('en-IN')          = 4,    /// English India
  usa('en-US')            = 5,    /// English USA
  spainEs('es-ES')        = 6,    /// Spanish Spain
  mexico('es-MX')         = 7,    /// Spanish Mexico
  spainUs('es-US')        = 8,    /// Spanish USA
  frenchCanada('fr-CA')   = 9,    /// French Canada
  frenchFrench('fr-FR')   = 10,   /// French France
  hindiIndia('hi-IN')     = 11,   /// Hindi India
  italianItaly('it-IT')   = 12,   /// Italian
  japan('ja-JP')          = 13,   /// Japanese
  portugal('pt-BR')       = 14;   /// Portuguese
}

36. Alexa CBL Authorization

36.1 Overview:

N/A.

36.2 API ID:

Future<LoginResponse> authorizeRequest(
      {required String productId, required CallbackPairCode func});

36.3 API Parameter:

@param: productId Product ID registered with Alexa backend.

@param: func Callback function, callback the URL and User Code required for Alexa authentication.

@return: LoginResponse, including:

enum LoginResponse {
  successful = 0, /// Success
  failed     = 1, /// Failed
  timeout    = 2, /// Timeout
}

37.Stop Alexa Login

37.1 Summary:

Provides the ability to end the current login operation.

37.2 API ID:

void stopLogin();

37.3 API Parameter Description:

None.

38.Logout Alexa

38.1 Summary:

None.

38.2 API ID:

void logout();

38.3 API Parameter Description:

None.

39.Register Listen Alexa Login State

39.1 Summary:

Provides the ability to register and listen for the login state of Alexa.

39.2 API ID:

StreamSubscription listenLoginStateChanged(
      void Function(LoginState state) func);

39.3 API Parameter Description:

@return: Callback login state, including:

enum LoginState {
  logging   = 0,  /// Logging in
  logined   = 1,  /// Logged in
  logout    = 2,  /// Not logged in
}

40.Register Listen Alexa Voice State

40.1 Summary:

Provides the ability to register and listen for the voice state of the wristband/watch.

40.2 API ID:

StreamSubscription listenVoiceStateChanged(
      void Function(VoiceState state) func);

40.3 API Parameter Description:

@return: Callback voice state, including:

enum VoiceState {
  none      = 0,  /// No state
  ready     = 1,  /// Ready
  starting  = 2,  /// Starting
  finished  = 3,  /// Finished
}
Copyright © 2023-2024 IDO. All rights reserved. all right reserved,powered by GitbookModify Date: 2025-04-30 09:32:44

results matching ""

    No results matching ""