上传psdk所有文件

This commit is contained in:
tangchao0503
2022-11-21 12:16:25 +08:00
parent 164ed89840
commit f896a708ea
979 changed files with 3057460 additions and 8 deletions

View File

@ -0,0 +1,132 @@
/**
********************************************************************
* @file psdk_aircraft_info.h
* @brief This is the header file for "psdk_aircraft_info.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2018 DJI. All rights reserved.
*
* All information contained herein is, and remains, the property of DJI.
* The intellectual and technical concepts contained herein are proprietary
* to DJI and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of DJI.
*
* If you receive this source code without DJIs authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify DJI of its removal. DJI reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef PSDK_AIRCRAFT_INFO_H
#define PSDK_AIRCRAFT_INFO_H
/* Includes ------------------------------------------------------------------*/
#include "psdk_typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief Aircraft type.
*/
typedef enum {
PSDK_AIRCRAFT_INFO_TYPE_UNKNOWN = 0, /*!< Aircraft type is unknown. */
PSDK_AIRCRAFT_INFO_TYPE_M200_V2 = 44, /*!< Aircraft type is Matrice 200 V2. */
PSDK_AIRCRAFT_INFO_TYPE_M210_V2 = 45, /*!< Aircraft type is Matrice 220 V2. */
PSDK_AIRCRAFT_INFO_TYPE_M210RTK_V2 = 46, /*!< Aircraft type is Matrice 210 RTK V2. */
PSDK_AIRCRAFT_INFO_TYPE_M300_RTK = 60, /*!< Aircraft type is Matrice 300 RTK. */
} E_PsdkAircraftInfoType;
/**
* @brief PSDK adapter type.
*/
typedef enum {
PSDK_AIRCRAFT_INFO_PSDK_ADAPTER_TYPE_UNKNOWN = 0, /*!< PSDK adapter type is unknown. */
PSDK_AIRCRAFT_INFO_PSDK_ADAPTER_TYPE_SKYPORT_V2 = 1, /*!< PSDK adapter type is Skyport V2. */
PSDK_AIRCRAFT_INFO_PSDK_ADAPTER_TYPE_XPORT = 2, /*!< PSDK adapter type is X-Port. */
} E_PsdkAircraftInfoPsdkAdapterType;
/**
* @brief Payload mount position.
*/
typedef enum {
PSDK_AIRCRAFT_INFO_PAYLOAD_MOUNT_POSITION_UNKNOWN = 0, /*!< Payload mount position is unknown.. */
PSDK_AIRCRAFT_INFO_PAYLOAD_MOUNT_POSITION_NO1 = 1, /*!< Payload is mounted on the first gimbal connector of aircraft. */
PSDK_AIRCRAFT_INFO_PAYLOAD_MOUNT_POSITION_NO2 = 2, /*!< Payload is mounted on the second gimbal connector of aircraft. */
PSDK_AIRCRAFT_INFO_PAYLOAD_MOUNT_POSITION_NO3 = 3, /*!< Payload is mounted on the third gimbal connector of aircraft. */
} E_PsdkAircraftInfoPayloadMountPosition;
/**
* @brief Mobile APP system language.
*/
typedef enum {
PSDK_AIRCRAFT_INFO_MOBILE_APP_LANGUAGE_UNKNOWN = 255, /*!< The system language of the mobile app is unknown */
PSDK_AIRCRAFT_INFO_MOBILE_APP_LANGUAGE_ENGLISH = 0, /*!< The system language of the mobile app is English */
PSDK_AIRCRAFT_INFO_MOBILE_APP_LANGUAGE_CHINESE = 1, /*!< The system language of the mobile app is Chinese */
PSDK_AIRCRAFT_INFO_MOBILE_APP_LANGUAGE_JAPANESE = 2, /*!< The system language of the mobile app is Japanese */
PSDK_AIRCRAFT_INFO_MOBILE_APP_LANGUAGE_FRENCH = 3, /*!< The system language of the mobile app is French */
} E_PsdkAircraftInfoMobileAppLanguage;
/**
* @brief Mobile APP screen size type.
*/
typedef enum {
PSDK_AIRCRAFT_INFO_MOBILE_APP_SCREEN_TYPE_UNKNOWN = 255, /*!< Mobile APP screen type is unknown. */
PSDK_AIRCRAFT_INFO_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. */
PSDK_AIRCRAFT_INFO_MOBILE_APP_SCREEN_TYPE_LITTLE_SCREEN = 1, /*!< The little screen of mobile device refers to a
* screen size less than 6 inches. */
} E_PsdkAircraftInfoMobileAppScreenType;
/**
* @brief Some base information of aircraft system, mainly including some constant parameters information of system.
*/
typedef struct {
E_PsdkAircraftInfoType aircraftType; /*!< Aircraft type. */
E_PsdkAircraftInfoPsdkAdapterType psdkAdapterType; /*!< PSDK adapter type. */
E_PsdkAircraftInfoPayloadMountPosition payloadMountPosition; /*!< Payload mount position. */
} T_PsdkAircraftInfoBaseInfo;
/**
* @brief Information related to mobile APP.
*/
typedef struct {
E_PsdkAircraftInfoMobileAppLanguage appLanguage; /*!< Mobile APP system language */
E_PsdkAircraftInfoMobileAppScreenType appScreenType; /*!< Mobile APP screen size type. */
} T_PsdkAircraftInfoMobileAppInfo;
/* Exported functions --------------------------------------------------------*/
/**
* @brief Get base information of aircraft system, including aircraft type and PSDK adapter type.
* @param baseInfo: pointer to memory space used to store base information of the aircraft system.
* @return Execution result.
*/
T_PsdkReturnCode PsdkAircraftInfo_GetBaseInfo(T_PsdkAircraftInfoBaseInfo *baseInfo);
/**
* @brief Get information related to mobile APP.
* @note The mobile APP language and screen type is unknown if RC or APP is not connected to the aircraft system.
* @param mobileAppInfo: pointer to memory space used to store information related to mobile APP.
* @return Execution result.
*/
T_PsdkReturnCode PsdkAircraftInfo_GetMobileAppInfo(T_PsdkAircraftInfoMobileAppInfo *mobileAppInfo);
#ifdef __cplusplus
}
#endif
#endif //PSDK_AIRCRAFT_INFO_H
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/

View File

@ -0,0 +1,82 @@
/**
********************************************************************
* @file psdk_core.h
* @brief This is the header file for "psdk_core.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2018 DJI. All rights reserved.
*
* All information contained herein is, and remains, the property of DJI.
* The intellectual and technical concepts contained herein are proprietary
* to DJI and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of DJI.
*
* If you receive this source code without DJIs authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify DJI of its removal. DJI reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef PSDK_CORE_H
#define PSDK_CORE_H
/* Includes ------------------------------------------------------------------*/
#include "psdk_typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
typedef struct {
char appName[32]; /*!< Specifies Payload SDK app name. This info can be obtained by logging in to the
developer website https://developer.dji.com/payload-sdk. End with '\0'. */
char appId[16]; /*!< Specifies Payload SDK app ID. This info can be obtained by logging in to the
developer website https://developer.dji.com/payload-sdk. */
char appKey[32]; /*!< Specifies Payload SDK app key. This info can be obtained by logging in to the
developer website https://developer.dji.com/payload-sdk. */
char developerAccount[64]; /*!< Specifies Payload SDK developer account email. This info can be obtained by
logging in to the developer website https://developer.dji.com/payload-sdk.
Developer's account and other related information need to be able to correspond.
End with '\0'. */
} T_PsdkUserInfo;
/* Exported functions --------------------------------------------------------*/
/**
* @brief Initialize the Payload SDK core in blocking mode.
* @note The call location of this interface requires special attention, The call needs to be completed after the
* registration of console/OSAL handler functions/HAL handler functions are completed. At the same time, it must be
* initialized at the beginning of calling other functional module interfaces. You need to fill in the developer
* information correctly to ensure the initialization is successful. For additional instructions, please refer to the
* tutorial“PSDK Initialization”.
* @note This function does not return until the correct aircraft type and PSDK adapter type is obtained. The logic ensures
* that aircraft and PSDK adapter have been started up normally before PSDK functional module and user's program run.
* General execution time of this function is 2~4 seconds.
* @param userInfo: pointer to the PSDK application information.
* @return Execution result.
*/
T_PsdkReturnCode PsdkCore_Init(const T_PsdkUserInfo *userInfo);
/**
* @brief Notify that the Payload SDK core application starts.
* @note The call location of this interface requires special attention, The call needs to be completed after all the
* module initialize and register interfaces.
* @return Execution result.
*/
T_PsdkReturnCode PsdkCore_ApplicationStart(void);
#ifdef __cplusplus
}
#endif
#endif //PSDK_CORE_H
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/

View File

@ -0,0 +1,99 @@
/**
********************************************************************
* @file psdk_data_channel.h
* @brief This is the header file for "psdk_data_channel.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2018 DJI. All rights reserved.
*
* All information contained herein is, and remains, the property of DJI.
* The intellectual and technical concepts contained herein are proprietary
* to DJI and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of DJI.
*
* If you receive this source code without DJIs authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify DJI of its removal. DJI reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef PSDK_DATA_CHANNEL_H
#define PSDK_DATA_CHANNEL_H
/* Includes ------------------------------------------------------------------*/
#include "psdk_typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief Data channel state.
*/
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_PsdkDataChannelState;
/**
* @brief Percentage of bandwidth proportion of high-speed channel.
*/
typedef struct {
uint8_t dataStream; /*!< Bandwidth proportion of data stream, range from 0 to 100. */
uint8_t videoStream; /*!< Bandwidth proportion of video stream, range from 0 to 100. */
uint8_t downloadStream; /*!< Bandwidth proportion of download stream, range from 0 to 100. */
} T_PsdkDataChannelBandwidthProportionOfHighspeedChannel;
/* Exported functions --------------------------------------------------------*/
/**
* @brief Set bandwidth proportion for the data stream, video stream and download stream of high-speed channel.
* @details Self-defined bandwidth distribution mechanism allows that user can control bandwidth limitation
* freely. System multiplies total bandwidth limitation of the high-speed channel by a proportion of the corresponding stream to
* get realtime bandwidth limitation of the specified stream. Realtime bandwidth limitation of data and video stream can be
* gotten by PsdkDataTransmission_GetDataStreamState() and PsdkPayloadCamera_GetVideoStreamState() interfaces. Total
* bandwidth of the high-speed channel is determined by the environment in which the system located and loading of system. If
* user does not set bandwidth proportion for each stream, the default proportion is 33% (data stream), 33% (video
* stream) and 34% (download stream).
* @note The bandwidth proportion will be effective after a while, the max value is 1s. If you want use this interface, should calling
* PsdkPlatform_RegHalNetworkHandler interface firstly, otherwise this interface will not work.
* @param bandwidthProportion: bandwidth proportion of each stream of high-speed channel. The Sum of bandwidth proportion
* must equal 100.
* @return Execution result.
*/
T_PsdkReturnCode PsdkDataChannel_SetBandwidthProportionForHighspeedChannel(
T_PsdkDataChannelBandwidthProportionOfHighspeedChannel bandwidthProportion);
#ifdef __cplusplus
}
#endif
#endif // PSDK_DATA_CHANNEL_H
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/

View File

@ -0,0 +1,479 @@
/**
********************************************************************
* @file psdk_data_subscription.h
* @brief This is the header file for "psdk_data_subscription.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2018 DJI. All rights reserved.
*
* All information contained herein is, and remains, the property of DJI.
* The intellectual and technical concepts contained herein are proprietary
* to DJI and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of DJI.
*
* If you receive this source code without DJIs authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify DJI of its removal. DJI reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef PSDK_DATA_SUBSCRIPTION_H
#define PSDK_DATA_SUBSCRIPTION_H
/* Includes ------------------------------------------------------------------*/
#include "psdk_typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief Name of topics that can be subscribed. Topic is minimum data item subscribed.
*/
typedef enum {
/*!
* @brief Quaternion of aircraft topic name. Quaternion topic provides aircraft body frame (FRD) to ground frame
* (NED) rotation. Please refer to ::T_PsdkDataSubscriptionQuaternion for information about data structure.
* @details The DJI quaternion follows Hamilton convention (q0 = w, q1 = x, q2 = y, q3 = z).
* | Angle | Unit | Accuracy | Notes |
|--------------|------|------------|-------------------------------------------------|
| pitch, roll | deg | <1 | in NON-AHRS mode |
| yaw | deg | <3 | in well-calibrated compass with fine aligned |
| yaw with rtk | deg | around 1.2 | in RTK heading fixed mode with 1 meter baseline |
*/
PSDK_DATA_SUBSCRIPTION_TOPIC_QUATERNION = 0,
/*!
* @brief Velocity of aircraft topic name. Velocity topic provides aircraft's velocity in a ground-fixed NEU frame.
* Please refer to ::T_PsdkDataSubscriptionVelocity for information about data structure.
* @warning Please note that this data is not in a conventional right-handed frame of reference.
* @details This velocity data is a fusion output from the aircraft. Original output is in a right-handed NED frame, but the
* sign of the Z-axis velocity is flipped before publishing to this topic. So if you are looking to get velocity
* in an NED frame, simply flip the sign of the z-axis value. Beyond that, you can convert using rotations to
* any right-handed frame of reference.
* | Axis | Unit | Accuracy |
|----------|------|---------------------------------------------------------------------------------------------|
| vgx, vgy | m/s | Around 5cm/s for GNSS navigation. Around 3cm/s with VO at 1 meter height |
| vgz | m/s | 10cm/s only with barometer in steady air. 3cm/s with VO at 1 meter height with 8cm baseline |
*/
PSDK_DATA_SUBSCRIPTION_TOPIC_VELOCITY,
/*!
* @brief Fused altitude of aircraft topic name. Fused altitude topic provides aircraft's fused altitude from sea
* level. Please refer to ::T_PsdkDataSubscriptionAltitudeFused for information about data structure.
*/
PSDK_DATA_SUBSCRIPTION_TOPIC_ALTITUDE_FUSED,
/*!
* @brief Relative height above ground of aircraft topic name. Please refer to
* ::T_PsdkDataSubscriptionHeightRelative for information about data structure.
* @details This data is a fusion output from aircraft. The height is a direct estimate of the closest large object
* below the aircraft's ultrasonic sensors.
* @warning This topic does not come with a 'valid' flag - so if the aircraft is too far from an object for the
* ultrasonic sensors/VO to provide any meaningful data, the values will latch and there is no way for user to
* determine if the data is valid or not. Please use with caution.
*/
PSDK_DATA_SUBSCRIPTION_TOPIC_HEIGHT_RELATIVE,
/*!
* Fused position of aircraft topic name. Please refer to ::T_PsdkDataSubscriptionPositionFused for information
* about data structure.
* @warning Please note that if GPS signal is weak (low visibleSatelliteNumber, see below), the
* latitude/longitude values won't be updated but the altitude might still be. There is currently no way to know if
* the lat/lon update is healthy.
* @details The most important component of this topic is the T_PsdkDataSubscriptionPositionFused::visibleSatelliteNumber.
* Use this to track your GPS satellite coverage and build some heuristics for when you might expect to lose GPS updates.
* | Axis | Unit | Position Sensor | Accuracy |
|------|------|-----------------|--------------------------------------------------|
| x, y | m | GPS | <3m with open sky without multipath |
| z | m | GPS | <5m with open sky without multipath |
*/
PSDK_DATA_SUBSCRIPTION_TOPIC_POSITION_FUSED,
/*!
* @brief GPS date topic name. Please refer to ::T_PsdkDataSubscriptionGpsDate for information about data structure.
*/
PSDK_DATA_SUBSCRIPTION_TOPIC_GPS_DATE,
/*!
* @brief GPS time topic name. Please refer to ::T_PsdkDataSubscriptionGpsTime for information about data structure.
*/
PSDK_DATA_SUBSCRIPTION_TOPIC_GPS_TIME,
/*!
* @brief GPS position topic name. Please refer to ::T_PsdkDataSubscriptionGpsPosition for information about data structure.
* @details
* | Axis | Accuracy |
|------|--------------------------------------------------|
| x, y | <3m with open sky without multipath |
| z | <5m with open sky without multipath |
*/
PSDK_DATA_SUBSCRIPTION_TOPIC_GPS_POSITION,
/*!
* @brief GPS velocity topic name. Please refer to ::T_PsdkDataSubscriptionGpsVelocity for information about data structure.
*/
PSDK_DATA_SUBSCRIPTION_TOPIC_GPS_VELOCITY,
/*!
* @brief GPS details topic name. GPS details topic provides GPS state and other detail information. Please refer
* to ::T_PsdkDataSubscriptionGpsDetail for information about data structure.
*/
PSDK_DATA_SUBSCRIPTION_TOPIC_GPS_DETAILS,
/*!
* @brief GPS signal level topic name. This topic provides a measure of the quality of GPS signal. Please refer to
* ::T_PsdkDataSubscriptionGpsSignalLevel for information about data structure.
*/
PSDK_DATA_SUBSCRIPTION_TOPIC_GPS_SIGNAL_LEVEL,
/*!
* @brief RTK position topic name. Please refer to ::T_PsdkDataSubscriptionRtkPosition for information about data structure.
* @details
* | Axis | Accuracy |
|------|--------------------------------------------------|
| x, y | ~2cm with fine alignment and fix condition |
| z | ~3cm with fine alignment and fix condition |
*/
PSDK_DATA_SUBSCRIPTION_TOPIC_RTK_POSITION,
/*!
* @brief RTK velocity topic name. Please refer to ::T_PsdkDataSubscriptionRtkVelocity for information about data structure.
*/
PSDK_DATA_SUBSCRIPTION_TOPIC_RTK_VELOCITY,
/*!
* @brief RTK yaw topic name. Please refer to ::T_PsdkDataSubscriptionRtkYaw for information about data structure.
* @details The RTK yaw will provide the vector from ANT1 to ANT2 as configured in DJI Assistant 2. This
* means that the value of RTK yaw will be 90deg offset from the yaw of the aircraft.
*/
PSDK_DATA_SUBSCRIPTION_TOPIC_RTK_YAW,
/*!
* @brief RTK position information topic name. RTK position information topic provides a state of RTK position
* solution. Please refer to ::T_PsdkDataSubscriptionRtkPositionInfo for information about data structure.
*/
PSDK_DATA_SUBSCRIPTION_TOPIC_RTK_POSITION_INFO,
/*!
* @brief RTK yaw topic name. RTK yaw information topic provides a state of RTK yaw solution. Please refer to
* ::T_PsdkDataSubscriptionRtkYawInfo for information about data structure.
*/
PSDK_DATA_SUBSCRIPTION_TOPIC_RTK_YAW_INFO,
/*!
* @brief Flight status topic name. Please refer to ::T_PsdkDataSubscriptionFlightStatus for information about data structure.
*/
PSDK_DATA_SUBSCRIPTION_TOPIC_STATUS_FLIGHT,
/*!
* @brief Battery information topic name. Please refer to ::T_PsdkDataSubscriptionBatteryInfo for information about data structure.
*/
PSDK_DATA_SUBSCRIPTION_TOPIC_BATTERY_INFO,
/*! Total number of topics that can be subscribed. */
PSDK_DATA_SUBSCRIPTION_TOPIC_TOTAL_NUMBER,
} E_PsdkDataSubscriptionTopicName;
/**
* @brief Health state of data subscribed.
*/
typedef enum {
PSDK_DATA_SUBSCRIPTION_DATA_NOT_HEALTH = 0, /*!< Data subscribed is healthy and can be used. */
PSDK_DATA_SUBSCRIPTION_DATA_HEALTH = 1, /*!< Data subscribed is not healthy and recommend not to use it. */
} E_PsdkDataSubscriptionDataHealthFlag;
/**
* @brief Position solution property.
*/
typedef enum {
PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_NOT_AVAILABLE = 0, /*!< Position solution is not available. */
PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_FIX_POSITION = 1, /*!< Position has been fixed by the FIX POSITION command. */
PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_FIX_HEIGHT_AUTO = 2, /*!< Position has been fixed by the FIX HEIGHT/AUTO command. */
PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_INSTANTANEOUS_DOPPLER_COMPUTE_VELOCITY = 8, /*!< Velocity computed using instantaneous Doppler. */
PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_SINGLE_PNT_SOLUTION = 16, /*!< Single point position solution. */
PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_PSEUDORANGE_DIFFERENTIAL_SOLUTION = 17, /*!< Pseudorange differential solution. */
PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_SBAS_CORRECTION_CALCULATED = 18, /*!< Solution calculated using corrections from an SBAS. */
PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_KALMAN_FILTER_WITHOUT_OBSERVATION_PROPAGATED = 19, /*!< Propagated by a Kalman filter without new observations. */
PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_OMNISTAR_VBS_POSITION = 20, /*!< OmniSTAR VBS position (L1 sub-metre). */
PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_FLOAT_L1_AMBIGUITY = 32, /*!< Floating L1 ambiguity solution. */
PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_FLOAT_IONOSPHERIC_FREE_AMBIGUITY = 33, /*!< Floating ionospheric-free ambiguity solution. */
PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_FLOAT_SOLUTION = 34, /*!< Float position solution. */
PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_L1_AMBIGUITY_INT = 48, /*!< Integer L1 ambiguity solution. */
PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_WIDE_LANE_AMBIGUITY_INT = 49, /*!< Integer wide-lane ambiguity solution. */
PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_NARROW_INT = 50, /*!< Narrow fixed point position solution. */
} E_PsdkDataSubscriptionPositionSolutionProperty;
/**
* @brief GPS fix state.
*/
typedef enum {
PSDK_DATA_SUBSCRIPTION_GPS_FIX_STATE_NO_FIX = 0, /*!< GPS position has not been fixed. */
PSDK_DATA_SUBSCRIPTION_GPS_FIX_STATE_DEAD_RECKONING_ONLY = 1, /*!< GPS position is dead reckoned only. */
PSDK_DATA_SUBSCRIPTION_GPS_FIX_STATE_2D_FIX = 2, /*!< The horizontal position with latitude/longitude (or northing/easting or X/Y) is fixed. */
PSDK_DATA_SUBSCRIPTION_GPS_FIX_STATE_3D_FIX = 3, /*!< The horizontal and vertical position with latitude/longitude/altitude (northing/easting/altitude or X/Y/Z) is fixed. */
PSDK_DATA_SUBSCRIPTION_GPS_FIX_STATE_GPS_PLUS_DEAD_RECKONING = 4, /*!< Position is calculated by GPS and combined with dead reckoning. */
PSDK_DATA_SUBSCRIPTION_GPS_FIX_STATE_TIME_ONLY_FIX = 5, /*!< Only time is fixed. */
} E_PsdkDataSubscriptionGpsFixState;
/**
* @brief Flight status of aircraft.
*/
typedef enum {
PSDK_DATA_SUBSCRIPTION_FLIGHT_STATUS_STOPED = 0, /*!< Aircraft is on ground and motors are still. */
PSDK_DATA_SUBSCRIPTION_FLIGHT_STATUS_ON_GROUND = 1, /*!< Aircraft is on ground but motors are rotating. */
PSDK_DATA_SUBSCRIPTION_FLIGHT_STATUS_IN_AIR = 2, /*!< Aircraft is in air. */
} E_PsdkDataSubscriptionFlightStatus;
#pragma pack(1)
/**
* @brief Timestamp data structure.
*/
typedef struct {
uint32_t millisecond; /*!< Millisecond. */
uint32_t microsecond; /*!< Microsecond. */
} T_PsdkDataSubscriptiontTimestamp;
/**
* @brief Quaternion topic data structure.
*/
typedef struct Quaternion {
psdk_f32_t q0; /*!< w, rad (when converted to a rotation matrix or Euler angles). */
psdk_f32_t q1; /*!< x, rad (when converted to a rotation matrix or Euler angles). */
psdk_f32_t q2; /*!< y, rad (when converted to a rotation matrix or Euler angles). */
psdk_f32_t q3; /*!< z, rad (when converted to a rotation matrix or Euler angles). */
} T_PsdkDataSubscriptionQuaternion;
/**
* @brief Velocity topic data structure.
*/
typedef struct Velocity {
/*! Velocity of aircraft. */
T_PsdkVector3f data;
/*! Health state of aircraft velocity data. It can be any value of ::E_PsdkDataSubscriptionDataHealthFlag. */
uint8_t health : 1;
/*! Reserved. */
uint8_t reserve : 7;
} T_PsdkDataSubscriptionVelocity;
/**
* @brief Fused altitude topic data structure, unit: m.
*/
typedef psdk_f32_t T_PsdkDataSubscriptionAltitudeFused;
/**
* @brief Relative height above ground topic data structure, unit: m.
*/
typedef psdk_f32_t T_PsdkDataSubscriptionHeightRelative;
/**
* @brief Fused position topic data structure.
*/
typedef struct PositionFused {
psdk_f64_t longitude; /*!< Longitude, unit: rad. */
psdk_f64_t latitude; /*!< Latitude, unit: rad. */
psdk_f32_t altitude; /*!< Altitude, WGS 84 reference ellipsoid, unit: m. */
uint16_t visibleSatelliteNumber; /*!< Number of visible satellites. */
} T_PsdkDataSubscriptionPositionFused;
/**
* @brief GPS date topic data structure, format: yyyymmdd.
*/
typedef uint32_t T_PsdkDataSubscriptionGpsDate;
/**
* @brief GPS time topic data structure, format: hhmmss.
*/
typedef uint32_t T_PsdkDataSubscriptionGpsTime;
/**
* @brief GPS position topic data structure. x = Longitude, y = Latitude, z = Altitude, unit: deg*10<SUP>-7</SUP>
* (Lat,Lon), mm (Alt)
*/
typedef T_PsdkVector3d T_PsdkDataSubscriptionGpsPosition;
/**
* @brief GPS velocity topic data structure, unit: cm/s.
*/
typedef T_PsdkVector3f T_PsdkDataSubscriptionGpsVelocity;
/**
* @brief GPS details topic data structure.
*/
typedef struct GpsDetail {
psdk_f32_t hdop; /*!< Horizontal dilution of precision, <1: ideal, 1-2: excellent, 2-5: good, 5-10: moderate, 10-20: fair, >20: poor. */
psdk_f32_t pdop; /*!< Position dilution of precision, <1: ideal, 1-2: excellent, 2-5: good, 5-10: moderate, 10-20: fair, >20: poor. */
psdk_f32_t fixState; /*!< GPS fix state, and can be any value of ::E_PsdkDataSubscriptionGpsFixState. Value other than ::E_PsdkDataSubscriptionGpsFixState is invalid. */
psdk_f32_t vacc; /*!< Vertical position accuracy (mm), the smaller, the better. */
psdk_f32_t hacc; /*!< Horizontal position accuracy (mm), the smaller, the better. */
psdk_f32_t sacc; /*!< Speed accuracy (cm/s), the smaller, the better. */
uint32_t gpsSatelliteNumberUsed; /*!< Number of GPS satellites used for fixing position. */
uint32_t glonassSatelliteNumberUsed; /*!< Number of GLONASS satellites used for fixing position. */
uint16_t totalSatelliteNumberUsed; /*!< Total number of satellites used for fixing position. */
uint16_t gpsCounter; /*!< Accumulated times of sending GPS data. */
} T_PsdkDataSubscriptionGpsDetail;
/**
* @brief GPS signal level topic data structure. Signal level of GPS. The level varies from 0 to 5, with 0 being the
* worst and 5 the best GPS signal.
*/
typedef uint8_t T_PsdkDataSubscriptionGpsSignalLevel;
/**
* @brief RTK position topic data structure.
*/
typedef struct PositionData {
psdk_f64_t longitude; /*!< Longitude, unit: deg. */
psdk_f64_t latitude; /*!< Latitude, unit: deg. */
psdk_f32_t hfsl; /*!< Height above mean sea level, unit: m. */
} T_PsdkDataSubscriptionRtkPosition;
/**
* @brief RTK velocity topic data structure, unit: cm/s.
*/
typedef T_PsdkVector3f T_PsdkDataSubscriptionRtkVelocity;
/**
* @brief RTK yaw topic data structure, unit: deg.
*/
typedef int16_t T_PsdkDataSubscriptionRtkYaw;
/**
* @brief RTK position information topic data structure. Specifies RTK position solution state, it can be any value of
* ::E_PsdkDataSubscriptionPositionSolutionProperty.
*/
typedef uint8_t T_PsdkDataSubscriptionRtkPositionInfo;
/**
* @brief RTK yaw information topic data structure. Specifies RTK yaw solution state, it can be any value of
* ::E_PsdkDataSubscriptionPositionSolutionProperty.
*/
typedef uint8_t T_PsdkDataSubscriptionRtkYawInfo;
/**
* @brief Flight status information topic data structure. It can be any value of ::E_PsdkDataSubscriptionFlightStatus.
*/
typedef uint8_t T_PsdkDataSubscriptionFlightStatus;
/**
* @brief Battery information topic data structure.
*/
typedef struct BatteryInfo {
uint32_t capacity; /*!< Battery capacity, unit: mAh. */
int32_t voltage; /*!< Battery voltage, unit: mV. */
int32_t current; /*!< Battery current, unit: mA. */
uint8_t percentage; /*!< Battery capacity percentage, unit: 1%. */
} T_PsdkDataSubscriptionBatteryInfo;
#pragma pack()
/**
* @brief 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.
* @param 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.
* @param dataSize: the size of memory space pointed by data argument, equal to data structure size corresponding to the topic.
* @param timestamp: pointer to timestamp corresponding this data.
* @return Execution result.
*/
typedef T_PsdkReturnCode (*ReceiveDataOfTopicCallback)(const uint8_t *data, uint16_t dataSize,
const T_PsdkDataSubscriptiontTimestamp *timestamp);
/* Exported functions --------------------------------------------------------*/
/**
* @brief Initialise data subscription module in blocking mode. This function has to be called before subscribing any
* data, to initialize run environment of data subscription module, if need to subscribe data from aircraft.
* @note Max execution time of this function is slightly larger than 500ms.
* @note This function has to be called in user task, rather than main() function, and after scheduler being started.
* @return Execution result.
*/
T_PsdkReturnCode PsdkDataSubscription_Init(void);
/**
* @brief Deinitialize data subscription module. When data subscription will no longer be used, can call this function
* to deinitialize the data subscription module. Deinitialization function will help to release all system resource data
* subscription has occupied.
* @return Execution result.
*/
T_PsdkReturnCode PsdkDataSubscription_DeInit(void);
/**
* @brief Subscribe a topic in blocking mode. Before subscribing any data from aircraft, PsdkDataSubscription_Init()
* function has to be called.
* @details User can subscribe a topic by specifying topic name, push frequency and callback function used to receive
* data of topic (if needed). After subscribing successfully, the user can call
* PsdkDataSubscription_GetValueOfTopicWithTimestamp() function to get the latest data of the topic have been
* subscribed and the corresponding timestamp when aircraft sends the data out, and the callback function will be called to
* push data of the topic and corresponding timestamp if the callback function is specified.
* @note Max execution time of this function is slightly larger than 1200ms.
* @note Topic to be subscribed can not have been subscribed, that is, one topic can not be subscribed repeatedly.
* @note User must ensure that types of subscription frequency of all topics have been subscribed is less than or
* equal to 4. Otherwise, the subscribing topic will fail.
* @note User must ensure that the data length sum of all topics of the same subscription frequency is less than or equal to 242.
* @param topic: topic name to be subscribed.
* @param frequency: subscription frequency of topic to be subscribed. Subscription frequency can not beyond max
* frequency limitation of the topic and must be a divisor of max subscription frequency limitation. And, subscription
* frequency has to be larger than 0. Users can find max frequency of topics in data subscription part of PSDK
* documentation on developer website (developer.dji.com).
* @param callback: callback function used to receive data of topic to be subscribed. If the callback function is not needed,
* this item can be set as NULL.
* @return Execution result.
*/
T_PsdkReturnCode PsdkDataSubscription_RegTopicSync(E_PsdkDataSubscriptionTopicName topic, uint16_t frequency,
ReceiveDataOfTopicCallback callback);
/**
* @brief Unsubscribe a topic in blocking mode.
* @details Users must specify frequency and callback function filled in when subscribe the topic. If frequency or
* callback function is incorrect, unsubscribe operation will fail and the interface return error.
* @note Max execution time of this function is slightly larger than 600ms.
* @param topic: topic name to be unsubscribed.
* @param frequency: subscription frequency filled in when subscribe.
* @param callback: callback function filled in when subscribe.
* @return Execution result.
*/
T_PsdkReturnCode PsdkDataSubscription_AntiRegTopicSync(E_PsdkDataSubscriptionTopicName topic, uint16_t frequency,
ReceiveDataOfTopicCallback callback);
/**
* @brief Get the latest data value and timestamp in aircraft time system when sending the data from aircraft of specified
* topic. If the specified topic has not been subscribed successfully, this function will return the error code.
* @note After calling this function, user need transfer type of data pointer that pointer to data of topic to
* corresponding data structure pointer for getting every item of the topic conveniently.
* @param topicName: topic name to be gotten value.
* @param data: pointer to memory space used to store data of the topic. The memory space used to store data of topic
* have to have been allocated correctly and should ensure its size is equal to data structure size corresponding to
* the topic, otherwise, this function will not be able to return data and timestamp (return error code).
* @param dataSizeOfTopic: the size of memory space used to store data of topic. Normally, this size is equal to data
* structure size corresponding to the topic. If this size is not equal to the size of the memory space, may cause memory
* overflow event
* @param timestamp: pointer to memory space used to store timestamps. The memory space used to store timestamps
* have to have been allocated correctly, and should ensure its size is equal to data structure size of timestamp,
* otherwise, this function will not be able to return data and timestamp (return error code) or even cause memory
* overflow event. If the user does not need timestamp information, can fill in NULL.
* @return Execution result.
*/
T_PsdkReturnCode PsdkDataSubscription_GetValueOfTopicWithTimestamp(E_PsdkDataSubscriptionTopicName topicName,
uint8_t *data, uint16_t dataSizeOfTopic,
T_PsdkDataSubscriptiontTimestamp *timestamp);
#ifdef __cplusplus
}
#endif
#endif // PSDK_DATA_SUBSCRIPTION_H
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/

View File

@ -0,0 +1,193 @@
/**
********************************************************************
* @file psdk_data_transmission.h
* @brief This is the header file for "psdk_data_transmission.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2018 DJI. All rights reserved.
*
* All information contained herein is, and remains, the property of DJI.
* The intellectual and technical concepts contained herein are proprietary
* to DJI and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of DJI.
*
* If you receive this source code without DJIs authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify DJI of its removal. DJI reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef PSDK_DATA_TRANSMISSION_H
#define PSDK_DATA_TRANSMISSION_H
/* Includes ------------------------------------------------------------------*/
#include "psdk_typedef.h"
#include "psdk_data_channel.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief Prototype of callback function used to receive data that come from mobile end.
* @warning User can not execute blocking style operations or functions in callback function, because that will block PSDK
* root thread, causing problems such as slow system response, payload disconnection or infinite loop.
* @param data: pointer to data.
* @param len: length of data.
* @return Execution result.
*/
typedef T_PsdkReturnCode (*ReceiveDataFromMobileCallback)(const uint8_t *data, uint16_t len);
/**
* @brief Prototype of callback function used to receive data that come from onboard computer.
* @warning User can not execute blocking style operations or functions in callback function, because that will block PSDK
* root thread, causing problems such as slow system response, payload disconnection or infinite loop.
* @param data: pointer to data.
* @param len: length of data.
* @return Execution result.
*/
typedef T_PsdkReturnCode (*ReceiveDataFromOsdkCallback)(const uint8_t *data, uint16_t len);
/* Exported functions --------------------------------------------------------*/
/**
* @brief Initialise data transmission module in block mode. Should call this function before sending data to mobile
* end/onboard computer or receiving data.
* @note Max execution time of this function is slightly larger than 500ms.
* @return Execution result.
*/
T_PsdkReturnCode PsdkDataTransmission_Init(void);
/**
* @brief Deinitialize data transmission module. User can call this function to release all resources that data
* transmission module have occupied from the system and restore the state of internal variables when functions of data
* transmission module will no longer be used or exit program.
* @return Execution result.
*/
T_PsdkReturnCode PsdkDataTransmission_DeInit(void);
/**
* @brief Register callback function used to receive data from mobile end. After registering this callback function,
* callback function will be called automatically when system receive data from mobile end.
* @param callback: pointer to callback function.
* @return Execution result.
*/
T_PsdkReturnCode PsdkDataTransmission_RegReceiveDataFromMobileCallback(ReceiveDataFromMobileCallback callback);
/**
* @brief Register callback function used to receive data from onboard computer. After registering this callback
* function, callback function will be called automatically when system receive data from onboard computer.
* @param callback: pointer to callback function.
* @return Execution result.
*/
T_PsdkReturnCode PsdkDataTransmission_RegReceiveDataFromOsdkCallback(ReceiveDataFromOsdkCallback callback);
/**
* @brief Send data to mobile end via command channel.
* @warning If actual bandwidth is below limitation, data can be sent to the endpoint directly. If exceeds the limitation,
* firstly data will be stored to buffer of the flow controller and be sent to endpoint after a period (an integer multiple of
* 1s, the exact time depends on bandwidth limitation and buffer size). If the buffer is full, data be will discarded. The
* capacity of flow controller buffer is 512 bytes.
* @note Must ensure actual bandwidth is less than bandwidth limitation of corresponding channel or stream, please
* refer to developer documentation or state of channel/stream for details related to bandwidth limitation. User can
* get state of "sendToMobile" command channel via PsdkDataTransmission_GetSendToMobileState() function. If actual
* bandwidth exceeds the limitation or busy state is set, the user should stop transmitting data or decrease amount of data
* to be sent.
* @note Max size of data package sent to mobile end on a physical link of command channel is 128. If the length of data to
* be sent is greater than 128, data to be sent will be divided into multiple packages to send, and the user will also
* receive multiple data packages on the mobile end.
* @param data: pointer to data to be sent.
* @param len: length of data to be sent, unit: byte.
* @return Execution result.
*/
T_PsdkReturnCode PsdkDataTransmission_SendDataToMobile(const uint8_t *data, uint8_t len);
/**
* @brief Send data to the onboard computer via command channel.
* @warning If actual bandwidth is below limitation, data can be sent to the endpoint directly. If exceeds the limitation,
* firstly data will be stored to buffer of the flow controller and be sent to endpoint after a period (an integer multiple of
* 1s, the exact time depends on bandwidth limitation and buffer size). If the buffer is full, data will be discarded. The
* capacity of flow controller buffer is 512 bytes.
* @note Must ensure actual bandwidth is less than bandwidth limitation of corresponding channel or stream, please
* refer to developer documentation or state of channel/stream for details related to bandwidth limitation. User can
* get state of "sendToOsdk" command channel via PsdkDataTransmission_GetSendToOsdkState() function. If actual bandwidth
* exceeds the limitation or busy state is set, the user should stop transmitting data or decrease amount of data to be
* sent.
* @note Max size of data package sent to an onboard computer on the physical link of command channel is 255. If the length of data
* to be sent is greater than 255, data to be sent will be divided into multiple packages to send, and the user will also
* receive multiple data packages on the onboard computer.
* @param data: pointer to data to be sent.
* @param len: length of data to be sent, unit: byte.
* @return Execution result.
*/
T_PsdkReturnCode PsdkDataTransmission_SendDataToOsdk(const uint8_t *data, uint8_t len);
/**
* @brief Get data transmission state of "sendToMobile" command channel. User can use the state as base for controlling
* data transmission between payload and mobile end.
* @param state: pointer to "sendToMobile" command channel state.
* @return Execution result.
*/
T_PsdkReturnCode PsdkDataTransmission_GetSendToMobileState(T_PsdkDataChannelState *state);
/**
* @brief Get data transmission state of "sendToOsdk" command channel. User can use the state as base for controlling data
* transmission between payload and onboard computer.
* @param state: pointer to "sendToOsdk" command channel state.
* @return Execution result.
*/
T_PsdkReturnCode PsdkDataTransmission_GetSendToOsdkState(T_PsdkDataChannelState *state);
/**
* @brief Get the network remote address for sending data stream.
* @note The interface is used to get the network remote address for sending data stream. You can get this info for another
* heterogeneous system to do somethings. This interface should be used after calling PsdkCore_Init function.
* @param ipAddr: the remote ip address for sending data stream.
* @param port: the remote port for sending data stream.
* @return Execution result.
*/
T_PsdkReturnCode PsdkDataTransmission_GetDataStreamRemoteAddress(char *ipAddr, uint16_t *port);
#if PSDK_ARCH_SYS_LINUX
/**
* @brief Send data to mobile end via data stream of the data channel.
* @note This function can be used only in Linux operating system.
* @note Must ensure actual bandwidth is less than bandwidth limitation of corresponding channel or stream, please
* refer to developer documentation and state of channel/stream for details related to bandwidth limitation. User can
* get state of "dataStream" channel via PsdkDataTransmission_GetDataStreamState() function. If actual bandwidth
* exceeds the limitation or busy state is set, the user should stop transmitting data or decrease amount of data to be
* sent. Otherwise, data may be discarded.
* @param data: pointer to data to be sent.
* @param len: length of data to be sent via data stream, and it must be less than or equal to 65000, unit: byte.
* @return Execution result.
*/
T_PsdkReturnCode PsdkDataTransmission_SendDataStream(const uint8_t *data, uint16_t len);
/**
* @brief Get data transmission state of "dataStream" channel. User can use the state as base for controlling data
* transmission of data stream. This function exists and can be used only in Linux operation system.
* @param state: pointer to "dataStream" channel state.
* @return Execution result.
*/
T_PsdkReturnCode PsdkDataTransmission_GetDataStreamState(T_PsdkDataChannelState *state);
#endif
#ifdef __cplusplus
}
#endif
#endif // PSDK_DATA_TRANSMISSION_H
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/

View File

@ -0,0 +1,255 @@
/**
********************************************************************
* @file psdk_error.h
* @brief This is the header file for "psdk_error.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2018 DJI. All rights reserved.
*
* All information contained herein is, and remains, the property of DJI.
* The intellectual and technical concepts contained herein are proprietary
* to DJI and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of DJI.
*
* If you receive this source code without DJIs authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify DJI of its removal. DJI reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef PSDK_ERROR_H
#define PSDK_ERROR_H
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
#define PSDK_ERROR_MODULE_INDEX_OFFSET 12u
#define PSDK_ERROR_MODULE_INDEX_MASK 0x00000000000FF000u
#define PSDK_ERROR_RAW_CODE_OFFSET 0u
#define PSDK_ERROR_RAW_CODE_MASK 0x0000000000000FFFu
#define PSDK_ERROR_CODE(moduleIndex, rawErrCode) \
((uint64_t)0 | \
((((uint64_t)(moduleIndex)) << (PSDK_ERROR_MODULE_INDEX_OFFSET)) & (PSDK_ERROR_MODULE_INDEX_MASK)) | \
((((uint64_t)(rawErrCode)) << (PSDK_ERROR_RAW_CODE_OFFSET)) & (PSDK_ERROR_RAW_CODE_MASK)))
/**
* @brief Error objects, specifying error code, error description, error reason and error recovery suggestion below.
* @attention Require arrange by error code from small to large.
*/
#define PSDK_ERROR_OBJECTS \
/* system module error message */ \
{PSDK_ERROR_SYSTEM_MODULE_CODE_SUCCESS, "Execution successfully.", NULL, NULL}, \
{PSDK_ERROR_SYSTEM_MODULE_CODE_INVALID_REQUEST_PARAMETER, "Request parameters are invalid.", NULL, "Please double-check requested parameters."}, \
{PSDK_ERROR_SYSTEM_MODULE_CODE_EXECUTING_HIGHER_PRIORITY_TASK, "A higher priority task is being executed.", NULL, "Please stop the higher priority task or try again later."}, \
{PSDK_ERROR_SYSTEM_MODULE_CODE_NONSUPPORT, "Operation is not supported.", NULL, "Please check input parameters or contact DJI for help."}, \
{PSDK_ERROR_SYSTEM_MODULE_CODE_TIMEOUT, "Execution timeout.", NULL, "Please contact DJI for help."}, \
{PSDK_ERROR_SYSTEM_MODULE_CODE_MEMORY_ALLOC_FAILED, "Memory allocation failed.", NULL, "Please check system configure."}, \
{PSDK_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER, "Input parameters are invalid.", NULL, "Please double-check requested parameters."}, \
{PSDK_ERROR_SYSTEM_MODULE_CODE_NONSUPPORT_IN_CURRENT_STATE, "Operation is not supported in current state.", NULL, "Please try again later."}, \
{PSDK_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR, "System error.", NULL, "Please contact DJI for help."}, \
{PSDK_ERROR_SYSTEM_MODULE_CODE_HARDWARE_ERR, "Hardware error.", NULL, "Please contact DJI for help."}, \
{PSDK_ERROR_SYSTEM_MODULE_CODE_INSUFFICIENT_ELECTRICITY, "Low battery.", NULL, "Please replacement battery for machine and try again."}, \
{PSDK_ERROR_SYSTEM_MODULE_CODE_UNKNOWN, "Unknown error.", NULL, NULL}, \
{PSDK_ERROR_SYSTEM_MODULE_CODE_NOT_FOUND, "Parameters are not found.", NULL, NULL}, \
{PSDK_ERROR_SYSTEM_MODULE_CODE_OUT_OF_RANGE, "Out of range.", NULL, "Please check parameters."}, \
{PSDK_ERROR_SYSTEM_MODULE_CODE_BUSY, "System is busy.", NULL, "Please try again later."}, \
{PSDK_ERROR_SYSTEM_MODULE_CODE_DUPLICATE, "Have existed the same object.", NULL, "Please input valid parameters."}, \
{PSDK_ERROR_SYSTEM_MODULE_CODE_ADAPTER_NOT_MATCH, "PSDK adapter do not meet requirements.", NULL, "Please try again after replacing PSDK adapter."}, \
\
/* gimbal module error message */ \
{PSDK_ERROR_GIMBAL_MODULE_CODE_PITCH_REACH_POSITIVE_LIMIT, "Pitch axis gimbal reach positive limit.", NULL, "Please do not rotate towards positive direction."}, \
{PSDK_ERROR_GIMBAL_MODULE_CODE_PITCH_REACH_NEGATIVE_LIMIT, "Pitch axis gimbal reach negative limit.", NULL, "Please do not rotate towards negative direction."}, \
{PSDK_ERROR_GIMBAL_MODULE_CODE_ROLL_REACH_POSITIVE_LIMIT, "Roll axis gimbal reach positive limit.", NULL, "Please do not rotate towards positive direction."}, \
{PSDK_ERROR_GIMBAL_MODULE_CODE_ROLL_REACH_NEGATIVE_LIMIT, "Roll axis gimbal reach negative limit.", NULL, "Please do not rotate towards negative direction."}, \
{PSDK_ERROR_GIMBAL_MODULE_CODE_YAW_REACH_POSITIVE_LIMIT, "Yaw axis gimbal reach positive limit.", NULL, "Please do not rotate towards positive direction."}, \
{PSDK_ERROR_GIMBAL_MODULE_CODE_YAW_REACH_NEGATIVE_LIMIT, "Yaw axis gimbal reach negative limit.", NULL, "Please do not rotate towards negative direction."}, \
{PSDK_ERROR_GIMBAL_MODULE_CODE_NON_CONTROL_AUTHORITY, "Current device do not have control authority of the gimbal.", NULL, "Please do not control gimbal with other devices that have high control priority simultaneously."}, \
\
/* payload collaboration module error message */ \
{PSDK_ERROR_PAYLOAD_COLLABORATION_MODULE_CODE_POSITION_NOT_MATCH, "Payload mount position do not meet requirements.", NULL, "Please read API and user documentation, ensuring input parameters satisfy requirements."}, \
\
/* subscription module error message */ \
{PSDK_ERROR_SUBSCRIPTION_MODULE_CODE_INVALID_TOPIC_FREQ, "Frequency of topic is invalid.", NULL, "Please read API and user documentation, ensuring input parameters satisfy requirements."}, \
{PSDK_ERROR_SUBSCRIPTION_MODULE_CODE_TOPIC_DUPLICATE, "Topic is subscribed repeatedly.", NULL, "Please do not subscribe a topic repeatedly."}, \
{PSDK_ERROR_SUBSCRIPTION_MODULE_CODE_TOPIC_NOT_SUBSCRIBED, "Requested topic have not been subscribed.", NULL, "Please try to get value after subscribing topic."}, \
{PSDK_ERROR_SUBSCRIPTION_MODULE_CODE_TIMESTAMP_NOT_ENABLE, "Requested topic do not have timestamp data.", "Did not enable timestamp when subscribe topic.", "Please subscribe topic enabled timestamp."}, \
/* mop channel module error message */ \
{PSDK_ERROR_MOP_CHANNEL_MODULE_CODE_CONNECTION_CLOSE, "Connection of channel is closed.", "The peer channel do not work or abnormally be closed.", "Please confirm state of the peer channel and reaccept the connection request of MSDK/OSDK"}, \
#define PSDK_RETURN_CODE_OK PSDK_ERROR_SYSTEM_MODULE_CODE_SUCCESS /*!< Payload SDK return code represents as status is ok. */
#define PSDK_RETURN_CODE_ERR_ALLOC PSDK_ERROR_SYSTEM_MODULE_CODE_MEMORY_ALLOC_FAILED /*!< Payload SDK return code represents as status alloc error. */
#define PSDK_RETURN_CODE_ERR_TIMEOUT PSDK_ERROR_SYSTEM_MODULE_CODE_TIMEOUT /*!< Payload SDK return code represents as status timeout error. */
#define PSDK_RETURN_CODE_ERR_NOT_FOUND PSDK_ERROR_SYSTEM_MODULE_CODE_NOT_FOUND /*!< Payload SDK return code represents as status not found error. */
#define PSDK_RETURN_CODE_ERR_OUT_OF_RANGE PSDK_ERROR_SYSTEM_MODULE_CODE_OUT_OF_RANGE /*!< Payload SDK return code represents as status out of range error. */
#define PSDK_RETURN_CODE_ERR_PARAM PSDK_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER /*!< Payload SDK return code represents as status parameter error. */
#define PSDK_RETURN_CODE_ERR_SYSTEM PSDK_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR /*!< Payload SDK return code represents as status system error. */
#define PSDK_RETURN_CODE_ERR_BUSY PSDK_ERROR_SYSTEM_MODULE_CODE_BUSY /*!< Payload SDK return code represents as status busy error. */
#define PSDK_RETURN_CODE_ERR_UNSUPPORT PSDK_ERROR_SYSTEM_MODULE_CODE_NONSUPPORT /*!< Payload SDK return code represents as status nonsupport error. */
#define PSDK_RETURN_CODE_ERR_UNKNOWN PSDK_ERROR_SYSTEM_MODULE_CODE_UNKNOWN /*!< Payload SDK return code represents as status unknown error. */
/* Exported types ------------------------------------------------------------*/
/**
* @brief PSDK module enum for defining error code.
*/
typedef enum {
PSDK_ERROR_MODULE_SYSTEM = 0,
PSDK_ERROR_MODULE_PLATFORM,
PSDK_ERROR_MODULE_LOGGER,
PSDK_ERROR_MODULE_TIME_SYNC,
PSDK_ERROR_MODULE_COMMAND,
PSDK_ERROR_MODULE_CAMERA,
PSDK_ERROR_MODULE_GIMBAL,
PSDK_ERROR_MODULE_XPORT,
PSDK_ERROR_MODULE_PAYLOAD_COLLABORATION,
PSDK_ERROR_MODULE_WIDGET,
PSDK_ERROR_MODULE_CORE,
PSDK_ERROR_MODULE_IDENTITY,
PSDK_ERROR_MODULE_TRANSMISSION,
PSDK_ERROR_MODULE_DATA_CHANNEL,
PSDK_ERROR_MODULE_SUBSCRIPTION,
PSDK_ERROR_MODULE_MOP_CHANNEL,
PSDK_ERROR_MODULE_POSITIONING,
PSDK_ERROR_MODULE_POWER_MANAGEMENT,
PSDK_ERROR_MODULE_AIRCRAFTINFO,
PSDK_ERROR_MODULE_PRODUCTINFO,
PSDK_ERROR_MODULE_FLOWCONTROLLER,
PSDK_ERROR_MODULE_DOWNLOADER,
PSDK_ERROR_MODULE_PARAMETER,
PSDK_ERROR_MODULE_UTIL,
PSDK_ERROR_MODULE_USER,
PSDK_ERROR_MODULE_NEGOTIATE,
PSDK_ERROR_MODULE_UPGRADE,
PSDK_ERROR_MODULE_ERROR,
} E_PsdkErrorModule;
/**
* @brief Raw error code of system module.
*/
typedef enum {
PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_SUCCESS = 0x000,
PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_INVALID_REQUEST_PARAMETER = 0x0D4,
PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_EXECUTING_HIGHER_PRIORITY_TASK = 0x0D7,
PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_NONSUPPORT = 0x0E0,
PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_TIMEOUT = 0x0E1,
PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_MEMORY_ALLOC_FAILED = 0x0E2,
PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_INVALID_PARAMETER = 0x0E3,
PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_NONSUPPORT_IN_CURRENT_STATE = 0x0E4,
PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_SYSTEM_ERROR = 0x0EC,
PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_HARDWARE_ERR = 0x0FA,
PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_INSUFFICIENT_ELECTRICITY = 0x0FB,
PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_UNKNOWN = 0x0FF,
PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_NOT_FOUND = 0x100,
PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_OUT_OF_RANGE = 0x101,
PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_BUSY = 0x102,
PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_DUPLICATE = 0x103,
PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_ADAPTER_NOT_MATCH = 0x104,
} E_PsdkErrorSystemModuleRawCode;
/**
* @brief Raw error code of gimbal module.
*/
typedef enum {
PSDK_ERROR_GIMBAL_MODULE_RAW_CODE_PITCH_REACH_POSITIVE_LIMIT = 0x000,
PSDK_ERROR_GIMBAL_MODULE_RAW_CODE_PITCH_REACH_NEGATIVE_LIMIT = 0x001,
PSDK_ERROR_GIMBAL_MODULE_RAW_CODE_ROLL_REACH_POSITIVE_LIMIT = 0x002,
PSDK_ERROR_GIMBAL_MODULE_RAW_CODE_ROLL_REACH_NEGATIVE_LIMIT = 0x003,
PSDK_ERROR_GIMBAL_MODULE_RAW_CODE_YAW_REACH_POSITIVE_LIMIT = 0x004,
PSDK_ERROR_GIMBAL_MODULE_RAW_CODE_YAW_REACH_NEGATIVE_LIMIT = 0x005,
PSDK_ERROR_GIMBAL_MODULE_RAW_CODE_NON_CONTROL_AUTHORITY = 0x006,
} E_PsdkErrorGimbalModuleRawCode;
/**
* @brief Raw error code of payload collaboration module.
*/
typedef enum {
PSDK_ERROR_PAYLOAD_COLLABORATION_MODULE_RAW_CODE_POSITION_NOT_MATCH = 0x000,
} E_PsdkErrorPayloadCollaborationModuleRawCode;
/**
* @brief Raw error code of subscription module.
*/
typedef enum {
PSDK_ERROR_SUBSCRIPTION_MODULE_RAW_CODE_INVALID_TOPIC_FREQ = 0x000,
PSDK_ERROR_SUBSCRIPTION_MODULE_RAW_CODE_TOPIC_DUPLICATE = 0x001,
PSDK_ERROR_SUBSCRIPTION_MODULE_RAW_CODE_TOPIC_NOT_SUBSCRIBED = 0x002,
PSDK_ERROR_SUBSCRIPTION_MODULE_RAW_CODE_TIMESTAMP_NOT_ENABLE = 0x003,
} E_PsdkErrorSubscriptionModuleRawCode;
/**
* @brief Raw error code of mop channel module.
*/
typedef enum {
PSDK_ERROR_MOP_CHANNEL_MODULE_RAW_CODE_CONNECTION_CLOSE = 0x00B,
} E_PsdkErrorMopChannelModuleRawCode;
//@formatter:off
/**
* @brief PSDK error code complete works. Users can search all error messages here.
* @details Please get error description, error reason and error recovery suggestion of every error code from
* ::PSDK_ERROR_OBJECTS macro.
*/
enum PsdkErrorCode {
/* system module error code, including some common error code */
PSDK_ERROR_SYSTEM_MODULE_CODE_SUCCESS = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_SYSTEM, PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_SUCCESS),
PSDK_ERROR_SYSTEM_MODULE_CODE_INVALID_REQUEST_PARAMETER = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_SYSTEM, PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_INVALID_REQUEST_PARAMETER),
PSDK_ERROR_SYSTEM_MODULE_CODE_EXECUTING_HIGHER_PRIORITY_TASK = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_SYSTEM, PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_EXECUTING_HIGHER_PRIORITY_TASK),
PSDK_ERROR_SYSTEM_MODULE_CODE_NONSUPPORT = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_SYSTEM, PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_NONSUPPORT),
PSDK_ERROR_SYSTEM_MODULE_CODE_TIMEOUT = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_SYSTEM, PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_TIMEOUT),
PSDK_ERROR_SYSTEM_MODULE_CODE_MEMORY_ALLOC_FAILED = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_SYSTEM, PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_MEMORY_ALLOC_FAILED),
PSDK_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_SYSTEM, PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_INVALID_PARAMETER),
PSDK_ERROR_SYSTEM_MODULE_CODE_NONSUPPORT_IN_CURRENT_STATE = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_SYSTEM, PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_NONSUPPORT_IN_CURRENT_STATE),
PSDK_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_SYSTEM, PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_SYSTEM_ERROR),
PSDK_ERROR_SYSTEM_MODULE_CODE_HARDWARE_ERR = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_SYSTEM, PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_HARDWARE_ERR),
PSDK_ERROR_SYSTEM_MODULE_CODE_INSUFFICIENT_ELECTRICITY = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_SYSTEM, PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_INSUFFICIENT_ELECTRICITY),
PSDK_ERROR_SYSTEM_MODULE_CODE_UNKNOWN = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_SYSTEM, PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_UNKNOWN),
PSDK_ERROR_SYSTEM_MODULE_CODE_NOT_FOUND = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_SYSTEM, PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_NOT_FOUND),
PSDK_ERROR_SYSTEM_MODULE_CODE_OUT_OF_RANGE = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_SYSTEM, PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_OUT_OF_RANGE),
PSDK_ERROR_SYSTEM_MODULE_CODE_BUSY = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_SYSTEM, PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_BUSY),
PSDK_ERROR_SYSTEM_MODULE_CODE_DUPLICATE = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_SYSTEM, PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_DUPLICATE),
PSDK_ERROR_SYSTEM_MODULE_CODE_ADAPTER_NOT_MATCH = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_SYSTEM, PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_ADAPTER_NOT_MATCH),
/* gimbal module error code */
PSDK_ERROR_GIMBAL_MODULE_CODE_PITCH_REACH_POSITIVE_LIMIT = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_GIMBAL, PSDK_ERROR_GIMBAL_MODULE_RAW_CODE_PITCH_REACH_POSITIVE_LIMIT),
PSDK_ERROR_GIMBAL_MODULE_CODE_PITCH_REACH_NEGATIVE_LIMIT = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_GIMBAL, PSDK_ERROR_GIMBAL_MODULE_RAW_CODE_PITCH_REACH_NEGATIVE_LIMIT),
PSDK_ERROR_GIMBAL_MODULE_CODE_ROLL_REACH_POSITIVE_LIMIT = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_GIMBAL, PSDK_ERROR_GIMBAL_MODULE_RAW_CODE_ROLL_REACH_POSITIVE_LIMIT),
PSDK_ERROR_GIMBAL_MODULE_CODE_ROLL_REACH_NEGATIVE_LIMIT = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_GIMBAL, PSDK_ERROR_GIMBAL_MODULE_RAW_CODE_ROLL_REACH_NEGATIVE_LIMIT),
PSDK_ERROR_GIMBAL_MODULE_CODE_YAW_REACH_POSITIVE_LIMIT = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_GIMBAL, PSDK_ERROR_GIMBAL_MODULE_RAW_CODE_YAW_REACH_POSITIVE_LIMIT),
PSDK_ERROR_GIMBAL_MODULE_CODE_YAW_REACH_NEGATIVE_LIMIT = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_GIMBAL, PSDK_ERROR_GIMBAL_MODULE_RAW_CODE_YAW_REACH_NEGATIVE_LIMIT),
PSDK_ERROR_GIMBAL_MODULE_CODE_NON_CONTROL_AUTHORITY = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_GIMBAL, PSDK_ERROR_GIMBAL_MODULE_RAW_CODE_NON_CONTROL_AUTHORITY),
/* payload collaboration module error code */
PSDK_ERROR_PAYLOAD_COLLABORATION_MODULE_CODE_POSITION_NOT_MATCH = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_PAYLOAD_COLLABORATION, PSDK_ERROR_PAYLOAD_COLLABORATION_MODULE_RAW_CODE_POSITION_NOT_MATCH),
/* subscription module error code */
PSDK_ERROR_SUBSCRIPTION_MODULE_CODE_INVALID_TOPIC_FREQ = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_SUBSCRIPTION, PSDK_ERROR_SUBSCRIPTION_MODULE_RAW_CODE_INVALID_TOPIC_FREQ),
PSDK_ERROR_SUBSCRIPTION_MODULE_CODE_TOPIC_DUPLICATE = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_SUBSCRIPTION, PSDK_ERROR_SUBSCRIPTION_MODULE_RAW_CODE_TOPIC_DUPLICATE),
PSDK_ERROR_SUBSCRIPTION_MODULE_CODE_TOPIC_NOT_SUBSCRIBED = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_SUBSCRIPTION, PSDK_ERROR_SUBSCRIPTION_MODULE_RAW_CODE_TOPIC_NOT_SUBSCRIBED),
PSDK_ERROR_SUBSCRIPTION_MODULE_CODE_TIMESTAMP_NOT_ENABLE = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_SUBSCRIPTION, PSDK_ERROR_SUBSCRIPTION_MODULE_RAW_CODE_TIMESTAMP_NOT_ENABLE),
/* mop channel module error code */
PSDK_ERROR_MOP_CHANNEL_MODULE_CODE_CONNECTION_CLOSE = PSDK_ERROR_CODE(PSDK_ERROR_MODULE_MOP_CHANNEL, PSDK_ERROR_MOP_CHANNEL_MODULE_RAW_CODE_CONNECTION_CLOSE),
};
//@formatter:on
/* Exported functions --------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif // PSDK_ERROR_H
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/

View File

@ -0,0 +1,334 @@
/**
********************************************************************
* @file psdk_gimbal.h
* @brief PSDK gimbal module is used to achieve the third gimbal for developer. The module can be used only when the PSDK
* adapter is Skyport, rather than XPort.
*
* @copyright (c) 2018 DJI. All rights reserved.
*
* All information contained herein is, and remains, the property of DJI.
* The intellectual and technical concepts contained herein are proprietary
* to DJI and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of DJI.
*
* If you receive this source code without DJIs authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify DJI of its removal. DJI reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef PSDK_GIMBAL_H
#define PSDK_GIMBAL_H
/* Includes ------------------------------------------------------------------*/
#include "psdk_typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief Gimbal work mode, specifies how gimbal follow aircraft movement.
*/
typedef enum {
PSDK_GIMBAL_MODE_FREE = 0, /*!< Free mode, fix gimbal attitude in the ground coordinate, ignoring movement of aircraft. */
PSDK_GIMBAL_MODE_FPV = 1, /*!< FPV (First Person View) mode, only control roll and yaw angle of gimbal in the ground coordinate to follow aircraft. */
PSDK_GIMBAL_MODE_YAW_FOLLOW = 2, /*!< Yaw follow mode, only control yaw angle of gimbal in the ground coordinate to follow aircraft. */
} E_PsdkGimbalMode;
/**
* @brief Gimbal calibration stage and result.
*/
typedef enum {
PSDK_GIMBAL_CALIBRATION_STAGE_COMPLETE = 0, /*!< Calibration have been completed and the result is successful. */
PSDK_GIMBAL_CALIBRATION_STAGE_PROCRESSING = 1, /*!< Gimbal is calibrating. */
PSDK_GIMBAL_CALIBRATION_STAGE_FAILED = 3, /*!< Calibration have been completed and the result is failure. */
} E_PsdkGimbalCalibrationStage;
/**
* @brief Gimbal rotation mode, specifies control style.
*/
typedef enum {
PSDK_GIMBAL_ROTATION_MODE_RELATIVE_ANGLE = 0, /*!< Relative angle rotation mode, represents rotating gimbal specified angles based on current angles. */
PSDK_GIMBAL_ROTATION_MODE_ABSOLUTE_ANGLE = 1, /*!< Absolute angle rotation mode, represents rotating gimbal to specified angles in the ground coordinate. */
PSDK_GIMBAL_ROTATION_MODE_SPEED = 2, /*!< Speed rotation mode, specifies rotation speed of gimbal in the ground coordinate. */
} E_PsdkGimbalRotationMode;
/**
* @brief Axis of gimbal.
*/
typedef enum {
PSDK_GIMBAL_AXIS_PITCH = 0, /*!< Pitch axis. */
PSDK_GIMBAL_AXIS_ROLL = 1, /*!< Roll axis. */
PSDK_GIMBAL_AXIS_YAW = 2, /*!< Yaw axis. */
} E_PsdkGimbalAxis;
/**
* @brief Reset mode of gimbal.
*/
typedef enum {
/*! Only reset yaw axis of gimbal. Reset angle of yaw axis to the sum of yaw axis angle of aircraft and fine tune angle
* of yaw axis of gimbal. */
PSDK_GIMBAL_RESET_MODE_YAW = 1,
/*! Reset yaw axis and pitch axis of gimbal. Reset angle of yaw axis to sum of yaw axis angle of aircraft and fine tune
* angle of yaw axis of gimbal, and reset pitch axis angle to the fine tune angle. */
PSDK_GIMBAL_RESET_MODE_PITCH_AND_YAW = 3,
/*! Reset yaw axis and pitch axis of gimbal. Reset angle of yaw axis to sum of yaw axis angle of aircraft and fine tune
* angle of yaw axis of gimbal, and reset pitch axis angle to sum of -90 degree and fine tune angle if gimbal
* downward, sum of 90 degree and fine tune angle if upward. */
PSDK_GIMBAL_RESET_MODE_PITCH_DOWNWARD_UPWARD_AND_YAW = 11,
/*! Reset pitch axis of gimbal. Reset pitch axis angle to sum of -90 degree and fine tune angle if gimbal downward,
* sum of 90 degree and fine tune angle if upward. */
PSDK_GIMBAL_RESET_MODE_PITCH_DOWNWARD_UPWARD = 12,
} E_PsdkGimbalResetMode;
/**
* @brief Smooth factor of gimbal controller.
*/
typedef struct {
uint8_t pitch; /*!< Smooth factor of pitch axis, range from 0 to 30. */
uint8_t yaw; /*!< Smooth factor of yaw axis, range from 0 to 30. */
} T_PsdkGimbalControllerSmoothFactor;
/**
* @brief Max speed percentage of every axis of gimbal.
*/
typedef struct {
uint8_t pitch; /*!< Max speed percentage of pitch axis, range from 1 to 100. */
uint8_t yaw; /*!< Max speed percentage of yaw axis, range from 1 to 100. */
} T_PsdkGimbalControllerMaxSpeedPercentage;
/**
* @brief Data structure describes gimbal system state.
*/
typedef struct {
bool resettingFlag; /*!< Specifies whether gimbal is resetting now or not. */
bool mountedUpward; /*!< Specifies whether gimbal is upward or not. */
bool blockingFlag; /*!< Specifies whether gimbal is stuck or not. */
bool pitchRangeExtensionEnabledFlag; /*!< Specifies whether extended angle range of gimbal pitch axis is enabled or not. */
E_PsdkGimbalMode gimbalMode; /*!< Gimbal mode. */
T_PsdkAttitude3d fineTuneAngle; /*!< Fine tune angles, unit: 0.1 degree. */
T_PsdkGimbalControllerSmoothFactor smoothFactor; /*!< Smooth factor of gimbal controller. */
T_PsdkGimbalControllerMaxSpeedPercentage maxSpeedPercentage; /*!< Max speed percentage of gimbal controller. */
} T_PsdkGimbalSystemState;
/**
* @brief Reach limit flag.
*/
typedef struct {
bool pitch; /*!< Specifies whether gimbal has reached angle limit of pitch axis, if true, reached the limit. */
bool roll; /*!< Specifies whether gimbal has reached angle limit of roll axis, if true, reached the limit. */
bool yaw; /*!< Specifies whether gimbal has reached angle limit of yaw axis, if true, reached the limit. */
} T_PsdkGimbalReachLimitFlag;
/**
* @brief Gimbal attitude related information.
*/
typedef struct {
T_PsdkAttitude3d attitude; /*!< Gimbal attitude in the ground coordinate, unit: 0.1 degree. */
T_PsdkGimbalReachLimitFlag reachLimitFlag; /*!< Reach limit flag, being set when the joint angles of gimbal reach limits. */
} T_PsdkGimbalAttitudeInformation;
/**
* @brief Gimbal calibration state.
*/
typedef struct {
bool calibratingFlag; /*!< Specifies whether gimbal is calibrating now or not. */
bool lastCalibrationResult; /*!< Result of the last calibration, and true specifies success. */
uint8_t currentCalibrationProgress; /*!< Progress percentage of current calibration. If gimbal is calibrating now and fill in real progress percentage, if not, fill in zero. The item ranges from 0 to 100. */
E_PsdkGimbalCalibrationStage currentCalibrationStage; /*!< Current calibration stage and result. If gimbal is calibrating now and fill in ::PSDK_GIMBAL_CALIBRATION_STAGE_PROCRESSING, if not, fill in result of the last calibration. */
} T_PsdkGimbalCalibrationState;
/**
* @brief Gimbal rotation command property.
*/
typedef struct {
struct {
bool pitch; /*!< Specifies whether ignore rotation command of pitch axis, and true specifies ignoring. */
bool roll; /*!< Specifies whether ignore rotation command of roll axis, and true specifies ignoring. */
bool yaw; /*!< Specifies whether ignore rotation command of yaw axis, and true specifies ignoring. */
} rotationValueInvalidFlag; /*!< Specifies whether ignore rotation command of some axis, including pitch, roll and yaw. */
union {
struct {
uint16_t actionTime; /*!< Action time during which gimbal move to target angles, unit: 0.01s. */
} relativeAngleRotation; /*!< Property of relative angle rotation command. */
struct {
uint16_t actionTime; /*!< Action time during which gimbal move to target angles, unit: 0.01s. */
/*! Joint angle valid flag, specifying whether
* T_PsdkGimbalRotationProperty::absoluteAngleRotation::jointAngle is valid when absolute angle control. */
bool jointAngleValid;
/*! Joint angles of gimbal, unit: 0.1 degree. If
* T_PsdkGimbalRotationProperty::absoluteAngleRotation::jointAngleValid is false, specifying here joint
* angles are invalid, and please ignore the joint angles. If joint angles are valid, users should ensure
* that target joint angles of gimbal is approximately the same as the specified value. */
T_PsdkAttitude3d jointAngle;
} absoluteAngleRotation; /*!< Property of absolute angle rotation command. */
};
} T_PsdkGimbalRotationProperty;
/**
* @brief Common handler function prototypes of gimbal, that is, some common callback function prototypes of gimbal.
* @warning User can not execute blocking style operations or functions in callback function, because that will block PSDK
* root thread, causing problems such as slow system response, payload disconnection or infinite loop.
*/
typedef struct {
/*!
* @brief Prototype of callback function used to report system state of gimbal.
* @param systemState: pointer to memory space used to store gimbal system state.
* @return Execution result.
*/
T_PsdkReturnCode (*GetSystemState)(T_PsdkGimbalSystemState *systemState);
/*!
* @brief Prototype of callback function used to report attitude information of gimbal.
* @param attitudeInformation: pointer to memory space used to store gimbal attitude information.
* @return Execution result.
*/
T_PsdkReturnCode (*GetAttitudeInformation)(T_PsdkGimbalAttitudeInformation *attitudeInformation);
/*!
* @brief Prototype of callback function used to report calibration state of gimbal.
* @param calibrationState: pointer to memory space used to store gimbal calibration state.
* @return Execution result.
*/
T_PsdkReturnCode (*GetCalibrationState)(T_PsdkGimbalCalibrationState *calibrationState);
/*!
* @brief Prototype of callback function used to rotate gimbal. Rotation callback function will be called when
* other modules control gimbal.
* @warning User should control execution time of the callback function to be short, because this callback function
* may be called at very high frequency in some scenarios, just like 200Hz.
* @param rotationMode: mode of rotation command.
* @param rotationProperty: property of rotation command.
* @param rotationValue: value of rotation command, unit: 0.1 degree (if rotation mode is
* ::PSDK_GIMBAL_ROTATION_MODE_RELATIVE_ANGLE or ::PSDK_GIMBAL_ROTATION_MODE_ABSOLUTE_ANGLE), 0.1 degree/s
* (if rotation mode is ::PSDK_GIMBAL_ROTATION_MODE_SPEED).
* @return Execution result.
*/
T_PsdkReturnCode (*Rotate)(E_PsdkGimbalRotationMode rotationMode, T_PsdkGimbalRotationProperty rotationProperty,
T_PsdkAttitude3d rotationValue);
/*!
* @brief Prototype of callback function used to start calibrating gimbal.
* @note Maximum allowable time of gimbal calibration is 120s. If gimbal has not completed calibration during
* 120s, DJI Pilot believe calibration failed.
* @return Execution result.
*/
T_PsdkReturnCode (*StartCalibrate)(void);
/**
* @brief Set smooth factor for gimbal controller, using to smooth control.
* @param smoothingFactor: smooth factor. The larger the value, the smaller the acceleration of gimbal. Recommended
* calculation formula is "acc = 10000 * (0.8 ^ (1 + x)) deg/s^2", x is smooth factor. Range from 0 to 30.
* @param axis: axis to be set.
* @return Execution result.
*/
T_PsdkReturnCode (*SetControllerSmoothFactor)(uint8_t smoothingFactor, E_PsdkGimbalAxis axis);
/*!
* @brief Prototype of callback function used to enable or disable extended pitch axis angle range.
* @details Switching the gimbal limit euler angle of pitch axis to the extended limit angle or the default limit
* angle.
* @param enabledFlag: flag specified whether enable or disable extended pitch axis angle range.
* @return Execution result.
*/
T_PsdkReturnCode (*SetPitchRangeExtensionEnabled)(bool enabledFlag);
/**
* @brief Set max speed percentage for gimbal controller.
* @param maxSpeedPercentage: max speed value. Recommended calculation formula is "spd = default_max_spd * x / 100",
* x is default max speed value. Range from 1 to 100.
* @param axis: axis to be set.
* @return Execution result.
*/
T_PsdkReturnCode (*SetControllerMaxSpeedPercentage)(uint8_t maxSpeedPercentage, E_PsdkGimbalAxis axis);
/**
* @brief Restore factory settings of gimbal, including fine tune angle, pitch angle extension enable flag and max
* speed etc.
* @return Execution result.
*/
T_PsdkReturnCode (*RestoreFactorySettings)(void);
/*!
* @brief Prototype of callback function used to set gimbal work mode.
* @param mode: gimbal work mode.
* @return Execution result.
*/
T_PsdkReturnCode (*SetMode)(E_PsdkGimbalMode mode);
/*!
* @brief Prototype of callback function used to reset gimbal.
* @note Reset command will interrupt rotation process.
* @param mode: Reset mode.
* @return Execution result.
*/
T_PsdkReturnCode (*Reset)(E_PsdkGimbalResetMode mode);
/*!
* @brief Prototype of callback function used to fine tune angle of gimbal.
* @param fineTuneAngle: fine tune angle, unit: 0.1 degree. Angle value of greater than 0 specifies rotation
* towards the positive direction of body coordinate.
* @return Execution result.
*/
T_PsdkReturnCode (*FineTuneAngle)(T_PsdkAttitude3d fineTuneAngle);
/**
* @brief Prototype of callback function used to report rotation speed of gimbal.
* @note The callback function will be called at 50 Hz. Developers should ensure that, the average rotation speed
* of gimbal within 20 ms after the callback function is called is approximately equal to the reported rotation
* speed.
* @param rotationSpeed: pointer to memory space used to store rotation speed, in body coordinate, unit:
* 0.1 degree/s.
* @return Execution result.
*/
T_PsdkReturnCode (*GetRotationSpeed)(T_PsdkAttitude3d *rotationSpeed);
/**
* @brief Prototype of callback function used to report joint angle of gimbal.
* @param jointAngle: pointer to memory space used to store joint angles, unit: 0.1 degree.
* @return Execution result.
*/
T_PsdkReturnCode (*GetJointAngle)(T_PsdkAttitude3d *jointAngle);
} T_PsdkGimbalCommonHandler;
/* Exported functions --------------------------------------------------------*/
/**
* @brief Initialise gimbal module, and user should call this function before using gimbal features.
* @return Execution result.
*/
T_PsdkReturnCode PsdkGimbal_Init(void);
/**
* @brief Deinitialise gimbal module.
* @return Execution result.
*/
T_PsdkReturnCode PsdkGimbal_DeInit(void);
/**
* @brief Register common handler functions/callback functions of gimbal. After registering, callback functions will be
* called automatically.
* @param commonHandler: pointer to common handler functions of gimbal.
* @return Execution result.
*/
T_PsdkReturnCode PsdkGimbal_RegCommonHandler(const T_PsdkGimbalCommonHandler *commonHandler);
#ifdef __cplusplus
}
#endif
#endif // PSDK_GIMBAL_H
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/

View File

@ -0,0 +1,129 @@
/**
********************************************************************
* @file psdk_logger.h
* @brief This is the header file for "psdk_logger.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2018 DJI. All rights reserved.
*
* All information contained herein is, and remains, the property of DJI.
* The intellectual and technical concepts contained herein are proprietary
* to DJI and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of DJI.
*
* If you receive this source code without DJIs authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify DJI of its removal. DJI reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef PSDK_LOGGER_H
#define PSDK_LOGGER_H
/* Includes ------------------------------------------------------------------*/
#include "psdk_typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief The console method that needs to be registered.
* @note Before registering the console method, you need to test the methods that need to be registered to ensure
* that they can be used normally.
*/
typedef T_PsdkReturnCode (*ConsoleFunc)(const uint8_t *data, uint16_t dataLen);
typedef enum {
PSDK_LOGGER_CONSOLE_LOG_LEVEL_ERROR = 1, /*!< Logger console error level. The method and level of the console are
associated with each other. If the level of the registered console
method is lower than this level, the level interface will not be
printed successfully. */
PSDK_LOGGER_CONSOLE_LOG_LEVEL_WARNING = 2, /*!< Logger console warning level.The method and level of the console are
associated with each other. If the level of the registered console
method is lower than this level, the level interface will not be
printed successfully. */
PSDK_LOGGER_CONSOLE_LOG_LEVEL_INFO = 3, /*!< Logger console info level. The method and level of the console are
associated with each other. If the level of the registered console
method is lower than this level, the level interface will not be
printed successfully. */
PSDK_LOGGER_CONSOLE_LOG_LEVEL_DEBUG = 4, /*!< Logger console debug level. The method and level of the console are
associated with each other. If the level of the registered console
method is lower than this level, the level interface will not be
printed successfully. */
} E_PsdkLoggerConsoleLogLevel;
typedef struct {
uint8_t consoleLevel; /*!< Specifies logger console level. The method and level of the console are associated with
each other. Calling different levels of the print interface, you can print the log with
the method no higher than the level. For example, the registered method level is info,
only the log not higher than info can be printed, and the debug log will not be printed.*/
ConsoleFunc func; /*!< Specifies logger console function. Before registering the console method, you need to
test the methods that need to be registered to ensure that they can be used normally.*/
} T_PsdkLoggerConsole;
/* Exported functions --------------------------------------------------------*/
/**
* @brief Add the console function and level for Payload SDK.
* @note When registering the console, you need to provide the method of the console and the level corresponding to
* the method. Log levels from high to low are Debug, Info, Warn, and Error, the log function module can print all
* logs not higher than the specified level. Maximum support for registering eight different console methods at the
* same time.Before registering the console method, you should test the registration method ensure that all the method
* are normally. If you registered multiple methods at the same time, all the methods will be print.
* @param console: pointer to the console function.
* @return Execution result.
*/
T_PsdkReturnCode PsdkLogger_AddConsole(T_PsdkLoggerConsole *console);
/**
* @brief Print out the info log of the specified format by the registration method.
* @note The registered method is printed according to the corresponding level. If the level of the console is lower
* than the level at which the log needs to be printed, it will not be printed successfully.
* @param fmt: pointer to the format string that needs print out.
* @param ...: Variable parameters, consistent with the use of the system interface print out.
*/
void PsdkLogger_UserLogInfo(const char *fmt, ...);
/**
* @brief Print out the warning log of the specified format by the registration method.
* @note The registered method is printed according to the corresponding level. If the level of the console is lower
* than the level at which the log needs to be printed, it will not be printed successfully.
* @param fmt: pointer to the format string that needs print out.
* @param ...: Variable parameters, consistent with the use of the system interface print out.
*/
void PsdkLogger_UserLogWarn(const char *fmt, ...);
/**
* @brief Print out the debug log of the specified format by the registration method.
* @note The registered method is printed according to the corresponding level. If the level of the console is lower
* than the level at which the log needs to be printed, it will not be printed successfully.
* @param fmt: pointer to the format string that needs print out.
* @param ...: Variable parameters, consistent with the use of the system interface print out.
*/
void PsdkLogger_UserLogDebug(const char *fmt, ...);
/**
* @brief Print out the error log of the specified format by the registration method.
* @note The registered method is printed according to the corresponding level. If the level of the console is lower
* than the level at which the log needs to be printed, it will not be printed successfully.
* @param fmt: pointer to the format string that needs print out.
* @param ...: Variable parameters, consistent with the use of the system interface print out.
*/
void PsdkLogger_UserLogError(const char *fmt, ...);
#ifdef __cplusplus
}
#endif
#endif // PSDK_LOGGER_H
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/

View File

@ -0,0 +1,154 @@
/**
********************************************************************
* @file psdk_mop_channel.h
* @brief This is the header file for "psdk_mop_channel.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2018 DJI. All rights reserved.
*
* All information contained herein is, and remains, the property of DJI.
* The intellectual and technical concepts contained herein are proprietary
* to DJI and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of DJI.
*
* If you receive this source code without DJIs authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify DJI of its removal. DJI reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef PSDK_MOP_CHANNEL_H
#define PSDK_MOP_CHANNEL_H
/* Includes ------------------------------------------------------------------*/
#include "psdk_typedef.h"
#if PSDK_ARCH_SYS_LINUX
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief Mop channel handle.
*/
typedef void *T_PsdkMopChannelHandle;
/**
* @brief Mop channel transmission type.
*/
typedef enum {
PSDK_MOP_CHANNEL_TRANS_RELIABLE = 0, /*!< Reliable transmission type. */
PSDK_MOP_CHANNEL_TRANS_UNRELIABLE, /*!< Unreliable transmission type. */
} E_PsdkMopChannelTransType;
/* Exported functions --------------------------------------------------------*/
/**
* @brief Initialize the mop channel for operation about mop channel handle later.
* @note This interface needs to be called before calling other mop channel interfaces. Please make sure the network port
* is connected properly before calling this interface. Mop channel feature currently only supports linux platform.
* @return Execution result.
*/
T_PsdkReturnCode PsdkMopChannel_Init(void);
/**
* @brief Create the mop channel handle by specified transmission type.
* @note After calling this interface, you should follow below cases:
* 1. When mop channel handle created successfully, you need bind channel id to this created mop channel handle and
* accept other client device connections, such as MSDK or OSDK device;
* 2. When mop channel accept successfully, you can use send or receive data interface to write or read data by accepted
* output channel handle;
* 3. When the mop channel handle do not used, you can use close or destroy interface to release the resource;
* @param channelHandle: pointer to the created mop channel.
* @param transType: the transmission type for mop channel ::E_PsdkMopChannelTransType.
* @return Execution result.
*/
T_PsdkReturnCode PsdkMopChannel_Create(T_PsdkMopChannelHandle *channelHandle, E_PsdkMopChannelTransType transType);
/**
* @brief Destroy the created mop channel and release the resource that referenced by the channel handle.
* @note After calling this interface, we can not do any operation about this channel handle expect create channel handle.
* @param channelHandle: pointer to the created mop channel.
* @return Execution result.
*/
T_PsdkReturnCode PsdkMopChannel_Destroy(T_PsdkMopChannelHandle channelHandle);
/**
* @brief Bind the channel id to the created mop channel handle.
* @note When mop channel handle created successfully, you can bind channel id to this created mop handle and calling
* interface ::PsdkMopChannel_Accept, then other client device can use this binded channel id to connect created mop handle.
* @param channelHandle: pointer to the created mop channel handle.
* @param channelId: the channel id of mop handle for accepting client device connection.
* @return Execution result.
*/
T_PsdkReturnCode PsdkMopChannel_Bind(T_PsdkMopChannelHandle channelHandle,
uint16_t channelId);
/**
* @brief Accept the connection by binded channel id for created mop channel.
* @note The mop accept channel extracts the connection request on the queue of pennding connections for listening channel
* handle ::channelHandle. Create a new connected channel handle and return to user ::outChannelHandle by referrng to a new
* connection. Payload can be a server that allow multiple client connections by binded channel id.
* @param channelHandle: pointer to the created mop channel.
* @param outChannelHandle: pointer to the accepted output mop channel.
* @return Execution result.
*/
T_PsdkReturnCode PsdkMopChannel_Accept(T_PsdkMopChannelHandle channelHandle,
T_PsdkMopChannelHandle *outChannelHandle);
/**
* @brief Close the created mop channel.
* @note After calling this interface, we can not do any operation about this channel handle expect destroy channel handle.
* @param channelHandle: pointer to the created mop channel.
* @return Execution result.
*/
T_PsdkReturnCode PsdkMopChannel_Close(T_PsdkMopChannelHandle channelHandle);
/**
* @brief Send data by the accepted output mop channel.
* @note This interface should be called after successfully calling the interface ::PsdkMopChannel_Accept. It is recommended
* to send more bytes of data at a time to improve read and write efficiency. Need to determine whether the send is
* successful according to the return code and the actual sent data length.
* @param channelHandle: pointer to accepted output mop handle ::outChannelHandle by calling interface ::PsdkMopChannel_Accept.
* @param data: pointer to data to be sent.
* @param len: length of data to be sent via accepted output mop handle, unit: byte.
* @param realLen: pointer to real length of data that already sent.
* @return Execution result.
*/
T_PsdkReturnCode PsdkMopChannel_SendData(T_PsdkMopChannelHandle channelHandle,
uint8_t *data,
uint32_t len,
uint32_t *realLen);
/**
* @brief Receive data from the accepted output mop channel.
* @note This interface should be called after successfully calling the interface ::PsdkMopChannel_Accept. It is recommended
* to receive more bytes of data at a time to improve read and write efficiency. Need to determine whether the receive
* is successful according to the return code and the actual received data length.
* @param channelHandle: pointer to accepted output mop handle ::outChannelHandle by calling interface ::PsdkMopChannel_Accept.
* @param data: pointer to data to store the received data.
* @param len: length of data to be received via accepted output mop handle, unit: byte.
* @param realLen: pointer to real length of data that already received.
* @return Execution result.
*/
T_PsdkReturnCode PsdkMopChannel_RecvData(T_PsdkMopChannelHandle channelHandle,
uint8_t *data,
uint32_t len,
uint32_t *realLen);
#ifdef __cplusplus
}
#endif
#endif
#endif // PSDK_MOP_CHANNEL_H
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/

View File

@ -0,0 +1,977 @@
/**
********************************************************************
* @file psdk_payload_camera.h
* @brief This is the header file for "psdk_payload_camera.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2018 DJI. All rights reserved.
*
* All information contained herein is, and remains, the property of DJI.
* The intellectual and technical concepts contained herein are proprietary
* to DJI and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of DJI.
*
* If you receive this source code without DJIs authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify DJI of its removal. DJI reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef PSDK_PAYLOAD_CAMERA_H
#define PSDK_PAYLOAD_CAMERA_H
/* Includes ------------------------------------------------------------------*/
#include "psdk_typedef.h"
#include "psdk_data_transmission.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief Camera work mode.
*/
typedef enum {
PSDK_CAMERA_MODE_SHOOT_PHOTO = 0, /*!< Shoot photo work mode. */
PSDK_CAMERA_MODE_RECORD_VIDEO = 1, /*!< Record video work mode. */
PSDK_CAMERA_MODE_PLAYBACK = 2, /*!< Media playback work mode. */
} E_PsdkCameraMode;
/**
* @brief Camera shoot photo mode.
*/
typedef enum {
PSDK_CAMERA_SHOOT_PHOTO_MODE_SINGLE = 1, /*!< Single photographing mode. */
PSDK_CAMERA_SHOOT_PHOTO_MODE_BURST = 4, /*!< Burst photographing mode. */
PSDK_CAMERA_SHOOT_PHOTO_MODE_INTERVAL = 6, /*!< Interval photographing mode. */
} E_PsdkCameraShootPhotoMode;
/**
* @brief Camera shooting state when photographing.
*/
typedef enum {
PSDK_CAMERA_SHOOTING_PHOTO_IDLE = 0, /*!< Photographing in idle state. */
PSDK_CAMERA_SHOOTING_SINGLE_PHOTO = 1, /*!< Photographing in single photograph state . */
PSDK_CAMERA_SHOOTING_BURST_PHOTO = 2, /*!< Photographing in burst photograph state. */
PSDK_CAMERA_SHOOTING_INTERVAL_PHOTO = 6, /*!< Photographing in interval photograph state. */
} E_PsdkCameraShootingState;
/**
* @brief Camera burst count setting when photographing.
*/
typedef enum {
PSDK_CAMERA_BURST_COUNT_2 = 2, /*!< Photo number of burst photographing: 2. */
PSDK_CAMERA_BURST_COUNT_3 = 3, /*!< Photo number of burst photographing: 3. */
PSDK_CAMERA_BURST_COUNT_5 = 5, /*!< Photo number of burst photographing: 5. */
PSDK_CAMERA_BURST_COUNT_7 = 7, /*!< Photo number of burst photographing: 7. */
PSDK_CAMERA_BURST_COUNT_10 = 10, /*!< Photo number of burst photographing: 10. */
PSDK_CAMERA_BURST_COUNT_14 = 14, /*!< Photo number of burst photographing: 14. */
} E_PsdkCameraBurstCount;
/**
* @brief Camera metering mode.
*/
typedef enum {
PSDK_CAMERA_METERING_MODE_CENTER = 0, /*!< Center metering mode. */
PSDK_CAMERA_METERING_MODE_AVERAGE = 1, /*!< Average metering mode. */
PSDK_CAMERA_METERING_MODE_SPOT = 2, /*!< Spot metering mode. */
} E_PsdkCameraMeteringMode;
/**
* @brief Camera focus mode.
*/
typedef enum {
PSDK_CAMERA_FOCUS_MODE_MANUAL = 0, /*!< Manual focus mode. */
PSDK_CAMERA_FOCUS_MODE_AUTO = 1, /*!< Auto focus mode. */
} E_PsdkCameraFocusMode;
/**
* @brief Camera zoom direction.
*/
typedef enum {
PSDK_CAMERA_ZOOM_DIRECTION_OUT = 0, /*!< The lens moves in the far direction, the zoom factor becomes smaller. */
PSDK_CAMERA_ZOOM_DIRECTION_IN = 1, /*!< The lens moves in the near direction, the zoom factor becomes larger. */
} E_PsdkCameraZoomDirection;
/**
* @brief Camera zoom speed.
*/
typedef enum {
PSDK_CAMERA_ZOOM_SPEED_SLOWEST = 72, /*!< Lens zooms in slowest speed. */
PSDK_CAMERA_ZOOM_SPEED_SLOW = 73, /*!< Lens zooms in slow speed. */
PSDK_CAMERA_ZOOM_SPEED_MODERATELY_SLOW = 74, /*!< Lens zooms in speed slightly slower than normal speed. */
PSDK_CAMERA_ZOOM_SPEED_NORMAL = 75, /*!< Lens zooms in normal speed. */
PSDK_CAMERA_ZOOM_SPEED_MODERATELY_FAST = 76, /*!< Lens zooms very in speed slightly faster than normal speed. */
PSDK_CAMERA_ZOOM_SPEED_FAST = 77, /*!< Lens zooms very in fast speed. */
PSDK_CAMERA_ZOOM_SPEED_FASTEST = 78, /*!< Lens zooms very in fastest speed. */
} E_PsdkCameraZoomSpeed;
/**
* @brief Camera supported media file type.
*/
typedef enum {
PSDK_CAMERA_FILE_TYPE_JPEG = 0, /*!< Media file JPEG type. */
PSDK_CAMERA_FILE_TYPE_DNG = 1, /*!< Media file DNG type. */
PSDK_CAMERA_FILE_TYPE_MOV = 2, /*!< Media file MOV type. */
PSDK_CAMERA_FILE_TYPE_MP4 = 3, /*!< Media file MP4 type. */
} E_PsdkCameraMediaFileType;
/**
* @brief Camera playback mode in playback process.
*/
typedef enum {
PSDK_CAMERA_PLAYBACK_MODE_PLAY = 2, /*!< Play playbacking mode. */
PSDK_CAMERA_PLAYBACK_MODE_PAUSE = 3, /*!< Pause playbacking mode. */
PSDK_CAMERA_PLAYBACK_MODE_STOP = 7, /*!< Stop playbacking mode. */
} E_PsdkCameraPlaybackMode;
/**
* @brief Camera supported video frames when working in playback mode.
*/
typedef enum {
PSDK_CAMERA_VIDEO_FRAME_RATE_8_DOT_8_FPS = 23, /*!< The camera's video frame rate is 8.8fps (frames per second) */
PSDK_CAMERA_VIDEO_FRAME_RATE_23_DOT_976_FPS = 1, /*!< The camera's video frame rate is 23.96fps (frames per second) */
PSDK_CAMERA_VIDEO_FRAME_RATE_24_FPS = 13, /*!< The camera's video frame rate is 24fps (frames per second) */
PSDK_CAMERA_VIDEO_FRAME_RATE_25_FPS = 2, /*!< The camera's video frame rate is 25fps (frames per second) */
PSDK_CAMERA_VIDEO_FRAME_RATE_29_DOT_970_FPS = 3, /*!< The camera's video frame rate is 29.97fps (frames per second) */
PSDK_CAMERA_VIDEO_FRAME_RATE_30_FPS = 14, /*!< The camera's video frame rate is 30fps (frames per second) */
PSDK_CAMERA_VIDEO_FRAME_RATE_47_DOT_950_FPS = 4, /*!< The camera's video frame rate is 47.95fps (frames per second) */
PSDK_CAMERA_VIDEO_FRAME_RATE_48_FPS = 15, /*!< The camera's video frame rate is 48fps (frames per second) */
PSDK_CAMERA_VIDEO_FRAME_RATE_50_FPS = 5, /*!< The camera's video frame rate is 50fps (frames per second) */
PSDK_CAMERA_VIDEO_FRAME_RATE_59_DOT_940_FPS = 6, /*!< The camera's video frame rate is 59.94fps (frames per second) */
PSDK_CAMERA_VIDEO_FRAME_RATE_60_FPS = 16, /*!< The camera's video frame rate is 60fps (frames per second) */
PSDK_CAMERA_VIDEO_FRAME_RATE_90_FPS = 17, /*!< The camera's video frame rate is 90fps (frames per second) */
PSDK_CAMERA_VIDEO_FRAME_RATE_96_FPS = 11, /*!< The camera's video frame rate is 96fps (frames per second) */
PSDK_CAMERA_VIDEO_FRAME_RATE_100_FPS = 10, /*!< The camera's video frame rate is 100fps (frames per second) */
PSDK_CAMERA_VIDEO_FRAME_RATE_120_FPS = 7, /*!< The camera's video frame rate is 120fps (frames per second) */
PSDK_CAMERA_VIDEO_FRAME_RATE_UNKNOWN = 0, /*!< The camera's video frame rate is unknown (frames per second) */
} E_PsdkCameraVideoFrameRate;
/**
* @brief Camera supported video resolutions when working in playback mode.
*/
typedef enum {
PSDK_CAMERA_VIDEO_RESOLUTION_336x256 = 38, /*!< /The camera's video resolution is 336x256. */
PSDK_CAMERA_VIDEO_RESOLUTION_640x360 = 46, /*!< /The camera's video resolution is 640x360. */
PSDK_CAMERA_VIDEO_RESOLUTION_640x480 = 0, /*!< /The camera's video resolution is 640x480. */
PSDK_CAMERA_VIDEO_RESOLUTION_640x512 = 26, /*!< /The camera's video resolution is 640x512. */
PSDK_CAMERA_VIDEO_RESOLUTION_1280x720 = 4, /*!< /The camera's video resolution is 1280x720. */
PSDK_CAMERA_VIDEO_RESOLUTION_1920x1080 = 10, /*!< /The camera's video resolution is 1920x1080. */
PSDK_CAMERA_VIDEO_RESOLUTION_2048x1080 = 37, /*!< /The camera's video resolution is 2048x1080. */
PSDK_CAMERA_VIDEO_RESOLUTION_2688x1512 = 45, /*!< /The camera's video resolution is 2688x1512. */
PSDK_CAMERA_VIDEO_RESOLUTION_2704x1520 = 24, /*!< /The camera's video resolution is 2704x1520. */
PSDK_CAMERA_VIDEO_RESOLUTION_2720x1530 = 42, /*!< /The camera's video resolution is 2720x1530. */
PSDK_CAMERA_VIDEO_RESOLUTION_3840x1572 = 34, /*!< /The camera's video resolution is 3840x1572. */
PSDK_CAMERA_VIDEO_RESOLUTION_3840x2160 = 41, /*!< /The camera's video resolution is 3840x2160. */
PSDK_CAMERA_VIDEO_RESOLUTION_4096x2160 = 22, /*!< /The camera's video resolution is 4096x2160. */
PSDK_CAMERA_VIDEO_RESOLUTION_4608x2160 = 27, /*!< /The camera's video resolution is 4608x2160. */
PSDK_CAMERA_VIDEO_RESOLUTION_4608x2592 = 28, /*!< /The camera's video resolution is 4608x2592. */
PSDK_CAMERA_VIDEO_RESOLUTION_5280x2160 = 32, /*!< /The camera's video resolution is 5280x2160. */
PSDK_CAMERA_VIDEO_RESOLUTION_5280x2972 = 33, /*!< /The camera's video resolution is 5280x2972. */
PSDK_CAMERA_VIDEO_RESOLUTION_5760X3240 = 35, /*!< /The camera's video resolution is 5760X3240. */
PSDK_CAMERA_VIDEO_RESOLUTION_6016X3200 = 36, /*!< /The camera's video resolution is 6016X3200. */
PSDK_CAMERA_VIDEO_RESOLUTION_UNKNOWN = 255, /*!< /The camera's video resolution is unknown. */
} E_PsdkCameraVideoResolution;
/**
* @brief Camera zoom state in tap zoom process.
*/
typedef enum {
PSDK_CAMERA_TAP_ZOOM_STATE_IDLE = 0, /*!< Camera is not in tap zoom process. */
PSDK_CAMERA_TAP_ZOOM_STATE_ZOOM_IN = 1, /*!< Camera is zooming in. */
PSDK_CAMERA_TAP_ZOOM_STATE_ZOOM_OUT = 2, /*!< Camera is zooming out. */
PSDK_CAMERA_TAP_ZOOM_STATE_ZOOM_LIMITED = 3, /*!< Camera has reached zoom limit. */
} E_PsdkCameraTapZoomState;
/**
* @brief Camera video stream type.
*/
typedef enum {
/*! Camera video stream by h264 custom format, which needs to comply with the user document Custom-H264 video stream format standard.
* When using this format to send a video stream, the bit rate of the video stream needs must not exceed the real-time bandwidth
* limit of the channel that feedback by interface #PsdkPayloadCamera_GetVideoStreamState.*/
PSDK_CAMERA_VIDEO_STREAM_TYPE_H264_CUSTOM_FORMAT = 0,
/*! Camera video stream by h264 DJI format, which needs to comply with the user document DJI-H264 video stream format standard.
* When using this format to send a video stream, the video stream will be recoded by aircraft. No need to dynamically adjust
* the bit rate to ensure the quality of transmission. But the bit rate of video stream can not exceed 8Mbps. */
PSDK_CAMERA_VIDEO_STREAM_TYPE_H264_DJI_FORMAT = 1,
} E_PsdkCameraVideoStreamType;
/**
* @brief Camera sdcard state.
*/
typedef struct {
bool isInserted; /*!< Specifies if the SD card is inserted in the camera. This parameter is boolean type. */
bool isVerified; /*!< Specifies if the SD card is verified as genuine. This parameter is boolean type. */
bool isInitializing; /*!< Specifies if the SD card is initializing. This parameter is boolean type. */
bool isReadOnly; /*!< Specifies if the SD card is read only type. This parameter is boolean type. */
bool isFormatting; /*!< Specifies if the SD card is in formatting process. This parameter is boolean type. */
bool isFull; /*!< Specifies if the SD card's capacity is full. This parameter is boolean type. */
bool isInvalidFormat;/*!< Specifies if the SD card is invalid formatted. This parameter is boolean type. */
bool hasError; /*!< Specifies if the SD card has error. This parameter is boolean type. */
uint32_t totalSpaceInMB; /*!< SD card total capacity, unit: MB. */
uint32_t remainSpaceInMB; /*!< SD card remaining capacity, unit: MB. */
uint32_t availableCaptureCount; /*!< Available capture photo count. */
uint32_t availableRecordingTimeInSeconds; /*!< Available video recording second time, unit: s. */
} T_PsdkCameraSDCardState;
/**
* @brief Camera time interval settings when in interval shootPhoto mode.
*/
typedef struct {
uint8_t captureCount; /*!< Specifies the total capture count of interval settings */
uint16_t timeIntervalSeconds; /*!< Specifies the interval time between two captures, unit: s*/
} T_PsdkCameraPhotoTimeIntervalSettings;
/**
* @brief Camera metering target when in spot metering mode.
*/
typedef struct {
uint8_t col; /*!< Specifies column coordinate. This parameter is between 0 and 11. */
uint8_t row; /*!< Specifies row coordinate. This parameter is between 0 and 7. */
} T_PsdkCameraSpotMeteringTarget;
/**
* @brief Camera system state.
*/
typedef struct {
E_PsdkCameraMode cameraMode; /*!< Specifies the camera current work mode, #E_PsdkCameraMode. */
E_PsdkCameraShootingState shootingState; /*!< Specifies the camera state of shooting, #E_PsdkCameraShootingState. */
bool isStoring;/*!< Specifies if the camera is in storing status. This parameter is boolean type. */
bool isShootingIntervalStart; /*!< Specifies if the camera is in interval shooting start status. This parameter is boolean type. */
uint16_t currentPhotoShootingIntervalTimeInSeconds; /*!< Specifies the current interval shoot countdown time, the value is decreasing,
* when the value equals to zero trigger the interval take photo, uint:s. */
uint16_t currentPhotoShootingIntervalCount; /*!< Specifies the current interval photo count, the value is decreasing step by one from
* the setted count when interval taking photo */
bool isRecording; /*!< Specifies if the camera is in recording status. This parameter is boolean type. */
uint16_t currentVideoRecordingTimeInSeconds; /*!< Specifies the current recording process time, uint:s. */
bool isOverheating; /*!< Specifies if the camera is in overheating status. This parameter is boolean type. */
bool hasError; /*!< Specifies if the camera in error status. This parameter is boolean type. */
} T_PsdkCameraSystemState;
/**
* @brief Camera focus target point when in focus mode.
*/
typedef struct {
psdk_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.*/
psdk_f32_t focusY; /*!< Specifies vertical zone coordinate. This parameter is between 0 and 1. */
} T_PsdkCameraPointInScreen;
/**
* @brief Camera focus assistant settings.
*/
typedef struct {
bool isEnabledMF; /*!< Specifies if the lens focus assistant is enabled for manual focusing. This parameter is boolean type. */
bool isEnabledAF; /*!< Specifies if the lens focus assistant is enabled for auto focusing. This parameter is boolean type. */
} T_PsdkCameraFocusAssistantSettings;
/**
* @brief Camera playback status.
*/
typedef struct {
E_PsdkCameraPlaybackMode playbackMode; /*!< Specifies the duration of video media file, #E_PsdkCameraPlaybackMode. */
uint8_t videoPlayProcess; /*!< Specifies the current play process of video media file. This parameter is between 0 and 100. */
uint32_t videoLengthMs; /*!< Specifies the total duration of video media file, uint:ms. */
uint32_t playPosMs; /*!< Specifies the current play position of video media file, uint:ms. */
} T_PsdkCameraPlaybackStatus;
/**
* @brief Camera focus assistant settings.
*/
typedef struct {
uint16_t attrVideoDuration; /*!< Specifies the playback duration of video media file, uint:s. */
uint16_t attrVideoFrameRate; /*!< Specifies the frame rate of video media file, uint:fps. */
uint16_t attrVideoResolution; /*!< Specifies the resolution of video media file, uint:px. */
} T_PsdkCameraMediaFileAttr;
/**
* @brief Camera media file info.
*/
typedef struct {
E_PsdkCameraMediaFileType type; /*!< Specifies the type of media file, #E_PsdkCameraMediaFileType. */
T_PsdkCameraMediaFileAttr mediaFileAttr; /*!< Specifies the attributes of media file. */
uint32_t fileSize; /*!< Specifies the size of media file, uint:byte. */
} T_PsdkCameraMediaFileInfo;
/**
* @brief Camera optical zoom specifies.
*/
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_PsdkCameraOpticalZoomSpec;
/**
* @brief Camera tap zoom state.
*/
typedef struct {
E_PsdkCameraTapZoomState zoomState; /*!< Camera zoom state. */
bool isGimbalMoving; /*!< Flag that specifies whether gimbal is moving for tap zoom. */
} T_PsdkCameraTapZoomState;
/**
* @brief Camera common features handler.
* @warning User can not execute blocking style operations or functions in callback function, because that will block PSDK
* root thread, causing problems such as slow system response, payload disconnection or infinite loop.
*/
typedef struct {
/**
* @brief Prototype of callback function used to get camera system state.
* @param systemState: pointer to memory space used to store camera system state.
* @return Execution result.
*/
T_PsdkReturnCode (*GetSystemState)(T_PsdkCameraSystemState *systemState);
/**
* @brief Prototype of callback function used to set camera work mode.
* @note Sets the camera's work mode to taking pictures, video, playback. Please note that you cannot change the mode
* when a certain task is executing, such as taking photo(s), recording video, or downloading and saving files. Also
* supported by thermal imaging camera.
* @param mode: camera work mode.
* @return Execution result.
*/
T_PsdkReturnCode (*SetMode)(E_PsdkCameraMode mode);
/**
* @brief Prototype of callback function used to get camera current work mode.
* @param mode: pointer to memory space used to store camera work mode.
* @return Execution result.
*/
T_PsdkReturnCode (*GetMode)(E_PsdkCameraMode *mode);
/**
* @brief Prototype of callback function used to start record video.
* @return Execution result.
*/
T_PsdkReturnCode (*StartRecordVideo)(void);
/**
* @brief Prototype of callback function used to stop record video.
* @return Execution result.
*/
T_PsdkReturnCode (*StopRecordVideo)(void);
/**
* @brief Prototype of callback function used to start shoot photo.
* @return Execution result.
*/
T_PsdkReturnCode (*StartShootPhoto)(void);
/**
* @brief Prototype of callback function used to stop shoot photo.
* @return Execution result.
*/
T_PsdkReturnCode (*StopShootPhoto)(void);
/**
* @brief Prototype of callback function used to set camera shoot photo mode.
* @param mode: camera shoot photo mode.
* @return Execution result.
*/
T_PsdkReturnCode (*SetShootPhotoMode)(E_PsdkCameraShootPhotoMode mode);
/**
* @brief Prototype of callback function used to get camera current shoot photo mode.
* @param mode: pointer to memory space used to store camera shoot photo mode.
* @return Execution result.
*/
T_PsdkReturnCode (*GetShootPhotoMode)(E_PsdkCameraShootPhotoMode *mode);
/**
* @brief Prototype of callback function used to set camera shoot burst count.
* @param burstCount: camera shoot burst count.
* @return Execution result.
*/
T_PsdkReturnCode (*SetPhotoBurstCount)(E_PsdkCameraBurstCount burstCount);
/**
* @brief Prototype of callback function used to get camera current burst count.
* @param burstCount: pointer to memory space used to store camera shoot burst count.
* @return Execution result.
*/
T_PsdkReturnCode (*GetPhotoBurstCount)(E_PsdkCameraBurstCount *burstCount);
/**
* @brief Prototype of callback function used to set camera shoot time interval settings.
* @note The value range of interval photograph count is [2, 255]. If 255 is selected, then the camera will continue
* to take pictures until StopShootPhoto is called.
* @param settings: camera shoot time interval settings.
* @return Execution result.
*/
T_PsdkReturnCode (*SetPhotoTimeIntervalSettings)(T_PsdkCameraPhotoTimeIntervalSettings settings);
/**
* @brief Prototype of callback function used to get camera shoot time interval settings.
* @param settings: pointer to memory space used to store camera shoot time interval settings.
* @return Execution result.
*/
T_PsdkReturnCode (*GetPhotoTimeIntervalSettings)(T_PsdkCameraPhotoTimeIntervalSettings *settings);
/**
* @brief Prototype of callback function used to get camera current SDCard state.
* @param sdCardState: pointer to memory space used to store camera SDCard state.
* @return Execution result.
*/
T_PsdkReturnCode (*GetSDCardState)(T_PsdkCameraSDCardState *sdCardState);
/**
* @brief Prototype of callback function used to format the SDCard inserted.
* @return Execution result.
*/
T_PsdkReturnCode (*FormatSDCard)(void);
} T_PsdkCameraCommonHandler;
/**
* @brief Camera metering feature handler.
* @warning User can not execute blocking style operations or functions in callback function, because that will block PSDK
* root thread, causing problems such as slow system response, payload disconnection or infinite loop.
*/
typedef struct {
/**
* @brief Prototype of callback function used to set camera metering mode.
* @param mode: camera metering mode.
* @return Execution result.
*/
T_PsdkReturnCode (*SetMeteringMode)(E_PsdkCameraMeteringMode mode);
/**
* @brief Prototype of callback function used to get camera current metering mode.
* @param mode: pointer to memory space used to store camera metering mode.
* @return Execution result.
*/
T_PsdkReturnCode (*GetMeteringMode)(E_PsdkCameraMeteringMode *mode);
/**
* @brief Prototype of callback function used to set camera spot metering target area.
* @param target: camera spot metering target area.
* @return Execution result.
*/
T_PsdkReturnCode (*SetSpotMeteringTarget)(T_PsdkCameraSpotMeteringTarget target);
/**
* @brief Prototype of callback function used to get camera spot metering target area.
* @param target: pointer to memory space used to store camera spot metering target area.
* @return Execution result.
*/
T_PsdkReturnCode (*GetSpotMeteringTarget)(T_PsdkCameraSpotMeteringTarget *target);
} T_PsdkCameraExposureMeteringHandler;
/**
* @brief Camera focus feature handler.
* @warning User can not execute blocking style operations or functions in callback function, because that will block PSDK
* root thread, causing problems such as slow system response, payload disconnection or infinite loop.
*/
typedef struct {
/**
* @brief Prototype of callback function used to set camera focus mode.
* @param mode: camera focus mode.
* @return Execution result.
*/
T_PsdkReturnCode (*SetFocusMode)(E_PsdkCameraFocusMode mode);
/**
* @brief Prototype of callback function used to get camera current focus mode.
* @param mode: pointer to memory space used to store camera focus mode.
* @return Execution result.
*/
T_PsdkReturnCode (*GetFocusMode)(E_PsdkCameraFocusMode *mode);
/**
* @brief Prototype of callback function used to set camera focus target area.
* @param target: camera focus target area.
* @return Execution result.
*/
T_PsdkReturnCode (*SetFocusTarget)(T_PsdkCameraPointInScreen target);
/**
* @brief Prototype of callback function used to get camera focus target area.
* @param target: pointer to memory space used to store camera focus target area.
* @return Execution result.
*/
T_PsdkReturnCode (*GetFocusTarget)(T_PsdkCameraPointInScreen *target);
/**
* @brief Prototype of callback function used to set camera focus assistant settings.
* @param settings: camera focus assistant settings.
* @return Execution result.
*/
T_PsdkReturnCode (*SetFocusAssistantSettings)(T_PsdkCameraFocusAssistantSettings settings);
/**
* @brief Prototype of callback function used to get camera focus assistant settings.
* @param settings: pointer to memory space used to store camera focus assistant settings.
* @return Execution result.
*/
T_PsdkReturnCode (*GetFocusAssistantSettings)(T_PsdkCameraFocusAssistantSettings *settings);
/**
* @brief Prototype of callback function used to set camera focus ring value.
* @param value: camera focus ring value.
* @return Execution result.
*/
T_PsdkReturnCode (*SetFocusRingValue)(uint32_t value);
/**
* @brief Prototype of callback function used to get camera focus ring value.
* @param value: pointer to memory space used to store camera focus ring value.
* @return Execution result.
*/
T_PsdkReturnCode (*GetFocusRingValue)(uint32_t *value);
/**
* @brief Prototype of callback function used to get camera focus upper bound ring value.
* @param value: pointer to memory space used to store camera focus upper bound value.
* @return Execution result.
*/
T_PsdkReturnCode (*GetFocusRingValueUpperBound)(uint32_t *value);
} T_PsdkCameraFocusHandler;
/**
* @brief Camera digital zoom feature handler.
* @warning User can not execute blocking style operations or functions in callback function, because that will block PSDK
* root thread, causing problems such as slow system response, payload disconnection or infinite loop.
*/
typedef struct {
/**
* @brief Prototype of callback function used to set camera digital zoom factor.
* @param factor: camera digital zoom factor.
* @return Execution result.
*/
T_PsdkReturnCode (*SetDigitalZoomFactor)(psdk_f32_t factor);
/**
* @brief Prototype of callback function used to get camera current digital zoom factor.
* @param factor: pointer to memory space used to store camera current digital zoom factor.
* @return Execution result.
*/
T_PsdkReturnCode (*GetDigitalZoomFactor)(psdk_f32_t *factor);
} T_PsdkCameraDigitalZoomHandler;
/**
* @brief Camera optical zoom feature handler.
* @warning User can not execute blocking style operations or functions in callback function, because that will block PSDK
* root thread, causing problems such as slow system response, payload disconnection or infinite loop.
*/
typedef struct {
/**
* @brief Prototype of callback function used to set camera optical zoom focal length.
* @param focalLength: camera optical zoom focal length.
* @return Execution result.
*/
T_PsdkReturnCode (*SetOpticalZoomFocalLength)(uint32_t focalLength);
/**
* @brief Prototype of callback function used to get camera optical zoom focal length.
* @param focalLength: pointer to memory space used to store camera optical zoom focal length.
* @return Execution result.
*/
T_PsdkReturnCode (*GetOpticalZoomFocalLength)(uint32_t *focalLength);
/**
* @brief Prototype of callback function used to get camera optical zoom factor.
* @param factor: pointer to memory space used to store camera optical zoom factor.
* @return Execution result.
*/
T_PsdkReturnCode (*GetOpticalZoomFactor)(psdk_f32_t *factor);
/**
* @brief Prototype of callback function used to get camera optical zoom specifies.
* @param spec: pointer to memory space used to store camera optical zoom specifies.
* @return Execution result.
*/
T_PsdkReturnCode (*GetOpticalZoomSpec)(T_PsdkCameraOpticalZoomSpec *spec);
/**
* @brief Prototype of callback function used to start continuous optical zoom.
* @param direction: camera zoom direction.
* @param speed: camera zoom speed.
* @return Execution result.
*/
T_PsdkReturnCode (*StartContinuousOpticalZoom)(E_PsdkCameraZoomDirection direction, E_PsdkCameraZoomSpeed speed);
/**
* @brief Prototype of callback function used to stop continuous optical zoom.
* @return Execution result.
*/
T_PsdkReturnCode (*StopContinuousOpticalZoom)(void);
} T_PsdkCameraOpticalZoomHandler;
#if PSDK_ARCH_SYS_LINUX
/**
* @brief Prototype of handler functions for media file download and playback.
* @warning User can not execute blocking style operations or functions in callback function, because that will block PSDK
* root thread, causing problems such as slow system response, payload disconnection or infinite loop.
*/
typedef struct {
/**
* @brief Prototype of callback function used to get camera media file path.
* @warning The maximum length of path that users can pass in is 256, including end character '\0'.
* @param dirPath: pointer to memory space used to store camera media file path.
* @return Execution result.
*/
T_PsdkReturnCode (*GetMediaFileDir)(char *dirPath);
/**
* @brief Prototype of callback function used to get the file info of the selected origin media file.
* @param dirPath: pointer to memory space used to store camera current media file path.
* @param fileInfo: pointer to memory space used to store file info of the selected origin media file.
* @return Execution result.
*/
T_PsdkReturnCode (*GetMediaFileOriginInfo)(const char *filePath, T_PsdkCameraMediaFileInfo *fileInfo);
/**
* @brief Prototype of callback function used to get the data of the selected origin media file.
* @param dirPath: pointer to memory space used to store camera current media file path.
* @param offset: the offset of origin file data that need get from the selected media file.
* @param length: the length of origin file data that need get from the selected media file.
* @param data: pointer to memory space used to store the selected origin media file.
* @return Execution result.
*/
T_PsdkReturnCode (*GetMediaFileOriginData)(const char *filePath, uint32_t offset, uint32_t length, uint8_t *data);
/**
* @brief Prototype of callback function used to create the thumb nail of selected media file.
* @param dirPath: pointer to memory space used to store camera current media file path.
* @return Execution result.
*/
T_PsdkReturnCode (*CreateMediaFileThumbNail)(const char *filePath);
/**
* @brief Prototype of callback function used to get the file info of the created thumbnail.
* @param dirPath: pointer to memory space used to store camera current media file path.
* @param fileInfo: pointer to memory space used to store file info of the created thumbnail.
* @return Execution result.
*/
T_PsdkReturnCode (*GetMediaFileThumbNailInfo)(const char *filePath, T_PsdkCameraMediaFileInfo *fileInfo);
/**
* @brief Prototype of callback function used to get the data of the created thumbnail.
* @param dirPath: pointer to memory space used to store camera current media file path.
* @param offset: the offset of thumb nail data that need get from the selected media file.
* @param length: the length of thumb nail data that need get from the selected media file.
* @param data: pointer to memory space used to store the created thumbnail data.
* @return Execution result.
*/
T_PsdkReturnCode (*GetMediaFileThumbNailData)(const char *filePath, uint32_t offset, uint32_t length,
uint8_t *data);
/**
* @brief Prototype of callback function used to destroy the created thumb nail of selected media file.
* @param dirPath: pointer to memory space used to store camera current media file path.
* @return Execution result.
*/
T_PsdkReturnCode (*DestroyMediaFileThumbNail)(const char *filePath);
/**
* @brief Prototype of callback function used to create the screen nail of selected media file.
* @param dirPath: pointer to memory space used to store camera current media file path.
* @return Execution result.
*/
T_PsdkReturnCode (*CreateMediaFileScreenNail)(const char *filePath);
/**
* @brief Prototype of callback function used to get the data of the created screen nail.
* @param dirPath: pointer to memory space used to store camera current media file path.
* @param offset: the offset of screen nail data that need get from selected media file.
* @param length: the length of screen nail data that need get from selected media file.
* @param data: pointer to memory space used to store the created screen nail data.
* @return Execution result.
*/
T_PsdkReturnCode (*GetMediaFileScreenNailData)(const char *filePath, uint32_t offset, uint32_t length,
uint8_t *data);
/**
* @brief Prototype of callback function used to get the file info of the created screen nail.
* @param dirPath: pointer to memory space used to store camera current media file path.
* @param fileInfo: pointer to memory space used to store file info of the created screen nail.
* @return Execution result.
*/
T_PsdkReturnCode (*GetMediaFileScreenNailInfo)(const char *filePath, T_PsdkCameraMediaFileInfo *fileInfo);
/**
* @brief Prototype of callback function used to destroy the created screen nail of selected media file.
* @param dirPath: pointer to memory space used to store camera current media file path.
* @return Execution result.
*/
T_PsdkReturnCode (*DestroyMediaFileScreenNail)(const char *filePath);
/**
* @brief Prototype of callback function used to notification when download starting.
* @note You can adjust the bandwidth proportion of each high speed channel in the notification callback.
* @return Execution result.
*/
T_PsdkReturnCode (*StartDownloadNotification)(void);
/**
* @brief Prototype of callback function used to notification when download stoping.
* @note You can adjust the bandwidth proportion of each high speed channel in the notification callback.
* @return Execution result.
*/
T_PsdkReturnCode (*StopDownloadNotification)(void);
/**
* @brief Prototype of callback function used to delete the user's media files.
* @param filePath: pointer to memory space used to store camera current media file path.
* @return Execution result.
*/
T_PsdkReturnCode (*DeleteMediaFile)(char *filePath);
/**
* @brief Prototype of callback function used to get camera media playback status.
* @param status: pointer to memory space used to store camera media file path.
* @return Execution result.
*/
T_PsdkReturnCode (*GetMediaPlaybackStatus)(T_PsdkCameraPlaybackStatus *status);
/**
* @brief Prototype of callback function used to set the file path of media file that need playback.
* @param filePath: pointer to memory space used to store the file path of media file that need playback.
* @return Execution result.
*/
T_PsdkReturnCode (*SetMediaPlaybackFile)(const char *filePath);
/**
* @brief Prototype of callback function used to start media video playback when camera work in playback mode.
* @return Execution result.
*/
T_PsdkReturnCode (*StartMediaPlayback)(void);
/**
* @brief Prototype of callback function used to stop media video playback when camera work in playback mode.
* @return Execution result.
*/
T_PsdkReturnCode (*StopMediaPlayback)(void);
/**
* @brief Prototype of callback function used to pause media video playback when camera work in playback mode.
* @return Execution result.
*/
T_PsdkReturnCode (*PauseMediaPlayback)(void);
/**
* @brief Prototype of callback function used to seek to the playback position of media video when camera work in playback mode.
* @param playbackPosition: playback position of video media, unit: ms.
* @return Execution result.
*/
T_PsdkReturnCode (*SeekMediaPlayback)(uint32_t playbackPosition);
} T_PsdkCameraMediaDownloadPlaybackHandler;
#endif
/**
* @brief Prototype of handler functions for tap zooming.
* @note User can not execute blocking style operations or functions in callback function, like PsdkXPort_RotateSync()
* function, because that will block PSDK root thread, causing problems such as slow system response, payload
* disconnection or infinite loop.
*/
typedef struct {
/**
* @brief Prototype of callback function used to get tap zoom state.
* @param state: pointer to memory space used to store tap zoom state.
* @return Execution result.
*/
T_PsdkReturnCode (*GetTapZoomState)(T_PsdkCameraTapZoomState *state);
/**
* @brief Prototype of callback function used to enable or disable tap zoom function.
* @details PSDK application should response tap zoom command only if tap zoom function is enabled.
* @param enabledFlag: enabled flag.
* @return Execution result.
*/
T_PsdkReturnCode (*SetTapZoomEnabled)(bool enabledFlag);
/**
* @brief Prototype of callback function used to get the flag that specifies whether tap zoom function has been
* enabled,
* @param enabledFlag: pointer to memory space used to store enabled flag.
* @return Execution result.
*/
T_PsdkReturnCode (*GetTapZoomEnabled)(bool *enabledFlag);
/**
* @brief Prototype of callback function used to set multiplier of single tap zoom.
* @param multiplier: multiplier of single tap zoom.
* @return Execution result.
*/
T_PsdkReturnCode (*SetTapZoomMultiplier)(uint8_t multiplier);
/**
* @brief Prototype of callback function used to get multiplier of single tap zoom.
* @param multiplier: pointer to memory space use to store multiplier of single tap zoom.
* @return Execution result.
*/
T_PsdkReturnCode (*GetTapZoomMultiplier)(uint8_t *multiplier);
/**
* @brief Prototype of callback function used to trigger tap zoom.
* @details Users trigger tap zoom in screen of mobile end, this callback function will be called. Then, PSDK
* application should rotate gimbal to orientation of target point and zoom by specified multiplier.
* @param target: position information of target point in screen.
* @return Execution result.
*/
T_PsdkReturnCode (*TapZoomAtTarget)(T_PsdkCameraPointInScreen target);
} T_PsdkCameraTapZoomHandler;
/* Exported functions --------------------------------------------------------*/
/**
* @brief Initialize the payload camera module.
* @note The interface is the total initialization interface of the camera module. The following interfaces are optional
* functions and can be freely selected according to the actual load device condition of the user. Before registering
* the optional interface, the interface must be initialized before the system can work normally. Interface initialization
* needs to be after PsdkCore_Init.
* @return Execution result.
*/
T_PsdkReturnCode PsdkPayloadCamera_Init(void);
/**
* @brief Register the handler for payload camera common function interfaces.
* @note This interface registers the camera's basic function interface, including camera camera, video, mode settings,
* SD card operation, camera status interface. Registration of this interface needs to be after PsdkPayloadCamera_Init.
* @param cameraCommonHandler: pointer to the handler for payload camera common functions.
* @return Execution result.
*/
T_PsdkReturnCode PsdkPayloadCamera_RegCommonHandler(const T_PsdkCameraCommonHandler *cameraCommonHandler);
/**
* @brief Register the handler for payload camera exposure and metering function interfaces.
* @note This interface registers the spot metering and exposure interface of the camera. It currently includes
* setting and acquiring the metering mode and metering area. Special attention must be paid to the limitations
* of the interface parameters. Registration of this interface needs to be after PsdkPayloadCamera_Init.
* @param cameraExposureMeteringHandler: pointer to the handler for payload camera exposure and metering functions.
* @return Execution result.
*/
T_PsdkReturnCode PsdkPayloadCamera_RegExposureMeteringHandler(const T_PsdkCameraExposureMeteringHandler
*cameraExposureMeteringHandler);
/**
* @brief Register the handler for payload camera focus function interfaces.
* @note This interface registers the camera's focus interface, which includes setting and acquiring the focus mode,
* focus area, and focus settings. Special attention must be paid to the interface parameters. Registration of
* this interface needs to be after PsdkPayloadCamera_Init.
* @param cameraFocusHandler: pointer to the handler for payload camera focus functions.
* @return Execution result.
*/
T_PsdkReturnCode PsdkPayloadCamera_RegFocusHandler(const T_PsdkCameraFocusHandler *cameraFocusHandler);
/**
* @brief Register the handler for payload camera digital zoom function interfaces.
* @note This interface registers the camera's digital zoom interface, which includes setting and obtaining the digital
* zoom zoom factor. Registering the load on this interface requires digital zoom. Registration of this interface
* needs to be after PsdkPayloadCamera_Init.
* @param cameraDigitalZoomHandler: pointer to the handler for payload camera digital zoom functions.
* @return Execution result.
*/
T_PsdkReturnCode PsdkPayloadCamera_RegDigitalZoomHandler(const T_PsdkCameraDigitalZoomHandler
*cameraDigitalZoomHandler);
/**
* @brief Register the handler for payload camera optical zoom function interfaces.
* @note This interface registers the camera's optical zoom interface, which includes setting and acquiring optical zoom
* parameters, and a continuous zoom interface. Registering the load on this interface requires support for optical
* zoom. Registration of this interface needs to be after PsdkPayloadCamera_Init.
* @param cameraOpticalZoomHandler: pointer to the handler for payload camera optical zoom functions.
* @return Execution result.
*/
T_PsdkReturnCode PsdkPayloadCamera_RegOpticalZoomHandler(const T_PsdkCameraOpticalZoomHandler
*cameraOpticalZoomHandler);
/**
* @brief Register handler functions for tap zoom function.
* @attention The tap zoom function currently only supports Mobile SDK for Android, DJI pilot App and other platforms
* cannot use this feature.
* @details Registration specifies PSDK application support tap zoom function.
* @param cameraTapZoomHandler: pointer to structure of handler functions for tap zoom function.
* @return Execution result.
*/
T_PsdkReturnCode PsdkPayloadCamera_RegTapZoomHandler(const T_PsdkCameraTapZoomHandler *cameraTapZoomHandler);
/**
* @brief Set the type of camera video stream.
* @note The interface is used to set the camera video stream type. Must ensure the format of video stream conforms to
* the specified type in E_PsdkCameraVideoStreamType, please refer to developer documentation for more details.
* @attention Set video stream type must before calling PsdkCore_ApplicationStart function, when calling this interface
* the thread will be blocked, and the maximum blocking time is 10s. If this interface is not called, the default video
* stream type ::PSDK_CAMERA_VIDEO_STREAM_TYPE_H264_CUSTOM_FORMAT will be used.
* @param videoStreamType: camera video stream type.
* @return Execution result.
*/
T_PsdkReturnCode PsdkPayloadCamera_SetVideoStreamType(E_PsdkCameraVideoStreamType videoStreamType);
/**
* @brief Get the network remote address for sending camera video stream.
* @note The interface is used to get the network remote address for sending camera video stream. You can get this info for another
* heterogeneous system to do somethings. This interface should be used after calling PsdkCore_Init function.
* @attention If you want use this interface, should call PsdkPlatform_RegHalNetworkHandler interface firstly, otherwise
* this interface will not work.
* @param ipAddr: the remote ip address for sending camera video stream.
* @param port: the remote port for sending camera video stream.
* @return Execution result.
*/
T_PsdkReturnCode PsdkPayloadCamera_GetVideoStreamRemoteAddress(char *ipAddr, uint16_t *port);
#if PSDK_ARCH_SYS_LINUX
/**
* @brief Register the handler for payload camera media download and playback function interfaces.
* @note Registering the camera playback and downloading related interfaces, mainly able to operate the media files of
* the user storage device online through the playback interface of the pilot. It can playback and download files
* of pictures and videos. Currently, only media files in MP4 and JPG formats are supported.
* @param cameraMediaHandler: pointer to the handler for payload camera media download and playback functions.
* @return Execution result.
*/
T_PsdkReturnCode PsdkPayloadCamera_RegMediaDownloadPlaybackHandler(const T_PsdkCameraMediaDownloadPlaybackHandler
*cameraMediaHandler);
/**
* @brief Send the video to mobile end via video stream of the data channel. This function exists and can be used only in Linux.
* @note Must ensure actual bandwidth is less than bandwidth limitation of corresponding channel or stream, please
* refer to developer documentation and state of channel/stream for details related to bandwidth limitation. User can
* get state of "videoStream" channel via PsdkPayloadCamera_GetVideoStreamState() function. If actual bandwidth
* exceeds the limitation or busy state is set, the user should stop transmitting data or decrease amount of data to be
* sent. Otherwise, data may be discarded.
* @param data: pointer to data to be sent.
* @param len: length of data to be sent via data stream, and it must be less than or equal to 65000, unit: byte.
* @return Execution result.
*/
T_PsdkReturnCode PsdkPayloadCamera_SendVideoStream(const uint8_t *data, uint16_t len);
/**
* @brief Get data transmission state of "videoStream" channel. User can use the state as base for controlling data
* transmission of video stream. This function exists and can be used only in Linux operation system.
* @param state: pointer to "videoStream" channel state.
* @return Execution result.
*/
T_PsdkReturnCode PsdkPayloadCamera_GetVideoStreamState(T_PsdkDataChannelState *state);
#endif
/**
* @brief Push added media file information to aircraft system.
* @details After photography or recording video, users must push information of created media file immediately using
* this interface.
* @param filePath: pointer to path of added media file. Guaranteed to end with '\0'. Length of path have to be less
* than ::PSDK_FILE_PATH_SIZE_MAX bytes.
* @param mediaFileInfo: information of added media file.
* @return Execution result.
*/
T_PsdkReturnCode PsdkPayloadCamera_PushAddedMediaFileInfo(const char *filePath,
T_PsdkCameraMediaFileInfo mediaFileInfo);
#ifdef __cplusplus
}
#endif
#endif // PSDK_PAYLOAD_CAMERA_H
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/

View File

@ -0,0 +1,117 @@
/**
********************************************************************
* @file psdk_payload_collaboration.h
* @brief This is the header file for "psdk_payload_collaboration.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2018 DJI. All rights reserved.
*
* All information contained herein is, and remains, the property of DJI.
* The intellectual and technical concepts contained herein are proprietary
* to DJI and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of DJI.
*
* If you receive this source code without DJIs authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify DJI of its removal. DJI reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef PSDK_PAYLOAD_COLLABORATION_H
#define PSDK_PAYLOAD_COLLABORATION_H
/* Includes ------------------------------------------------------------------*/
#include "psdk_typedef.h"
#include "psdk_payload_camera.h"
#include "psdk_aircraft_info.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief Camera type.
*/
typedef enum {
PSDK_PAYLOAD_COLLABORATION_CAMERA_TYPE_UNKNOWN = 0, /*!< Camera type is unknown. */
PSDK_PAYLOAD_COLLABORATION_CAMERA_TYPE_XT = 7, /*!< Camera type is XT. */
PSDK_PAYLOAD_COLLABORATION_CAMERA_TYPE_X4S = 14, /*!< Camera type is X4S. */
PSDK_PAYLOAD_COLLABORATION_CAMERA_TYPE_X5S = 15, /*!< Camera type is X5S. */
PSDK_PAYLOAD_COLLABORATION_CAMERA_TYPE_X7 = 17, /*!< Camera type is X7. */
PSDK_PAYLOAD_COLLABORATION_CAMERA_TYPE_Z30 = 20, /*!< Camera type is Z30. */
PSDK_PAYLOAD_COLLABORATION_CAMERA_TYPE_XT2 = 26, /*!< Camera type is XT2. */
PSDK_PAYLOAD_COLLABORATION_CAMERA_TYPE_PSDK = 31, /*!< Camera type is third party camera based on Payload SDK. */
PSDK_PAYLOAD_COLLABORATION_CAMERA_TYPE_XTS = 41, /*!< Camera type is XT S. */
PSDK_PAYLOAD_COLLABORATION_CAMERA_TYPE_H20 = 42, /*!< Camera type is H20. */
PSDK_PAYLOAD_COLLABORATION_CAMERA_TYPE_H20T = 43, /*!< Camera type is H20T. */
} E_PsdkPayloadCollaborationCameraType;
/* Exported functions --------------------------------------------------------*/
/**
* @brief Initialise payload collaboration module. User should call this function before using this module.
* @return Execution result.
*/
T_PsdkReturnCode PsdkPayloadCollaboration_Init(void);
/**
* @brief Deinitialise payload collaboration module.
* @return Execution result.
*/
T_PsdkReturnCode PsdkPayloadCollaboration_DeInit(void);
/**
* @brief Get camera type of other payloads mounted on aircraft.
* @note Please refer to PSDK documentation in DJI SDK developer website for details of conditions of use.
* @note If there is empty in requested position or payload do not have camera type, the interface will return error.
* @param payloadPosition: position where payload mounted on.
* @param cameraType: Pointer to camera type of payload.
* @return Execution result.
*/
T_PsdkReturnCode PsdkPayloadCollaboration_GetCameraTypeOfPayload(
E_PsdkAircraftInfoPayloadMountPosition payloadPosition,
E_PsdkPayloadCollaborationCameraType *cameraType);
/**
* @brief Get optical zoom specification of other camera payloads mounted on aircraft.
* @note Please refer to PSDK documentation in DJI SDK developer website for details of conditions of use.
* @note If there is empty in requested position or payload do not have related information, the interface will return
* error.
* @param payloadPosition: position where payload mounted on.
* @param opticalZoomSpec: pointer to optical zoom specification.
* @return Execution result.
*/
T_PsdkReturnCode
PsdkPayloadCollaboration_GetCameraOpticalZoomSpecOfPayload(E_PsdkAircraftInfoPayloadMountPosition payloadPosition,
T_PsdkCameraOpticalZoomSpec *opticalZoomSpec);
/**
* @brief Get hybrid zoom focal length of other camera payloads mounted on aircraft.
* @note Please refer to PSDK documentation in DJI SDK developer website for details of conditions of use.
* @note If there is empty in requested position or payload do not have related information, the interface will return
* error.
* @param payloadPosition: position where payload mounted on.
* @param focalLength: Pointer to optical focal length, unit: 0.1mm.
* @return Execution result.
*/
T_PsdkReturnCode
PsdkPayloadCollaboration_GetCameraHybridZoomFocalLengthOfPayload(E_PsdkAircraftInfoPayloadMountPosition payloadPosition,
uint16_t *focalLength);
#ifdef __cplusplus
}
#endif
#endif // PSDK_PAYLOAD_COLLABORATION_H
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/

View File

@ -0,0 +1,409 @@
/**
********************************************************************
* @file psdk_platform.h
* @brief This is the header file for define PSDK platform interfaces.
*
* @copyright (c) 2018 DJI. All rights reserved.
*
* All information contained herein is, and remains, the property of DJI.
* The intellectual and technical concepts contained herein are proprietary
* to DJI and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of DJI.
*
* If you receive this source code without DJIs authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify DJI of its removal. DJI reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef PSDK_PLATFORM_H
#define PSDK_PLATFORM_H
/* Includes ------------------------------------------------------------------*/
#include "psdk_typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/**
* @brief Platform handle of thread task operation.
*/
typedef void *T_PsdkTaskHandle;
/**
* @brief Platform handle of mutex operation.
*/
typedef void *T_PsdkMutexHandle;
/**
* @brief Platform handle of semaphore operation.
*/
typedef void *T_PsdkSemHandle;
/* Exported types ------------------------------------------------------------*/
typedef struct {
/**
* @brief Prototype of the callback function used to init the user uart that connected to the payload device.
* @note Users need to implement the initialization interface of their serial device and register it. For the related
* parameter settings of the serial port, please refer to the document.
* @return Execution result.
*/
T_PsdkReturnCode (*UartInit)(void);
/**
* @brief Prototype of callback function used to write data by the user uart that connected to the payload device.
* @note Users need to implement the sending interface of their serial device and register it. Please use the relevant
* tools to test the interface before registering.
* @param buf: pointer to memory space used to store the data that needs send by uart.
* @param len: the length of data that needs send by uart.
* @return Execution result.
*/
T_PsdkReturnCode (*UartWriteData)(const uint8_t *buf, uint16_t len);
/**
* @brief Prototype of callback function used to read data from the user uart that connected to the payload device..
* @note Users need to implement the read interface of their serial device and register it. Please use the relevant
* tools to test the interface before registering.
* @param buf: pointer to memory space used to store the data that read from uart.
* @param len: the length of data that need read from uart.
* @param realLen: pointer to memory space used to store the real size of reading data from uart.
* @return Execution result.
*/
T_PsdkReturnCode (*UartReadData)(uint8_t *buf, uint16_t len, uint16_t *realLen);
} T_PsdkHalUartHandler;
typedef struct {
/**
* @brief Prototype of callback function used to declare the task container, initialize the task, and create task ID.
* @note This interface is mainly used to create the task. Users need to adapt according to their platform and system.
* Also needs test the implemented interface before registration to ensure that the registration can be used normally.
* For details of the parameters, please refer to the following API interface #PsdkOsal_TaskCreate.
* @param task: pointer to memory space used to store the created task handle.
* @param taskFunc: pointer to the created task function.
* @param name: pointer to task name string, end with '\0'. If user does not specifically name for task, fill in NULL.
* @param stackSize: the value of task stack size, unit: byte.
* @param arg: pointer to the user-defined data.
* @return Execution result.
*/
T_PsdkReturnCode (*TaskCreate)(T_PsdkTaskHandle *task, void *(*taskFunc)(void *), const char *name,
uint32_t stackSize, void *arg);
/**
* @brief Prototype of callback function used to destroy the created task.
* @note This interface is mainly used to destroy the created task. Users need to adapt according to their platform
* and system. Also needs test the implemented interface before registration to ensure that the registration can be used
* normally. For details of the parameters, please refer to the following API interface #PsdkOsal_TaskDestroy.
* @param task: task handle.
* @return Execution result.
*/
T_PsdkReturnCode (*TaskDestroy)(T_PsdkTaskHandle task);
/**
* @brief Prototype of callback function used to let task into a sleep state in a set time, uint:ms.
* @note This interface is mainly used to let task sleep. Users need to adapt according to their platform and system.
* Also needs test the implemented interface before registration to ensure that the registration can be used normally.
* For details of the parameters, please refer to the following API interface #PsdkOsal_TaskSleepMs.
* @param timeMs: the value of time ms for task sleeping.
* @return Execution result.
*/
T_PsdkReturnCode (*TaskSleepMs)(uint32_t timeMs);
/**
* @brief Prototype of callback function used to declare the mutex container, initialize the mutex, and create mutex ID.
* @note This interface is mainly used to create a mutex. Users need to adapt according to their platform and system.
* Also needs test the implemented interface before registration to ensure that the registration can be used normally.
* For details of the parameters, please refer to the following API interface #PsdkOsal_MutexCreate.
* @param mutex: pointer to memory space used to store the created mutex ID.
* @return Execution result.
*/
T_PsdkReturnCode (*MutexCreate)(T_PsdkMutexHandle *mutex);
/**
* @brief Prototype of callback function used to destroy the created mutex.
* @note This interface is mainly used to destroy the created mutex. Users need to adapt according to their platform
* and system. Also need test the implemented interface before registration to ensure that the registration can be used
* normally. For details of the parameters, please refer to the following API interface #PsdkOsal_MutexDestroy.
* @param mutex: pointer to memory space used to store the created mutex ID.
* @return Execution result.
*/
T_PsdkReturnCode (*MutexDestroy)(T_PsdkMutexHandle mutex);
/**
* @brief Prototype of callback function used to acquire and lock the mutex when peripheral access is required.
* @note This interface is mainly used to lock the created mutex. Users need to adapt according to their platform
* and system. Also needs test the implemented interface before registration to ensure that the registration can be
* used normally. For details of the parameters, please
* refer to the following API interface #PsdkOsal_MutexLock.
* @param mutex: pointer to memory space used to store the created mutex ID.
* @return Execution result.
*/
T_PsdkReturnCode (*MutexLock)(T_PsdkMutexHandle mutex);
/**
* @brief Prototype of callback function used to unlock and release the mutex when done with the peripheral access.
* @note This interface is mainly used to unlock the created mutex. Users need to adapt according to their platform
* and system. Also needs test the implemented interface before registration to ensure that the registration can be used
* normally. For details of the parameters, please refer to the following API interface #PsdkOsal_MutexUnlock.
* @param mutex: pointer to memory space used to store the created mutex ID.
* @return Execution result.
*/
T_PsdkReturnCode (*MutexUnlock)(T_PsdkMutexHandle mutex);
/**
* @brief Prototype of callback function used to declare the semaphore container, initialize the semaphore, and create semaphore ID.
* @note This interface is mainly used to create semaphore. Users need to adapt according to their platform and system.
* Also needs test the implemented interface before registration to ensure that the registration can be used normally.
* For details of the parameters, please refer to the following API interface #PsdkOsal_SemaphoreCreate.
* @param semaphore: pointer to memory space used to store the created semaphore ID.
* @param initValue: init value of semaphore for the created semaphore.
* @return Execution result.
*/
T_PsdkReturnCode (*SemaphoreCreate)(T_PsdkSemHandle *semaphore, uint32_t initValue);
/**
* @brief Prototype of callback function used to destroy the created semaphore.
* @note This interface is mainly used to destroy the created semaphore. Users need to adapt according to their own
* platform and system. Also need test the implemented interface before registration to ensure that the registration
* can be used normally. For details of the parameters, please refer to the following API interface #PsdkOsal_SemaphoreDestroy.s
* @param semaphore: pointer to memory space used to store the created semaphore ID.
* @return Execution result.
*/
T_PsdkReturnCode (*SemaphoreDestroy)(T_PsdkSemHandle semaphore);
/**
* @brief Prototype of callback function used to wait the created semaphore forever.
* @note This interface is mainly used to wait the created semaphore forever. Users need to adapt according to their
* own platform and system. Also need to test the implemented interface before registration to ensure that the registration
* can be used normally. For details of the parameters, please refer to the following API interface #PsdkOsal_SemaphoreWait.
* @param semaphore: pointer to memory space used to store the created semaphore ID.
* @return Execution result.
*/
T_PsdkReturnCode (*SemaphoreWait)(T_PsdkSemHandle semaphore);
/**
* @brief Prototype of callback function used to ait the created semaphore and set the value of timeout.
* @note This interface is mainly used to wait for the created semaphore. Users need to adapt according to their platform
* and system. Also needs test the implemented interface before registration to ensure that the registration can be used
* normally. For details of the parameters, please refer to the following API interface #PsdkOsal_SemaphoreTimedWait.
* @param semaphore: pointer to memory space used to store the created semaphore ID.
* @param waitTimeMs: the value of timeout for waiting created semaphore.
* @return Execution result.
*/
T_PsdkReturnCode (*SemaphoreTimedWait)(T_PsdkSemHandle semaphore, uint32_t waitTimeMs);
/**
* @brief Prototype of callback function used to post the created semaphore.
* @note This interface is mainly used to post the created semaphore. Users need to adapt according to their platform
* and system. Also needs test the implemented interface before registration to ensure that the registration can be used
* normally. For details of the parameters, please refer to the following API interface #PsdkOsal_SemaphorePost.
* @param semaphore: pointer to memory space used to store the created semaphore ID.
* @return Execution result.
*/
T_PsdkReturnCode (*SemaphorePost)(T_PsdkSemHandle semaphore);
/**
* @brief Prototype of callback function used to get the system millisecond time, uint:ms.
* @note This interface is mainly used to get system millisecond time. Users need to adapt according to their own
* platform and system. Also need test the implemented interface before registration to ensure that the registration
* can be used normally. For details of the parameters, please refer to the following API interface #PsdkOsal_GetTimeMs.
* @param factor: pointer to memory space used to store the got time ms.
* @return Execution result.
*/
T_PsdkReturnCode (*GetTimeMs)(uint32_t *ms);
/**
* @brief Prototype of callback function used to allocate size bytes of memory.
* @note This interface is mainly used to allocate size bytes of memory. Users need to adapt according to their own
* platform and system. Also need test the implemented interface before registration to ensure that the registration
* can be used normally. For details of the parameters, please refer to the following API interface #PsdkOsal_Malloc.
* @param size: uint32_t size that needs allocate.
* @return a void pointer to the allocated memory, if equal to NULL, please do related processing to avoid null pointer crash.
*/
void *(*Malloc)(uint32_t size);
/**
* @brief Prototype of callback function used to release allocated memory.
* @note This interface is mainly used to release allocated memory. Users need to adapt according to their platform
* and system. Also needs test the implemented interface before registration to ensure that the registration can be used
* normally. For details of the parameters, please refer to the following API interface #PsdkOsal_Free.
* @param ptr: pointer to the need allocated memory.
*/
void (*Free)(void *ptr);
} T_PsdkOsalHandler;
typedef struct {
/**
* @brief Prototype of the callback function used to config the network device that connected to the payload device.
* @note Users need to implement the initialization interface of their network device and register it. For the related
* parameter settings of the network port, please refer to the document.
* @return Execution result.
*/
T_PsdkReturnCode (*NetWorkConfig)(const char *ipAddr, const char *netMask);
} T_PsdkHalNetWorkHandler;
/* Exported functions --------------------------------------------------------*/
/**
* @brief Register the handler for hal uart interfaces by your platform.
* @note It should be noted that the interface in hal is written and tested well. Users need to implement all the
* interfaces. Otherwise, the user interface cannot be successfully registered, and then the user interface is registered
* through the interface. If the registration fails, it needs to be based on the return code. To judge the problem. Make
* sure that the feature is available after a successful registration. The interface needs to be called at the beginning of
* the application for registration, otherwise, the subsequent functions will not work properly.
* @param halUartHandler: pointer to the handler for hal uart interfaces by your platform.
* @return Execution result.
*/
T_PsdkReturnCode PsdkPlatform_RegHalUartHandler(const T_PsdkHalUartHandler *halUartHandler);
/**
* @brief Register the handler for osal interfaces by your platform.
* @note It should be noted that the interface in osal is written and tested well. Users need to implement all the
* interfaces. Otherwise, the user interface cannot be successfully registered, and then the user interface is registered
* through the interface. If the registration fails, it needs to be based on the return code. To judge the problem. Make
* sure that the feature is available after a successful registration. The interface needs to be called at the beginning of
* the application for registration, otherwise, the subsequent functions will not work properly.
* @param osalHandler: pointer to the handler for osal interfaces by your platform.
* @return Execution result.
*/
T_PsdkReturnCode PsdkPlatform_RegOsalHandler(const T_PsdkOsalHandler *osalHandler);
/**
* @brief Register the handler for hal network interfaces by your platform.
* @note It should be noted that the interface in hal is written and tested well. Users need to implement all the
* interfaces. Otherwise, the user interface cannot be successfully registered, and then the user interface is registered
* through the interface. If the registration fails, it needs to be based on the return code. To judge the problem. Make
* sure that the feature is available after a successful registration.
* @attention The interface needs to be called at the beginning of the application for registration, otherwise, the
* subsequent functions will not work properly.
* @param osalHandler: pointer to the handler for network handler interfaces by your platform.
* @return Execution result.
*/
T_PsdkReturnCode PsdkPlatform_RegHalNetworkHandler(const T_PsdkHalNetWorkHandler *halNetWorkHandler);
/**
* @brief Declare the task container, initialize the task, and create task ID.
* @param task: pointer to the created task ID.
* @param taskFunc: pointer to the created task function.
* @param name: pointer to task name string, end with '\0'. If user do not specify name for task, fill in NULL.
* @param stackSize: value of task stack size, unit: byte.
* @param arg: pointer to the user defined data.
* @return Execution result.
*/
T_PsdkReturnCode PsdkOsal_TaskCreate(T_PsdkTaskHandle *task, void *(*taskFunc)(void *), const char *name,
uint32_t stackSize, void *arg);
/**
* @brief Destroy the created task.
* @param task: pointer to the created task ID.
* @return Execution result.
*/
T_PsdkReturnCode PsdkOsal_TaskDestroy(T_PsdkTaskHandle task);
/**
* @brief Let task into a sleep state in a set time, uint:ms.
* @param timeMs: value of time ms for task sleeping.
* @return Execution result.
*/
T_PsdkReturnCode PsdkOsal_TaskSleepMs(uint32_t timeMs);
/**
* @brief Declare the mutex container, initialize the mutex, and create mutex ID.
* @param mutex: pointer to the created mutex ID.
* @return Execution result.
*/
T_PsdkReturnCode PsdkOsal_MutexCreate(T_PsdkMutexHandle *mutex);
/**
* @brief Destroy the created mutex.
* @param mutex: pointer to the created mutex ID.
* @return Execution result.
*/
T_PsdkReturnCode PsdkOsal_MutexDestroy(T_PsdkMutexHandle mutex);
/**
* @brief Acquire and lock the mutex when peripheral access is required.
* @param mutex: pointer to the created mutex ID.
* @return Execution result.
*/
T_PsdkReturnCode PsdkOsal_MutexLock(T_PsdkMutexHandle mutex);
/**
* @brief Unlock and release the mutex when done with the peripheral access.
* @param mutex: pointer to the created mutex ID.
* @return Execution result.
*/
T_PsdkReturnCode PsdkOsal_MutexUnlock(T_PsdkMutexHandle mutex);
/**
* @brief Declare the semaphore container, initialize the semaphore, and create semaphore ID.
* @param semaphore: pointer to the created semaphore ID.
* @param initValue: init value of semaphore for the created semaphore.
* @return Execution result.
*/
T_PsdkReturnCode PsdkOsal_SemaphoreCreate(T_PsdkSemHandle *semaphore, uint32_t initValue);
/**
* @brief Destroy the created semaphore.
* @param semaphore: pointer to the created semaphore ID.
* @return Execution result.
*/
T_PsdkReturnCode PsdkOsal_SemaphoreDestroy(T_PsdkSemHandle semaphore);
/**
* @brief Wait the created semaphore forever.
* @param semaphore: pointer to the created semaphore ID.
* @return Execution result.
*/
T_PsdkReturnCode PsdkOsal_SemaphoreWait(T_PsdkSemHandle semaphore);
/**
* @brief Wait the created semaphore and set the value of timeout.
* @param semaphore: pointer to the created semaphore ID.
* @param waitTimeMs: value of timeout for waiting created semaphore.
* @return Execution result.
*/
T_PsdkReturnCode PsdkOsal_SemaphoreTimedWait(T_PsdkSemHandle semaphore, uint32_t waitTimeMs);
/**
* @brief Post the created semaphore.
* @param semaphore: pointer to the created semaphore ID.
* @return Execution result.
*/
T_PsdkReturnCode PsdkOsal_SemaphorePost(T_PsdkSemHandle semaphore);
/**
* @brief Get the system millisecond time, uint:ms.
* @param ms: pointer to the got time ms.
* @return Execution result.
*/
T_PsdkReturnCode PsdkOsal_GetTimeMs(uint32_t *ms);
/**
* @brief Allocate size bytes of memory.
* @note Users need to apply for memory according to the actual situation of the platform and application. If you do not
* use the memory after applying for it, please call #PsdkOsal_Free to release the memory.
* @param size: uint32_t size that needs allocate.
* @return a void pointer to the allocated memory, if equal to NULL, please do related processing to avoid null pointer crash.
*/
void *PsdkOsal_Malloc(uint32_t size);
/**
* @brief Release allocated memory.
* @note After calling the #PsdkOsal_Malloc interface, if you do not use memory, please remember to use this interface
* to release the memory.
* @param ptr: pointer to the need allocated memory.
*/
void PsdkOsal_Free(void *ptr);
#ifdef __cplusplus
}
#endif
#endif // PSDK_PLATFORM_H
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/

View File

@ -0,0 +1,138 @@
/**
********************************************************************
* @file psdk_positioning.h
* @brief This is the header file for "psdk_positioning.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2018 DJI. All rights reserved.
*
* All information contained herein is, and remains, the property of DJI.
* The intellectual and technical concepts contained herein are proprietary
* to DJI and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of DJI.
*
* If you receive this source code without DJIs authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify DJI of its removal. DJI reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef PSDK_POSITIONING_H
#define PSDK_POSITIONING_H
/* Includes ------------------------------------------------------------------*/
#include "psdk_typedef.h"
#include "psdk_data_subscription.h"
#include "psdk_time_sync.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief Data structure that describes a positioning event.
*/
typedef struct {
/*! Index of event set in which positioning event is located. The item will be written to mark file in aircraft for
* some post-precess work. If not needed, fill in 0. */
uint16_t eventSetIndex;
/*! Index of target point in payload whose position user is requesting. The item will be written to mark file in
* aircraft for some post-precess work. If not needed, fill in 0. */
uint8_t targetPointIndex;
/*! Timestamp in aircraft time system when the positioning event occur. Users should transfer time in local time
* system to time in aircraft time system by PsdkTimeSync_TransferToAircraftTime() interface in time
* synchronization module. */
T_PsdkTimeSyncAircraftTime eventTime;
} T_PsdkPositioningEventInfo;
/**
* @brief Data structure that describes position of a point.
*/
typedef struct {
psdk_f64_t longitude; /*!< Specifies longitude, unit: degree. */
psdk_f64_t latitude; /*!< Specifies latitude, unit: degree. */
psdk_f64_t height; /*!< Specifies height above sea level, unit: m. */
} T_PsdkPositioningPosition;
/**
* @brief Position value standard deviation.
*/
typedef struct {
psdk_f32_t longitude; /*!< Specifies longitude standard deviation, unit: degree. */
psdk_f32_t latitude; /*!< Specifies latitude standard deviation unit: degree. */
psdk_f32_t height; /*!< Specifies height standard deviation unit: m. */
} T_PsdkPositioningPositionStandardDeviation;
/**
* @brief Position of target point and other details returned by interface of requesting position.
*/
typedef struct {
E_PsdkDataSubscriptionPositionSolutionProperty positionSolutionProperty; /*!< Property of position solution. */
T_PsdkAttitude3d uavAttitude; /*!< Specifies UAV attitude, unit: degree. */
T_PsdkVector3d offsetBetweenMainAntennaAndTargetPoint; /*!< Specifies position offset from RTK main antenna to target points in NED coordinate system, unit: mm. */
T_PsdkPositioningPosition targetPointPosition; /*!< Specifies position of target points in GROUND coordinate system. */
T_PsdkPositioningPositionStandardDeviation targetPointPositionStandardDeviation; /*!< Specifies position standard deviation of target points. */
} T_PsdkPositioningPositionInfo;
/* Exported functions --------------------------------------------------------*/
/**
* @brief Initialise positioning module in blocking mode. User should call this function before all other positioning
* operations, just like setting task index, register callback function and requesting positions.
* @note Max execution time of this function is slightly larger than 500ms.
* @note This function has to be called in user task, rather than main() function, and after scheduler being started.
* @return Execution result.
*/
T_PsdkReturnCode PsdkPositioning_Init(void);
/**
* @brief Set task index, specifying a sequence number of operations, using to write to mark the file for some post-process
* flows.
* @details One operation may be a precise surveying and mapping task or ten exposures of camera. The default task index
* is 0.
* @param index: task index.
*/
void PsdkPositioning_SetTaskIndex(uint8_t index);
/**
* @brief The interface is used to get the position of target points and other information (refer to
* ::T_PsdkPositioningPositionInfo) based on the timestamp in aircraft time system when some events (positioning events) are
* triggered. The function uses blocking mode.
* @details Users can request positions for multiple events (event set) conveniently, such as sync exposure of
* multiple cameras. User must register callback function used to get the newest PPS triggered timestamp (refer to
* PsdkPositioning_RegGetNewestPpsTriggerTimeCallback()) before requesting position. When users have set structure
* parameters of payload and interest points (the points whose position user hope to get, e.g. center point of the camera
* image sensor), the target points are interest points, otherwise the target points are main gimbal interface center.
* Users can use position information of gimbal interface center, position offset between gimbal interface center and
* RTK main antenna, UAV attitude, gimbal structure parameters ,and gimbal attitude to calculate the position of interest
* points in the payload.
* @note Max execution time of this function is slightly larger than 600ms.
* @note All requested timestamp have to be between the time point 2 seconds earlier than the newest synchronized
* timestamp and the time point 1 seconds earlier than the newest synchronized timestamp.
* @param eventCount: count of positioning event set specified by eventInfo parameter. Please ensure the count is less
* than 5.
* @param eventInfo: pointer to positioning event information array.
* @param positionInfo: the position of target points. In Matrice 210 RTK V2 and Matrice 300 RTK aircraft system, it is
* the position of the main gimbal interface always.
* @return Execution result.
*/
T_PsdkReturnCode PsdkPositioning_GetPositionInformationSync(uint8_t eventCount, T_PsdkPositioningEventInfo *eventInfo,
T_PsdkPositioningPositionInfo *positionInfo);
#ifdef __cplusplus
}
#endif
#endif //PSDK_POSITIONING_H
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/

View File

@ -0,0 +1,106 @@
/**
********************************************************************
* @file psdk_power_management.h
* @brief This is the header file for "psdk_power_management.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2018 DJI. All rights reserved.
*
* All information contained herein is, and remains, the property of DJI.
* The intellectual and technical concepts contained herein are proprietary
* to DJI and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of DJI.
*
* If you receive this source code without DJIs authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify DJI of its removal. DJI reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef PSDK_POWER_MANAGEMENT_H
#define PSDK_POWER_MANAGEMENT_H
/* Includes ------------------------------------------------------------------*/
#include "psdk_typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief Pin state.
*/
typedef enum {
PSDK_POWER_MANAGEMENT_PIN_STATE_RESET = 0, /*!< Specifies pin is in low level state. */
PSDK_POWER_MANAGEMENT_PIN_STATE_SET = 1, /*!< Specifies pin is in high level state. */
} E_PsdkPowerManagementPinState;
/**
* @brief Prototype of callback function used to set level of high power application pin.
* @param pinState: level state of pin to be set.
* @return Execution result.
*/
typedef T_PsdkReturnCode (*WriteHighPowerApplyPinCallback)(E_PsdkPowerManagementPinState pinState);
/**
* @brief Prototype of callback function used to notify payload that the aircraft will power off soon and get state
* whether the payload is ready to power off or not.
* @warning User can not execute blocking style operations or functions in a callback function, because that will block PSDK
* root thread, causing problems such as slow system response, payload disconnection or infinite loop.
* @param powerOffPreparationFlag: pointer to memory space used to store power off preparation flag. True represents
* that payload has completed all work and is ready to power off. False represents that payload is not ready to power
* off.
* @return Execution result.
*/
typedef T_PsdkReturnCode (*PowerOffNotificationCallback)(bool *powerOffPreparationFlag);
/* Exported functions --------------------------------------------------------*/
/**
* @brief Apply high power from aircraft in blocking mode.
* @details Before applying, user should register callback function used to set level state of high power application
* pin using PsdkPowerManagement_RegWriteHighPowerApplyPinCallback() function. After applying high power, power pin of
* PSDK adapter will output high power based predetermined specification.
* @note Max execution time of this function is slightly larger than 600ms.
* @return Execution result.
*/
T_PsdkReturnCode PsdkPowerManagement_ApplyHighPowerSync(void);
/**
* @brief Register callback function used to set level state of high power application pin. Must be called before
* applying high power.
* @param callback: pointer to the callback function.
* @return Execution result.
*/
T_PsdkReturnCode PsdkPowerManagement_RegWriteHighPowerApplyPinCallback(WriteHighPowerApplyPinCallback callback);
/**
* @brief Register callback function used to notify payload that the aircraft will power off soon and get state
* whether the payload is ready to power off or not.
* @details After registering, the callback function will be called at a fixed frequency when aircraft will power off.
* User fill in the power off preparation flag, and once the payload is ready to power off, the callback function will not
* be called. After a specified time, if the payload is not ready to power off, the aircraft will power off immediately. The
* specified time is 10s.
* @param callback: pointer to callback function used to notify aircraft power off message and get payload power off
* preparation flag.
* @return Execution result.
*/
T_PsdkReturnCode PsdkPowerManagement_RegPowerOffNotificationCallback(PowerOffNotificationCallback callback);
#ifdef __cplusplus
}
#endif
#endif // PSDK_POWER_MANAGEMENT_H
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/

View File

@ -0,0 +1,62 @@
/**
********************************************************************
* @file psdk_product_info.h
* @brief This is the header file for "psdk_product_info.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2018 DJI. All rights reserved.
*
* All information contained herein is, and remains, the property of DJI.
* The intellectual and technical concepts contained herein are proprietary
* to DJI and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of DJI.
*
* If you receive this source code without DJIs authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify DJI of its removal. DJI reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef PSDK_PRODUCT_INFO_H
#define PSDK_PRODUCT_INFO_H
/* Includes ------------------------------------------------------------------*/
#include "psdk_typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
/**
* @brief Set an alias that satisfies the condition for PSDK application or product.
* @details Alias will display in DJI Pilot, if exist.
* @note Still need to pass in correct PSDK APP name that is obtained from DJI SDK developer website to PsdkCore_Init()
* interface. The PSDK APP name will be used to bind or verification.
* @note Alias will be effective after a while, and the max value is 1s.
* @param productAlias: pointer to product alias string, and alias end with '\0'. The max length of the string is 31. If
* length of alias string is greater than 31, alias string will be truncated and passed in.
* @return Execution result.
*/
T_PsdkReturnCode PsdkProductInfo_SetAlias(const char *productAlias);
#ifdef __cplusplus
}
#endif
#endif //PSDK_PRODUCT_INFO_H
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/

View File

@ -0,0 +1,99 @@
/**
********************************************************************
* @file psdk_time_sync.h
* @brief This is the header file for "psdk_time_synchronization.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2018 DJI. All rights reserved.
*
* All information contained herein is, and remains, the property of DJI.
* The intellectual and technical concepts contained herein are proprietary
* to DJI and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of DJI.
*
* If you receive this source code without DJIs authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify DJI of its removal. DJI reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef PSDK_TIME_SYNC_H
#define PSDK_TIME_SYNC_H
/* Includes ------------------------------------------------------------------*/
#include "psdk_typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief Prototype of callback function used to get the newest PPS triggered timestamp.
* @warning User can not execute blocking style operations or functions in callback function, because that will block PSDK
* root thread, causing problems such as slow system response, payload disconnection or infinite loop.
* @param localTimeUs: pointer to memory space used to store PPS triggered timestamp.
* @return Execution result.
*/
typedef T_PsdkReturnCode (*GetNewestPpsTriggerLocalTimeUsCallback)(uint64_t *localTimeUs);
/**
* @brief Data structure of time in aircraft time system.
*/
typedef struct {
uint16_t year; /*!< Specifies year. */
uint8_t month; /*!< Specifies month, range from 1 to 12. */
uint8_t day; /*!< Specifies day, range from 1 to 31. */
uint8_t hour; /*!< Specifies hour, range from 0 to 23. */
uint8_t minute; /*!< Specifies minute, range from 0 to 59. */
uint8_t second; /*!< Specifies second, range from 0 to 59. */
uint32_t microsecond; /*!< Specifies microsecond, range from 0 to 999999. */
} T_PsdkTimeSyncAircraftTime;
/* Exported functions --------------------------------------------------------*/
/**
* @brief Initialise time synchronization module in blocking mode. User should call this function before all other time
* synchronization operations, just like transferring time.
* @note Max execution time of this function is slightly larger than 2000ms.
* @note This function have to be called in user task, rather than main() function, and after scheduler being started.
* @return Execution result.
*/
T_PsdkReturnCode PsdkTimeSync_Init(void);
/**
* @brief Register callback function used to get the newest timestamp in local time system when PPS rising edge signal
* is detected.
* @details PSDK uses the timestamp information to synchronise time of local time system and RTK navigation and
* positioning system.
* @param callback: pointer to the callback function.
* @return Execution result.
*/
T_PsdkReturnCode PsdkTimeSync_RegGetNewestPpsTriggerTimeCallback(GetNewestPpsTriggerLocalTimeUsCallback callback);
/**
* @brief Transfer local time to time in aircraft time system.
* @note Before calling the interface, users must call PsdkTimeSync_RegGetNewestPpsTriggerTimeCallback() to register
* callback function used to report the latest triggered time of PPS signal.
* @param localTimeUs: local time, unit: microsecond.
* @param aircraftTime: pointer to memory space used to store time in aircraft time system.
* @return Execution result.
*/
T_PsdkReturnCode PsdkTimeSync_TransferToAircraftTime(uint64_t localTimeUs, T_PsdkTimeSyncAircraftTime *aircraftTime);
#ifdef __cplusplus
}
#endif
#endif //PSDK_TIME_SYNC_H
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/

View File

@ -0,0 +1,110 @@
/**
********************************************************************
* @file psdk_typedef.h
* @brief PSDK type define file.
*
* @copyright (c) 2018 DJI. All rights reserved.
*
* All information contained herein is, and remains, the property of DJI.
* The intellectual and technical concepts contained herein are proprietary
* to DJI and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of DJI.
*
* If you receive this source code without DJIs authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify DJI of its removal. DJI reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef PSDK_TYPEDEF_H
#define PSDK_TYPEDEF_H
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
#include "psdk_error.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
#define PI (3.14159265358979323846f)
#define PSDK_FILE_NAME_SIZE_MAX 256
#define PSDK_FILE_PATH_SIZE_MAX (PSDK_FILE_NAME_SIZE_MAX + 256)
#define PSDK_IP_ADDR_STR_SIZE_MAX 15
#define PSDK_MD5_BUFFER_LEN 16
/* Exported types ------------------------------------------------------------*/
/**
* @brief Type define double as psdk_f64_t.
*/
typedef double psdk_f64_t;
/**
* @brief Type define float as psdk_f32_t.
*/
typedef float psdk_f32_t;
/**
* @brief Type define uint64 as T_PsdkReturnCode.
* @details The type can be any value of ::PsdkErrorCode.
*/
typedef uint64_t T_PsdkReturnCode;
#pragma pack (1)
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_PsdkVector3d;
typedef struct Vector3f {
psdk_f32_t x; /*!< Specifies float value of x for vector. */
psdk_f32_t y; /*!< Specifies float value of y for vector. */
psdk_f32_t z; /*!< Specifies float value of z for vector. */
} T_PsdkVector3f;
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_PsdkAttitude3d;
typedef struct {
psdk_f32_t pitch; /*!< Specifies float value of pitch for attitude. */
psdk_f32_t roll; /*!< Specifies float value of roll for attitude */
psdk_f32_t yaw; /*!< Specifies float value of yaw for attitude */
} T_PsdkAttitude3f;
typedef struct {
psdk_f32_t q0; /*!< w, when converted to a rotation matrix or Euler angles. */
psdk_f32_t q1; /*!< x, when converted to a rotation matrix or Euler angles. */
psdk_f32_t q2; /*!< y, when converted to a rotation matrix or Euler angles. */
psdk_f32_t q3; /*!< z, when converted to a rotation matrix or Euler angles. */
} T_PsdkQuaternion4f;
#pragma pack ()
/* define compiler specific symbols */
#if defined (__ICCARM__)
#elif defined (__CC_ARM)
#pragma anon_unions
#elif defined (__GNUC__)
#elif defined (__TASKING__)
#endif
#ifdef __cplusplus
}
#endif
#endif //PSDK_TYPEDEF_H
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/

View File

@ -0,0 +1,228 @@
/**
********************************************************************
* @file psdk_upgrade.h
* @brief This is the header file for "psdk_upgrade.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2018 DJI. All rights reserved.
*
* All information contained herein is, and remains, the property of DJI.
* The intellectual and technical concepts contained herein are proprietary
* to DJI and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of DJI.
*
* If you receive this source code without DJIs authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify DJI of its removal. DJI reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef PSDK_UPGRADE_H
#define PSDK_UPGRADE_H
/* Includes ------------------------------------------------------------------*/
#include <psdk_typedef.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
typedef enum {
/*!
* @brief FTP firmware transfer type.
* @note This transfer type only support linux platform and use network port. Users need to deploy FTP service on
* payload. The ftp user info used to transfer upgrade firmware is :
* username:psdk_payload_ftp
* password:DJi_#$31
* You can get guide about FTP service deployment on https://developer.dji.com/payload-sdk/documentation
*/
PSDK_PAYLOAD_FIRMWARE_TRANSFER_TYPE_FTP = 0,
/*!
* @brief DCFTP firmware transfer type.
* @details DCFTP (DJI Common File Transfer Protocol) is a private protocol used to transfer file on DJI Product.
* Users can get file data by command callbacks, see :: T_PsdkUpgradeDcftpFileTransferOpt.
* @note This transfer type is used to support RTOS platform or payload don't have network port. The transfer speed
* is very slow compare to FTP because it uses low speed transfer channel.
*/
PSDK_PAYLOAD_FIRMWARE_TRANSFER_TYPE_DCFTP,
} E_PsdkPayloadFirmwareTransferType;
typedef enum {
PSDK_UPGRADE_STAGE_IDLE = 0, /*!< Idle stage means not in upgrade mode. */
PSDK_UPGRADE_STAGE_ONGOING = 3, /*!< Ongoing stage means payload is upgrading. */
PSDK_UPGRADE_STAGE_DEVICE_REBOOT = 6, /*!< Device reboot stage means device is rebooting. */
PSDK_UPGRADE_STAGE_END = 4, /*!< End Stage means upgrade finish and reporting upgrade result to the terminal APP. */
} E_PsdkUpgradeStage;
typedef enum {
PSDK_UPGRADE_END_STATE_SUCCESS = 1, /*!< Upgrade success. */
PSDK_UPGRADE_END_STATE_UNKNOWN_ERROR = 2, /*!< Upgrade failure due to unknown reason. */
} E_PsdkUpgradeEndState;
/**
* @brief The firmware version of payload.
* @note If majorVersion = AA, minorVersion = BB, modifyVersion = CC, debugVersion = DD, The version show in
* terminal APP is AA.BB.CC.DD
*/
typedef struct {
uint8_t majorVersion; /*!< The major version of firmware, the range is 0 ~ 99. */
uint8_t minorVersion; /*!< The minor version of firmware, the range is 0 ~ 99. */
uint8_t modifyVersion; /*!< The modify version of firmware, the range is 0 ~ 99. */
uint8_t debugVersion; /*!< The debug version of firmware, the range is 0 ~ 99. */
} T_PsdkPayloadFirmwareVersion;
typedef struct {
uint8_t upgradeProgress; /*!< The upgrade progress, the range is 0 ~ 100. */
} T_PsdkUpgradeOngoingInfo;
typedef struct {
uint8_t rebootTimeout; /*!< The timeout value of rebooting device. unit: s */
} T_PsdkUpgradeRebootInfo;
typedef struct {
E_PsdkUpgradeEndState upgradeEndState; /*!< The upgrade end state */
} T_PsdkUpgradeEndInfo;
typedef struct {
uint32_t port; /*!< FTP port used to transfer file, default is 21 */
} T_PsdkUpgradeFtpFileTransferInfo;
typedef struct {
uint32_t fileSize; /*! The size of file. */
char fileName[PSDK_FILE_NAME_SIZE_MAX]; /*! The name of file. */
} T_PsdkUpgradeFileInfo;
typedef struct {
/**
* @brief Prototype of callback function used to start file transfer.
* @param fileInfo: the file info about the file to be transferred.
* @return Execution result.
*/
T_PsdkReturnCode (*start)(const T_PsdkUpgradeFileInfo *fileInfo);
/**
* @brief Prototype of callback function used to transfer file data.
* @details After start transfer, this callback function will be called several times to transfer file data sequentially.
* @param data: pointer to memory space used to store file data.
* @param dataLen: the data length of data.
* @return Execution result.
*/
T_PsdkReturnCode (*transfer)(const uint8_t *data, uint16_t dataLen);
/**
* @brief Prototype of callback function used to finish file transfer.
* @param md5: the md5 value of file, used to check the correctness of the file transfer .
* @return Execution result.
*/
T_PsdkReturnCode (*finish)(const uint8_t md5[PSDK_MD5_BUFFER_LEN]);
} T_PsdkUpgradeDcftpFileTransferOpt;
typedef struct {
/*! The firmware transfer type for upgrade. */
E_PsdkPayloadFirmwareTransferType transferType;
/*! If transferType is PSDK_PAYLOAD_FIRMWARE_TRANSFER_TYPE_FTP, need support ftpTransferInfo. */
T_PsdkUpgradeFtpFileTransferInfo ftpTransferInfo;
/*! If transferType is PSDK_PAYLOAD_FIRMWARE_TRANSFER_TYPE_DCFTP, need support dcftpFileTransferOpt. */
T_PsdkUpgradeDcftpFileTransferOpt dcftpFileTransferOpt;
} T_PsdkPayloadFirmwareTransferInfo;
typedef struct {
/*! The upgrade stage in upgrade process. */
E_PsdkUpgradeStage upgradeStage;
union {
/*! If upgradeStage is PSDK_UPGRADE_STAGE_ONGOING, need support upgradeOngoingInfo. */
T_PsdkUpgradeOngoingInfo upgradeOngoingInfo;
/*! If upgradeStage is PSDK_UPGRADE_STAGE_DEVICE_REBOOT, need support upgradeRebootInfo. */
T_PsdkUpgradeRebootInfo upgradeRebootInfo;
/*! If upgradeStage is PSDK_UPGRADE_STAGE_END, need support upgradeEndInfo. */
T_PsdkUpgradeEndInfo upgradeEndInfo;
};
} T_PsdkUpgradeState;
typedef struct {
T_PsdkPayloadFirmwareVersion currentFirmwareVersion; /*!< The current firmware version of payload. */
T_PsdkPayloadFirmwareTransferInfo firmwareTransferInfo; /*!< The firmware transfer info of payload. */
} T_PsdkUpgradeConfig;
typedef struct {
/**
* @brief Prototype of callback function used to enter upgrade mode.
* @param waitTime: the wait time for enter upgrade mode. The terminal APP will wait these time before do other
* upgrade actions. You can use this time to prepare for firmware upgrade in other task, such as clean firmware
* store area. unit: s
* @return Execution result.
*/
T_PsdkReturnCode (*EnterUpgradeMode)(uint16_t *waitTime);
/**
* @brief Prototype of callback function used to check transferred firmware.
* @details You can verify signature and decrypt firmware in this callback function.
* @return Execution result.
*/
T_PsdkReturnCode (*CheckFirmware)(void);
/**
* @brief Prototype of callback function used to start firmware upgrade.
* @note After start upgrade, the upgrade stage need change to ::PSDK_UPGRADE_STAGE_ONGOING
* @return Execution result.
*/
T_PsdkReturnCode (*StartUpgrade)(void);
/**
* @brief Prototype of callback function used to finish firmware upgrade.
* @note After call finish upgrade, the upgrade stage need change from ::PSDK_UPGRADE_STAGE_END to ::PSDK_UPGRADE_STAGE_IDLE
* @return Execution result.
*/
T_PsdkReturnCode (*FinishUpgrade)(void);
} T_PsdkUpgradeHandler;
/* Exported functions --------------------------------------------------------*/
/**
* @brief Initialise upgrade module, and user should call this function before using upgrade features.
* @param upgradeConfig: upgrade init configuration.
* @return Execution result.
*/
T_PsdkReturnCode PsdkUpgrade_Init(const T_PsdkUpgradeConfig *upgradeConfig);
/**
* @brief Enable local upgrade mode.
* @details After enable local upgrade mode, DJI Assistant 2 will display payload upgrade interface. Users can choose
* firmware file to upgrade payload.
* @return Execution result.
*/
T_PsdkReturnCode PsdkUpgrade_EnableLocalUpgrade(void);
/**
* @brief Register the handler for upgrade process.
* @param upgradeHandler: pointer to structure of handler functions for upgrade process.
* @return Execution result.
*/
T_PsdkReturnCode PsdkUpgrade_RegHandler(const T_PsdkUpgradeHandler *upgradeHandler);
/**
* @brief Push upgrade state to terminal app.
* @param upgradeState: upgrade state in upgrade process.
* @note When start upgrade, you need push upgrade state until finish upgrade. The upgrade state push logic is :
* 1. StartUpgrade callback called;
* 2. The upgrade stage change to :: PSDK_UPGRADE_STAGE_ONGOING. Push upgrade state upgradeOngoingInfo when upgradeOngoingInfo changed;
* 3. After upgrade ongoing, change upgrade stage to PSDK_UPGRADE_STAGE_DEVICE_REBOOT and push upgrade state upgradeRebootInfo;
* 4. Device reboot;
* 4. After device reboot, change upgrade stage to PSDK_UPGRADE_STAGE_END and continuous push upgrade state upgradeEndInfo (recommended 1Hz);
* 5. FinishUpgrade Callback called, stop push upgrade state. The upgrade process finished.
* @return Execution result.
*/
T_PsdkReturnCode PsdkUpgrade_PushUpgradeState(const T_PsdkUpgradeState *upgradeState);
#ifdef __cplusplus
}
#endif
#endif // PSDK_UPGRADE_H
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/

View File

@ -0,0 +1,54 @@
/**
********************************************************************
* @file psdk_version.h
* @brief This is the header file for "psdk_version.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2018 DJI. All rights reserved.
*
* All information contained herein is, and remains, the property of DJI.
* The intellectual and technical concepts contained herein are proprietary
* to DJI and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of DJI.
*
* If you receive this source code without DJIs authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify DJI of its removal. DJI reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef PSDK_VERSION_H
#define PSDK_VERSION_H
/* Includes ------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
#define PSDK_VERSION_MAJOR 2 /*!< Payload SDK major version num, when have incompatible API changes. Range from 0 to 99. */
#define PSDK_VERSION_MINOR 2 /*!< Payload SDK minor version num, when add functionality in a backwards compatible manner changes. Range from 0 to 99. */
#define PSDK_VERSION_MODIFY 1 /*!< Payload SDK modify version num, when have backwards compatible bug fixes changes. Range from 0 to 99. */
#define PSDK_VERSION_BETA 0 /*!< Payload SDK version beta info, release version will be 0, when beta version release changes. Range from 0 to 255. */
#define PSDK_VERSION_BUILD 315 /*!< Payload SDK version build info, when jenkins trigger build changes. Range from 0 to 65535. */
/* Exported types ------------------------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif // PSDK_VERSION_H
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/

View File

@ -0,0 +1,228 @@
/**
********************************************************************
* @file psdk_widget.h
* @brief This is the header file for "psdk_widget.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2018 DJI. All rights reserved.
*
* All information contained herein is, and remains, the property of DJI.
* The intellectual and technical concepts contained herein are proprietary
* to DJI and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of DJI.
*
* If you receive this source code without DJIs authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify DJI of its removal. DJI reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef PSDK_WIDGET_H
#define PSDK_WIDGET_H
/* Includes ------------------------------------------------------------------*/
#include <psdk_typedef.h>
#include "psdk_data_transmission.h"
#include "psdk_aircraft_info.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/*! The maximum length of a message that can be displayed by the mobile app floating window */
#define PSDK_WIDGET_FLOATING_WINDOW_MSG_MAX_LEN 255
/* Exported types ------------------------------------------------------------*/
/**
* @brief Widget types.
*/
typedef enum {
PSDK_WIDGET_TYPE_BUTTON = 1, /*!< button widget type */
PSDK_WIDGET_TYPE_SWITCH = 2, /*!< switch widget type */
PSDK_WIDGET_TYPE_SCALE = 3, /*!< scale widget type */
PSDK_WIDGET_TYPE_LIST = 4, /*!< list widget type */
PSDK_WIDGET_TYPE_INT_INPUT_BOX = 5, /*!< integer input box widget type */
} E_PsdkWidgetType;
/**
* @brief Button widget state.
*/
typedef enum {
PSDK_WIDGET_BUTTON_STATE_PRESS_DOWN = 1, /*!< Button is pressed down */
PSDK_WIDGET_BUTTON_STATE_RELEASE_UP = 0, /*!< Button is released up */
} E_PsdkWidgetButtonState;
/**
* @brief Switch widget state.
*/
typedef enum {
PSDK_WIDGET_SWITCH_STATE_OFF = 0, /*!< Switch is turned off */
PSDK_WIDGET_SWITCH_STATE_ON = 1 /*!< Switch is turned on */
} E_PsdkWidgetSwitchState;
/**
* @brief Widget file binary array.
*/
typedef struct {
char *fileName; /*!< The file name of the widget file */
uint32_t fileSize; /*!< The file size of the widget file, uint : byte */
const uint8_t *fileBinaryArray; /*!< The binary C array of the widget file */
} T_PsdkWidgetFileBinaryArray;
/**
* @brief Widget binary array config.
*/
typedef struct {
uint16_t binaryArrayCount; /*!< Binary array count. */
T_PsdkWidgetFileBinaryArray *fileBinaryArrayList; /*!< Pointer to binary array list */
} T_PsdkWidgetBinaryArrayConfig;
/**
* @brief Widget handler item.
*/
typedef struct {
/*! The index of widget, the index can be numbered starting from 0 and cannot be repeated */
uint32_t widgetIndex;
/*! The type of widget, refer to ::E_PsdkWidgetType */
E_PsdkWidgetType widgetType;
/**
* @brief Prototype of callback function used to set widget value, the function will be call when the user triggers
* the widget.
* @param widgetType: the type of widget, refer to ::E_PsdkWidgetType.
* @param index: the index of widget.
* @param value: the value of widget, need be set.
* if the widget type is PSDK_WIDGET_TYPE_BUTTON, the value is refer to ::E_PsdkWidgetButtonState;
* if the widget type is PSDK_WIDGET_TYPE_SWITCH, the value is refer to ::E_PsdkWidgetSwitchState;
* if the widget type is PSDK_WIDGET_TYPE_SCALE, the value is range from 0 to 100, which represents the percentage
* of the scale slider;
* if the Widget type is PSDK_WIDGET_TYPE_LIST, the value is range from 0 to N-1 (N is the value of list item
* count), which represents which item is chosen;
* if the widget type is PSDK_WIDGET_TYPE_INT_INPUT_BOX, the value is the input value of int input box widget.
* @param userData: the user data need used in callback.
* @return Execution result.
*/
T_PsdkReturnCode (*SetWidgetValue)(E_PsdkWidgetType widgetType, uint32_t index, int32_t value, void *userData);
/**
* @brief Prototype of callback function used to get widget value.
* @param widgetType: the type of widget, refer to ::E_PsdkWidgetType.
* @param index
* @param value: the value of widget, need be set.
* if the widget type is PSDK_WIDGET_TYPE_BUTTON, the value is refer to ::E_PsdkWidgetButtonState;
* if the widget type is PSDK_WIDGET_TYPE_SWITCH, the value is refer to ::E_PsdkWidgetSwitchState;
* if the widget type is PSDK_WIDGET_TYPE_SCALE, the value is range from 0 to 100, which represents the percentage
* of the scale slider;
* if the Widget type is PSDK_WIDGET_TYPE_LIST, the value is range from 0 to N-1 (N is the value of list item
* count), which represents which item is chosen;
* if the widget type is PSDK_WIDGET_TYPE_INT_INPUT_BOX, the value is the input value of int input box widget.
* @param userData: the user data need used in callback function.
* @return Execution result.
*/
T_PsdkReturnCode (*GetWidgetValue)(E_PsdkWidgetType widgetType, uint32_t index, int32_t *value, void *userData);
/*! the user data need used in SetWidgetValue and GetWidgetValue callback function. */
void *userData;
} T_PsdkWidgetHandlerListItem;
/* Exported functions --------------------------------------------------------*/
/**
* @brief Initialise widget module, and user should call this function before using widget features.
* @return Execution result.
*/
T_PsdkReturnCode PsdkWidget_Init(void);
#if PSDK_ARCH_SYS_LINUX
/**
* @brief Register default widget UI configuration file directory path.
* @note Under Linux system, there are two functions to set the custom widget configuration directory path, function
* PsdkWidget_RegDefaultConfigByDirPath and PsdkWidget_RegUiConfigByDirPath. When you don't need multi-language
* and multi-screen size support, you can just use PsdkWidget_RegDefaultUiConfigByDirPath function set widget UI
* Config directory path. If you need support multi-language and multi-screen size support, you can use function
* PsdkWidget_RegUiConfigByDirPath to specify widget configuration. When the language and screen size is not
* cover in your setting by PsdkWidget_RegUiConfigByDirPath, the widget UI configuration uses setting by
* PsdkWiget_RegDefaultUiConfigByDirPath function.
* @param widgetConfigDirPath: the widget UI configuration directory path.
* @return Execution result.
*/
T_PsdkReturnCode PsdkWidget_RegDefaultUiConfigByDirPath(const char *widgetConfigDirPath);
/**
* @brief Register widget UI configuration file directory path.
* @note Different widget UI configurations for several language and screen size require the same widget type, index and
* count.
* @param appLanguage: mobile app language type.
* @param appScreenType: mobile app screen type.
* @param widgetConfigDirPath: the widget UI configuration directory path.
* @return Execution result.
*/
T_PsdkReturnCode PsdkWidget_RegUiConfigByDirPath(E_PsdkAircraftInfoMobileAppLanguage appLanguage,
E_PsdkAircraftInfoMobileAppScreenType appScreenType,
const char *widgetConfigDirPath);
#endif
/**
* @brief Register default widget UI config by binary array configuration.
* @note In RTOS, most likely there is no file system. The widget config file content can use C array express. Use this
* function and PsdkWidget_RegDefaultUiConfigBinaryArray set widget UI configuration. When the language and screen size
* is not cover in your setting by PsdkWidget_RegUiConfigByBinaryArray, the widget UI configuration uses setting by this
* function.
* @param binaryArrayConfig: the binary array config for widget UI configuration.
* @return Execution result.
*/
T_PsdkReturnCode PsdkWidget_RegDefaultUiConfigByBinaryArray(const T_PsdkWidgetBinaryArrayConfig *binaryArrayConfig);
/**
* @brief Register widget UI config by binary array configuration.
* @note Different widget UI configurations for several language and screen size require the same widget type, index and
* count.
* @param appLanguage: mobile app language type.
* @param screenType: mobile app screen type.
* @param binaryArrayConfig: the binary array config for widget UI configuration.
* @return Execution result.
*/
T_PsdkReturnCode PsdkWidget_RegUiConfigByBinaryArray(E_PsdkAircraftInfoMobileAppLanguage appLanguage,
E_PsdkAircraftInfoMobileAppScreenType screenType,
const T_PsdkWidgetBinaryArrayConfig *binaryArrayConfig);
/**
* @brief Register handler list for widgets.
* @param widgetHandlerList: widget handler list for widgets.
* @param itemCount: the item count of widget handler list.
* @return Execution result.
*/
T_PsdkReturnCode PsdkWidget_RegHandlerList(const T_PsdkWidgetHandlerListItem *widgetHandlerList, uint32_t itemCount);
/**
* @brief Send message to mobile app floating window.
* @note the message length can't more than PSDK_WIDGET_FLOATING_WINDOW_MSG_MAX_LEN. The max data bandwidth of floating
* windows message is 2KB/s.
* @param str: pointer to message string.
* @return Execution result.
*/
T_PsdkReturnCode PsdkWidgetFloatingWindow_ShowMessage(const char *str);
/**
* @brief Get data transmission state of floating window channel. User can use the state as base for controlling
* floating windows message send.
* @param state: pointer to floating window channel state.
* @return Execution result.
*/
T_PsdkReturnCode PsdkWidgetFloatingWindow_GetChannelState(T_PsdkDataChannelState *state);
#ifdef __cplusplus
}
#endif
#endif // PSDK_WIDGET_H
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/

View File

@ -0,0 +1,222 @@
/**
********************************************************************
* @file psdk_xport.h
* @brief XPort module provides some interfaces used to control XPort and get states of XPort. The module can be used
* only when the PSDK adapter is XPort, rather than Skyport.
*
* @copyright (c) 2018 DJI. All rights reserved.
*
* All information contained herein is, and remains, the property of DJI.
* The intellectual and technical concepts contained herein are proprietary
* to DJI and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of DJI.
*
* If you receive this source code without DJIs authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify DJI of its removal. DJI reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef PSDK_XPORT_H
#define PSDK_XPORT_H
/* Includes ------------------------------------------------------------------*/
#include "psdk_typedef.h"
#include "psdk_gimbal.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief XPort limit angle category.
*/
typedef enum {
PSDK_XPORT_LIMIT_ANGLE_CATEGORY_ROLL_JOINT_ANGLE = 0, /*!< Joint angle limit of roll axis. */
PSDK_XPORT_LIMIT_ANGLE_CATEGORY_PITCH_JOINT_ANGLE = 1, /*!< Joint angle limit of pitch axis. */
PSDK_XPORT_LIMIT_ANGLE_CATEGORY_PITCH_EULER_ANGLE = 2, /*!< Euler angle limit of pitch axis, just is limitation of angle in ground coordinate. */
PSDK_XPORT_LIMIT_ANGLE_CATEGORY_PITCH_EULER_ANGLE_EXTENSION = 3, /*!< Extended euler angle limit of pitch axis, just is limitation of angle in ground coordinate. Extended euler
angle limit is activated when enable extended pitch axis angle limit. */
PSDK_XPORT_LIMIT_ANGLE_CATEGORY_YAW_JOINT_ANGLE = 4, /*!< Joint angle limit of yaw axis. */
} E_PsdkXPortLimitAngleCategory;
/**
* @brief Limit angle data structure.
*/
typedef struct {
int16_t upperLimit; /*!< Upper limit of limit angle, unit: 0.1degree. */
int16_t lowerLimit; /*!< Lower limit of limit angle, unit: 0.1degree. */
} T_PsdkXPortLimitAngle;
/**
* @brief Prototype of callback function used to receive system state of XPort.
* @warning User can not execute blocking style operations or functions in callback function, because that will block PSDK
* root thread, causing problems such as slow system response, payload disconnection or infinite loop.
* @param systemState: system state of XPort.
* @return Execution result.
*/
typedef T_PsdkReturnCode (*ReceiveXPortSystemStateCallback)(T_PsdkGimbalSystemState systemState);
/**
* @brief Prototype of callback function used to receive attitude information of XPort.
* @warning User can not execute blocking style operations or functions in callback function, because that will block PSDK
* root thread, causing problems such as slow system response, payload disconnection or infinite loop.
* @param attitudeInformation: attitude information of XPort.
* @return Execution result.
*/
typedef T_PsdkReturnCode (*ReceiveXPortAttitudeInformationCallback)(
T_PsdkGimbalAttitudeInformation attitudeInformation);
/* Exported functions --------------------------------------------------------*/
/**
* @brief Initialise XPort module.
* @note The function have to be called before other functions related to XPort.
* @return Execution result.
*/
T_PsdkReturnCode PsdkXPort_Init(void);
/**
* @brief Deinitialize XPort module.
* @return Execution result.
*/
T_PsdkReturnCode PsdkXPort_DeInit(void);
/**
* @brief Register callback function used to receive system state of XPort.
* @note The callback function will be called after registering. The call frequency is 1Hz.
* @param callback: pointer to the callback function.
* @return Execution result.
*/
T_PsdkReturnCode PsdkXPort_RegReceiveSystemStateCallback(ReceiveXPortSystemStateCallback callback);
/**
* @brief Register callback function used to receive attitude information of XPort.
* @note The callback function will be called after registering. The call frequency is 10Hz.
* @param callback: pointer to the callback function.
* @return Execution result.
*/
T_PsdkReturnCode PsdkXPort_RegReceiveAttitudeInformationCallback(ReceiveXPortAttitudeInformationCallback callback);
/**
* @brief Set gimbal mode of XPort in blocking mode.
* @note Max execution time of this function is slightly larger than 600ms.
* @param mode: gimbal mode.
* @return Execution result.
*/
T_PsdkReturnCode PsdkXPort_SetGimbalModeSync(E_PsdkGimbalMode mode);
/**
* @brief Rotate gimbal of XPort in blocking mode.
* @note Max execution time of this function is slightly larger than 600ms.
* @note If rotation mode is ::PSDK_GIMBAL_ROTATION_MODE_RELATIVE_ANGLE or ::PSDK_GIMBAL_ROTATION_MODE_ABSOLUTE_ANGLE,
* range of yaw value in rotation value argument is [-1800, 1800]. Gimbal can rotate to any angle of yaw axis by the
* range. Symbol of yaw value does not determine the rotation direction of the gimbal.
* @note Attitude that gimbal can reach is also determined by angle limitation and angle limitation buffer of the gimbal.
* When the gimbal is upward, angle limitation differs from limitation users set. For angle limitation and angle limitation
* buffer, please refer to PSDK documentation for details. If gimbal attitude is within range limitation buffer and
* control gimbal move towards limit direction still, or gimbal attitude is outside the angle limitation buffer but
* control gimbal to the range limitation buffer, the gimbal will return an error. For the former case, the gimbal will not
* move. In the latter case, the gimbal will try to move towards the direction of angle limit but it will stop at
* somewhere in angle limitation buffer.
* @note Rotation speed and rotation duration are also limited by the maximum speed of gimbal and maximum acceleration. The
* maximum acceleration is determined by the smooth factor of the gimbal controller set by APP. The maximum speed is determined
* by default maximum speed and maximum speed percentage set by APP, and the default maximum speed of XPort is
* 90degree/s. For the detailed relationship, please refer to SetControllerSmoothFactor() and
* SetControllerMaxSpeedPercentage() callback function prototype in psdk_gimbal.h file.
* @note Only pitch and yaw axis of XPort is controllable.
* @note XPort do not response rotation command in process of control parameters auto-tuning, coaxiality detection,
* balance detection and resetting. And these operations will interrupt rotation of XPort.
* @note Effective time of a speed control command is 500ms, that is, if XPort do not receive other control commands
* within 500ms after speed control, XPort will stop rotation.
* @param rotationMode: mode of rotation command.
* @param rotationProperty: property of rotation command.
* @param rotationValue: value of rotation command, unit: 0.1 degree (if rotation mode is
* ::PSDK_GIMBAL_ROTATION_MODE_RELATIVE_ANGLE or ::PSDK_GIMBAL_ROTATION_MODE_ABSOLUTE_ANGLE), 0.1 degree/s
* (if rotation mode is ::PSDK_GIMBAL_ROTATION_MODE_SPEED).
* @return Execution result.
*/
T_PsdkReturnCode PsdkXPort_RotateSync(E_PsdkGimbalRotationMode rotationMode,
T_PsdkGimbalRotationProperty rotationProperty, T_PsdkAttitude3d rotationValue);
/**
* @brief Release gimbal control permission out in blocking mode.
* @details When PSDK application control XPort gimbal, PSDK application will capture and gain control permission of
* gimbal if allowable. After PSDK application sending a sequence of the gimbal control command, PSDK application should
* call this interface to release control permission of gimbal, to allow other modules (like APP, flight
* controller) can control gimbal right now. For example, PSDK application can release control permission after tap
* zooming. Of course, if PSDK application does not release control permission after controlling gimbal, the gimbal will also
* release control permission automatically at some time point later than the completion of control commands. Undoubtedly,
* this is inefficient.
* @note Max execution time of this function is slightly larger than 600ms.
* @note XPort do not response release control permission command in process of control parameters auto-tuning,
* coaxiality detection and balance detection.
* @return Execution result.
*/
T_PsdkReturnCode PsdkXPort_ReleaseControlPermissionSync(void);
/**
* @brief Reset gimbal of XPort in blocking mode.
* @details The interface reset angle of pitch axis to corresponding fine tune value in ground coordinate, and yaw axis
* to superimposed value of yaw axis angle of aircraft and corresponding fine tune value in ground coordinate.
* @note Max execution time of this function is slightly larger than 600ms.
* @note XPort do not response reset command in process of control parameters auto-tuning, coaxiality detection and
* balance detection.
* @param mode: Reset mode.
* @return Execution result.
*/
T_PsdkReturnCode PsdkXPort_ResetSync(E_PsdkGimbalResetMode mode);
/**
* @brief Set limit angle for XPort in blocking mode.
* @details Please refer to XPort part of <a href="https://developer.dji.com/payload-sdk">developer website</a> for
* details about default limit angle of XPort.
* @note Max execution time of this function is slightly larger than 1200ms.
* @note XPort do not response set limit angle command in process of control parameters auto-tuning, coaxiality
* detection and balance detection.
* @param limitAngleCategory: limit angle category.
* @param limitAngle: limit angle.
* @return Execution result.
*/
T_PsdkReturnCode PsdkXPort_SetLimitAngleSync(E_PsdkXPortLimitAngleCategory limitAngleCategory,
T_PsdkXPortLimitAngle limitAngle);
/**
* @brief Get limit angle of XPort in blocking mode.
* @note Max execution time of this function is slightly larger than 1200ms.
* @param limitAngleCategory: limit angle category.
* @param limitAngle: pointer to memory space used to store limit angle.
* @return Execution result.
*/
T_PsdkReturnCode PsdkXPort_GetLimitAngleSync(E_PsdkXPortLimitAngleCategory limitAngleCategory,
T_PsdkXPortLimitAngle *limitAngle);
/**
* @brief Set speed conversion factor for speed control from joystick and APP.
* @details XPort convert speed control command from joystick and APP to rotation speed based on the speed conversion
* factor. The formula is "speed = maximum rotation speed * conversion factor", and maximum rotation speed is a product of
* default maximum speed and maximum speed percentage. The default maximum rotation speed is 90degree/s. The maximum
* speed percentage is set by APP. The default speed conversion factor is 1.0.
* @note The value will be effective after a while, and the max value is 100ms.
* @param factor: Speed conversion factor and it has to be smaller than or equal to 1.0.
* @return Execution result.
*/
T_PsdkReturnCode PsdkXPort_SetSpeedConversionFactor(float factor);
#ifdef __cplusplus
}
#endif
#endif // PSDK_XPORT_H
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/