QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
MAVLinkFTP.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QString>
4#include <QtCore/QLoggingCategory>
5
6#include "MAVLinkLib.h"
7
9
11public:
16 typedef struct RequestHeader {
17 uint16_t seqNumber;
18 uint8_t session;
19 uint8_t opcode;
20 uint8_t size;
21 uint8_t req_opcode;
22 uint8_t burstComplete;
23 uint8_t paddng;
24 uint32_t offset;
25 }) RequestHeader;
26
28 typedef struct Request{
29 RequestHeader hdr;
30
31 // We use a union here instead of just casting (uint32_t)&payload[0] to not break strict aliasing rules
32 union {
33 // The entire Request must fit into the payload member of the mavlink_file_transfer_protocol_t structure. We use as many leftover bytes
34 // after we use up space for the RequestHeader for the data portion of the Request.
35 uint8_t data[sizeof(((mavlink_file_transfer_protocol_t*)0)->payload) - sizeof(RequestHeader)];
36
37 // File length returned by Open command
38 uint32_t openFileLength;
39 };
40 }) Request;
41
63
78
79 static QString opCodeToString (OpCode_t opCode);
80 static QString errorCodeToString(ErrorCode_t errorCode);
81};
Q_DECLARE_LOGGING_CATEGORY(AndroidSerialLog)
MAVPACKED(typedef struct RequestHeader { uint16_t seqNumber;uint8_t session;uint8_t opcode;uint8_t size;uint8_t req_opcode;uint8_t burstComplete;uint8_t paddng;uint32_t offset;}) RequestHeader
MAVPACKED(typedef struct Request{ RequestHeader hdr;union { uint8_t data[sizeof(((mavlink_file_transfer_protocol_t *) 0) ->payload) - sizeof(RequestHeader)];uint32_t openFileLength;};}) Request
@ kErrNoSessionsAvailable
All available Sessions in use.
Definition MAVLinkFTP.h:71
@ kErrFail
Unknown failure.
Definition MAVLinkFTP.h:67
@ kErrEOF
Offset past end of file for List and Read commands.
Definition MAVLinkFTP.h:72
@ kErrUnknownCommand
Unknown command opcode.
Definition MAVLinkFTP.h:73
@ kErrFailFileExists
File exists already.
Definition MAVLinkFTP.h:74
@ kErrInvalidDataSize
PayloadHeader.size is invalid.
Definition MAVLinkFTP.h:69
@ kErrFailErrno
errno sent back in PayloadHeader.data[1]
Definition MAVLinkFTP.h:68
@ kErrInvalidSession
Session is not currently open.
Definition MAVLinkFTP.h:70
@ kErrFailFileProtected
File is write protected.
Definition MAVLinkFTP.h:75
@ kCmdRemoveFile
Remove file at <path>
Definition MAVLinkFTP.h:51
@ kCmdRename
Rename <path1> to <path2>
Definition MAVLinkFTP.h:56
@ kCmdWriteFile
Writes <size> bytes to <offset> in <session>
Definition MAVLinkFTP.h:50
@ kCmdCreateFile
Creates file at <path> for writing, returns <session>
Definition MAVLinkFTP.h:49
@ kCmdOpenFileRO
Opens file at <path> for reading, returns <session>
Definition MAVLinkFTP.h:47
@ kCmdRemoveDirectory
Removes Directory at <path>, must be empty.
Definition MAVLinkFTP.h:53
@ kCmdReadFile
Reads <size> bytes from <offset> in <session>
Definition MAVLinkFTP.h:48
@ kCmdTruncateFile
Truncate file at <path> to <offset> length.
Definition MAVLinkFTP.h:55
@ kCmdOpenFileWO
Opens file at <path> for writing, returns <session>
Definition MAVLinkFTP.h:54
@ kCmdResetSessions
Terminates all open Read sessions.
Definition MAVLinkFTP.h:45
@ kCmdBurstReadFile
Burst download session file.
Definition MAVLinkFTP.h:58
@ kCmdCreateDirectory
Creates directory at <path>
Definition MAVLinkFTP.h:52
@ kCmdCalcFileCRC32
Calculate CRC32 for file at <path>
Definition MAVLinkFTP.h:57
@ kCmdTerminateSession
Terminates open Read session.
Definition MAVLinkFTP.h:44
@ kRspNak
Nak response.
Definition MAVLinkFTP.h:61
@ kCmdListDirectory
List files in <path> from <offset>
Definition MAVLinkFTP.h:46