dji_command.hpp
Go to the documentation of this file.
1 
29 #ifndef DJI_COMMAND_H
30 #define DJI_COMMAND_H
31 
32 #include "dji_error.hpp"
33 #include <stdint.h>
34 
35 namespace DJI
36 {
37 namespace OSDK
38 {
39 
40 class OpenProtocolCMD : public ErrorCode
41 {
42 public:
43  const static int MAX_CMD_ARRAY_SIZE = 2;
44 
45  class CMDSet
46  {
47  public:
48  typedef struct Activation
49  {
50  const static uint8_t getVersion[MAX_CMD_ARRAY_SIZE];
51  const static uint8_t activate[MAX_CMD_ARRAY_SIZE];
52  const static uint8_t dataBury[MAX_CMD_ARRAY_SIZE];
53  const static uint8_t frequency[MAX_CMD_ARRAY_SIZE];
54  const static uint8_t toMobile[MAX_CMD_ARRAY_SIZE];
55  const static uint8_t toPayload[MAX_CMD_ARRAY_SIZE];
56  const static uint8_t heatBeatCmd[MAX_CMD_ARRAY_SIZE];
57  } Activation;
58 
59  typedef struct Broadcast
60  {
61  const static uint8_t broadcast[MAX_CMD_ARRAY_SIZE];
62  const static uint8_t fromMobile[MAX_CMD_ARRAY_SIZE];
63  const static uint8_t lostCTRL[MAX_CMD_ARRAY_SIZE];
64  const static uint8_t mission[MAX_CMD_ARRAY_SIZE];
65  const static uint8_t subscribe[MAX_CMD_ARRAY_SIZE];
66  const static uint8_t test[MAX_CMD_ARRAY_SIZE];
67  const static uint8_t waypoint[MAX_CMD_ARRAY_SIZE];
68  const static uint8_t fromPayload[MAX_CMD_ARRAY_SIZE];
69  const static uint8_t psdkWidgetValue[MAX_CMD_ARRAY_SIZE];
70  } Broadcast;
71 
72  typedef struct Control
73  {
74  const static uint8_t setControl[MAX_CMD_ARRAY_SIZE];
75  const static uint8_t task[MAX_CMD_ARRAY_SIZE];
76  // CMD_ID_STATUS Not used at all
77  const static uint8_t status[MAX_CMD_ARRAY_SIZE];
78  const static uint8_t control[MAX_CMD_ARRAY_SIZE];
79  const static uint8_t emergencyBrake[MAX_CMD_ARRAY_SIZE];
80  // CMD_ID_SETARM Supported on Matrice 100, A3, N3
81  // with firmware version < 3.3
82  const static uint8_t setArm[MAX_CMD_ARRAY_SIZE];
83  const static uint8_t killSwitch[MAX_CMD_ARRAY_SIZE];
84  const static uint8_t setHomeLocation[MAX_CMD_ARRAY_SIZE];
85  const static uint8_t gimbalSpeed[MAX_CMD_ARRAY_SIZE];
86  const static uint8_t gimbalAngle[MAX_CMD_ARRAY_SIZE];
87  const static uint8_t cameraShot[MAX_CMD_ARRAY_SIZE];
88  const static uint8_t cameraVideoStart[MAX_CMD_ARRAY_SIZE];
89  const static uint8_t cameraVideoStop[MAX_CMD_ARRAY_SIZE];
90  const static uint8_t extendedFunction[MAX_CMD_ARRAY_SIZE];
91  const static uint8_t parameterRead[MAX_CMD_ARRAY_SIZE];
92  const static uint8_t parameterWrite[MAX_CMD_ARRAY_SIZE];
93  } Control;
94 
95  typedef struct Mission
96  {
97  // Waypoint mission commands
98  const static uint8_t waypointInit[MAX_CMD_ARRAY_SIZE];
99  const static uint8_t waypointAddPoint[MAX_CMD_ARRAY_SIZE];
100  const static uint8_t waypointSetStart[MAX_CMD_ARRAY_SIZE];
101  const static uint8_t waypointSetPause[MAX_CMD_ARRAY_SIZE];
102  const static uint8_t waypointDownload[MAX_CMD_ARRAY_SIZE];
103  const static uint8_t waypointIndexDownload[MAX_CMD_ARRAY_SIZE];
104  const static uint8_t waypointSetVelocity[MAX_CMD_ARRAY_SIZE];
105  const static uint8_t waypointGetVelocity[MAX_CMD_ARRAY_SIZE];
106  // Hotpint mission commands
107  const static uint8_t hotpointStart[MAX_CMD_ARRAY_SIZE];
108  const static uint8_t hotpointStop[MAX_CMD_ARRAY_SIZE];
109  const static uint8_t hotpointSetPause[MAX_CMD_ARRAY_SIZE];
110  const static uint8_t hotpointYawRate[MAX_CMD_ARRAY_SIZE];
111  const static uint8_t hotpointRadius[MAX_CMD_ARRAY_SIZE];
112  const static uint8_t hotpointSetYaw[MAX_CMD_ARRAY_SIZE];
113  const static uint8_t hotpointDownload[MAX_CMD_ARRAY_SIZE];
114  // Follow mission commands
115  const static uint8_t followStart[MAX_CMD_ARRAY_SIZE];
116  const static uint8_t followStop[MAX_CMD_ARRAY_SIZE];
117  const static uint8_t followSetPause[MAX_CMD_ARRAY_SIZE];
118  const static uint8_t followTarget[MAX_CMD_ARRAY_SIZE];
119  } Mission;
120 
121  typedef struct HardwareSync
122  {
123  const static uint8_t broadcast[MAX_CMD_ARRAY_SIZE];
124  const static uint8_t ppsNMEAGPSGSA[MAX_CMD_ARRAY_SIZE];
125  const static uint8_t ppsNMEAGPSRMC[MAX_CMD_ARRAY_SIZE];
126  const static uint8_t ppsNMEARTKGSA[MAX_CMD_ARRAY_SIZE];
127  const static uint8_t ppsNMEARTKRMC[MAX_CMD_ARRAY_SIZE];
128  const static uint8_t ppsUTCTime[MAX_CMD_ARRAY_SIZE];
129  const static uint8_t ppsUTCFCTimeRef[MAX_CMD_ARRAY_SIZE];
130  const static uint8_t ppsSource[MAX_CMD_ARRAY_SIZE];
131  } HardwareSync;
132 
133  typedef struct VirtualRC
134  {
135  const static uint8_t settings[MAX_CMD_ARRAY_SIZE];
136  const static uint8_t data[MAX_CMD_ARRAY_SIZE];
137  } VirtualRC;
138 
139  typedef struct MFIO
140  {
141  const static uint8_t init[MAX_CMD_ARRAY_SIZE];
142  const static uint8_t get[MAX_CMD_ARRAY_SIZE];
143  const static uint8_t set[MAX_CMD_ARRAY_SIZE];
144  } MFIO;
145  typedef struct Subscribe
146  {
147  const static uint8_t versionMatch[MAX_CMD_ARRAY_SIZE];
148  const static uint8_t addPackage[MAX_CMD_ARRAY_SIZE];
149  const static uint8_t reset[MAX_CMD_ARRAY_SIZE];
150  const static uint8_t removePackage[MAX_CMD_ARRAY_SIZE];
151  // TODO implement API call
152  const static uint8_t updatePackageFreq[MAX_CMD_ARRAY_SIZE];
153  const static uint8_t pauseResume[MAX_CMD_ARRAY_SIZE];
154  // TODO implement API call
155  const static uint8_t getConfig[MAX_CMD_ARRAY_SIZE];
156  } Subscribe;
157 
158  typedef struct Intelligent
159  {
160  const static uint8_t setAvoidObstacle[MAX_CMD_ARRAY_SIZE];
161  }Intelligent;
163  const static uint8_t activation = 0x00;
164  const static uint8_t control = 0x01;
165  const static uint8_t broadcast = 0x02;
166  const static uint8_t mission = 0x03;
167  const static uint8_t hardwareSync = 0x04;
168  const static uint8_t virtualRC = 0x05;
169  const static uint8_t mfio = 0x09;
170  const static uint8_t subscribe = 0x0B;
171  const static uint8_t intelligent = 0xFE;
172  };
173 };
174 } // namespace
175 } // namespace
176 
177 #endif /* DJI_COMMAND_H */
Definition: dji_ack.cpp:38
All DJI OSDK OpenProtocol ACK Error Codes.