IDO Protocol Library Cache Interface Description
1. Functionality Overview
Provides the capability to query logs, Alexa, device cache root directory, export logs, load device function tables, and retrieve information about connected devices.
2. Interface Capabilities
1. Get Log Root Path:
1.1 Functionality:
None.
1.2 API ID:
Future<String> logPath() async {
final pathSDK = await LocalStorage.pathSDKStatic();
return Future.value('$pathSDK/logs');
}
1.3 API Parameter Description:
@return: Log root path as a string.
2. Get Alexa Root Path:
2.1 Functionality:
None.
2.2 API ID:
Future<String> alexaPath() async {
final pathSDK = await LocalStorage.pathSDKStatic();
return Future.value('$pathSDK/alexa');
}
2.3 API Parameter Description:
@return: Alexa root path as a string.
3. Get Alexa Test Path:
3.1 Functionality:
None.
3.2 API ID:
Future<String> alexaTestPath() async {
final dirDocument = await getApplicationDocumentsDirectory();
return Future.value('${dirDocument.path}/alexa_test_pkg');
}
3.3 API Parameter Description:
@return: Alexa test path as a string.
4. Get Current Device Cache Root Path:
4.1 Functionality:
None.
4.2 API ID:
Future<String?> currentDevicePath() async {
return storage?.pathRoot();
}
4.3 API Parameter Description:
@return: Current device cache root path as a string.
5. Export Logs:
5.1 Functionality:
None.
5.2 API ID:
Future<String?> exportLog() async {
final pathSDK = await LocalStorage.pathSDKStatic();
return await compute(_doZip, pathSDK);
}
5.3 API Parameter Description:
@return: Absolute path to the compressed log zip file, as a string.
6. Load specified device function table:
6.1 Functionality:
None.
6.2 API ID:
Future<FunctionTableModel?> loadFuncTable(
{required String macAddress}) async {
final macAddr = macAddress.replaceAll(':', '').toUpperCase();
return storage?.loadFunctionTableWith(macAddress: macAddr);
}
6.3 API Parameter Description:
@param: macAddress (String) - MAC address of the device.
@return: Returns a JSON-formatted string if successful, otherwise returns null.
7. Load specified device function table: ////TODO
7.1 Functionality:
None.
7.2 API ID:
Future<FunctionTableModel?> loadFuncTable(
{required String macAddress}) async {
final macAddr = macAddress.replaceAll(':', '').toUpperCase();
return storage?.loadFunctionTableWith(macAddress: macAddr);
}
7.3 API Parameter Description:
@param: macAddress (String) - MAC address of the device.
@return: Returns a JSON-formatted string if successful, otherwise returns null. ////TODO
8. Load specified device function table: ////TODO
8.1 Functionality:
None.
8.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);
}
8.3 API Parameter Description:
@param: macAddress (String) - MAC address of the device.
@return: .
9. Load specified device function table: ////TODO
9.1 Functionality:
None.
9.2 API ID:
Future<String?> loadFuncTableJsonByDisk(
{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 jsonEncode(ft.toJson());
}
9.3 API Parameter Description:
@param: macAddress (String) - MAC address of the device.
@return: .
10. Load specified device binding status: ////TODO
10.1 Functionality:
None.
10.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);
}
10.3 API Parameter Description:
@param: macAddress (String) - MAC address of the device.
@return: The binding status of the specified MAC address. It returns a boolean value, true - bound, false - not bound.
11. Query information of the last connected device: ////TODO
11.1 Functionality:
Provides the capability to query information about the last connected device, including OTA mode, device name, UUID (iOS), BT/MAC address, and last update time.
11.2 API ID:
Future<DeviceInfoExtModel?> lastConnectDevice() async {
final list = await storage?.loadDeviceExtListByDisk();
return Future(() => list?.first);
}
11.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();
}
12. Get list of connected devices: ////TODO
12.1 Functionality:
Provides the capability to retrieve a list of connected devices, including OTA mode, device name, UUID (iOS), BT/MAC address, and last update time.
12.2 API ID:
Future<List<DeviceInfoExtModel>?> loadDeviceExtListByDisk(
{bool sortDesc = true}) async {
return storage?.loadDeviceExtListByDisk(sortDesc: sortDesc);
}
12.3 API Parameter Description:
@return: List of 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();
}