Flight plan upload with sdk ftp uploader


#1

Product: Bebop 2
Product version: [4.0.3]
SDK version: [3.11]
Use of libARController: [YES] (Only for ARSDK)
SDK platform: [Android]
Reproductible with the official app: [Not tried]

Hi,
I try to use the SDK ftp uploader to upload a file into Bebop 2.
But the file isn’t transfered into the flightplans directory.
Is it possible with the SDK ?
Regards
Here’s my code :

private static final int DEVICE_PORT_UPLOAD = 61;

try
{
    ARUtilsManager ftpPutManager = new ARUtilsManager();
    ftpPutManager.initWifiFtp(mux.newMuxRef(), DEVICE_PORT_UPLOAD, ARUtilsManager.FTP_ANONYMOUS, "");
    
    uploadFlightPlan("flightplan.mavlink", "/storage/sdcard0/bebop/flightPlanGoTo.mavlink");
}
catch (ARUtilsException e)
{
    Log.e(TAG, "Exception", e);
}

public void uploadFlightPlan(String remotePath, String localPath) {

    ARDATATRANSFER_UPLOADER_RESUME_ENUM result = ARDATATRANSFER_UPLOADER_RESUME_ENUM.ARDATATRANSFER_UPLOADER_RESUME_TRUE;

    try {
         mDataTransferManager.getARDataTransferUploader().createUploader(ftpPutManager,remotePath, localPath, mULProgressListener, null, mULCompletionListener, null, result );
    } catch (ARDataTransferException e) {
        Log.e(TAG, "Exception", e);
    }
}

#2

Hi, if anybody is still looking for an answer, I’ve finally made it work :nerd_face::

/* Ftp upload */
eARDATATRANSFER_ERROR dataTransferError = ARDATATRANSFER_OK;
ARDATATRANSFER_Manager_t *dataTransferManager = ARDATATRANSFER_Manager_New(&dataTransferError);
fileOutInstance.error(“ARDATATRANSFER_Manager_New error: %s”, ARDATATRANSFER_Error_ToString(dataTransferError));

eARUTILS_ERROR utilsError = ARUTILS_OK;
ARUTILS_Manager_t *ftpManager = ARUTILS_Manager_New(&utilsError);
if (utilsError != ARUTILS_OK)
	fileOutInstance.error("\033[1;31mARUTILS_Manager_New error: %s\033[0m", ARUTILS_Error_ToString(utilsError));
else
	fileOutInstance.info("\033[1;32mARUTILS_Manager_New: OK\033[0m");

utilsError = ARUTILS_Manager_InitWifiFtp(ftpManager, BebopIpAddress.c_str(), 61, "", "");
if (utilsError != ARUTILS_OK)
	fileOutInstance.error("\033[1;31mARUTILS_Manager_InitWifiFtp error: %s\033[0m", ARUTILS_Error_ToString(utilsError));
else
	fileOutInstance.info("\033[1;32mARUTILS_Manager_InitWifiFtp: OK\033[0m");

dataTransferError = ARDATATRANSFER_Uploader_New(dataTransferManager, ftpManager, "flightPlan.mavlink", flightPlanFileName.c_str(), ARUPDATER_Uploader_ProgressCallback, uavSharedData, ARUPDATER_Uploader_CompletionCallback, uavSharedData, ARDATATRANSFER_UPLOADER_RESUME_FALSE);
if (dataTransferError != ARDATATRANSFER_OK)
	fileOutInstance.error("\033[1;31mARDATATRANSFER_Uploader_New error: %s\033[0m", ARDATATRANSFER_Error_ToString(dataTransferError));
else
	fileOutInstance.info("\033[1;32mARDATATRANSFER_Uploader_New: OK\033[0m");

ARDATATRANSFER_Uploader_ThreadRun((void*) dataTransferManager);
/* Ftp upload - end */

FTP client for autonomous flight performance