DJI Payload SDK  1.5.3
psdk_cmdset_app_func.h
Go to the documentation of this file.
1 /**
2  ******************************************************************************
3  * @file psdk_cmdset_app_func.h
4  * @version V1.0.0
5  * @date 2017/11/9
6  * @brief This file defines the payload SDK App function command set.
7  *
8  * @copyright (c) 2017-2018 DJI. All rights reserved.
9  *
10  * All information contained herein is, and remains, the property of DJI.
11  * The intellectual and technical concepts contained herein are proprietary
12  * to DJI and may be covered by U.S. and foreign patents, patents in process,
13  * and protected by trade secret or copyright law. Dissemination of this
14  * information, including but not limited to data and other proprietary
15  * material(s) incorporated within the information, in any form, is strictly
16  * prohibited without the express written consent of DJI.
17  *
18  * If you receive this source code without DJI’s authorization, you may not
19  * further disseminate the information, and you must immediately remove the
20  * source code and notify DJI of its removal. DJI reserves the right to pursue
21  * legal actions against you for any loss(es) or damage(s) caused by your
22  * failure to do so.
23  *
24  ******************************************************************************
25  */
26 
27 /* Define to prevent recursive inclusion -------------------------------------*/
28 #ifndef PSDK_CMDSET_APP_FUNC_H
29 #define PSDK_CMDSET_APP_FUNC_H
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 /* Includes ------------------------------------------------------------------*/
36 #include <psdk_typedef.h>
37 #include <psdk_core.h>
38 
39 /** @addtogroup PSDK
40  * @{
41  */
42 
43 /** @addtogroup PSDK_App_Function
44  * @{
45  */
46 
47 /* Exported constants --------------------------------------------------------*/
48 
49 /** @defgroup A_Func_Exported_Constants Exported constants
50  * @{
51  */
52 
53 /** @defgroup Data_Length_Related Data Length Related
54  * @{
55  */
56 
57 #define APPFUNC_APP_TO_LOAD_MAX_LEN 128 /*!< Max size of data from mobile app to load */
58 #define APPFUNC_LOAD_TO_APP_MAX_LEN 128 /*!< Max size of data from load to mobile app */
59 #define APPFUNC_FLOAT_WINDOW_MSG_MAX_SIZE 128 /*!< Max size of float window data from load to mobile app */
60 
61 /**
62  * @}
63  */
64 
65 /** @defgroup E_Constants_Widget_Related Widget Related
66  * @{
67  */
68 
69 #define APPFUNC_MAX_WIDGET_COUNT 30 /*!< Max widget count PSDK supported */
70 #define APPFUNC_MAX_WIDGET_NAME_SIZE 32 /*!< Max size of widget name */
71 #define APPFUNC_LIST_MAX_ITEM_NUM 10 /*!< Max list item number */
72 #define APPFUNC_LIST_MAX_ITEM_NAME_SIZE 16 /*!< Max size of list item name */
73 #define APPFUNC_INT_INPUT_BOX_PROMPT_CHAR_MAX_SIZE 32 /*!< Max size of additional prompt string of input box widget */
74 #define APPFUNC_WIDGET_VALUE_GROUP_MAX_ITEM_COUNT 15 /*!< Max item count of widget group, used when "Get Widget Value Group Data" command */
75 #define APPFUNC_WIDGET_SCALE_MIN_VALUE 0 /*!< Scale widget min value */
76 #define APPFUNC_WIDGET_SCALE_MAX_VALUE 100 /*!< Scale widget max value */
77 
78 /**
79  * @}
80  */
81 
82 /** @defgroup E_Constants_TextInputBox_Related TextInputBox Related
83  * @{
84  */
85 
86 #define APPFUNC_TEXT_INPUT_BOX_NAME_MAX_SIZE 32 /*!< Max size of text input box name */
87 #define APPFUNC_TEXT_INPUT_BOX_DESCRIPTION_MAX_SIZE 32 /*!< Max size of text input box description information */
88 
89 /**
90  * @}
91  */
92 
93 /**
94  * @}
95  */
96 
97 /* Exported macros -----------------------------------------------------------*/
98 /* Exported types ------------------------------------------------------------*/
99 
100 /** @defgroup A_Func_Exported_Types Exported Types
101  * @{
102  */
103 
104 /** @defgroup A_Func_Command_Related Command Related
105  * @{
106  */
107 
108 /**
109  * @brief App Function Command ID
110  */
111 typedef enum {
112  PSDK_APPFUNC_CMDID_TT_APP_TO_LOAD = 0x01, /*!< Transparent data transmission from mobile app to load command */
113  PSDK_APPFUNC_CMDID_TT_LOAD_TO_APP = 0x02, /*!< Transparent data transmission from load to mobile app command */
114  PSDK_APPFUNC_CMDID_PUSH_FLOATING_WINDOW_MSG = 0x03, /*!< Float window data transmission command */
115  PSDK_APPFUNC_CMDID_GET_WIDGET_LIST_LENGTH = 0x04, /*!< Get widget list length command, used to get total widget count. */
116  PSDK_APPFUNC_CMDID_GET_WIDGET_LIST_VALUE = 0x05, /*!< Get widget list data command, used to get widget attribute. */
117  PSDK_APPFUNC_CMDID_GET_WIDGET_GROUP_COUNT = 0x06, /*!< Get widget value group number command,
118  @note max item count of widget group is #APPFUNC_WIDGET_VALUE_GROUP_MAX_ITEM_COUNT. */
119  PSDK_APPFUNC_CMDID_GET_WIDGET_GROUP_VALUE = 0x07, /*!< Get widget value group data command, used to get widget value data of a group.
120  @note Max item count of widget group is #APPFUNC_WIDGET_VALUE_GROUP_MAX_ITEM_COUNT. */
121  PSDK_APPFUNC_CMDID_SET_WIDGET_VALUE = 0x08, /*!< Set widget value command */
122  PSDK_APPFUNC_CMDID_GET_TEXT_INPUT_BOX_PARAM = 0x09, /*!< Get parameters of text input box in DJI Pilot command. */
124 
125 /**
126  * @}
127  */
128 
129 /** @defgroup A_Func_Widget_Related Widget Related
130  * @{
131  */
132 
133 /**
134  * @brief Widget Type
135  */
136 typedef enum {
137  PSDK_APPFUNC_WIDGET_TYPE_BUTTON = 1, /*!< button widget type value */
138  PSDK_APPFUNC_WIDGET_TYPE_SWITCH = 2, /*!< switch widget type value */
139  PSDK_APPFUNC_WIDGET_TYPE_SCALE = 3, /*!< scale widget type value */
140  PSDK_APPFUNC_WIDGET_TYPE_LIST = 4, /*!< list widget type value */
141  PSDK_APPFUNC_WIDGET_TYPE_INT_INPUT_BOX = 5, /*!< input box widget type value */
143 
144 /**
145  * @brief Button State
146  */
147 typedef enum {
148  PSDK_APPFUNC_BUTTON_VAL_PRESS_DOWN = 1, /*!< button press down state */
149  PSDK_APPFUNC_BUTTON_VAL_RELEASE_UP = 0, /*!< button release up state */
151 
152 /**
153  * @brief Switch State
154  */
155 typedef enum {
156  PSDK_APPFUNC_SWITCH_VAL_OFF = 0, /*!< switch off state */
157  PSDK_APPFUNC_SWITCH_VAL_ON = 1, /*!< switch on state */
159 
160 /**
161  * @brief Text Input Box Display Control Flag
162  */
163 typedef enum {
164  PSDK_APPFUNC_TEXT_INPUT_BOX_NOT_DISPLAY = 0, /*!< text input box not display flag */
165  PSDK_APPFUNC_TEXT_INPUT_BOX_DISPLAY = 1, /*!< text input box display flag */
167 
168 #pragma pack(1)
169 
170 /**
171  * @brief Widget Value Union
172  */
173 typedef union {
174  int32_t buttonVal; /*!< Specifies button value.
175  This parameter can be any value of ::E_PsdkAppFuncButtonVal
176  @note This value have meaning only when set value.*/
177  int32_t switchVal; /*!< Specifies switch value.
178  This parameter can be any value of ::E_PsdkAppFuncSwitchVal */
179  int32_t scaleVal; /*!< Specifies scale value.
180  This parameter must be between #APPFUNC_WIDGET_SCALE_MIN_VALUE and #APPFUNC_WIDGET_SCALE_MAX_VALUE */
181  int32_t listVal; /*!< Specifies the choose list item number.
182  This parameter start at 0 */
183  int32_t intInputBoxVal; /*!< Specifies the int input box value. */
184  int32_t data; /*!< Specifies the widget value. */
186 
187 /**
188 * @brief Widget based parameters and value structure
189 */
190 typedef struct {
191  uint8_t widgetType; /*!< Specifies widget type.
192  This parameter can be any value of ::E_PsdkAppFuncWidgetType */
193  uint8_t widgetIndex; /*!< Specifies widget index.
194  @note The value is unique index for widget, starting at 0.
195  DJI Pilot widget show sequence relay on the widgetIndex.*/
196  U_AppFuncWidgetValue widgetValue; /*!< Specifies widget value, please refer to ::U_AppFuncWidgetValue */
198 
199 /**
200  * @brief Widget property structure.
201  */
202 typedef struct {
203  uint8_t widgetType; /*!< Specifies widget type.
204  This parameter can be any value of ::E_PsdkAppFuncWidgetType */
205  uint8_t widgetIndex; /*!< Specifies widget index.
206  @note The value is unique index for widget, starting at 0.
207  DJI Pilot widget show sequence relay on the widgetIndex.*/
208  uint8_t widgetName[APPFUNC_MAX_WIDGET_NAME_SIZE];/*!< Specifies widget name string.
209  @note Widget name max length is #APPFUNC_MAX_WIDGET_NAME_SIZE */
210  union {
211  struct {
212  PSDK_EMPTY_STRUCT
213  } buttonAttribute; /*!< Specifies button widget attribute. */
214  struct {
215  PSDK_EMPTY_STRUCT
216  } switchAttribute; /*!< Specifies switch widget attribute. */
217  struct {
218  PSDK_EMPTY_STRUCT
219  } scaleAttribute; /*!< Specifies scale widget attribute. */
220  struct {
221  uint8_t listItemNum; /*!< Specifies list item number */
223  /*!< Specifies list item names.
224  @note list item name max length is #APPFUNC_LIST_MAX_ITEM_NAME_SIZE */
225  } listAttribute; /*!< Specifies list widget attribute. */
226  struct {
228  /*!< Specifies input box additional prompt string.
229  @note its max length is #APPFUNC_INT_INPUT_BOX_PROMPT_CHAR_MAX_SIZE */
230  } intInputBoxAttribute; /*!< Specifies input box widget attribute. */
231  } widgetAttribute;
233 
234 /**
235  * @}
236  */
237 
238 /** @addtogroup A_Func_Command_Related
239  * @{
240  */
241 
242 // PSDK_APPFUNC_CMDID_TT_APP_TO_LOAD
243 /**
244  * @brief Transparent data transmission from mobile app to load command request data structure.
245  */
246 typedef struct {
247  uint8_t data[APPFUNC_APP_TO_LOAD_MAX_LEN]; /*!< Specifies transmission data. */
249 
250 /**
251  * @brief Transparent data transmission from mobile app to load command ack data structure.
252  */
253 typedef struct {
254  PSDK_EMPTY_STRUCT
256 
257 // PSDK_APPFUNC_CMDID_TT_LOAD_TO_APP
258 /**
259  * @brief Transparent data transmission from load to mobile app command request data structure.
260  */
261 typedef struct {
262  uint8_t data[APPFUNC_LOAD_TO_APP_MAX_LEN]; /*!< Specifies transmission data. */
264 
265 /**
266  * @brief Transparent data transmission from load to mobile app command ack data structure.
267  */
268 typedef struct {
269  PSDK_EMPTY_STRUCT
271 
272 //PSDK_APPFUNC_CMDID_PUSH_FLOATING_WINDOW_MSG
273 /**
274  * @brief Float window message transmission command request data structure.
275  */
276 typedef struct {
277  uint8_t msg[APPFUNC_FLOAT_WINDOW_MSG_MAX_SIZE]; /*!< Specifies float window message. */
279 
280 /**
281  * @brief Float window message transmission command ack data structure.
282  */
283 typedef struct {
284  PSDK_EMPTY_STRUCT
286 
287 //PSDK_APPFUNC_CMDID_GET_WIDGET_LIST_LENGTH
288 /**
289  * @brief Get widget list length command request data structure.
290  */
291 typedef struct {
292  PSDK_EMPTY_STRUCT
294 
295 /**
296  * @brief Get widget list length command ack data structure.
297  */
298 typedef struct {
299  uint8_t ackCode; /*!< Specifies PSDK command ack code.
300  This parameter can be any value of ::E_PsdkCmdAckCode */
301  uint8_t widgetListLength; /*!< Specifies widget count of widget list. */
303 
304 //PSDK_APPFUNC_CMDID_GET_WIDGET_LIST_VALUE
305 /**
306  * @brief Get widget list data command request data structure.
307  */
308 typedef struct {
309  uint8_t widgetListSubscript;/*!< Specifies widget subscription. */
311 
312 /**
313  * @brief Get widget list data command ack data structure.
314  */
315 typedef struct {
316  uint8_t ackCode; /*!< Specifies PSDK command ack code.
317  This parameter can be any value of ::E_PsdkCmdAckCode */
318  T_PsdkAppFuncWidgetProperty prop; /*!< Specifies widget property, refer to ::T_PsdkAppFuncWidgetProperty */
320 
321 //PSDK_APPFUNC_CMDID_GET_WIDGET_GROUP_COUNT
322 /**
323  * @brief Get widget value group number command request data structure.
324  */
325 typedef struct {
326  PSDK_EMPTY_STRUCT
328 
329 /**
330  * @brief Get widget value group number command ack data structure.
331  */
332 typedef struct {
333  uint8_t ackCode; /*!< Specifies PSDK command ack code.
334  This parameter can be any value of ::E_PsdkCmdAckCode */
335  uint8_t groupCount; /*!< Specifies widget group count. */
337 
338 //PSDK_APPFUNC_CMDID_GET_WIDGET_GROUP_VALUE
339 /**
340  * @brief Get widget value group data command request data structure.
341  */
342 typedef struct {
343  uint8_t groupNum; /*!< Specifies group number requested, starting at 0 */
345 
346 /**
347  * @brief Get widget value group data command ack data structure.
348  */
349 typedef struct {
350  uint8_t ackCode; /*!< Specifies PSDK command ack code.
351  This parameter can be any value of ::E_PsdkCmdAckCode */
352  uint8_t widgetValueCount; /*!< Specifies widget count of the group. */
354  /*!< Specifies widget value items of the group. */
356 
357 // PSDK_APPFUNC_CMDID_SET_WIDGET_VALUE
358 /**
359  * @brief Set widget value command request data structure.
360  */
361 typedef struct {
362  T_PsdkAppFuncWidgetValueItem widgetValue; /*!< Specifies widget value item set. */
364 
365 /**
366  * @brief Set widget value command ack data structure.
367  */
368 typedef struct {
369  uint8_t ackCode; /*!< Specifies PSDK command ack code.
370  This parameter can be any value of ::E_PsdkCmdAckCode */
372 
373 //PSDK_APPFUNC_CMDID_GET_TEXT_INPUT_BOX_PARAM
374 /**
375  * @brief Get text input box parameters command request data structure.
376  */
377 typedef struct {
378  PSDK_EMPTY_STRUCT
380 
381 /**
382  * @brief Get text input box parameters command ack data structure.
383  */
384 typedef struct {
385  uint8_t ackCode; /*!< Specifies PSDK command ack code.
386  This parameter can be any value of ::E_PsdkCmdAckCode */
387  uint8_t displayControlFlag; /*!< Specifies whether text input box display.
388  This parameter can be any value of
389  ::E_PsdkAppFuncTextInputBoxDisplayControlFlag */
390  uint8_t boxName[APPFUNC_TEXT_INPUT_BOX_NAME_MAX_SIZE]; /*!< Specifies text input box name. */
391  uint8_t boxDescription[APPFUNC_TEXT_INPUT_BOX_DESCRIPTION_MAX_SIZE]; /*!< Specifies text input box description information. */
393 
394 #pragma pack()
395 
396 /**
397  * @}
398  */
399 
400 /**
401  * @}
402  */
403 
404 /* Exported variables --------------------------------------------------------*/
405 /* Exported functions --------------------------------------------------------*/
406 /* Private constants ---------------------------------------------------------*/
407 /* Private macros ------------------------------------------------------------*/
408 /* Private types -------------------------------------------------------------*/
409 /* Private variables ---------------------------------------------------------*/
410 /* Private functions ---------------------------------------------------------*/
411 
412 /**
413  * @}
414  */
415 
416 /**
417  * @}
418  */
419 
420 #ifdef __cplusplus
421 }
422 #endif
423 
424 #endif //PSDK_CMDSET_APP_FUNC_H
425 
426 /************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
427 
T_PsdkAppFuncWidgetProperty prop
Definition: psdk_cmdset_app_func.h:318
uint8_t groupCount
Definition: psdk_cmdset_app_func.h:335
Transparent data transmission from load to mobile app command request data structure.
Definition: psdk_cmdset_app_func.h:261
Get widget value group number command ack data structure.
Definition: psdk_cmdset_app_func.h:332
T_PsdkAppFuncWidgetValueItem widgetValue
Definition: psdk_cmdset_app_func.h:362
Float window message transmission command request data structure.
Definition: psdk_cmdset_app_func.h:276
uint8_t widgetListLength
Definition: psdk_cmdset_app_func.h:301
int32_t scaleVal
Definition: psdk_cmdset_app_func.h:179
uint8_t ackCode
Definition: psdk_cmdset_app_func.h:316
uint8_t widgetIndex
Definition: psdk_cmdset_app_func.h:205
Set widget value command ack data structure.
Definition: psdk_cmdset_app_func.h:368
uint8_t widgetListSubscript
Definition: psdk_cmdset_app_func.h:309
int32_t listVal
Definition: psdk_cmdset_app_func.h:181
int32_t intInputBoxVal
Definition: psdk_cmdset_app_func.h:183
Get widget list length command ack data structure.
Definition: psdk_cmdset_app_func.h:298
int32_t switchVal
Definition: psdk_cmdset_app_func.h:177
Get text input box parameters command request data structure.
Definition: psdk_cmdset_app_func.h:377
Get widget value group number command request data structure.
Definition: psdk_cmdset_app_func.h:325
int32_t data
Definition: psdk_cmdset_app_func.h:184
Transparent data transmission from mobile app to load command request data structure.
Definition: psdk_cmdset_app_func.h:246
uint8_t listItemNum
Definition: psdk_cmdset_app_func.h:221
Transparent data transmission from mobile app to load command ack data structure.
Definition: psdk_cmdset_app_func.h:253
Get widget list data command ack data structure.
Definition: psdk_cmdset_app_func.h:315
uint8_t ackCode
Definition: psdk_cmdset_app_func.h:369
PSDK core include file.
uint8_t widgetValueCount
Definition: psdk_cmdset_app_func.h:352
uint8_t widgetType
Definition: psdk_cmdset_app_func.h:191
U_AppFuncWidgetValue widgetValue
Definition: psdk_cmdset_app_func.h:196
uint8_t displayControlFlag
Definition: psdk_cmdset_app_func.h:387
Float window message transmission command ack data structure.
Definition: psdk_cmdset_app_func.h:283
Get widget value group data command ack data structure.
Definition: psdk_cmdset_app_func.h:349
uint8_t widgetType
Definition: psdk_cmdset_app_func.h:203
Widget Value Union.
Definition: psdk_cmdset_app_func.h:173
uint8_t ackCode
Definition: psdk_cmdset_app_func.h:385
uint8_t widgetIndex
Definition: psdk_cmdset_app_func.h:193
uint8_t ackCode
Definition: psdk_cmdset_app_func.h:299
Widget property structure.
Definition: psdk_cmdset_app_func.h:202
uint8_t ackCode
Definition: psdk_cmdset_app_func.h:333
uint8_t ackCode
Definition: psdk_cmdset_app_func.h:350
uint8_t groupNum
Definition: psdk_cmdset_app_func.h:343
Widget based parameters and value structure.
Definition: psdk_cmdset_app_func.h:190
Get widget list data command request data structure.
Definition: psdk_cmdset_app_func.h:308
Get widget value group data command request data structure.
Definition: psdk_cmdset_app_func.h:342
Set widget value command request data structure.
Definition: psdk_cmdset_app_func.h:361
int32_t buttonVal
Definition: psdk_cmdset_app_func.h:174
Get widget list length command request data structure.
Definition: psdk_cmdset_app_func.h:291
Get text input box parameters command ack data structure.
Definition: psdk_cmdset_app_func.h:384
Transparent data transmission from load to mobile app command ack data structure.
Definition: psdk_cmdset_app_func.h:268