dji_psdk_manager.hpp
Go to the documentation of this file.
1 
29 #ifndef ONBOARDSDK_DJI_PSDK_MANAGER_HPP
30 #define ONBOARDSDK_DJI_PSDK_MANAGER_HPP
31 
32 #include <vector>
33 #include "dji_psdk_module.hpp"
34 
35 namespace DJI {
36 namespace OSDK {
41 class PSDKManager {
42  public:
43  PSDKManager(Vehicle *vehiclePtr);
44 
45  ~PSDKManager();
46 
47  public:
60  const char *name);
61 
72 
75  void deinitAllPSDKModule(void);
76 
87  std::string &name);
88 
97  ErrorCode::ErrorCodeType getPSDKModuleIndex(const char *name, uint8_t &index);
98 
109  bool &enable);
110 
111  public:
112 #if defined(__linux__)
113 
123  PayloadIndexType index, MopClient *&mopClient);
124 #endif
125 
138  PayloadIndexType index, uint8_t widgetIndex,
139  PSDKModule::PayloadWidgetType widgetType, int widgetValue, int timeout);
140 
154  PayloadIndexType index, uint8_t widgetIndex,
155  PSDKModule::PayloadWidgetType widgetType, int widgetValue,
156  void (*UserCallBack)(ErrorCode::ErrorCodeType retCode, UserData userData),
157  UserData userData);
158 
171  PayloadIndexType index, PSDKModule::PSDKWidgetValuesUserCallback cb,
172  UserData userData);
173 
182 
191  PayloadIndexType index);
192 
204  PayloadIndexType index, PSDKModule::PSDKCommunicationUserCallback cb,
205  UserData userData);
206 
216 
225 
236  uint16_t len);
237 
238  private:
239  PayloadLink *payloadLink;
240  std::vector<PSDKModule *> psdkModuleVector;
241 
247  PSDKModule *getPSDKModule(PayloadIndexType index);
248 
253  PSDKModule *getPSDKModule(std::string name);
254 
256  const char *defaultPSDKName = "uninitialized_psdk";
257 };
258 
259 } // namespace OSDK
260 } // namespace DJI
261 
262 #endif // ONBOARDSDK_DJI_PSDK_MANAGER_HPP
void * UserData
This is used as the datatype for all data arguments in callbacks.
Definition: dji_type.hpp:75
Implementation of psdk module for payload node.
ErrorCode::ErrorCodeType sendDataToPSDK(PayloadIndexType index, uint8_t *data, uint16_t len)
sending data from OSDK to PSDK
Definition: dji_psdk_manager.cpp:241
ErrorCode::ErrorCodeType getPSDKModuleIndex(const char *name, uint8_t &index)
get the index of psdk module, searched by name
Definition: dji_psdk_manager.cpp:114
int64_t ErrorCodeType
Unified error type.
Definition: dji_error.hpp:144
PSDK module.
Definition: dji_psdk_module.hpp:43
ErrorCode::ErrorCodeType unsubscribePSDKCommonication(PayloadIndexType index)
Sample to disable the callback for PSDK commonication data, non-blocking.
Definition: dji_psdk_manager.cpp:221
ErrorCode::ErrorCodeType initPSDKModule(PayloadIndexType index, const char *name)
init the psdk module
Definition: dji_psdk_manager.cpp:70
PayloadIndexType
The payload Index of camera.
Definition: dji_payload_base.hpp:42
ErrorCode::ErrorCodeType subscribePSDKCommonication(PayloadIndexType index, PSDKModule::PSDKCommunicationUserCallback cb, UserData userData)
Sample to set the callback for PSDK commonication data, non-blocking.
Definition: dji_psdk_manager.cpp:210
ErrorCode::ErrorCodeType unsubscribeWidgetValues(PayloadIndexType index)
Sample to disable the callback for widget values, non-blocking.
Definition: dji_psdk_manager.cpp:190
ErrorCode::ErrorCodeType getPSDKModuleName(PayloadIndexType index, std::string &name)
get the name of psdk module, searched by index
Definition: dji_psdk_manager.cpp:103
ErrorCode::ErrorCodeType deinitPSDKModule(PayloadIndexType index)
deinit the psdk module In the deinit, the psdk module will set name to be defaultPSDKName and set ena...
Definition: dji_psdk_manager.cpp:84
void configureWidgetValueAsync(PayloadIndexType index, uint8_t widgetIndex, PSDKModule::PayloadWidgetType widgetType, int widgetValue, void(*UserCallBack)(ErrorCode::ErrorCodeType retCode, UserData userData), UserData userData)
Sample to configure the value, non-blocking.
Definition: dji_psdk_manager.cpp:164
VehicleCallBackHandler * getSubscribeWidgetValuesHandler(PayloadIndexType index)
used in internal to do suhscribing task for PSDK widget
Definition: dji_psdk_manager.cpp:200
The CallBackHandler struct allows users to encapsulate callbacks and data in one struct.
Definition: dji_vehicle_callback.hpp:83
ErrorCode::ErrorCodeType getMopClient(PayloadIndexType index, MopClient *&mopClient)
Get the mop client object of the target psdk module.
Definition: dji_psdk_manager.cpp:137
PayloadWidgetType
Definition: dji_psdk_module.hpp:51
void deinitAllPSDKModule(void)
deinit all the psdk modules
Definition: dji_psdk_manager.cpp:96
ErrorCode::ErrorCodeType subscribePSDKWidgetValues(PayloadIndexType index, PSDKModule::PSDKWidgetValuesUserCallback cb, UserData userData)
Sample to set the callback for widget values, non-blocking.
Definition: dji_psdk_manager.cpp:179
Definition: dji_ack.cpp:38
The manager of psdk module.
Definition: dji_psdk_manager.hpp:41
VehicleCallBackHandler * getCommunicationHandler(PayloadIndexType index)
used in internal to do suhscribing task for PSDK commonication data
Definition: dji_psdk_manager.cpp:231
ErrorCode::ErrorCodeType getPSDKModuleEnable(PayloadIndexType index, bool &enable)
get the enable status of psdk module, searched by index
Definition: dji_psdk_manager.cpp:125
Class providing APIs & data structures for acting as a MOP client.
Definition: dji_mop_client.hpp:43
ErrorCode::ErrorCodeType configureWidgetValueSync(PayloadIndexType index, uint8_t widgetIndex, PSDKModule::PayloadWidgetType widgetType, int widgetValue, int timeout)
Sample to configure the value, blocking.
Definition: dji_psdk_manager.cpp:152