PSDK module. More...

#include <dji_psdk_module.hpp>

Inheritance diagram for DJI::OSDK::PSDKModule:

Classes

struct  PSDKWidgetValuesData
 Capturing PushData of PSDK widget values, CMD: 0x00, 0x07. More...
 

Public Types

enum  FunctionID { FUNCTION_SET_PSDK_1_0_WIDGET_VALUE = 70 }
 
enum  PayloadWidgetType {
  BUTTON = 1,
  SWITCH = 2,
  RANGE = 3,
  LIST = 4,
  INPUT = 5,
  UNKNOWN = 0xFF
}
 
typedef struct DJI::OSDK::PSDKModule::PSDKWidgetInfo PSDKWidgetInfo
 
typedef struct DJI::OSDK::PSDKModule::PSDKWidgetReq PSDKWidgetReq
 
typedef struct DJI::OSDK::PSDKModule::PSDKWidgetRsp PSDKWidgetRsp
 
typedef struct DJI::OSDK::PSDKModule::PSDKWidgetValuesData PSDKWidgetValuesData
 Capturing PushData of PSDK widget values, CMD: 0x00, 0x07.
 
typedef void(* PSDKWidgetValuesUserCallback) (std::vector< PSDKWidgetInfo > widgets, UserData userData)
 
typedef struct DJI::OSDK::PSDKModule::PSDKWidgetValuesUserHandler PSDKWidgetValuesUserHandler
 
typedef void(* PSDKCommunicationUserCallback) (uint8_t *dataBuf, uint16_t dataLen, UserData userData)
 
typedef struct DJI::OSDK::PSDKModule::PSDKCommonicationUserHandler PSDKCommonicationUserHandler
 

Public Member Functions

 PSDKModule (PayloadLink *payloadLink, PayloadIndexType payloadIndex, std::string name, bool enable)
 
MopClientgetMopClient ()
 
ErrorCode::ErrorCodeType configureWidgetValueSync (uint8_t widgetIndex, PayloadWidgetType widgetType, int widgetValue, int timeout)
 Sample to configure the value, blocking. More...
 
void configureWidgetValueAsync (uint8_t widgetIndex, PayloadWidgetType widgetType, int widgetValue, void(*UserCallBack)(ErrorCode::ErrorCodeType retCode, UserData userData), UserData userData)
 Sample to configure the value, non-blocking. More...
 
ErrorCode::ErrorCodeType subscribePSDKWidgetValues (PSDKWidgetValuesUserCallback cb, UserData userData)
 Sample to set the callback for widget values, non-blocking. More...
 
ErrorCode::ErrorCodeType unsubscribeWidgetValues ()
 Sample to disable the callback for widget values, non-blocking. More...
 
VehicleCallBackHandlergetSubscribeWidgetValuesHandler ()
 used in internal to do suhscribing task for PSDK widget More...
 
ErrorCode::ErrorCodeType subscribePSDKCommonication (PSDKCommunicationUserCallback cb, UserData userData)
 Sample to set the callback for PSDK commonication data, non-blocking. More...
 
ErrorCode::ErrorCodeType unsubscribePSDKCommonication ()
 Sample to disable the callback for PSDK commonication data, non-blocking. More...
 
VehicleCallBackHandlergetCommunicationHandler ()
 used in internal to do suhscribing task for PSDK commonication data More...
 
ErrorCode::ErrorCodeType sendDataToPSDK (uint8_t *data, uint16_t len)
 sending data from OSDK to PSDK More...
 
- Public Member Functions inherited from DJI::OSDK::PayloadBase
 PayloadBase (Linker *linker, PayloadIndexType index, std::string name, bool enable)
 
void setEnable (bool en)
 set the enable status of this payload module More...
 
bool getEnable ()
 get the enable status of this payload module More...
 
PayloadIndexType getIndex ()
 
std::string getName ()
 
void setName (std::string name)
 
Linker * getLinker ()
 

Static Public Attributes

static const uint8_t psdkWidgetMaxCount = 30
 
static const uint16_t MAX_SIZE_OF_PACKAGE = 255
 

Detailed Description

PSDK module.

Member Enumeration Documentation

◆ PayloadWidgetType

Enumerator
BUTTON 

Button widget could return the widget value of 1 or 0, normally it's widget value is 0, when the button is being pressed the widget value will change to 1.

SWITCH 

Switch widget could return the widget value of 1 or 0, when the switch is changed to "ON" state, the widget value will change to 1, if the switch is changed to "OFF" state, the widget value will change to 0.

RANGE 

Range widget could return the widget value between 0 - 100 (inclusive).

LIST 

List widget could return the int value between 0 and N, N is determined by the firmware, the size of sub items returned by getSubItems() method in PayloadWidget will be N+1

INPUT 

Input widget could be set with any int value, the default value is determined by the firmware.

UNKNOWN 

Unknown widget type

Member Function Documentation

◆ configureWidgetValueAsync()

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

Sample to configure the value, non-blocking.

Parameters
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 DJI::OSDK::PSDKModule::configureWidgetValueSync ( uint8_t  widgetIndex,
PayloadWidgetType  widgetType,
int  widgetValue,
int  timeout 
)

Sample to configure the value, blocking.

Parameters
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

◆ getCommunicationHandler()

VehicleCallBackHandler* DJI::OSDK::PSDKModule::getCommunicationHandler ( )

used in internal to do suhscribing task for PSDK commonication data

Returns
handler including callback and userdata to do PSDK commonication data subscription related deocding.

◆ getMopClient()

MopClient* DJI::OSDK::PSDKModule::getMopClient ( )

@breif Get the object of the mop client of this psdk module

◆ getSubscribeWidgetValuesHandler()

VehicleCallBackHandler* DJI::OSDK::PSDKModule::getSubscribeWidgetValuesHandler ( )

used in internal to do suhscribing task for PSDK widget

Returns
handler including callback and userdata to do psdk widget subscription related deocding.

◆ sendDataToPSDK()

ErrorCode::ErrorCodeType DJI::OSDK::PSDKModule::sendDataToPSDK ( uint8_t *  data,
uint16_t  len 
)

sending data from OSDK to PSDK

Parameters
datasent data
lenlength of data
Returns
ErrorCode::ErrorCodeType error code

◆ subscribePSDKCommonication()

ErrorCode::ErrorCodeType DJI::OSDK::PSDKModule::subscribePSDKCommonication ( PSDKCommunicationUserCallback  cb,
UserData  userData 
)

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

Parameters
cbthe callback to catch the communication data from PSDK.
userDatathe userData to be called by cb
Returns
ErrorCode::ErrorCodeType error code

◆ subscribePSDKWidgetValues()

ErrorCode::ErrorCodeType DJI::OSDK::PSDKModule::subscribePSDKWidgetValues ( PSDKWidgetValuesUserCallback  cb,
UserData  userData 
)

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

Note
When the widget values of target PSDK device is pushing to OSDK, the callback will be called and catch the widget values.
Parameters
cbthe callback to catch the widget values pushging.
userDatathe userData to be called by cb
Returns
ErrorCode::ErrorCodeType error code

◆ unsubscribePSDKCommonication()

ErrorCode::ErrorCodeType DJI::OSDK::PSDKModule::unsubscribePSDKCommonication ( )

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

Returns
ErrorCode::ErrorCodeType error code

◆ unsubscribeWidgetValues()

ErrorCode::ErrorCodeType DJI::OSDK::PSDKModule::unsubscribeWidgetValues ( )

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

Returns
ErrorCode::ErrorCodeType error code

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