Read filename using new setNewGeneratedMediaFileInfoCallback

Completed

Comments

7 comments

  • DJI Developer Support
    The setMediaFileCallback often carries the wrong file name so we use setNewGeneratedMediaFileInfoCallback instead and deprecate the setMediaFileCallback . If you are ok with the setMediaFileCallback then you can still use it. The bug only occurs to some models such as M300RTK.
    0
    Comment actions Permalink
  • Kenneth Argo

    I'm using the M300RTK.

    So this is a bug in 4.16.2?  What about 5.x?

    How can I use setNewGeneratedMediaFileInfoCallback, and get the filename of a newly added image WITHOUT refreshing the complete image list?

    0
    Comment actions Permalink
  • DJI Developer Support
    It is not an SDK bug, it is a firmware issue and unfixable. So it will be exist in both 4.x and 5.x version. The theory is we actually cannot get the real fileName, the fileName is created by the SDK according to the naming rules, sometimes it is mismatched with the real file name in SD card.
    0
    Comment actions Permalink
  • Kenneth Argo

    Is there a way to read the last image filename without refreshing the complete list of all image files? It makes it nearly impossible to do image validation on the most recent image of I must download the complete list each time. It means the more images taken, the larger the list on the callback.

    0
    Comment actions Permalink
  • DJI Developer Support
    Actually everytime you call refreh it will only refresh the newly generated files not the complete list. Everytime you shoot photos, the fileListState should go into INCOMPLETE state. ![](https://djisdksupport.zendesk.com/attachments/token/SBKB7ks0wHzuwKxvuljF2uhQ4/?name=image.png)
    0
    Comment actions Permalink
  • Kenneth Argo

    It appears that each call to

    refreshFileListOfStorageLocation(SettingsDefinitions.StorageLocation.SDCARD)

    is returning the complete list.  Unless I misunderstand the documentation and the information in the link you listed above.

    First call:

    ::refreshFileList: djiError: null
    ::sdCardFileListSnapshot
    ::refreshFileList: Size=474, TaskScheduler=IDLE

    Second call: 

    ::refreshFileList: djiError: null
    ::sdCardFileListSnapshot
    ::refreshFileList: Size=476, TaskScheduler=IDLE

    djiCamera!!.setNewGeneratedMediaFileInfoCallback { mediaFileInfo ->

                                // According to DJI, this should return ONLY the new images since the last refresh
                                // TODO:
                                mediaManager?.refreshFileListOfStorageLocation(SettingsDefinitions.StorageLocation.SDCARD) { djiError ->

                                    logInfo("AircraftDataSourceImpl::refreshFileList: djiError: $djiError")

                                    if (djiError == null) {

                                        logInfo("AircraftDataSourceImpl::sdCardFileListSnapshot")

                                        mediaManager?.sdCardFileListSnapshot?.let { djiMedias ->

                                            logInfo(
                                                "AircraftDataSourceImpl::refreshFileList: Size=${djiMedias.size}, TaskScheduler=${fetchMediaTaskScheduler?.state}"
                                            )

     

    0
    Comment actions Permalink
  • DJI Developer Support
    refreshFileList will return a complate list, it will only fetch the newly generated file and apend to the list. It will not fetch the whole list.
    0
    Comment actions Permalink

Please sign in to leave a comment.