DJI Payload SDK  1.5.3
psdk_app_func.h
Go to the documentation of this file.
1 /**
2  ******************************************************************************
3  * @file psdk_app_func.h
4  * @version V1.0.0
5  * @date 2017/08/10
6  * @brief This is the header file for "psdk_app_func.c", defining the
7  * structures and (exported) function prototypes.
8  *
9  * @copyright (c) 2017-2018 DJI. All rights reserved.
10  *
11  * All information contained herein is, and remains, the property of DJI.
12  * The intellectual and technical concepts contained herein are proprietary
13  * to DJI and may be covered by U.S. and foreign patents, patents in process,
14  * and protected by trade secret or copyright law. Dissemination of this
15  * information, including but not limited to data and other proprietary
16  * material(s) incorporated within the information, in any form, is strictly
17  * prohibited without the express written consent of DJI.
18  *
19  * If you receive this source code without DJI’s authorization, you may not
20  * further disseminate the information, and you must immediately remove the
21  * source code and notify DJI of its removal. DJI reserves the right to pursue
22  * legal actions against you for any loss(es) or damage(s) caused by your
23  * failure to do so.
24  *
25  ******************************************************************************
26  */
27 
28 /* Define to prevent recursive inclusion -------------------------------------*/
29 #ifndef PSDK_APP_FUNC_H
30 #define PSDK_APP_FUNC_H
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /* Includes ------------------------------------------------------------------*/
37 #include <psdk_upper.h>
38 #include "psdk_cmdset.h"
39 
40 /** @addtogroup PSDK
41  * @{
42  */
43 
44 /** @addtogroup PSDK_App_Function
45  * @{
46  */
47 
48 /* Exported constants --------------------------------------------------------*/
49 /* Exported macros -----------------------------------------------------------*/
50 
51 /** @defgroup A_Func_Exported_Macros Exported Macros
52  * @{
53  */
54 
55 /**
56  * @brief Define button widget.
57  */
58 #define APPFUNC_DEF_BUTTON_WIDGET(index, nameStr) \
59 { \
60  .widgetType = PSDK_APPFUNC_WIDGET_TYPE_BUTTON, \
61  .widgetIndex = index, \
62  .widgetName = nameStr, \
63 }
64 
65 /**
66  * @brief Define switch widget.
67  */
68 #define APPFUNC_DEF_SWITCH_WIDGET(index, nameStr) \
69 { \
70  .widgetType = PSDK_APPFUNC_WIDGET_TYPE_SWITCH, \
71  .widgetIndex = index, \
72  .widgetName = nameStr, \
73 }
74 
75 /**
76  * @brief Define scale widget.
77  */
78 #define APPFUNC_DEF_SCALE_WIDGET(index, nameStr) \
79 { \
80  .widgetType = PSDK_APPFUNC_WIDGET_TYPE_SCALE, \
81  .widgetIndex = index, \
82  .widgetName = nameStr, \
83 }
84 
85 /**
86  * @brief Define list widget.
87  */
88 #define APPFUNC_DEF_LIST_WIDGET(index, nameStr, chooseCount, choose1Str, ...) \
89 { \
90  .widgetType = PSDK_APPFUNC_WIDGET_TYPE_LIST, \
91  .widgetIndex = index, \
92  .widgetName = nameStr, \
93  .widgetAttribute.listAttribute.listItemNum = chooseCount, \
94  .widgetAttribute.listAttribute.listItemName = {choose1Str,##__VA_ARGS__}, \
95 }
96 
97 /**
98  * @brief Define input box widget.
99  */
100 #define APPFUNC_DEF_INT_INPUT_BOX_WIDGET(index, nameStr, promtStr) \
101 { \
102  .widgetType = PSDK_APPFUNC_WIDGET_TYPE_INT_INPUT_BOX, \
103  .widgetIndex = index, \
104  .widgetName = nameStr, \
105  .widgetAttribute.intInputBoxAttribute.promptStr = promtStr, \
106 }
107 
108 /**
109  * @}
110  */
111 
112 /* Exported types ------------------------------------------------------------*/
113 
114 /** @addtogroup A_Func_Exported_Types
115  * @{
116  */
117 
118 /** @defgroup A_Func_Callback_Related Callback Related
119  * @{
120  */
121 
122 typedef void (*ReceiveFromAppFunc)(const uint8_t *pData, uint16_t dataLen);
123 typedef E_PsdkStat (*GetWidgetValueFunc)(E_PsdkAppFuncWidgetType widgetType, uint8_t widgetIndex,
124  U_AppFuncWidgetValue *pWidgetValue);
125 typedef E_PsdkStat (*SetWidgetValueFunc)(E_PsdkAppFuncWidgetType widgetType, uint8_t widgetIndex,
126  const U_AppFuncWidgetValue *pWidgetValue);
127 typedef E_PsdkStat (*GetTextInputBoxParamFunc)(E_PsdkAppFuncTextInputBoxDisplayControlFlag *displayControlFlag,
128  uint8_t *boxName, uint8_t *boxDescription);
129 
130 /**
131  * @}
132  */
133 
134 /** @addtogroup A_Func_Widget_Related
135  * @{
136  */
137 
138 /**
139  * @brief Widget detail information.
140  */
141 typedef struct {
142  E_PsdkAppFuncWidgetType widgetType; /*!< Specifies widget type.
143  This parameter can be any value of ::E_PsdkAppFuncWidgetType */
144  uint8_t widgetIndex; /*!< Specifies widget index.
145  @note The value is unique index for widget, starting at 0.
146  DJI Pilot widget show sequence relay on the widgetIndex.*/
147  const char *widgetName; /*!< Pointer widget name string.
148  @note Widget name max length is #APPFUNC_MAX_WIDGET_NAME_SIZE */
149  union {
150  struct {
151  PSDK_EMPTY_STRUCT
152  } buttonAttribute; /*!< Specifies button widget attribute. */
153  struct {
154  PSDK_EMPTY_STRUCT
155  } switchAttribute; /*!< Specifies switch widget attribute. */
156  struct {
157  PSDK_EMPTY_STRUCT
158  } scaleAttribute; /*!< Specifies scale widget attribute. */
159  struct {
160  uint8_t listItemNum; /*!< Specifies list item number */
161  const char *listItemName[APPFUNC_LIST_MAX_ITEM_NUM];
162  /*!< Array of pointer to list item names,
163  * @note list item name max length is #APPFUNC_LIST_MAX_ITEM_NAME_SIZE. */
164  } listAttribute; /*!< Specifies list widget attribute. */
165  struct {
166  //promptStr max length : APPFUNC_INT_INPUT_BOX_PROMPT_CHAR_MAX_SIZE (32)
167  const char *promptStr; /*!< Pointer to input box additional prompt string. */
168  } intInputBoxAttribute; /*!< Specifies input box widget attribute. */
169  } widgetAttribute;
171 /**
172  * @}
173  */
174 
175 /**
176  * @}
177  */
178 
179 /* Exported variables --------------------------------------------------------*/
180 /* Exported functions --------------------------------------------------------*/
181 
182 /** @defgroup A_Func_Exported_Functions Exported Functions
183  * @{
184  */
185 
186 E_PsdkStat PsdkAppFunc_Init(T_PsdkUpper *psdkUpper);
187 E_PsdkStat PsdkAppFunc_TransferToApp(T_PsdkUpper *psdkUpper, const uint8_t *pSendData, uint16_t needSendLen,
188  uint16_t *pRealSendLen);
189 E_PsdkStat PsdkAppFunc_SetReceiveFromAppCallback(T_PsdkUpper *psdkUpper, ReceiveFromAppFunc func);
190 E_PsdkStat PsdkAppFunc_PushMsgToFloatingWindow(T_PsdkUpper *psdkUpper, const char *msg);
191 E_PsdkStat PsdkAppFunc_SetWidgetList(T_PsdkUpper *psdkUpper, const T_PsdkAppFuncWidgetListItem *widgetList,
192  uint8_t widgetItemCount);
193 E_PsdkStat PsdkAppFunc_RegGetWidgetValueCallback(T_PsdkUpper *psdkUpper, GetWidgetValueFunc getWidgetValueFunc);
194 E_PsdkStat PsdkAppFunc_RegSetWidgetValueCallback(T_PsdkUpper *psdkUpper, SetWidgetValueFunc setWidgetValueFunc);
195 E_PsdkStat PsdkAppFunc_RegGetTextInputBoxParamCallback(T_PsdkUpper *psdkUpper,
196  GetTextInputBoxParamFunc getTextInputBoxParamFunc);
197 
198 /**
199  * @}
200  */
201 
202 /* Private constants ---------------------------------------------------------*/
203 /* Private macros ------------------------------------------------------------*/
204 /* Private types -------------------------------------------------------------*/
205 /* Private variables ---------------------------------------------------------*/
206 /* Private functions ---------------------------------------------------------*/
207 
208 /**
209  * @}
210  */
211 
212 /**
213  * @}
214  */
215 
216 #ifdef __cplusplus
217 }
218 #endif
219 
220 #endif //PSDK_APP_FUNC_H
221 
222 /************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
This is a structure type for defining a top-level structure for the integration of your application w...
Definition: psdk_upper.h:113
uint8_t widgetIndex
Definition: psdk_app_func.h:144
This is the header file for "psdk_upper.c", defining the structures and (exported) function prototype...
const char * promptStr
Definition: psdk_app_func.h:167
E_PsdkAppFuncWidgetType widgetType
Definition: psdk_app_func.h:142
Widget Value Union.
Definition: psdk_cmdset_app_func.h:173
const char * widgetName
Definition: psdk_app_func.h:147
uint8_t listItemNum
Definition: psdk_app_func.h:160
This file defines the PSDK command set.
Widget detail information.
Definition: psdk_app_func.h:141