Send files to Bebop 2


#1

Product : [Bebop2]
SDK Platform : [Unix]
SDK version : the latest one

Hi.

I’m currently trying to delevop a method in C++ able to send mavlink files to a Bebop 2. Here is my code :

void AutopilotBebop2::sendWriteMission(std::string filepath)
{
  eARDATATRANSFER_UPLOADER_RESUME resume = ARDATATRANSFER_UPLOADER_RESUME_FALSE;
  eARUTILS_ERROR error = ARUTILS_OK;
  eARDATATRANSFER_ERROR error2 = ARDATATRANSFER_OK;
  std::string filename = filepath.substr(filepath.find_last_of('/') + 1);

  ARUTILS_Manager_t* ftp = ARUTILS_Manager_New(&error);
  ARDATATRANSFER_Manager_t* transfer = ARDATATRANSFER_Manager_New(&error2);

  ARUTILS_Manager_InitWifiFtp(ftp, "192.168.42.1", 61, "", "");

  ARDATATRANSFER_Uploader_New(transfer, ftp, filename.c_str(), filepath.c_str(), NULL, NULL, NULL, NULL, resume);

  std::cout << "\033[1;31mSending : " << filename << "\nFrom : " << filepath << "\033[0m" << std::endl;

  ARDATATRANSFER_Uploader_ThreadRun(transfer);
  usleep(100000); // To be sure the file is completely sent...
}

However, after verification with FileZilla, no files are uploaded. And I am sure that the path sent is the correct one.
I followed several other threads and there weren’t any idea that solved my problem so I would be truly grateful if someone could help me.

Again, many thanks for your help.


#2

I don’t see a listener / callback for transfer progress…


#3

Thanks for your answer, I have several questions though :
Are they necessary for the method to execute? Shouldn’t it return a segfault otherwise?
And how can I initialize them?


#4

I only have experience with the Java layer with ARSDK3. Pretty sure nothing happens if you don’t define it.


#5

Alright, I tried adding the callbacks and listener but still no file are being transmitted.
However I found a solution : I’m using a 3rd party library that encapsulates the FTP protocol into a C++ class. I leave the link here for those who are interested : here.

Anyways, thanks for your help.


#6

That will work just fine so long as you don’t need to do a file transfer with the SC2 in the middle. The ARUTILS transfer methods have been improved (and simplified) significantly over the past year, IMHO.