{IDO File Transfer Interface Specification}
1. Function Overview
Provides the ability to transfer single/multiple files, including firmware packages, image gallery packages, font packages, language packages, BT upgrade packages, dials, address books, AGPS, GPS, message icons, sports icons, EPO upgrade packages, notification sound files, blood pressure calibration files. Provides the ability to retrieve file transfer progress, transfer status, and current file transfer type.
2. Interface Abilities
1. Query Transfer Status:
1.1 Function Summary:
None
1.2 API ID:
bool get isTransmitting;
1.3 API Parameter Description:
@Param:isTransmitting Transferred flag, false: idle, true: transferring
2. Query Current Transferring File Type:
2.1 Function Summary:
None
2.2 API ID:
FileTransType? get transFileType;
2.3 API Parameter Description:
@Param:transFileType File type
////TODO
3. Listen to the Currently Uploading File Type:
3.1 Function Summary:
Callback for file start transferring, completion, and failure.
3.2 API ID:
StreamSubscription listenTransFileTypeChanged(void Function(FileTransType? fileType) func);
3.3 API Parameter Description:
@Param:fileType The file type currently being uploaded, null means no file being uploaded.
////TODO
4. Transfer Single File:
4.1 Function Summary:
Provides the ability to transfer files, retrieve file transfer status, progress, error codes, and cancel the transfer of a single file.
4.2 API ID:
Stream<bool> transferSingle(
{required BaseFileModel fileItem,
required CallbackFileTransStatusSingle funcStatus,
required CallbackFileTransProgressSingle funcProgress,
CallbackFileTransErrorCode? funError,
bool cancelPrevTranTask});
4.3 API Parameter Description:
4.3.1 @Param:fileItem File configuration information, including:
class BaseFileModel{
final FileTransType fileType; /// File type
final String filePath; /// File absolute path
final String fileName; /// File name
int? fileSize; /// File size
int? originalFileSize; /// Original file size (before compression), only used for dials temporarily
}
4.3.2 @Param:funcStatus Transfer status, including:
typedef CallbackFileTransStatusSingle = void Function(FileTransStatus status);
enum FileTransStatus {
none = 0,
invalid = 1, /// Invalid type
notExists = 2, /// File does not exist
busy = 3, /// Transfer task in progress
config = 4, /// Configuration
beforeOpt = 5, /// Pre-transfer operation
trans = 6, /// Transferring
finished = 7, /// Transfer completed
onFastSynchronizing = 8, /// Fast configuration in progress, file transfer not supported
error = 9, /// Transfer failed
}
4.3.3 @Param:funcProgress Transfer progress.
4.3.4 @Param:funError Transfer error codes, including:
typedef CallbackFileTransErrorCode = void Function(
int index, int errorCode, int errorCodeFromDevice, int finishingTime);
@Param:index Current index of the file being transferred.
@Param:errorCode Error code returned by the C library.
@Param:errorCodeFromDevice Error code returned by the firmware. When errorCode is 24 or 25, errorCodeFromDevice equals errorCode.
@Param:finishingTime Estimated time for firmware to finish organizing, only returned when errorCode is 24 or 25, otherwise 0.
4.3.5 @Param:cancelPrevTranTask Cancel existing upload task. Default is false.
5. Transfer Multiple Files:
5.1 Function Summary:
Provides the ability to transfer multiple files, retrieve file transfer status, progress, error codes, and cancel the transfer of a single file.
5.2 API ID:
Stream<List<bool>> transferMultiple(
{required List<BaseFileModel> fileItems,
required CallbackFileTransStatusMultiple funcStatus,
required CallbackFileTransProgressMultiple funcProgress,
CallbackFileTransErrorCode? funError,
bool cancelPrevTranTask});
5.3 API Parameter Description:
5.3.1 @Param:fileItem File configuration information, including:
class BaseFileModel{
final FileTransType fileType; /// File type
final String filePath; /// File absolute path
final String fileName; /// File name
int? fileSize; /// File size
int? originalFileSize; /// Original file size (before compression), only used for dials temporarily
}
5.3.2 @Param:funcStatus Transfer status, including:
typedef CallbackFileTransStatusMultiple = void Function(int index, FileTransStatus status);
enum FileTransStatus {
none = 0,
invalid = 1, /// Invalid type
notExists = 2, /// File does not exist
busy = 3, /// Transfer task in progress
config = 4, /// Configuration
beforeOpt = 5, /// Pre-transfer operation
trans = 6, /// Transferring
finished = 7, /// Transfer completed
onFastSynchronizing = 8, /// Fast configuration in progress, file transfer not supported
error = 9, /// Transfer failed
}
5.3.3 @Param:funcProgress Transfer progress, including:
typedef CallbackFileTransProgressMultiple = void Function(int currentIndex,
int totalCount, double currentProgress, double totalProgress);
@Param:currentIndex Current index of the file being transferred (0 ~ totalCount-1).
@Param:totalCount Total number of files to be transferred (>= 1).
@Param:currentProgress Current progress of the current file being transferred (0.0 ~ 1.0).
@Param:totalProgress Overall progress (0.0 ~ 1.0).
5.3.4 @Param:funError Transfer error codes, including:
typedef CallbackFileTransErrorCode = void Function(
int index, int errorCode, int errorCodeFromDevice, int finishingTime);
@Param:index Current index of the file being transferred.
@Param:errorCode Error code returned by the C library.
@Param:errorCodeFromDevice Error code returned by the firmware. When errorCode is 24 or 25, errorCodeFromDevice equals errorCode.
@Param:finishingTime Estimated time for firmware to finish organizing, only returned when errorCode is 24 or 25, otherwise 0.