Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/192.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在DJI Android SDK中调用refreshFileListOfStorageLocation()需要很多秒才能生成结果(mavic_Android_Performance_Dji Sdk - Fatal编程技术网

在DJI Android SDK中调用refreshFileListOfStorageLocation()需要很多秒才能生成结果(mavic

在DJI Android SDK中调用refreshFileListOfStorageLocation()需要很多秒才能生成结果(mavic,android,performance,dji-sdk,Android,Performance,Dji Sdk,我正在编写的程序的目标如下: mMediaManager = DJISampleApplication.getProductInstance().getCamera().getMediaManager(); camera = DJISampleApplication.getProductInstance().getCamera(); camera.startShootPhoto(new CommonCallbacks.CompletionCallback() { @Override

我正在编写的程序的目标如下:


mMediaManager = DJISampleApplication.getProductInstance().getCamera().getMediaManager();
camera = DJISampleApplication.getProductInstance().getCamera();

camera.startShootPhoto(new CommonCallbacks.CompletionCallback() {
    @Override
    public void onResult(DJIError djiError) {
        mMediaManager.refreshFileListOfStorageLocation(SettingsDefinitions.StorageLocation.INTERNAL_STORAGE, new CommonCallbacks.CompletionCallback() {
        @Override
        public void onResult(DJIError djiError) {
        newPicture();
    });
});


void newPicture() {
mediaFileList = mMediaManager.getInternalStorageFileListSnapshot();
MediaFile lastImage = mediaFileList.get(mediaFileList.size()-1);
lastImage.fetchFileData(destDir, names[0], new DownloadListener<String>() {
    @Override
    public void onSuccess(String s) {
        deleteAllFilesFromDrone();
    return;
    }
}
  • 用DJI mavic 2 enterprise拍摄一张jpg图像
  • 将jpg图像下载到已连接的android应用程序上
代码就是这样做的。问题是,整个过程需要5秒,有时长达15秒才能完成。主要的瓶颈是refreshFileListOfStorageLocation()函数

代码设置如下所示:


mMediaManager = DJISampleApplication.getProductInstance().getCamera().getMediaManager();
camera = DJISampleApplication.getProductInstance().getCamera();

camera.startShootPhoto(new CommonCallbacks.CompletionCallback() {
    @Override
    public void onResult(DJIError djiError) {
        mMediaManager.refreshFileListOfStorageLocation(SettingsDefinitions.StorageLocation.INTERNAL_STORAGE, new CommonCallbacks.CompletionCallback() {
        @Override
        public void onResult(DJIError djiError) {
        newPicture();
    });
});


void newPicture() {
mediaFileList = mMediaManager.getInternalStorageFileListSnapshot();
MediaFile lastImage = mediaFileList.get(mediaFileList.size()-1);
lastImage.fetchFileData(destDir, names[0], new DownloadListener<String>() {
    @Override
    public void onSuccess(String s) {
        deleteAllFilesFromDrone();
    return;
    }
}

mMediaManager=DJISampleApplication.getProductInstance().getCamera().getMediaManager();
camera=DJISampleApplication.getProductInstance().getCamera();
camera.startShootPhoto(新的CommonCallbacks.CompletionCallback(){
@凌驾
公开作废onResult(DJIError DJIError){
mMediaManager.refreshFileListOfStorageLocation(setingsDefinitions.StorageLocation.INTERNAL_存储,新的CommonCallbacks.CompletionCallback(){
@凌驾
公开作废onResult(DJIError DJIError){
新图片();
});
});
void newPicture(){
mediaFileList=mMediaManager.getInternalStorageFileListSnapshot();
MediaFile lastImage=mediaFileList.get(mediaFileList.size()-1);
fetchFileData(destDir,名称[0],新的DownloadListener()){
@凌驾
成功时的公共void(字符串s){
deleteAllFilesFromDrone();
返回;
}
}
正如我所说,这是可行的;问题是refreshFileListOfStorageLocation()和它的onResult之间的时间

有没有办法加快速度?我试过:

  • 将无人机存储上的文件数保持在1个最大值
  • 通过addUpdateFileListStateListener创建文件状态侦听器,尽管这只触发一次
  • 检查FileListState并仅在状态不完整或重置时刷新

这些都没有帮助。

根据我与DJI开发者支持部门的通信:

不幸的是,普遍的答案是速度就是速度 而且,我们无法采取任何措施来加快这一进程 除下载媒体文件预览或手动拍摄外 将SD卡取出并直接将媒体下载到计算机上

因此,似乎不可能通过任何API技巧进一步提高速度