DJI::OSDK::PSDKManager Class Reference

The manager of psdk module. More...

#include <dji_psdk_manager.hpp>

Public Member Functions

 PSDKManager (Vehicle *vehiclePtr)
 
ErrorCode::ErrorCodeType initPSDKModule (PayloadIndexType index, const char *name)
 init the psdk module More...
 
ErrorCode::ErrorCodeType deinitPSDKModule (PayloadIndexType index)
 deinit the psdk module In the deinit, the psdk module will set name to be defaultPSDKName and set enable to be false. More...
 
void deinitAllPSDKModule (void)
 deinit all the psdk modules
 
ErrorCode::ErrorCodeType getPSDKModuleName (PayloadIndexType index, std::string &name)
 get the name of psdk module, searched by index More...
 
ErrorCode::ErrorCodeType getPSDKModuleIndex (const char *name, uint8_t &index)
 get the index of psdk module, searched by name More...
 
ErrorCode::ErrorCodeType getPSDKModuleEnable (PayloadIndexType index, bool &enable)
 get the enable status of psdk module, searched by index More...
 
ErrorCode::ErrorCodeType getMopClient (PayloadIndexType index, MopClient *&mopClient)
 Get the mop client object of the target psdk module. More...
 
ErrorCode::ErrorCodeType configureWidgetValueSync (PayloadIndexType index, uint8_t widgetIndex, PSDKModule::PayloadWidgetType widgetType, int widgetValue, int timeout)
 Sample to configure the value, blocking. More...
 
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. More...
 
ErrorCode::ErrorCodeType subscribePSDKWidgetValues (PayloadIndexType index, PSDKModule::PSDKWidgetValuesUserCallback cb, UserData userData)
 Sample to set the callback for widget values, non-blocking. More...
 
ErrorCode::ErrorCodeType unsubscribeWidgetValues (PayloadIndexType index)
 Sample to disable the callback for widget values, non-blocking. More...
 
VehicleCallBackHandlergetSubscribeWidgetValuesHandler (PayloadIndexType index)
 used in internal to do suhscribing task for PSDK widget More...
 
ErrorCode::ErrorCodeType subscribePSDKCommonication (PayloadIndexType index, PSDKModule::PSDKCommunicationUserCallback cb, UserData userData)
 Sample to set the callback for PSDK commonication data, non-blocking. More...
 
ErrorCode::ErrorCodeType unsubscribePSDKCommonication (PayloadIndexType index)
 Sample to disable the callback for PSDK commonication data, non-blocking. More...
 
VehicleCallBackHandlergetCommunicationHandler (PayloadIndexType index)
 used in internal to do suhscribing task for PSDK commonication data More...
 
ErrorCode::ErrorCodeType sendDataToPSDK (PayloadIndexType index, uint8_t *data, uint16_t len)
 sending data from OSDK to PSDK More...
 

Detailed Description

The manager of psdk module.

This class support the transparent communication and widget values modifying between OSDK and PSDK.

Member Function Documentation

◆ configureWidgetValueAsync()

void PSDKManager::configureWidgetValueAsync ( PayloadIndexType  index,
uint8_t  widgetIndex,
PSDKModule::PayloadWidgetType  widgetType,
int  widgetValue,
void(*)(ErrorCode::ErrorCodeType retCode, UserData userData)  UserCallBack,
UserData  userData 
)

Sample to configure the value, non-blocking.

Supported Platforms : M210V2, M300
Parameters
indexpayload node index, input limit see enum DJI::OSDK::PayloadIndexType
widgetIndexthe index of target widget
widgetTypethe type of target widget, ref to DJI::OSDK::PSDKModule::PayloadWidgetType
widgetValuethe value of target widget
UserCallBackUserCallBack callback function defined by user
userDatawhen UserCallBack is called, used in UserCallBack

◆ configureWidgetValueSync()

ErrorCode::ErrorCodeType PSDKManager::configureWidgetValueSync ( PayloadIndexType  index,
uint8_t  widgetIndex,
PSDKModule::PayloadWidgetType  widgetType,
int  widgetValue,
int  timeout 
)

Sample to configure the value, blocking.

Supported Platforms : M210V2, M300
Parameters
indexpayload node index, input limit see enum DJI::OSDK::PayloadIndexType
widgetIndexthe index of target widget
widgetTypethe type of target widget, ref to DJI::OSDK::PSDKModule::PayloadWidgetType
widgetValuethe value of target widget
timeouttimeout time in seconds to request
Returns
ErrorCode::ErrorCodeType error code

◆ deinitPSDKModule()

ErrorCode::ErrorCodeType PSDKManager::deinitPSDKModule ( PayloadIndexType  index)

deinit the psdk module In the deinit, the psdk module will set name to be defaultPSDKName and set enable to be false.

Supported Platforms : M210V2, M300
Parameters
indexpsdk module index, input limit see enum DJI::OSDK::PayloadIndexType
Returns
ErrorCode::ErrorCodeType error code

◆ getCommunicationHandler()

VehicleCallBackHandler * PSDKManager::getCommunicationHandler ( PayloadIndexType  index)

used in internal to do suhscribing task for PSDK commonication data

Parameters
indexpayload node index, input limit see enum DJI::OSDK::PayloadIndexType
Returns
handler including callback and userdata to do PSDK commonication data subscription related deocding.

◆ getMopClient()

ErrorCode::ErrorCodeType PSDKManager::getMopClient ( PayloadIndexType  index,
MopClient *&  mopClient 
)

Get the mop client object of the target psdk module.

Supported Platforms : M300
Parameters
indexpayload node index, input limit see enum DJI::OSDK::PayloadIndexType
mopClientIf this api called successfully, this pointer will point to the mop client object of target psdk module.
Returns
ErrorCode::ErrorCodeType error code

◆ getPSDKModuleEnable()

ErrorCode::ErrorCodeType PSDKManager::getPSDKModuleEnable ( PayloadIndexType  index,
bool &  enable 
)

get the enable status of psdk module, searched by index

Supported Platforms : M210V2, M300
Parameters
indexpsdk module index, input limit see enum DJI::OSDK::PayloadIndexType
enableget the enable status of PSDKModule. If get fail, this parameter will not do any assignment
Returns
ErrorCode::ErrorCodeType error code

◆ getPSDKModuleIndex()

ErrorCode::ErrorCodeType PSDKManager::getPSDKModuleIndex ( const char *  name,
uint8_t &  index 
)

get the index of psdk module, searched by name

Supported Platforms : M210V2, M300
Parameters
namename of psdk module
indexpsdk module index, see enum DJI::OSDK::PayloadIndexType. If get fail, this parameter will not do any assignment
Returns
ErrorCode::ErrorCodeType error code

◆ getPSDKModuleName()

ErrorCode::ErrorCodeType PSDKManager::getPSDKModuleName ( PayloadIndexType  index,
std::string &  name 
)

get the name of psdk module, searched by index

Supported Platforms : M210V2, M300
Parameters
indexpsdk module index, input limit see enum DJI::OSDK::PayloadIndexType
namename of the psdk module, it's a output parameter. If get fail, this parameter will not do any assignment
Returns
ErrorCode::ErrorCodeType error code

◆ getSubscribeWidgetValuesHandler()

VehicleCallBackHandler * PSDKManager::getSubscribeWidgetValuesHandler ( PayloadIndexType  index)

used in internal to do suhscribing task for PSDK widget

Parameters
indexpayload node index, input limit see enum DJI::OSDK::PayloadIndexType
Returns
handler including callback and userdata to do psdk widget subscription related deocding.

◆ initPSDKModule()

ErrorCode::ErrorCodeType PSDKManager::initPSDKModule ( PayloadIndexType  index,
const char *  name 
)

init the psdk module

Supported Platforms : M210V2, M300
Note
It should be paid attention that only one PSDK device is supported in OSDK 3.9 version. It will support more PSDK devices in the same time in the future
Parameters
indexpsdk module index, input limit see enum DJI::OSDK::PayloadIndexType
namepsdk module name used in initialization
Returns
ErrorCode::ErrorCodeType error code

◆ sendDataToPSDK()

ErrorCode::ErrorCodeType PSDKManager::sendDataToPSDK ( PayloadIndexType  index,
uint8_t *  data,
uint16_t  len 
)

sending data from OSDK to PSDK

Supported Platforms : M210V2, M300
Parameters
indexpayload node index, input limit see enum DJI::OSDK::PayloadIndexType
datasent data
lenlength of data
Returns
ErrorCode::ErrorCodeType error code

◆ subscribePSDKCommonication()

ErrorCode::ErrorCodeType PSDKManager::subscribePSDKCommonication ( PayloadIndexType  index,
PSDKModule::PSDKCommunicationUserCallback  cb,
UserData  userData 
)

Sample to set the callback for PSDK commonication data, non-blocking.

Supported Platforms : M210V2, M300
Parameters
indexpayload node index, input limit see enum DJI::OSDK::PayloadIndexType
cbthe callback to catch the communication data from PSDK.
userDatathe userData to be called by cb
Returns
ErrorCode::ErrorCodeType error code

◆ subscribePSDKWidgetValues()

ErrorCode::ErrorCodeType PSDKManager::subscribePSDKWidgetValues ( PayloadIndexType  index,
PSDKModule::PSDKWidgetValuesUserCallback  cb,
UserData  userData 
)

Sample to set the callback for widget values, non-blocking.

Supported Platforms : M210V2, M300
Note
When the widget values of target PSDK device is pushing to OSDK, the callback will be called and catch the widget values.
Parameters
indexpayload node index, input limit see enum DJI::OSDK::PayloadIndexType
cbthe callback to catch the widget values pushging.
userDatathe userData to be called by cb
Returns
ErrorCode::ErrorCodeType error code

◆ unsubscribePSDKCommonication()

ErrorCode::ErrorCodeType PSDKManager::unsubscribePSDKCommonication ( PayloadIndexType  index)

Sample to disable the callback for PSDK commonication data, non-blocking.

Supported Platforms : M210V2, M300
Parameters
indexpayload node index, input limit see enum DJI::OSDK::PayloadIndexType
Returns
ErrorCode::ErrorCodeType error code

◆ unsubscribeWidgetValues()

ErrorCode::ErrorCodeType PSDKManager::unsubscribeWidgetValues ( PayloadIndexType  index)

Sample to disable the callback for widget values, non-blocking.

Supported Platforms : M210V2, M300
Parameters
indexpayload node index, input limit see enum DJI::OSDK::PayloadIndexType
Returns
ErrorCode::ErrorCodeType error code

The documentation for this class was generated from the following files: