Closed QZH-Caesar closed 10 months ago
FTP has been rewritten and will be part of MAVSDK v2.
Until then, I probably won't be able to debug issues in v1.
@julianoes I'm glad to receive your response. I'm curious about the timing of FTP updates in MAV SDK v2 because I want to perform file transfer between a mobile device and a drone. This functionality has already been implemented in iOS and Python. Also, I'd like to ask a question: How can MAVSDK retrieve heartbeat data from the device?
Thank you in advance.
If you have another question, please open a new thread.
The following is my code and logs for reference:
String fileName = "file.text"; File file = new File(getFilesDir(),fileName); try { FileOutputStream outputStream = new FileOutputStream(file);; String content = "Hello,World!"; if (file.canRead() && file.canWrite()){ byte[] bytes = content.getBytes(); outputStream.write(bytes); } FileReader fileReader = new FileReader(file); BufferedReader bufferedReader = new BufferedReader(fileReader); String redStr = bufferedReader.readLine(); logger.debug("File Message" + redStr); } catch (IOException e) { e.printStackTrace(); } MavsdkEventQueue.executor().execute(() ->{ disposables.add( drone.getFtp().setTargetCompid(1) .subscribe());}); disposables.add( drone.getFtp().upload(file.getPath(),"/fs/microsd/").subscribe( onNext -> { logger.debug("FTP upload" + onNext.getTotalBytes()); }, throwable ->{ logger.debug("FTP error" + throwable.getMessage()); } ) );
D/Mavsdk: MAVLink: info: System id: 1 D/MapsActivity: [grpc-default-executor-0] - FTP upload12 W/Mavsdk: Response timeout. Retry: 1 W/Mavsdk: Response timeout. Retry: 1 W/Mavsdk: Response timeout. Retry: 1 W/Mavsdk: Response timeout. Retry: 1