DJI Typedef
The header file of Typedef is dji_typedef.h
. This document describes the key information and usage of macro definitions and structures in the dji_typedef.h
file.
Definition
#define DJI_PI (3.14159265358979323846f)
#define DJI_FILE_NAME_SIZE_MAX 256
#define DJI_FILE_PATH_SIZE_MAX (DJI_FILE_NAME_SIZE_MAX + 256)
#define DJI_IP_ADDR_STR_SIZE_MAX 15
#define DJI_MD5_BUFFER_LEN 16
#define DJI_SUBSCRIPTION_MODULE_INDEX_OFFSET 24u
#define DJI_SUBSCRIPTION_MODULE_INDEX_MASK 0xFF000000u
#define DJI_SUBSCRIPTION_TOPIC_CODE_OFFSET 0u
#define DJI_SUBSCRIPTION_TOPIC_CODE_MASK 0x00FFFFFFu
#define DJI_DATA_SUBSCRIPTION_TOPIC(subscriptionModule, topicCode) \
(uint32_t)\
(((((uint32_t)(subscriptionModule)) << (DJI_SUBSCRIPTION_MODULE_INDEX_OFFSET)) & (DJI_SUBSCRIPTION_MODULE_INDEX_MASK)) | \
((((uint32_t)(topicCode)) << (DJI_SUBSCRIPTION_TOPIC_CODE_OFFSET)) & (DJI_SUBSCRIPTION_TOPIC_CODE_MASK)))
Data Type
typedef double dji_f64_t;
typedef float dji_f32_t;
typedef uint64_t T_DjiReturnCode;
Enum
typedef enum E_DjiMountPositionType
typedef enum {
DJI_MOUNT_POSITION_TYPE_UNKNOWN = 0,
DJI_MOUNT_POSITION_TYPE_PAYLOAD_PORT = 1,
DJI_MOUNT_POSITION_TYPE_EXTENSION_PORT = 2,
DJI_MOUNT_POSITION_TYPE_EXTENSION_LITE_PORT = 3
} E_DjiMountPositionType;
typedef enum E_DjiMountPosition
typedef enum {
DJI_MOUNT_POSITION_UNKNOWN = 0,
DJI_MOUNT_POSITION_PAYLOAD_PORT_NO1 = 1,
DJI_MOUNT_POSITION_PAYLOAD_PORT_NO2 = 2,
DJI_MOUNT_POSITION_PAYLOAD_PORT_NO3 = 3,
DJI_MOUNT_POSITION_EXTENSION_PORT = 4,
DJI_MOUNT_POSITION_EXTENSION_LITE_PORT = 5,
} E_DjiMountPosition;
typedef enum E_DjiAircraftSeries
typedef enum {
DJI_AIRCRAFT_SERIES_UNKNOWN = 0,
DJI_AIRCRAFT_SERIES_M200_V2 = 1,
DJI_AIRCRAFT_SERIES_M300 = 2,
DJI_AIRCRAFT_SERIES_M30 = 3,
DJI_AIRCRAFT_SERIES_M3 = 4,
DJI_AIRCRAFT_SERIES_M350 = 5,
DJI_AIRCRAFT_SERIES_M3D = 6,
DJI_AIRCRAFT_SERIES_FC30 = 7,
} E_DjiAircraftSeries;
typedef enum E_DjiAircraftType
typedef enum {
DJI_AIRCRAFT_TYPE_UNKNOWN = 0, /*!< unknown */
DJI_AIRCRAFT_TYPE_M200_V2 = 44, /*!< Matrice 200 V2 */
DJI_AIRCRAFT_TYPE_M210_V2 = 45, /*!< Matrice 220 V2 */
DJI_AIRCRAFT_TYPE_M210RTK_V2 = 46, /*!< Matrice 210 RTK V2 */
DJI_AIRCRAFT_TYPE_M300_RTK = 60, /*!< Matrice 300 RTK */
DJI_AIRCRAFT_TYPE_M30 = 67, /*!< Matrice 30 */
DJI_AIRCRAFT_TYPE_M30T = 68, /*!< Matrice 30T */
DJI_AIRCRAFT_TYPE_M3E = 77, /*!< Mavic 3E */
DJI_AIRCRAFT_TYPE_FC30 = 78, /* !<FlyCart 30> */
DJI_AIRCRAFT_TYPE_M3T = 79, /*!< Mavic 3T */
DJI_AIRCRAFT_TYPE_M350_RTK = 89, /*!< Matrice 350 RTK */
DJI_AIRCRAFT_TYPE_M3D = 91, /*!< Matrice 3D */
DJI_AIRCRAFT_TYPE_M3TD = 93, /*!< Matrice 3TD */
} E_DjiAircraftType;
typedef enum E_DjiCameraType
typedef enum {
DJI_CAMERA_TYPE_UNKNOWN = 0, /*!< Camera type is unknown. */
DJI_CAMERA_TYPE_Z30 = 20, /*!< Camera type is Z30. */
DJI_CAMERA_TYPE_XT2 = 26, /*!< Camera type is XT2. */
DJI_CAMERA_TYPE_PSDK = 31, /*!< Camera type is third party camera based on Payload SDK. */
DJI_CAMERA_TYPE_XTS = 41, /*!< Camera type is XT S. */
DJI_CAMERA_TYPE_H20 = 42, /*!< Camera type is H20. */
DJI_CAMERA_TYPE_H20T = 43, /*!< Camera type is H20T. */
DJI_CAMERA_TYPE_H20N = 61, /*!< Camera type is H20N. */
DJI_CAMERA_TYPE_P1 = 50, /*!< Camera type is P1. */
DJI_CAMERA_TYPE_L1, /*!< Camera type is L1. */
DJI_CAMERA_TYPE_L2, /*!< Camera type is L2. */
DJI_CAMERA_TYPE_M30, /*!< Camera type is M30. */
DJI_CAMERA_TYPE_M30T, /*!< Camera type is M30T. */
DJI_CAMERA_TYPE_M3E, /*!< Camera type is M3E. */
DJI_CAMERA_TYPE_M3T, /*!< Camera type is M3T. */
DJI_CAMERA_TYPE_M3D, /*!< Camera type is Matrice 3D. */
DJI_CAMERA_TYPE_M3TD, /*!< Camera type is Matrice 3TD. */
} E_DjiCameraType;
typedef enum E_DjiCameraMediaFileType
typedef enum {
DJI_CAMERA_FILE_TYPE_JPEG = 0, /*!< Media file JPEG type. */
DJI_CAMERA_FILE_TYPE_DNG = 1, /*!< Media file DNG type. */
DJI_CAMERA_FILE_TYPE_MOV = 2, /*!< Media file MOV type. */
DJI_CAMERA_FILE_TYPE_MP4 = 3, /*!< Media file MP4 type. */
DJI_CAMERA_FILE_TYPE_UNKNOWN = 255, /*!< Media file unknown type. */
} E_DjiCameraMediaFileType;
typedef enum E_DjiGimbalMode
typedef enum {
DJI_GIMBAL_MODE_FREE = 0, /*!< Free mode, fix gimbal attitude in the ground coordinate, ignoring movement of aircraft. */
DJI_GIMBAL_MODE_FPV = 1, /*!< FPV (First Person View) mode, only control roll and yaw angle of gimbal in the ground coordinate to follow aircraft. */
DJI_GIMBAL_MODE_YAW_FOLLOW = 2, /*!< Yaw follow mode, only control yaw angle of gimbal in the ground coordinate to follow aircraft. */
} E_DjiGimbalMode;
typedef enum E_DjiGimbalRotationMode
typedef enum {
DJI_GIMBAL_ROTATION_MODE_RELATIVE_ANGLE = 0, /*!< Relative angle rotation mode, represents rotating gimbal specified angles based on current angles. */
DJI_GIMBAL_ROTATION_MODE_ABSOLUTE_ANGLE = 1, /*!< Absolute angle rotation mode, represents rotating gimbal to specified angles in the ground coordinate. */
DJI_GIMBAL_ROTATION_MODE_SPEED = 2, /*!< Speed rotation mode, specifies rotation speed of gimbal in the ground coordinate. */
} E_DjiGimbalRotationMode;
typedef enum E_DjiMobileAppLanguage
typedef enum {
DJI_MOBILE_APP_LANGUAGE_UNKNOWN = 255, /*!< The system language of the mobile app is unknown */
DJI_MOBILE_APP_LANGUAGE_ENGLISH = 0, /*!< The system language of the mobile app is English */
DJI_MOBILE_APP_LANGUAGE_CHINESE = 1, /*!< The system language of the mobile app is Chinese */
DJI_MOBILE_APP_LANGUAGE_JAPANESE = 2, /*!< The system language of the mobile app is Japanese */
DJI_MOBILE_APP_LANGUAGE_FRENCH = 3, /*!< The system language of the mobile app is French */
} E_DjiMobileAppLanguage;
typedef enum E_DjiMobileAppScreenType
typedef enum {
DJI_MOBILE_APP_SCREEN_TYPE_UNKNOWN = 255, /*!< Mobile APP screen type is unknown. */
DJI_MOBILE_APP_SCREEN_TYPE_BIG_SCREEN = 0, /*!< The big screen of mobile device refers to a screen
* size greater than or equal to 6 inches. */
DJI_MOBILE_APP_SCREEN_TYPE_LITTLE_SCREEN = 1, /*!< The little screen of mobile device refers to a
* screen size less than 6 inches. */
} E_DjiMobileAppScreenType;
typedef enum E_DjiMobileAppScreenType
typedef enum {
DJI_DATA_SUBSCRIPTION_TOPIC_1_HZ = 1,
DJI_DATA_SUBSCRIPTION_TOPIC_5_HZ = 5,
DJI_DATA_SUBSCRIPTION_TOPIC_10_HZ = 10,
DJI_DATA_SUBSCRIPTION_TOPIC_50_HZ = 50,
DJI_DATA_SUBSCRIPTION_TOPIC_100_HZ = 100,
DJI_DATA_SUBSCRIPTION_TOPIC_200_HZ = 200,
DJI_DATA_SUBSCRIPTION_TOPIC_400_HZ = 400,
} E_DjiDataSubscriptionTopicFreq;
typedef enum E_DjiDataSubscriptionModule
DJI 模块枚举,用于定义数据订阅模块
typedef enum {
DJI_DATA_SUBSCRIPTION_MODULE_FC = 0,
DJI_DATA_SUBSCRIPTION_MODULE_CAMERA,
DJI_DATA_SUBSCRIPTION_MODULE_ERROR,
} E_DjiDataSubscriptionModule;
typedef enum E_DjiSdkAdapterType
typedef enum {
DJI_SDK_ADAPTER_TYPE_UNKNOWN = 0, /*!< SDK adapter type is unknown. */
DJI_SDK_ADAPTER_TYPE_SKYPORT_V2 = 1, /*!< SDK adapter type is Skyport V2. */
DJI_SDK_ADAPTER_TYPE_XPORT = 2, /*!< SDK adapter type is X-Port. */
DJI_SDK_ADAPTER_TYPE_NONE = 3, /*!< don't have any adapter outside */
} E_DjiSdkAdapterType;
typedef enum E_DjiChannelAddress
typedef enum {
DJI_CHANNEL_ADDRESS_UNKNOWN = 0,
DJI_CHANNEL_ADDRESS_PAYLOAD_PORT_NO1,
DJI_CHANNEL_ADDRESS_PAYLOAD_PORT_NO2,
DJI_CHANNEL_ADDRESS_PAYLOAD_PORT_NO3,
DJI_CHANNEL_ADDRESS_EXTENSION_PORT,
DJI_CHANNEL_ADDRESS_MASTER_RC_APP,
DJI_CHANNEL_ADDRESS_SLAVE_RC_APP,
} E_DjiChannelAddress;
typedef enum E_DjiCameraZoomSpeed
typedef enum {
DJI_CAMERA_ZOOM_SPEED_SLOWEST = 72, /*!< Lens zooms in slowest speed. */
DJI_CAMERA_ZOOM_SPEED_SLOW = 73, /*!< Lens zooms in slow speed. */
DJI_CAMERA_ZOOM_SPEED_MODERATELY_SLOW = 74, /*!< Lens zooms in speed slightly slower than normal speed. */
DJI_CAMERA_ZOOM_SPEED_NORMAL = 75, /*!< Lens zooms in normal speed. */
DJI_CAMERA_ZOOM_SPEED_MODERATELY_FAST = 76, /*!< Lens zooms very in speed slightly faster than normal speed. */
DJI_CAMERA_ZOOM_SPEED_FAST = 77, /*!< Lens zooms very in fast speed. */
DJI_CAMERA_ZOOM_SPEED_FASTEST = 78, /*!< Lens zooms very in fastest speed. */
} E_DjiCameraZoomSpeed;
typedef enum E_DjiCameraBurstCount
typedef enum {
/*! The number of pictures to continuously take each time in BURST mode is 2
*/
DJI_CAMERA_BURST_COUNT_2 = 2,
/*! The number of pictures to continuously take each time in BURST mode is 3
*/
DJI_CAMERA_BURST_COUNT_3 = 3,
/*! The number of pictures to continuously take each time in BURST mode is 5
*/
DJI_CAMERA_BURST_COUNT_5 = 5,
/*! The number of pictures to continuously take each time in BURST mode is 7
*/
DJI_CAMERA_BURST_COUNT_7 = 7,
/*! The number of pictures to continuously take at one time in BURST mode is
* 10, Only supported by X4S camera, X5S camera and Phantom 4 Pro camera.
*/
DJI_CAMERA_BURST_COUNT_10 = 10,
/*! The number of pictures to continuously take at one time in BURST mode is
* 14, Only supported by X4S camera, X5S camera and Phantom 4 Pro camera.
*/
DJI_CAMERA_BURST_COUNT_14 = 14,
/*! The camera burst shoot count value is unknown.
*/
DJI_CAMERA_BURST_COUNT_KNOWN = 0xFF,
} E_DjiCameraBurstCount;
typedef enum E_DjiCameraZoomDirection
typedef enum {
DJI_CAMERA_ZOOM_DIRECTION_OUT = 0, /*!< The lens moves in the far direction, the zoom factor becomes smaller. */
DJI_CAMERA_ZOOM_DIRECTION_IN = 1, /*!< The lens moves in the near direction, the zoom factor becomes larger. */
} E_DjiCameraZoomDirection;
Struct
typedef struct T_DjiCameraOpticalZoomSpec
typedef struct {
uint16_t maxFocalLength; /*!< The maximum focal length of the lens, unit: 0.1mm. */
uint16_t minFocalLength; /*!< The minimum focal length of the lens, unit: 0.1mm. */
uint16_t focalLengthStep; /*!< The minimum interval of focal length change, unit: 0.1mm. */
} T_DjiCameraOpticalZoomSpec;
typedef struct T_DjiCameraPointInScreen
typedef struct {
dji_f32_t focusX; /*!< Specifies horizontal zone coordinate. This parameter is between 0 and 1.
The point [0.0, 0.0] represents the top-left angle of the screen.*/
dji_f32_t focusY; /*!< Specifies vertical zone coordinate. This parameter is between 0 and 1. */
} T_DjiCameraPointInScreen;
typedef struct T_DjiCameraPhotoTimeIntervalSettings
typedef struct {
uint8_t captureCount; /*!< Specifies the total capture count of interval settings.
* 0:reserve 1~254:number 255:keep capturing till stop */
uint16_t timeIntervalSeconds; /*!< Specifies the interval time between two captures, unit: s*/
} T_DjiCameraPhotoTimeIntervalSettings;
typedef struct T_DjiDataChannelState
typedef struct {
/*! Realtime bandwidth limitation, varying with link status of aircraft system for some channels, such as data
* stream, video stream and download stream. Must ensure actual bandwidth of data transmission is less than
* realtime bandwidth limitation, unit: byte/s. */
int32_t realtimeBandwidthLimit;
/*! Realtime actual transmission bandwidth of data transmission channel calculated before flow controller, unit: byte/s. */
int32_t realtimeBandwidthBeforeFlowController;
/*! Realtime actual transmission bandwidth of data transmission channel calculated after flow controller, unit:
* byte/s. If specified channel without flow controller. the value is equal to
* ::realtimeBandwidthBeforeFlowController. */
int32_t realtimeBandwidthAfterFlowController;
/*! State specified whether the channel is busy or not. When data can not be sent to the endpoint directly, instead be
* sent to buffer of flow controller or discarded, the busy state will be set. At this time, the user should stop
* transmitting data or decrease the amount of data to be transmitted via this channel. When data bandwidth restore to
* normal, this state will be clear again. */
bool busyState;
} T_DjiDataChannelState;
typedef struct T_DjiVector3d
typedef struct Vector3d {
int32_t x; /*!< Specifies int32 value of x for vector. */
int32_t y; /*!< Specifies int32 value of y for vector. */
int32_t z; /*!< Specifies int32 value of z for vector. */
} T_DjiVector3d;
typedef struct T_DjiVector3f
typedef struct Vector3f {
dji_f32_t x; /*!< Specifies float value of x for vector. */
dji_f32_t y; /*!< Specifies float value of y for vector. */
dji_f32_t z; /*!< Specifies float value of z for vector. */
} T_DjiVector3f;
typedef struct T_DjiAttitude3d
typedef struct {
int32_t pitch; /*!< Specifies int32 value of pitch for attitude. */
int32_t roll; /*!< Specifies int32 value of roll for attitude */
int32_t yaw; /*!< Specifies int32 value of yaw for attitude */
} T_DjiAttitude3d;
typedef struct T_DjiAttitude3f
typedef struct {
dji_f32_t pitch; /*!< Specifies float value of pitch for attitude. */
dji_f32_t roll; /*!< Specifies float value of roll for attitude */
dji_f32_t yaw; /*!< Specifies float value of yaw for attitude */
} T_DjiAttitude3f;
typedef struct T_DjiQuaternion4f
typedef struct {
dji_f32_t q0; /*!< w, when converted to a rotation matrix or Euler angles. */
dji_f32_t q1; /*!< x, when converted to a rotation matrix or Euler angles. */
dji_f32_t q2; /*!< y, when converted to a rotation matrix or Euler angles. */
dji_f32_t q3; /*!< z, when converted to a rotation matrix or Euler angles. */
} T_DjiQuaternion4f;
typedef struct T_DjiDataTimestamp
typedef struct {
uint32_t millisecond; /*!< Millisecond. */
uint32_t microsecond; /*!< Microsecond. */
} T_DjiDataTimestamp;
typedef function DjiReceiveDataOfTopicCallback
Prototype of callback function used to receive data of topic.
@warning User can not execute blocking style operations or functions in the callback function, because that will block PSDK root thread, causing problems such as slow system response, payload disconnection or infinite loop.
typedef T_DjiReturnCode (*DjiReceiveDataOfTopicCallback)(const uint8_t *data, uint16_t dataSize,
const T_DjiDataTimestamp *timestamp);
data: pointer to data of the topic, user need transfer type of this pointer to the corresponding data structure pointer for getting every item of the topic conveniently.
dataSize: the size of memory space pointed by data argument, equal to data structure size corresponding to the topic.
timestamp: pointer to timestamp corresponding this data.
Return
The details for the return code please refer to: DjiErrorCode