7. Smooth GPS Data Set:

7.1 Function Overview:

This API takes in multiple sets of GPS coordinates and provides the ability to smooth the GPS data set.

7.2 API ID:

String gpsSmoothData({required String json})

7.3 API Parameter Description:

@param: json GPS coordinate data in JSON format. The JSON should contain the following keys:

lat: an array of latitude values with length 'len' and data type 'double'
lon: an array of longitude values with length 'len' and data type 'double'
len: the number of latitude and longitude pairs in the arrays

@return: Returns a JSON formatted string with the smoothed GPS coordinate data. The JSON contains the following keys:

lat: an array of latitude values with length 'len' and data type 'double'
lon: an array of longitude values with length 'len' and data type 'double'
len: the number of latitude and longitude pairs in the arrays

8. Get Log Root Path:

8.1 Function Overview:

No functionality description provided.

8.2 API ID:

Future<String> logPath() async {
  final pathSDK = await LocalStorage.pathSDKStatic();
  return Future.value('$pathSDK/logs');
}

8.3 API Parameter Description:

@return: Returns the root path of the log directory as a string.

9. Get Alexa Root Path:

9.1 Function Overview:

No functionality description provided.

9.2 API ID:

Future<String> alexaPath() async {
  final pathSDK = await LocalStorage.pathSDKStatic();
  return Future.value('$pathSDK/alexa');
}

9.3 API Parameter Description:

@return: Returns the root path of the Alexa directory as a string.

10. Get Alexa Test Path:

10.1 Function Overview:

No functionality description provided.

10.2 API ID:

Future<String> alexaTestPath() async {
  final dirDocument = await getApplicationDocumentsDirectory();
  return Future.value('${dirDocument.path}/alexa_test_pkg');
}

10.3 API Parameter Description:

@return: Returns the path of the Alexa test directory as a string.

11. Get Current Device Cache Path:

11.1 Function Overview:

No functionality description provided.

11.2 API ID:

Future<String?> currentDevicePath() async {
  return storage?.pathRoot();
}

11.3 API Parameter Description:

@return: Returns the root path of the current device's cache directory as a string.

12. Export Logs:

12.1 Function Overview:

No functionality description provided.

12.2 API ID:

Future<String?> exportLog() async {
  final pathSDK = await LocalStorage.pathSDKStatic();
  return await compute(_doZip, pathSDK);
}

12.3 API Parameter Description:

@return: Returns the absolute path of the compressed log zip file as a string.

13. Load Specific Device Function Table:

13.1 Function Overview:

No functionality description provided.

13.2 API ID:

Future<FunctionTableModel?> loadFuncTable(
      {required String macAddress}) async {
    final macAddr = macAddress.replaceAll(':', '').toUpperCase();
    return storage?.loadFunctionTableWith(macAddress: macAddr);
  }

13.3 API Parameter Description:

@param: macAddress - The MAC address of the device as a string.

@return: Returns a JSON formatted string if successful, or null if unsuccessful.

14. Load Specific Device Function Table: ////TODO

14.1 Function Overview:

No functionality description provided.

14.2 API ID:

Future<FunctionTableModel?> loadFuncTable(
      {required String macAddress}) async {
    final macAddr = macAddress.replaceAll(':', '').toUpperCase();
    return storage?.loadFunctionTableWith(macAddress: macAddr);
  }

14.3 API Parameter Description:

@param: macAddress - The MAC address of the device as a string.

@return: Returns a JSON formatted string if successful, or null if unsuccessful. ////TODO

15. Load Specific Device Function Table: ////TODO

15.1 Function Overview:

No functionality description provided.

15.2 API ID:

Future<BaseFunctionTable?> loadFuncTableByDisk(
  {required String macAddress}) async {
  final macAddr = macAddress.replaceAll(':', '').toUpperCase();
  final ft = await storage?.loadFunctionTableWith(macAddress: macAddr);
  logger?.d('loadFuncTableByDisk rs:$ft');
  if (ft == null) return null;
  return BaseFunctionTable()..initFunTableModel(ft);
}

15.3 API Parameter Description:

@param: macAddress - The MAC address of the device as a string.

@return: .

Translate the Chinese characters in the text to English, do not modify the other structures.

16. Load specified device binding status: ////TODO

16.1 Function Overview:

None.

16.2 API ID:

Future<bool> loadBindStatus({required String macAddress}) async {
    final macAddr = macAddress.replaceAll(':', '').toUpperCase();
    final rs = await storage?.loadBindStatus(macAddress: macAddr);
    return Future(() => rs ?? false);
  }

16.3 API Parameter Description:

@param: macAddress - Device MAC address, string.

@return: Binding status corresponding to the input MAC address, bool type, true: bound, false: unbound.

17. Query information of the last connected device: ////TODO

17.1 Function Overview:

Provides the ability to query information of the last connected device, including OTA mode, device name, UUID (IOS), BT/MAC address, and last update time.

17.2 API ID:

Future<DeviceInfoExtModel?> lastConnectDevice() async {
    final list = await storage?.loadDeviceExtListByDisk();
    return Future(() => list?.first);
  }

17.3 API Parameter Description:

@return: Information of the last connected device, including: ////TODO

final String macAddress;  // MAC address
String? macAddressFull;   // ?
bool otaMode = false;     // OTA mode?
String uuid;              // UUID (IOS)
String deviceName;        // Device name
int updateTime;           // Last update time in milliseconds
String? macAddressBt;     // BT address

String formatTime(int millisecondsSince) {
  return DateTime.fromMicrosecondsSinceEpoch(millisecondsSince).toString();
}

18. Query the list of connected devices: ////TODO

18.1 Function Overview:

Provides the ability to query the list of connected devices, including OTA mode, device name, UUID (IOS), BT/MAC address, and last update time.

18.2 API ID:

Future<List<DeviceInfoExtModel>?> loadDeviceExtListByDisk(
      {bool sortDesc = true}) async {
    return storage?.loadDeviceExtListByDisk(sortDesc: sortDesc);
  }

18.3 API Parameter Description:

@return: Device information list of the connected devices. Each device information in the list includes: ////TODO

final String macAddress;  // MAC address
String? macAddressFull;   // ?
bool otaMode = false;     // OTA mode?
String uuid;              // UUID (IOS)
String deviceName;        // Device name
int updateTime;           // Last update time in milliseconds
String? macAddressBt;     // BT address

String formatTime(int millisecondsSince) {
  return DateTime.fromMicrosecondsSinceEpoch(millisecondsSince).toString();
}
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 ""