Skip to main content

MicroFtpUtil

class MicroFtpUtil

Description: Device file processing tools provide upload, download, delete, query functions

method uploadMissionFile

public static void uploadMissionFile(File file, FileTransmissionListener<String> listener)

Description: Upload mission files

Input parameters: file: local file to be uploaded listener: listening interface

Output parameters: None。

Related parameters: FileTransmissionListener。

method uploadNoFlyZoneFile

public static void uploadNoFlyZoneFile(File file, FileTypeEnum fileType, FileTransmissionListener<String> listener)

Description: upload no fly zone file

Input parameters:

file: no-fly zone file fileType: file type (must be related to the no-fly zone) listener: upload callback

Output parameters: None。

Related parameters: FileTransmissionListener。

method uploadOTAFile

public static void uploadOTAFile(File file, String desPath, FileTypeEnum fileType, FileTransmitListener<String> listener)

Description: Uploading OTA file to drone

Input parameters: file: file path desPath: destination path fileType: file type listener: callback listener for upload file

Output parameters: None。

Related parameters: FileTransmissionListener。

method queryPostProgressWithRetry

private static synchronized void queryPostProgressWithRetry(File file, String desPath, FileTypeEnum fileType,
FileTransmitListener<String> listener,
OkHttpClient client, Headers headers,
int retryCount)

Description: Upload OTA file with progress

Input parameters: file: file path fileType: file type listener: call back listener for file upload client: client ok http object headers: headers defined retryCount: retry counting

Output parameters: None。

Related parameters: FileTransmissionListener。

method uploadWithProgress

private synchronized static void uploadWithProgress(File file,
FileTypeEnum fileType,
FileTransmitListener<String> listener,
OkHttpClient client,
Headers headers,
int progress)

Description: Upload OTA file with progress

Input parameters: file: file path fileType: file type listener: call back listener for file upload client: client ok http object headers: headers defined progress: progress for upload file

Output parameters: None。

Related parameters: FileTransmitListener。

method cancelOTAUpload

public static void cancelOTAUpload()

Description: Cancel upload OTA file

Input parameters: None。

Output parameters: None。

Related parameters: None。

method uploadFile

public static void uploadFile(File file, String desPath, FileTypeEnum fileType, FileTransmissionListener<String> listener)

Description: Upload file

Input parameters: file: local file to be uploaded desPath: file upload path starts with / fileType: file type FileConstants class has instructions listener: listening interface

Output parameters: None。

Related parameters: FileTransmissionListener。

method uploadFileByToken

public static void uploadFileByToken(File file, String serial_number,String token,String uploadUrl, FileTransmissionListener<String> listener)

Description: Upload OTA file with progress

Input parameters: file: file path serial_number: file type token: token uploadUrl: upload url listener: call back listener for file upload

Output parameters: None。

Related parameters: FileTransmissionListener。

method getAutelStatusCodeByResult

public static AutelStatusCode getAutelStatusCodeByResult(int code)

Description: Status for OTA file result

Input parameters: code: passing code for uploading file

Output parameters: Status code getting

Related parameters: None。

method downloadFile

public static void downloadFile(String sourcePath, String desPath, FileTransmissionListener<File> listener)

Description: File Download

Input parameters: sourcePath: The path of the file to be downloaded on the plane desPath: The file path to download to the local listener: listener for transmission

Output parameters: None。

Related parameters: FileTransmissionListener。

method downloadAbsoluteAutFile

public static void downloadAbsoluteAutFile(String sourcePath, String desPath, FileTransmissionListener<File> listener)

Description: File Download

Input parameters: sourcePath: The path of the file to be downloaded on the plane desPath: The file path to download to the local listener: listener

Output parameters: None。

Related parameters: FileTransmissionListener。

method queryPostProgress

public static void queryPostProgress(File file, String desPath, ResponseCallBack<String> callBack)

Description: Query the progress of file upload

Input parameters: desPath: The file path to download to the local callBack: ResponseCallBack

Output parameters: None。

Related parameters: ResponseCallBack。

method downloadAutFile

public static void downloadAutFile(String sourcePath, String desPath, FileTransmissionListener<File> listener)

Description: File Download

Input parameters: sourcePath: The path of the file to be downloaded on the plane desPath: The file path to download to the local listener: listener

Output parameters: None。

Related parameters: FileTransmissionListener。

method downloadAutFileResumable

public static S3DownloadInterceptor downloadAutFileResumable(String sourcePath, String desPath, FileTransmitListener<File> listener)

Description: Download OTA file with resumable

Input parameters: sourcePath: source path desPath: destination path listener: lisntener for file transition

Output parameters: return interceptor object

Related parameters: FileTransmitListener。

method queryFolder

public static void queryFolder(String path, FolderQueryListener listener)

Description: Folder query

Input parameters: path: the path of the query listener: listener object

Output parameters: None。

Related parameters: FolderQueryListener。

method deleteFile

public static void deleteFile(String path, DeleteFileListener listener)

Description: File or folder deletion

Input parameters: path: the path of the file or folder to delete listener: interface callback

Output parameters: None。

Related parameters: DeleteFileListener。

method getMediaFileList

public static void getMediaFileList(MediaTypeEnum type, StorageTypeEnum storageType, String albumName, int offset,
int count, OrderTypeEnum order, CommonCallbacks.CompletionCallbackWithParam<AlbumResultBean> callback)

Description: Get the list of album files

Input parameters: type: file type, 0-all files, 1-video files, 2-photo files storageType: storage type, 0-SD card, 1-onboard flash memory albumName: folder name, can not pass or pass empty, if not, it means to query the entire album file list offset: file offset count: the number of file queries, the maximum value is 500 order: sorting type, 0 for order, 1 for reverse order callback: callback of completion

Output parameters: None。

Related parameters: CompletionCallbackWithParam。

method getMediaFolderList

public static void getMediaFolderList(StorageTypeEnum storageType, OrderTypeEnum order,
CommonCallbacks.CompletionCallbackWithParam<AlbumFolderResultBean> callback)

Description: Get the list of album folders

Input parameters: storageType: storage type, 0-SD card, 1-onboard flash memory<BR order: sorting type, 0 for order, 1 for reverse order callback: callback for completion

Output parameters: None。

Related parameters: CompletionCallbackWithParam。

method healthCheck

public static void healthCheck(CommonCallbacks.CompletionCallbackWithParam<String> callback)

Description: Health check provides the fastest access mechanism to verify whether MicroFTP is running normally; at the same time, because MicroFtp can be deployed on all nodes, it can also be used to detect the network reachability of each node

Input parameters: callback: callback for completion status

Output parameters: None。

Related parameters: CompletionCallbackWithParam。

method deleteMediaFile

public static void deleteMediaFile(int indexId, DeleteFileListener listener)

Description: File or folder deletion

Input parameters: indexId: File or Package ID listener: interface callback

Output parameters: None。

Related parameters: DeleteFileListener。

method downloadMediaFile

public static BaseRequest downloadMediaFile(String sourcePath, String desPath, FileTransmissionListener<File> listener)

Description: File Download

Input parameters: sourcePath: The path of the file to be downloaded on the plane desPath: The file path to download to the local listener: listener

Output parameters: None。

Related parameters: FileTransmissionListener。

method getCameraAbilityFilePath

public static String getCameraAbilityFilePath(String fileName)

Description: camera ability file path as string

Input parameters: fileName: file name

Output parameters: return file path

Related parameters: None。

method isNeedDownloadAbilityFile

public static Boolean isNeedDownloadAbilityFile(String model, String versionInfo)

Description: Do you need to download the capability set file

Input parameters: model: camera model versionInfo: A string of concatenated version information and download address

Output parameters: true needs to download, false does not need to download

Related parameters: None。

method getDroneFilePath

public static String getDroneFilePath(String fileName)

Description: Getting drone file path

Input parameters: fileName: file name od drone

Output parameters: file path as string

Related parameters: None。

method getAppFilePath

public static String getAppFilePath(String fileName)

Description: App file path getting with filename

Input parameters: fileName: filename

Output parameters: Application file path as string

Related parameters: None。

method deleteFile

public static void deleteFile(File file)

Description: delete a file

Input parameters: file: file path to be delete

Output parameters: None。

Related parameters: None。