第一次提交

This commit is contained in:
2023-03-22 09:47:10 +08:00
commit f713586b04
633 changed files with 266330 additions and 0 deletions

View File

@ -0,0 +1,126 @@
/**
********************************************************************
* @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) 2021 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 "legacy_psdk2.x/psdk_typedef.h"
#include <dji_typedef.h>
#include <dji_aircraft_info.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief Aircraft type.
*/
typedef E_DjiAircraftType E_PsdkAircraftInfoType;
#define PSDK_AIRCRAFT_INFO_TYPE_UNKNOWN DJI_AIRCRAFT_TYPE_UNKNOWN /*!< Aircraft type is unknown. */
#define PSDK_AIRCRAFT_INFO_TYPE_M200_V2 DJI_AIRCRAFT_TYPE_M200_V2 /*!< Aircraft type is Matrice 200 V2. */
#define PSDK_AIRCRAFT_INFO_TYPE_M210_V2 DJI_AIRCRAFT_TYPE_M210_V2 /*!< Aircraft type is Matrice 220 V2. */
#define PSDK_AIRCRAFT_INFO_TYPE_M210RTK_V2 DJI_AIRCRAFT_TYPE_M210RTK_V2 /*!< Aircraft type is Matrice 210 RTK V2. */
#define PSDK_AIRCRAFT_INFO_TYPE_M300_RTK DJI_AIRCRAFT_TYPE_M300_RTK /*!< Aircraft type is Matrice 300 RTK. */
/**
* @brief PSDK adapter type.
*/
typedef E_DjiSdkAdapterType E_PsdkAircraftInfoPsdkAdapterType;
#define PSDK_AIRCRAFT_INFO_PSDK_ADAPTER_TYPE_UNKNOWN DJI_SDK_ADAPTER_TYPE_UNKNOWN /*!< PSDK adapter type is unknown. */
#define PSDK_AIRCRAFT_INFO_PSDK_ADAPTER_TYPE_SKYPORT_V2 DJI_SDK_ADAPTER_TYPE_SKYPORT_V2 /*!< PSDK adapter type is Skyport V2. */
#define PSDK_AIRCRAFT_INFO_PSDK_ADAPTER_TYPE_XPORT DJI_SDK_ADAPTER_TYPE_XPORT /*!< PSDK adapter type is X-Port. */
/**
* @brief Payload mount position.
*/
typedef E_DjiMountPosition E_PsdkAircraftInfoPayloadMountPosition;
#define PSDK_AIRCRAFT_INFO_PAYLOAD_MOUNT_POSITION_UNKNOWN DJI_MOUNT_POSITION_UNKNOWN /*!< Payload mount position is unknown.. */
#define PSDK_AIRCRAFT_INFO_PAYLOAD_MOUNT_POSITION_NO1 DJI_MOUNT_POSITION_PAYLOAD_PORT_NO1 /*!< Payload is mounted on the first gimbal connector of aircraft. */
#define PSDK_AIRCRAFT_INFO_PAYLOAD_MOUNT_POSITION_NO2 DJI_MOUNT_POSITION_PAYLOAD_PORT_NO2 /*!< Payload is mounted on the second gimbal connector of aircraft. */
#define PSDK_AIRCRAFT_INFO_PAYLOAD_MOUNT_POSITION_NO3 DJI_MOUNT_POSITION_PAYLOAD_PORT_NO3 /*!< Payload is mounted on the third gimbal connector of aircraft. */
/**
* @brief Mobile APP system language.
*/
typedef E_DjiMobileAppLanguage E_PsdkAircraftInfoMobileAppLanguage;
#define PSDK_AIRCRAFT_INFO_MOBILE_APP_LANGUAGE_UNKNOWN DJI_MOBILE_APP_LANGUAGE_UNKNOWN /*!< The system language of the mobile app is unknown */
#define PSDK_AIRCRAFT_INFO_MOBILE_APP_LANGUAGE_ENGLISH DJI_MOBILE_APP_LANGUAGE_ENGLISH /*!< The system language of the mobile app is English */
#define PSDK_AIRCRAFT_INFO_MOBILE_APP_LANGUAGE_CHINESE DJI_MOBILE_APP_LANGUAGE_CHINESE /*!< The system language of the mobile app is Chinese */
#define PSDK_AIRCRAFT_INFO_MOBILE_APP_LANGUAGE_JAPANESE DJI_MOBILE_APP_LANGUAGE_JAPANESE /*!< The system language of the mobile app is Japanese */
#define PSDK_AIRCRAFT_INFO_MOBILE_APP_LANGUAGE_FRENCH DJI_MOBILE_APP_LANGUAGE_FRENCH /*!< The system language of the mobile app is French */
/**
* @brief Mobile APP screen size type.
*/
typedef E_DjiMobileAppScreenType E_PsdkAircraftInfoMobileAppScreenType;
#define PSDK_AIRCRAFT_INFO_MOBILE_APP_SCREEN_TYPE_UNKNOWN DJI_MOBILE_APP_SCREEN_TYPE_UNKNOWN /*!< Mobile APP screen type is unknown. */
#define PSDK_AIRCRAFT_INFO_MOBILE_APP_SCREEN_TYPE_BIG_SCREEN DJI_MOBILE_APP_SCREEN_TYPE_BIG_SCREEN /*!< The big screen of mobile device refers to a screen
* size greater than or equal to 6 inches. */
#define PSDK_AIRCRAFT_INFO_MOBILE_APP_SCREEN_TYPE_LITTLE_SCREEN DJI_MOBILE_APP_SCREEN_TYPE_LITTLE_SCREEN /*!< The little screen of mobile device refers to a
* screen size less than 6 inches. */
/**
* @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 T_DjiMobileAppInfo 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,72 @@
/**
********************************************************************
* @file psdk_core.h
* @brief This is the header file for "psdk_core.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2021 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 <legacy_psdk2.x/psdk_typedef.h>
#include <dji_core.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
typedef T_DjiUserInfo 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,72 @@
/**
********************************************************************
* @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) 2021 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 "legacy_psdk2.x/psdk_typedef.h"
#include "dji_high_speed_data_channel.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief Percentage of bandwidth proportion of high-speed channel.
*/
typedef T_DjiDataChannelBandwidthProportionOfHighspeedChannel 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,434 @@
/**
********************************************************************
* @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) 2021 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 "legacy_psdk2.x/psdk_typedef.h"
#include "dji_fc_subscription.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 E_DjiFcSubscriptionTopic E_PsdkDataSubscriptionTopicName;
/*!
* @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 |
*/
#define PSDK_DATA_SUBSCRIPTION_TOPIC_QUATERNION DJI_FC_SUBSCRIPTION_TOPIC_QUATERNION
/*!
* @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 |
*/
#define PSDK_DATA_SUBSCRIPTION_TOPIC_VELOCITY DJI_FC_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.
*/
#define PSDK_DATA_SUBSCRIPTION_TOPIC_ALTITUDE_FUSED DJI_FC_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.
*/
#define PSDK_DATA_SUBSCRIPTION_TOPIC_HEIGHT_RELATIVE DJI_FC_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 |
*/
#define PSDK_DATA_SUBSCRIPTION_TOPIC_POSITION_FUSED DJI_FC_SUBSCRIPTION_TOPIC_POSITION_FUSED
/*!
* @brief GPS date topic name. Please refer to ::T_PsdkDataSubscriptionGpsDate for information about data structure.
*/
#define PSDK_DATA_SUBSCRIPTION_TOPIC_GPS_DATE DJI_FC_SUBSCRIPTION_TOPIC_GPS_DATE
/*!
* @brief GPS time topic name. Please refer to ::T_PsdkDataSubscriptionGpsTime for information about data structure.
*/
#define PSDK_DATA_SUBSCRIPTION_TOPIC_GPS_TIME DJI_FC_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 |
*/
#define PSDK_DATA_SUBSCRIPTION_TOPIC_GPS_POSITION DJI_FC_SUBSCRIPTION_TOPIC_GPS_POSITION
/*!
* @brief GPS velocity topic name. Please refer to ::T_PsdkDataSubscriptionGpsVelocity for information about data structure.
*/
#define PSDK_DATA_SUBSCRIPTION_TOPIC_GPS_VELOCITY DJI_FC_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.
*/
#define PSDK_DATA_SUBSCRIPTION_TOPIC_GPS_DETAILS DJI_FC_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.
*/
#define PSDK_DATA_SUBSCRIPTION_TOPIC_GPS_SIGNAL_LEVEL DJI_FC_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 |
*/
#define PSDK_DATA_SUBSCRIPTION_TOPIC_RTK_POSITION DJI_FC_SUBSCRIPTION_TOPIC_RTK_POSITION
/*!
* @brief RTK velocity topic name. Please refer to ::T_PsdkDataSubscriptionRtkVelocity for information about data structure.
*/
#define PSDK_DATA_SUBSCRIPTION_TOPIC_RTK_VELOCITY DJI_FC_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.
*/
#define PSDK_DATA_SUBSCRIPTION_TOPIC_RTK_YAW DJI_FC_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.
*/
#define PSDK_DATA_SUBSCRIPTION_TOPIC_RTK_POSITION_INFO DJI_FC_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.
*/
#define PSDK_DATA_SUBSCRIPTION_TOPIC_RTK_YAW_INFO DJI_FC_SUBSCRIPTION_TOPIC_RTK_YAW_INFO
/*!
* @brief Flight status topic name. Please refer to ::T_PsdkDataSubscriptionFlightStatus for information about data structure.
*/
#define PSDK_DATA_SUBSCRIPTION_TOPIC_STATUS_FLIGHT DJI_FC_SUBSCRIPTION_TOPIC_STATUS_FLIGHT
/*!
* @brief Battery information topic name. Please refer to ::T_PsdkDataSubscriptionBatteryInfo for information about data structure.
*/
#define PSDK_DATA_SUBSCRIPTION_TOPIC_BATTERY_INFO DJI_FC_SUBSCRIPTION_TOPIC_BATTERY_INFO
/*! Total number of topics that can be subscribed. */
#define PSDK_DATA_SUBSCRIPTION_TOPIC_TOTAL_NUMBER DJI_FC_SUBSCRIPTION_TOPIC_TOTAL_NUMBER
/**
* @brief Health state of data subscribed.
*/
typedef E_DjiFcSubscriptionDataHealthFlag E_PsdkDataSubscriptionDataHealthFlag;
#define PSDK_DATA_SUBSCRIPTION_DATA_NOT_HEALTH DJI_FC_SUBSCRIPTION_DATA_NOT_HEALTH /*!< Data subscribed is healthy and can be used. */
#define PSDK_DATA_SUBSCRIPTION_DATA_HEALTH DJI_FC_SUBSCRIPTION_DATA_HEALTH /*!< Data subscribed is not healthy and recommend not to use it. */
/**
* @brief Position solution property.
*/
typedef E_DjiFcSubscriptionPositionSolutionProperty E_PsdkDataSubscriptionPositionSolutionProperty;
#define PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_NOT_AVAILABLE DJI_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_NOT_AVAILABLE /*!< Position solution is not available. */
#define PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_FIX_POSITION DJI_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_FIX_POSITION /*!< Position has been fixed by the FIX POSITION command. */
#define PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_FIX_HEIGHT_AUTO DJI_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_FIX_HEIGHT_AUTO /*!< Position has been fixed by the FIX HEIGHT/AUTO command. */
#define PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_INSTANTANEOUS_DOPPLER_COMPUTE_VELOCITY DJI_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_INSTANTANEOUS_DOPPLER_COMPUTE_VELOCITY /*!< Velocity computed using instantaneous Doppler. */
#define PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_SINGLE_PNT_SOLUTION DJI_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_SINGLE_PNT_SOLUTION /*!< Single point position solution. */
#define PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_PSEUDORANGE_DIFFERENTIAL_SOLUTION DJI_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_PSEUDORANGE_DIFFERENTIAL_SOLUTION /*!< Pseudorange differential solution. */
#define PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_SBAS_CORRECTION_CALCULATED DJI_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_SBAS_CORRECTION_CALCULATED /*!< Solution calculated using corrections from an SBAS. */
#define PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_KALMAN_FILTER_WITHOUT_OBSERVATION_PROPAGATED DJI_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_KALMAN_FILTER_WITHOUT_OBSERVATION_PROPAGATED /*!< Propagated by a Kalman filter without new observations. */
#define PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_OMNISTAR_VBS_POSITION DJI_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_OMNISTAR_VBS_POSITION /*!< OmniSTAR VBS position (L1 sub-metre). */
#define PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_FLOAT_L1_AMBIGUITY DJI_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_FLOAT_L1_AMBIGUITY /*!< Floating L1 ambiguity solution. */
#define PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_FLOAT_IONOSPHERIC_FREE_AMBIGUITY DJI_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_FLOAT_IONOSPHERIC_FREE_AMBIGUITY /*!< Floating ionospheric-free ambiguity solution. */
#define PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_FLOAT_SOLUTION DJI_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_FLOAT_SOLUTION /*!< Float position solution. */
#define PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_L1_AMBIGUITY_INT DJI_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_L1_AMBIGUITY_INT /*!< Integer L1 ambiguity solution. */
#define PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_WIDE_LANE_AMBIGUITY_INT DJI_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_WIDE_LANE_AMBIGUITY_INT /*!< Integer wide-lane ambiguity solution. */
#define PSDK_DATA_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_NARROW_INT DJI_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_NARROW_INT /*!< Narrow fixed point position solution. */
/**
* @brief GPS fix state.
*/
typedef E_DjiFcSubscriptionGpsFixState E_PsdkDataSubscriptionGpsFixState;
#define PSDK_DATA_SUBSCRIPTION_GPS_FIX_STATE_NO_FIX DJI_FC_SUBSCRIPTION_GPS_FIX_STATE_NO_FIX /*!< GPS position has not been fixed. */
#define PSDK_DATA_SUBSCRIPTION_GPS_FIX_STATE_DEAD_RECKONING_ONLY DJI_FC_SUBSCRIPTION_GPS_FIX_STATE_DEAD_RECKONING_ONLY /*!< GPS position is dead reckoned only. */
#define PSDK_DATA_SUBSCRIPTION_GPS_FIX_STATE_2D_FIX DJI_FC_SUBSCRIPTION_GPS_FIX_STATE_2D_FIX /*!< The horizontal position with latitude/longitude (or northing/easting or X/Y) is fixed. */
#define PSDK_DATA_SUBSCRIPTION_GPS_FIX_STATE_3D_FIX DJI_FC_SUBSCRIPTION_GPS_FIX_STATE_3D_FIX /*!< The horizontal and vertical position with latitude/longitude/altitude (northing/easting/altitude or X/Y/Z) is fixed. */
#define PSDK_DATA_SUBSCRIPTION_GPS_FIX_STATE_GPS_PLUS_DEAD_RECKONING DJI_FC_SUBSCRIPTION_GPS_FIX_STATE_GPS_PLUS_DEAD_RECKONING /*!< Position is calculated by GPS and combined with dead reckoning. */
#define PSDK_DATA_SUBSCRIPTION_GPS_FIX_STATE_TIME_ONLY_FIX DJI_FC_SUBSCRIPTION_GPS_FIX_STATE_TIME_ONLY_FIX /*!< Only time is fixed. */
/**
* @brief Flight status of aircraft.
*/
typedef E_DjiFcSubscriptionFlightStatus E_PsdkDataSubscriptionFlightStatus;
#define PSDK_DATA_SUBSCRIPTION_FLIGHT_STATUS_STOPED DJI_FC_SUBSCRIPTION_FLIGHT_STATUS_STOPED /*!< Aircraft is on ground and motors are still. */
#define PSDK_DATA_SUBSCRIPTION_FLIGHT_STATUS_ON_GROUND DJI_FC_SUBSCRIPTION_FLIGHT_STATUS_ON_GROUND/*!< Aircraft is on ground but motors are rotating. */
#define PSDK_DATA_SUBSCRIPTION_FLIGHT_STATUS_IN_AIR DJI_FC_SUBSCRIPTION_FLIGHT_STATUS_IN_AIR /*!< Aircraft is in air. */
#pragma pack(1)
/**
* @brief Timestamp data structure.
*/
typedef T_DjiDataTimestamp T_PsdkDataSubscriptiontTimestamp;
/**
* @brief Quaternion topic data structure.
*/
typedef T_DjiFcSubscriptionQuaternion T_PsdkDataSubscriptionQuaternion;
/**
* @brief Velocity topic data structure.
*/
typedef T_DjiFcSubscriptionVelocity T_PsdkDataSubscriptionVelocity;
/**
* @brief Fused altitude topic data structure, unit: m.
*/
typedef T_DjiFcSubscriptionAltitudeFused T_PsdkDataSubscriptionAltitudeFused;
/**
* @brief Relative height above ground topic data structure, unit: m.
*/
typedef T_DjiFcSubscriptionHeightRelative T_PsdkDataSubscriptionHeightRelative;
/**
* @brief Fused position topic data structure.
*/
typedef T_DjiFcSubscriptionPositionFused T_PsdkDataSubscriptionPositionFused;
/**
* @brief GPS date topic data structure, format: yyyymmdd.
*/
typedef T_DjiFcSubscriptionGpsDate T_PsdkDataSubscriptionGpsDate;
/**
* @brief GPS time topic data structure, format: hhmmss.
*/
typedef T_DjiFcSubscriptionGpsTime 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_DjiFcSubscriptionGpsPosition T_PsdkDataSubscriptionGpsPosition;
/**
* @brief GPS velocity topic data structure, unit: cm/s.
*/
typedef T_DjiFcSubscriptionGpsVelocity T_PsdkDataSubscriptionGpsVelocity;
/**
* @brief GPS details topic data structure.
*/
typedef T_DjiFcSubscriptionGpsDetails 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 T_DjiFcSubscriptionGpsSignalLevel T_PsdkDataSubscriptionGpsSignalLevel;
/**
* @brief RTK position topic data structure.
*/
typedef T_DjiFcSubscriptionRtkPosition T_PsdkDataSubscriptionRtkPosition;
/**
* @brief RTK velocity topic data structure, unit: cm/s.
*/
typedef T_DjiFcSubscriptionRtkVelocity T_PsdkDataSubscriptionRtkVelocity;
/**
* @brief RTK yaw topic data structure, unit: deg.
*/
typedef T_DjiFcSubscriptionRtkYaw T_PsdkDataSubscriptionRtkYaw;
/**
* @brief RTK position information topic data structure. Specifies RTK position solution state, it can be any value of
* ::E_PsdkDataSubscriptionPositionSolutionProperty.
*/
typedef T_DjiFcSubscriptionRtkPositionInfo T_PsdkDataSubscriptionRtkPositionInfo;
/**
* @brief RTK yaw information topic data structure. Specifies RTK yaw solution state, it can be any value of
* ::E_PsdkDataSubscriptionPositionSolutionProperty.
*/
typedef T_DjiFcSubscriptionRtkYawInfo T_PsdkDataSubscriptionRtkYawInfo;
/**
* @brief Flight status information topic data structure. It can be any value of ::E_PsdkDataSubscriptionFlightStatus.
*/
typedef T_DjiFcSubscriptionFlightStatus T_PsdkDataSubscriptionFlightStatus;
/**
* @brief Battery information topic data structure.
*/
typedef T_DjiFcSubscriptionWholeBatteryInfo 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 DjiReceiveDataOfTopicCallback ReceiveDataOfTopicCallback;
/* 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,222 @@
/**
********************************************************************
* @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) 2021 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 "legacy_psdk2.x/psdk_typedef.h"
#include "dji_low_speed_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 DjiLowSpeedDataChannelRecvDataCallback ReceiveDataFromMobileCallback;
/**
* @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 DjiLowSpeedDataChannelRecvDataCallback ReceiveDataFromOsdkCallback;
/* 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);
/**
* @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);
/**
* @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);
/**
* @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);
#ifdef __cplusplus
}
#endif
#endif // PSDK_DATA_TRANSMISSION_H
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/

View File

@ -0,0 +1,208 @@
/**
********************************************************************
* @file psdk_error.h
* @brief This is the header file for "psdk_error.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2021 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>
#include "dji_error.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
#define PSDK_ERROR_MODULE_INDEX_OFFSET DJI_ERROR_MODULE_INDEX_OFFSET
#define PSDK_ERROR_MODULE_INDEX_MASK DJI_ERROR_MODULE_INDEX_MASK
#define PSDK_ERROR_RAW_CODE_OFFSET DJI_ERROR_RAW_CODE_OFFSET
#define PSDK_ERROR_RAW_CODE_MASK DJI_ERROR_RAW_CODE_MASK
#define PSDK_ERROR_CODE(moduleIndex, rawErrCode) DJI_ERROR_CODE(moduleIndex, rawErrCode)
/**
* @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 DJI_ERROR_OBJECTS
#define PSDK_RETURN_CODE_OK DJI_RETURN_CODE_OK /*!< Payload SDK return code represents as status is ok. */
#define PSDK_RETURN_CODE_ERR_ALLOC DJI_RETURN_CODE_ERR_ALLOC /*!< Payload SDK return code represents as status alloc error. */
#define PSDK_RETURN_CODE_ERR_TIMEOUT DJI_RETURN_CODE_ERR_TIMEOUT /*!< Payload SDK return code represents as status timeout error. */
#define PSDK_RETURN_CODE_ERR_NOT_FOUND DJI_RETURN_CODE_ERR_NOT_FOUND /*!< Payload SDK return code represents as status not found error. */
#define PSDK_RETURN_CODE_ERR_OUT_OF_RANGE DJI_RETURN_CODE_ERR_OUT_OF_RANGE /*!< Payload SDK return code represents as status out of range error. */
#define PSDK_RETURN_CODE_ERR_PARAM DJI_RETURN_CODE_ERR_PARAM /*!< Payload SDK return code represents as status parameter error. */
#define PSDK_RETURN_CODE_ERR_SYSTEM DJI_RETURN_CODE_ERR_SYSTEM /*!< Payload SDK return code represents as status system error. */
#define PSDK_RETURN_CODE_ERR_BUSY DJI_RETURN_CODE_ERR_BUSY /*!< Payload SDK return code represents as status busy error. */
#define PSDK_RETURN_CODE_ERR_UNSUPPORT DJI_RETURN_CODE_ERR_UNSUPPORT /*!< Payload SDK return code represents as status nonsupport error. */
#define PSDK_RETURN_CODE_ERR_UNKNOWN DJI_RETURN_CODE_ERR_UNKNOWN /*!< Payload SDK return code represents as status unknown error. */
/* Exported types ------------------------------------------------------------*/
/**
* @brief PSDK module enum for defining error code.
*/
typedef E_DjiErrorModule E_PsdkErrorModule;
#define PSDK_ERROR_MODULE_SYSTEM DJI_ERROR_MODULE_SYSTEM
#define PSDK_ERROR_MODULE_PLATFORM DJI_ERROR_MODULE_PLATFORM
#define PSDK_ERROR_MODULE_LOGGER DJI_ERROR_MODULE_LOGGER
#define PSDK_ERROR_MODULE_TIME_SYNC DJI_ERROR_MODULE_TIME_SYNC
#define PSDK_ERROR_MODULE_COMMAND DJI_ERROR_MODULE_COMMAND
#define PSDK_ERROR_MODULE_CAMERA DJI_ERROR_MODULE_CAMERA
#define PSDK_ERROR_MODULE_GIMBAL DJI_ERROR_MODULE_GIMBAL
#define PSDK_ERROR_MODULE_XPORT DJI_ERROR_MODULE_XPORT
#define PSDK_ERROR_MODULE_PAYLOAD_COLLABORATION DJI_ERROR_MODULE_PAYLOAD_COLLABORATION
#define PSDK_ERROR_MODULE_WIDGET DJI_ERROR_MODULE_WIDGET
#define PSDK_ERROR_MODULE_CORE DJI_ERROR_MODULE_CORE
#define PSDK_ERROR_MODULE_IDENTITY DJI_ERROR_MODULE_IDENTITY
#define PSDK_ERROR_MODULE_TRANSMISSION DJI_ERROR_MODULE_TRANSMISSION
#define PSDK_ERROR_MODULE_DATA_CHANNEL DJI_ERROR_MODULE_DATA_CHANNEL
#define PSDK_ERROR_MODULE_SUBSCRIPTION DJI_ERROR_MODULE_SUBSCRIPTION
#define PSDK_ERROR_MODULE_MOP_CHANNEL DJI_ERROR_MODULE_MOP_CHANNEL
#define PSDK_ERROR_MODULE_POSITIONING DJI_ERROR_MODULE_POSITIONING
#define PSDK_ERROR_MODULE_POWER_MANAGEMENT DJI_ERROR_MODULE_POWER_MANAGEMENT
#define PSDK_ERROR_MODULE_AIRCRAFTINFO DJI_ERROR_MODULE_AIRCRAFTINFO
#define PSDK_ERROR_MODULE_PRODUCTINFO DJI_ERROR_MODULE_PRODUCTINFO
#define PSDK_ERROR_MODULE_FLOWCONTROLLER DJI_ERROR_MODULE_FLOWCONTROLLER
#define PSDK_ERROR_MODULE_DOWNLOADER DJI_ERROR_MODULE_DOWNLOADER
#define PSDK_ERROR_MODULE_PARAMETER DJI_ERROR_MODULE_PARAMETER
#define PSDK_ERROR_MODULE_UTIL DJI_ERROR_MODULE_UTIL
#define PSDK_ERROR_MODULE_USER DJI_ERROR_MODULE_USER
#define PSDK_ERROR_MODULE_NEGOTIATE DJI_ERROR_MODULE_NEGOTIATE
#define PSDK_ERROR_MODULE_UPGRADE DJI_ERROR_MODULE_UPGRADE
#define PSDK_ERROR_MODULE_ERROR DJI_ERROR_MODULE_ERROR
/**
* @brief Raw error code of system module.
*/
typedef E_DjiErrorSystemModuleRawCode E_PsdkErrorSystemModuleRawCode;
#define PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_SUCCESS DJI_ERROR_SYSTEM_MODULE_RAW_CODE_SUCCESS
#define PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_INVALID_REQUEST_PARAMETER DJI_ERROR_SYSTEM_MODULE_RAW_CODE_INVALID_REQUEST_PARAMETER
#define PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_EXECUTING_HIGHER_PRIORITY_TASK DJI_ERROR_SYSTEM_MODULE_RAW_CODE_EXECUTING_HIGHER_PRIORITY_TASK
#define PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_NONSUPPORT DJI_ERROR_SYSTEM_MODULE_RAW_CODE_NONSUPPORT
#define PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_TIMEOUT DJI_ERROR_SYSTEM_MODULE_RAW_CODE_TIMEOUT
#define PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_MEMORY_ALLOC_FAILED DJI_ERROR_SYSTEM_MODULE_RAW_CODE_MEMORY_ALLOC_FAILED
#define PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_INVALID_PARAMETER DJI_ERROR_SYSTEM_MODULE_RAW_CODE_INVALID_PARAMETER
#define PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_NONSUPPORT_IN_CURRENT_STATE DJI_ERROR_SYSTEM_MODULE_RAW_CODE_NONSUPPORT_IN_CURRENT_STATE
#define PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_SYSTEM_ERROR DJI_ERROR_SYSTEM_MODULE_RAW_CODE_SYSTEM_ERROR
#define PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_HARDWARE_ERR DJI_ERROR_SYSTEM_MODULE_RAW_CODE_HARDWARE_ERR
#define PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_INSUFFICIENT_ELECTRICITY DJI_ERROR_SYSTEM_MODULE_RAW_CODE_INSUFFICIENT_ELECTRICITY
#define PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_UNKNOWN DJI_ERROR_SYSTEM_MODULE_RAW_CODE_UNKNOWN
#define PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_NOT_FOUND DJI_ERROR_SYSTEM_MODULE_RAW_CODE_NOT_FOUND
#define PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_OUT_OF_RANGE DJI_ERROR_SYSTEM_MODULE_RAW_CODE_OUT_OF_RANGE
#define PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_BUSY DJI_ERROR_SYSTEM_MODULE_RAW_CODE_BUSY
#define PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_DUPLICATE DJI_ERROR_SYSTEM_MODULE_RAW_CODE_DUPLICATE
#define PSDK_ERROR_SYSTEM_MODULE_RAW_CODE_ADAPTER_NOT_MATCH DJI_ERROR_SYSTEM_MODULE_RAW_CODE_ADAPTER_NOT_MATCH
/**
* @brief Raw error code of gimbal module.
*/
typedef E_DjiErrorGimbalModuleRawCode E_PsdkErrorGimbalModuleRawCode;
#define PSDK_ERROR_GIMBAL_MODULE_RAW_CODE_PITCH_REACH_POSITIVE_LIMIT DJI_ERROR_GIMBAL_MODULE_RAW_CODE_PITCH_REACH_POSITIVE_LIMIT
#define PSDK_ERROR_GIMBAL_MODULE_RAW_CODE_PITCH_REACH_NEGATIVE_LIMIT DJI_ERROR_GIMBAL_MODULE_RAW_CODE_PITCH_REACH_NEGATIVE_LIMIT
#define PSDK_ERROR_GIMBAL_MODULE_RAW_CODE_ROLL_REACH_POSITIVE_LIMIT DJI_ERROR_GIMBAL_MODULE_RAW_CODE_ROLL_REACH_POSITIVE_LIMIT
#define PSDK_ERROR_GIMBAL_MODULE_RAW_CODE_ROLL_REACH_NEGATIVE_LIMIT DJI_ERROR_GIMBAL_MODULE_RAW_CODE_ROLL_REACH_NEGATIVE_LIMIT
#define PSDK_ERROR_GIMBAL_MODULE_RAW_CODE_YAW_REACH_POSITIVE_LIMIT DJI_ERROR_GIMBAL_MODULE_RAW_CODE_YAW_REACH_POSITIVE_LIMIT
#define PSDK_ERROR_GIMBAL_MODULE_RAW_CODE_YAW_REACH_NEGATIVE_LIMIT DJI_ERROR_GIMBAL_MODULE_RAW_CODE_YAW_REACH_NEGATIVE_LIMIT
#define PSDK_ERROR_GIMBAL_MODULE_RAW_CODE_NON_CONTROL_AUTHORITY DJI_ERROR_GIMBAL_MODULE_RAW_CODE_NON_CONTROL_AUTHORITY
/**
* @brief Raw error code of payload collaboration module.
*/
typedef E_DjiErrorPayloadCollaborationModuleRawCode E_PsdkErrorPayloadCollaborationModuleRawCode;
#define PSDK_ERROR_PAYLOAD_COLLABORATION_MODULE_RAW_CODE_POSITION_NOT_MATCH DJI_ERROR_PAYLOAD_COLLABORATION_MODULE_RAW_CODE_POSITION_NOT_MATCH
/**
* @brief Raw error code of subscription module.
*/
typedef E_DjiErrorSubscriptionModuleRawCode E_PsdkErrorSubscriptionModuleRawCode;
#define PSDK_ERROR_SUBSCRIPTION_MODULE_RAW_CODE_INVALID_TOPIC_FREQ DJI_ERROR_SUBSCRIPTION_MODULE_RAW_CODE_INVALID_TOPIC_FREQ
#define PSDK_ERROR_SUBSCRIPTION_MODULE_RAW_CODE_TOPIC_DUPLICATE DJI_ERROR_SUBSCRIPTION_MODULE_RAW_CODE_TOPIC_DUPLICATE
#define PSDK_ERROR_SUBSCRIPTION_MODULE_RAW_CODE_TOPIC_NOT_SUBSCRIBED DJI_ERROR_SUBSCRIPTION_MODULE_RAW_CODE_TOPIC_NOT_SUBSCRIBED
#define PSDK_ERROR_SUBSCRIPTION_MODULE_RAW_CODE_TIMESTAMP_NOT_ENABLE DJI_ERROR_SUBSCRIPTION_MODULE_RAW_CODE_TIMESTAMP_NOT_ENABLE
/**
* @brief Raw error code of mop channel module.
*/
typedef E_DjiErrorMopChannelModuleRawCode E_PsdkErrorMopChannelModuleRawCode;
#define PSDK_ERROR_MOP_CHANNEL_MODULE_RAW_CODE_CONNECTION_CLOSE DJI_ERROR_MOP_CHANNEL_MODULE_RAW_CODE_CONNECTION_CLOSE
//@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,166 @@
/**
********************************************************************
* @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) 2021 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 "legacy_psdk2.x/psdk_typedef.h"
#include "dji_gimbal.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief Gimbal work mode, specifies how gimbal follow aircraft movement.
*/
typedef E_DjiGimbalMode E_PsdkGimbalMode;
/*!< Free mode, fix gimbal attitude in the ground coordinate, ignoring movement of aircraft. */
#define PSDK_GIMBAL_MODE_FREE DJI_GIMBAL_MODE_FREE
/*!< FPV (First Person View) mode, only control roll and yaw angle of gimbal in the ground coordinate to follow aircraft. */
#define PSDK_GIMBAL_MODE_FPV DJI_GIMBAL_MODE_FPV
/*!< Yaw follow mode, only control yaw angle of gimbal in the ground coordinate to follow aircraft. */
#define PSDK_GIMBAL_MODE_YAW_FOLLOW DJI_GIMBAL_MODE_YAW_FOLLOW
/**
* @brief Gimbal calibration stage and result.
*/
typedef E_DjiGimbalCalibrationStage E_PsdkGimbalCalibrationStage;
/*!< Calibration have been completed and the result is successful. */
#define PSDK_GIMBAL_CALIBRATION_STAGE_COMPLETE DJI_GIMBAL_CALIBRATION_STAGE_COMPLETE
/*!< Gimbal is calibrating. */
#define PSDK_GIMBAL_CALIBRATION_STAGE_PROCRESSING DJI_GIMBAL_CALIBRATION_STAGE_PROCRESSING
/*!< Calibration have been completed and the result is failure. */
#define PSDK_GIMBAL_CALIBRATION_STAGE_FAILED DJI_GIMBAL_CALIBRATION_STAGE_FAILED
/**
* @brief Gimbal rotation mode, specifies control style.
*/
typedef E_DjiGimbalRotationMode E_PsdkGimbalRotationMode;
#define PSDK_GIMBAL_ROTATION_MODE_RELATIVE_ANGLE DJI_GIMBAL_ROTATION_MODE_RELATIVE_ANGLE /*!< Relative angle rotation mode, represents rotating gimbal specified angles based on current angles. */
#define PSDK_GIMBAL_ROTATION_MODE_ABSOLUTE_ANGLE DJI_GIMBAL_ROTATION_MODE_ABSOLUTE_ANGLE /*!< Absolute angle rotation mode, represents rotating gimbal to specified angles in the ground coordinate. */
#define PSDK_GIMBAL_ROTATION_MODE_SPEED DJI_GIMBAL_ROTATION_MODE_SPEED /*!< Speed rotation mode, specifies rotation speed of gimbal in the ground coordinate. */
/**
* @brief Axis of gimbal.
*/
typedef E_DjiGimbalAxis E_PsdkGimbalAxis;
#define PSDK_GIMBAL_AXIS_PITCH DJI_GIMBAL_AXIS_PITCH /*!< Pitch axis. */
#define PSDK_GIMBAL_AXIS_ROLL DJI_GIMBAL_AXIS_ROLL /*!< Roll axis. */
#define PSDK_GIMBAL_AXIS_YAW DJI_GIMBAL_AXIS_YAW /*!< Yaw axis. */
/**
* @brief Reset mode of gimbal.
*/
typedef E_DjiGimbalResetMode E_PsdkGimbalResetMode;
/*! 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. */
#define PSDK_GIMBAL_RESET_MODE_YAW DJI_GIMBAL_RESET_MODE_YAW
/*! 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. */
#define PSDK_GIMBAL_RESET_MODE_PITCH_AND_YAW DJI_GIMBAL_RESET_MODE_PITCH_AND_YAW
/*! 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. */
#define PSDK_GIMBAL_RESET_MODE_PITCH_DOWNWARD_UPWARD_AND_YAW DJI_GIMBAL_RESET_MODE_PITCH_DOWNWARD_UPWARD_AND_YAW
/*! 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. */
#define PSDK_GIMBAL_RESET_MODE_PITCH_DOWNWARD_UPWARD DJI_GIMBAL_RESET_MODE_PITCH_DOWNWARD_UPWARD
/**
* @brief Smooth factor of gimbal controller.
*/
typedef T_DjiGimbalControllerSmoothFactor T_PsdkGimbalControllerSmoothFactor;
/**
* @brief Max speed percentage of every axis of gimbal.
*/
typedef T_DjiGimbalControllerMaxSpeedPercentage T_PsdkGimbalControllerMaxSpeedPercentage;
/**
* @brief Data structure describes gimbal system state.
*/
typedef T_DjiGimbalSystemState T_PsdkGimbalSystemState;
/**
* @brief Reach limit flag.
*/
typedef T_DjiGimbalReachLimitFlag T_PsdkGimbalReachLimitFlag;
/**
* @brief Gimbal attitude related information.
*/
typedef T_DjiGimbalAttitudeInformation T_PsdkGimbalAttitudeInformation;
/**
* @brief Gimbal calibration state.
*/
typedef T_DjiGimbalCalibrationState T_PsdkGimbalCalibrationState;
/**
* @brief Gimbal rotation command property.
*/
typedef T_DjiGimbalRotationProperty 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 T_DjiGimbalCommonHandler 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,113 @@
/**
********************************************************************
* @file psdk_logger.h
* @brief This is the header file for "psdk_logger.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2021 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 "legacy_psdk2.x/psdk_typedef.h"
#include "dji_logger.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
typedef E_DjiLoggerConsoleLogLevel E_PsdkLoggerConsoleLogLevel;
/*!< 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. */
#define PSDK_LOGGER_CONSOLE_LOG_LEVEL_ERROR DJI_LOGGER_CONSOLE_LOG_LEVEL_ERROR
/*!< 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. */
#define PSDK_LOGGER_CONSOLE_LOG_LEVEL_WARNING DJI_LOGGER_CONSOLE_LOG_LEVEL_WARNING
/*!< 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. */
#define PSDK_LOGGER_CONSOLE_LOG_LEVEL_INFO DJI_LOGGER_CONSOLE_LOG_LEVEL_INFO
/*!< 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. */
#define PSDK_LOGGER_CONSOLE_LOG_LEVEL_DEBUG DJI_LOGGER_CONSOLE_LOG_LEVEL_DEBUG
typedef T_DjiLoggerConsole 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,150 @@
/**
********************************************************************
* @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) 2021 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 "legacy_psdk2.x/psdk_typedef.h"
#include "dji_mop_channel.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief Mop channel handle.
*/
typedef T_DjiMopChannelHandle T_PsdkMopChannelHandle;
/**
* @brief Mop channel transmission type.
*/
typedef E_DjiMopChannelTransType E_PsdkMopChannelTransType;
#define PSDK_MOP_CHANNEL_TRANS_RELIABLE DJI_MOP_CHANNEL_TRANS_RELIABLE
#define PSDK_MOP_CHANNEL_TRANS_UNRELIABLE DJI_MOP_CHANNEL_TRANS_UNRELIABLE
/* 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 // PSDK_MOP_CHANNEL_H
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/

View File

@ -0,0 +1,421 @@
/**
********************************************************************
* @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) 2021 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 "legacy_psdk2.x/psdk_typedef.h"
#include "dji_payload_camera.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief Camera work mode.
*/
typedef E_DjiCameraMode E_PsdkCameraMode;
#define PSDK_CAMERA_MODE_SHOOT_PHOTO DJI_CAMERA_MODE_SHOOT_PHOTO /*!< Shoot photo work mode. */
#define PSDK_CAMERA_MODE_RECORD_VIDEO DJI_CAMERA_MODE_RECORD_VIDEO/*!< Record video work mode. */
#define PSDK_CAMERA_MODE_PLAYBACK DJI_CAMERA_MODE_PLAYBACK /*!< Media playback work mode. */
/**
* @brief Camera shoot photo mode.
*/
typedef E_DjiCameraShootPhotoMode E_PsdkCameraShootPhotoMode;
#define PSDK_CAMERA_SHOOT_PHOTO_MODE_SINGLE DJI_CAMERA_SHOOT_PHOTO_MODE_SINGLE /*!< Single photographing mode. */
#define PSDK_CAMERA_SHOOT_PHOTO_MODE_BURST DJI_CAMERA_SHOOT_PHOTO_MODE_BURST/*!< Burst photographing mode. */
#define PSDK_CAMERA_SHOOT_PHOTO_MODE_INTERVAL DJI_CAMERA_SHOOT_PHOTO_MODE_INTERVAL/*!< Interval photographing mode. */
/**
* @brief Camera shooting state when photographing.
*/
typedef E_DjiCameraShootingState E_PsdkCameraShootingState;
#define PSDK_CAMERA_SHOOTING_PHOTO_IDLE DJI_CAMERA_SHOOTING_PHOTO_IDLE /*!< Photographing in idle state. */
#define PSDK_CAMERA_SHOOTING_SINGLE_PHOTO DJI_CAMERA_SHOOTING_SINGLE_PHOTO /*!< Photographing in single photograph state . */
#define PSDK_CAMERA_SHOOTING_BURST_PHOTO DJI_CAMERA_SHOOTING_BURST_PHOTO /*!< Photographing in burst photograph state. */
#define PSDK_CAMERA_SHOOTING_INTERVAL_PHOTO DJI_CAMERA_SHOOTING_INTERVAL_PHOTO /*!< Photographing in interval photograph state. */
/**
* @brief Camera burst count setting when photographing.
*/
typedef E_DjiCameraBurstCount E_PsdkCameraBurstCount;
#define PSDK_CAMERA_BURST_COUNT_2 DJI_CAMERA_BURST_COUNT_2 /*!< Photo number of burst photographing: 2. */
#define PSDK_CAMERA_BURST_COUNT_3 DJI_CAMERA_BURST_COUNT_3 /*!< Photo number of burst photographing: 3. */
#define PSDK_CAMERA_BURST_COUNT_5 DJI_CAMERA_BURST_COUNT_5 /*!< Photo number of burst photographing: 5. */
#define PSDK_CAMERA_BURST_COUNT_7 DJI_CAMERA_BURST_COUNT_7/*!< Photo number of burst photographing: 7. */
#define PSDK_CAMERA_BURST_COUNT_10 DJI_CAMERA_BURST_COUNT_10 /*!< Photo number of burst photographing: 10. */
#define PSDK_CAMERA_BURST_COUNT_14 DJI_CAMERA_BURST_COUNT_14 /*!< Photo number of burst photographing: 14. */
/**
* @brief Camera metering mode.
*/
typedef E_DjiCameraMeteringMode E_PsdkCameraMeteringMode;
#define PSDK_CAMERA_METERING_MODE_CENTER DJI_CAMERA_METERING_MODE_CENTER /*!< Center metering mode. */
#define PSDK_CAMERA_METERING_MODE_AVERAGE DJI_CAMERA_METERING_MODE_AVERAGE /*!< Average metering mode. */
#define PSDK_CAMERA_METERING_MODE_SPOT DJI_CAMERA_METERING_MODE_SPOT /*!< Spot metering mode. */
/**
* @brief Camera focus mode.
*/
typedef E_DjiCameraFocusMode E_PsdkCameraFocusMode;
#define PSDK_CAMERA_FOCUS_MODE_MANUAL DJI_CAMERA_FOCUS_MODE_MANUAL /*!< Manual focus mode. */
#define PSDK_CAMERA_FOCUS_MODE_AUTO DJI_CAMERA_FOCUS_MODE_AUTO /*!< Auto focus mode. */
/**
* @brief Camera zoom direction.
*/
typedef E_DjiCameraZoomDirection E_PsdkCameraZoomDirection;
#define PSDK_CAMERA_ZOOM_DIRECTION_OUT DJI_CAMERA_ZOOM_DIRECTION_OUT /*!< The lens moves in the far direction, the zoom factor becomes smaller. */
#define PSDK_CAMERA_ZOOM_DIRECTION_IN DJI_CAMERA_ZOOM_DIRECTION_IN /*!< The lens moves in the near direction, the zoom factor becomes larger. */
/**
* @brief Camera zoom speed.
*/
typedef E_DjiCameraZoomSpeed E_PsdkCameraZoomSpeed;
#define PSDK_CAMERA_ZOOM_SPEED_SLOWEST DJI_CAMERA_ZOOM_SPEED_SLOWEST/*!< Lens zooms in slowest speed. */
#define PSDK_CAMERA_ZOOM_SPEED_SLOW DJI_CAMERA_ZOOM_SPEED_SLOW /*!< Lens zooms in slow speed. */
#define PSDK_CAMERA_ZOOM_SPEED_MODERATELY_SLOW DJI_CAMERA_ZOOM_SPEED_MODERATELY_SLOW /*!< Lens zooms in speed slightly slower than normal speed. */
#define PSDK_CAMERA_ZOOM_SPEED_NORMAL DJI_CAMERA_ZOOM_SPEED_NORMAL /*!< Lens zooms in normal speed. */
#define PSDK_CAMERA_ZOOM_SPEED_MODERATELY_FAST DJI_CAMERA_ZOOM_SPEED_MODERATELY_FAST /*!< Lens zooms very in speed slightly faster than normal speed. */
#define PSDK_CAMERA_ZOOM_SPEED_FAST DJI_CAMERA_ZOOM_SPEED_FAST /*!< Lens zooms very in fast speed. */
#define PSDK_CAMERA_ZOOM_SPEED_FASTEST DJI_CAMERA_ZOOM_SPEED_FASTEST /*!< Lens zooms very in fastest speed. */
/**
* @brief Camera supported media file type.
*/
typedef E_DjiCameraMediaFileType E_PsdkCameraMediaFileType;
#define PSDK_CAMERA_FILE_TYPE_JPEG DJI_CAMERA_FILE_TYPE_JPEG /*!< Media file JPEG type. */
#define PSDK_CAMERA_FILE_TYPE_DNG DJI_CAMERA_FILE_TYPE_DNG /*!< Media file DNG type. */
#define PSDK_CAMERA_FILE_TYPE_MOV DJI_CAMERA_FILE_TYPE_MOV /*!< Media file MOV type. */
#define PSDK_CAMERA_FILE_TYPE_MP4 DJI_CAMERA_FILE_TYPE_MP4 /*!< Media file MP4 type. */
/**
* @brief Camera playback mode in playback process.
*/
typedef E_DjiCameraPlaybackMode E_PsdkCameraPlaybackMode;
#define PSDK_CAMERA_PLAYBACK_MODE_PLAY DJI_CAMERA_PLAYBACK_MODE_PLAY /*!< Play playbacking mode. */
#define PSDK_CAMERA_PLAYBACK_MODE_PAUSE DJI_CAMERA_PLAYBACK_MODE_PAUSE /*!< Pause playbacking mode. */
#define PSDK_CAMERA_PLAYBACK_MODE_STOP DJI_CAMERA_PLAYBACK_MODE_STOP /*!< Stop playbacking mode. */
/**
* @brief Camera supported video frames when working in playback mode.
*/
typedef E_DjiCameraVideoFrameRate E_PsdkCameraVideoFrameRate;
#define PSDK_CAMERA_VIDEO_FRAME_RATE_24_FPS DJI_CAMERA_VIDEO_FRAME_RATE_24_FPS /*!< The camera's video frame rate is 24fps (frames per second) */
#define PSDK_CAMERA_VIDEO_FRAME_RATE_25_FPS DJI_CAMERA_VIDEO_FRAME_RATE_25_FPS /*!< The camera's video frame rate is 25fps (frames per second) */
#define PSDK_CAMERA_VIDEO_FRAME_RATE_30_FPS DJI_CAMERA_VIDEO_FRAME_RATE_30_FPS /*!< The camera's video frame rate is 30fps (frames per second) */
#define PSDK_CAMERA_VIDEO_FRAME_RATE_UNKNOWN DJI_CAMERA_VIDEO_FRAME_RATE_UNKNOWN /*!< The camera's video frame rate is unknown (frames per second) */
/**
* @brief Camera supported video resolutions when working in playback mode.
*/
typedef E_DjiCameraVideoResolution E_PsdkCameraVideoResolution;
#define PSDK_CAMERA_VIDEO_RESOLUTION_640x480 DJI_CAMERA_VIDEO_RESOLUTION_640x480 /*!< /The camera's video resolution is 640x480. */
#define PSDK_CAMERA_VIDEO_RESOLUTION_1280x720 DJI_CAMERA_VIDEO_RESOLUTION_1280x720 /*!< /The camera's video resolution is 1280x720. */
#define PSDK_CAMERA_VIDEO_RESOLUTION_1920x1080 DJI_CAMERA_VIDEO_RESOLUTION_1920x1080 /*!< /The camera's video resolution is 1920x1080. */
#define PSDK_CAMERA_VIDEO_RESOLUTION_2048x1080 DJI_CAMERA_VIDEO_RESOLUTION_2048x1080 /*!< /The camera's video resolution is 2048x1080. */
#define PSDK_CAMERA_VIDEO_RESOLUTION_3840x2160 DJI_CAMERA_VIDEO_RESOLUTION_3840x2160 /*!< /The camera's video resolution is 3840x2160. */
#define PSDK_CAMERA_VIDEO_RESOLUTION_UNKNOWN DJI_CAMERA_VIDEO_RESOLUTION_UNKNOWN /*!< /The camera's video resolution is unknown. */
/**
* @brief Camera zoom state in tap zoom process.
*/
typedef E_DjiCameraTapZoomState E_PsdkCameraTapZoomState;
#define PSDK_CAMERA_TAP_ZOOM_STATE_IDLE DJI_CAMERA_TAP_ZOOM_STATE_IDLE /*!< Camera is not in tap zoom process. */
#define PSDK_CAMERA_TAP_ZOOM_STATE_ZOOM_IN DJI_CAMERA_TAP_ZOOM_STATE_ZOOM_IN /*!< Camera is zooming in. */
#define PSDK_CAMERA_TAP_ZOOM_STATE_ZOOM_OUT DJI_CAMERA_TAP_ZOOM_STATE_ZOOM_OUT /*!< Camera is zooming out. */
#define PSDK_CAMERA_TAP_ZOOM_STATE_ZOOM_LIMITED DJI_CAMERA_TAP_ZOOM_STATE_ZOOM_LIMITED /*!< Camera has reached zoom limit. */
/**
* @brief Camera video stream type.
*/
typedef E_DjiCameraVideoStreamType E_PsdkCameraVideoStreamType;
/*! 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.*/
#define PSDK_CAMERA_VIDEO_STREAM_TYPE_H264_CUSTOM_FORMAT DJI_CAMERA_VIDEO_STREAM_TYPE_H264_CUSTOM_FORMAT
/*! 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. */
#define PSDK_CAMERA_VIDEO_STREAM_TYPE_H264_DJI_FORMAT DJI_CAMERA_VIDEO_STREAM_TYPE_H264_DJI_FORMAT
/**
* @brief Camera sdcard state.
*/
typedef T_DjiCameraSDCardState T_PsdkCameraSDCardState;
/**
* @brief Camera time interval settings when in interval shootPhoto mode.
*/
typedef T_DjiCameraPhotoTimeIntervalSettings T_PsdkCameraPhotoTimeIntervalSettings;
/**
* @brief Camera metering target when in spot metering mode.
*/
typedef T_DjiCameraSpotMeteringTarget T_PsdkCameraSpotMeteringTarget;
/**
* @brief Camera system state.
*/
typedef T_DjiCameraSystemState T_PsdkCameraSystemState;
/**
* @brief Camera focus target point when in focus mode.
*/
typedef T_DjiCameraPointInScreen T_PsdkCameraPointInScreen;
/**
* @brief Camera focus assistant settings.
*/
typedef T_DjiCameraFocusAssistantSettings T_PsdkCameraFocusAssistantSettings;
/**
* @brief Camera playback status.
*/
typedef T_DjiCameraPlaybackStatus T_PsdkCameraPlaybackStatus;
/**
* @brief Camera focus assistant settings.
*/
typedef T_DjiCameraMediaFileAttr T_PsdkCameraMediaFileAttr;
/**
* @brief Camera media file info.
*/
typedef T_DjiCameraMediaFileInfo T_PsdkCameraMediaFileInfo;
/**
* @brief Camera optical zoom specifies.
*/
typedef T_DjiCameraOpticalZoomSpec T_PsdkCameraOpticalZoomSpec;
/**
* @brief Camera tap zoom state.
*/
typedef T_DjiCameraTapZoomState 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 T_DjiCameraCommonHandler 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 T_DjiCameraExposureMeteringHandler 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 T_DjiCameraFocusHandler 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 T_DjiCameraDigitalZoomHandler 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 T_DjiCameraOpticalZoomHandler T_PsdkCameraOpticalZoomHandler;
/**
* @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 T_DjiCameraMediaDownloadPlaybackHandler T_PsdkCameraMediaDownloadPlaybackHandler;
/**
* @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 T_DjiCameraTapZoomHandler 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.
* @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);
/**
* @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);
/**
* @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,116 @@
/**
********************************************************************
* @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) 2021 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 "legacy_psdk2.x/psdk_typedef.h"
#include "legacy_psdk2.x/psdk_payload_camera.h"
#include "legacy_psdk2.x/psdk_aircraft_info.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief Camera type.
*/
typedef E_DjiCameraType E_PsdkPayloadCollaborationCameraType;
#define PSDK_PAYLOAD_COLLABORATION_CAMERA_TYPE_UNKNOWN DJI_CAMERA_TYPE_UNKNOWN /*!< Camera type is unknown. */
#define PSDK_PAYLOAD_COLLABORATION_CAMERA_TYPE_XT DJI_CAMERA_TYPE_XT /*!< Camera type is XT. */
#define PSDK_PAYLOAD_COLLABORATION_CAMERA_TYPE_X4S DJI_CAMERA_TYPE_X4S /*!< Camera type is X4S. */
#define PSDK_PAYLOAD_COLLABORATION_CAMERA_TYPE_X5S DJI_CAMERA_TYPE_X5S /*!< Camera type is X5S. */
#define PSDK_PAYLOAD_COLLABORATION_CAMERA_TYPE_X7 DJI_CAMERA_TYPE_X7 /*!< Camera type is X7. */
#define PSDK_PAYLOAD_COLLABORATION_CAMERA_TYPE_Z30 DJI_CAMERA_TYPE_Z30 /*!< Camera type is Z30. */
#define PSDK_PAYLOAD_COLLABORATION_CAMERA_TYPE_XT2 DJI_CAMERA_TYPE_XT2/*!< Camera type is XT2. */
#define PSDK_PAYLOAD_COLLABORATION_CAMERA_TYPE_PSDK DJI_CAMERA_TYPE_PSDK /*!< Camera type is third party camera based on Payload SDK. */
#define PSDK_PAYLOAD_COLLABORATION_CAMERA_TYPE_XTS DJI_CAMERA_TYPE_XTS /*!< Camera type is XT S. */
#define PSDK_PAYLOAD_COLLABORATION_CAMERA_TYPE_H20 DJI_CAMERA_TYPE_H20 /*!< Camera type is H20. */
#define PSDK_PAYLOAD_COLLABORATION_CAMERA_TYPE_H20T DJI_CAMERA_TYPE_H20T /*!< Camera type is H20T. */
/* 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,216 @@
/**
********************************************************************
* @file psdk_platform.h
* @brief This is the header file for define PSDK platform interfaces.
*
* @copyright (c) 2021 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 "legacy_psdk2.x/psdk_typedef.h"
#include "dji_platform.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/**
* @brief Platform handle of thread task operation.
*/
typedef T_DjiTaskHandle T_PsdkTaskHandle;
/**
* @brief Platform handle of mutex operation.
*/
typedef T_DjiMutexHandle T_PsdkMutexHandle;
/**
* @brief Platform handle of semaphore operation.
*/
typedef T_DjiSemaHandle T_PsdkSemHandle;
/* Exported types ------------------------------------------------------------*/
typedef T_DjiHalUartHandler T_PsdkHalUartHandler;
typedef T_DjiHalNetworkHandler T_PsdkHalNetWorkHandler;
typedef T_DjiOsalHandler T_PsdkOsalHandler;
/* 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,113 @@
/**
********************************************************************
* @file psdk_positioning.h
* @brief This is the header file for "psdk_positioning.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2021 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 "legacy_psdk2.x/psdk_typedef.h"
#include "legacy_psdk2.x/psdk_time_sync.h"
#include "dji_positioning.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief Data structure that describes a positioning event.
*/
typedef T_DjiPositioningEventInfo T_PsdkPositioningEventInfo;
/**
* @brief Data structure that describes position of a point.
*/
typedef T_DjiPositioningPosition T_PsdkPositioningPosition;
/**
* @brief Position value standard deviation.
*/
typedef T_DjiPositioningPositionStandardDeviation T_PsdkPositioningPositionStandardDeviation;
/**
* @brief Position of target point and other details returned by interface of requesting position.
*/
typedef T_DjiPositioningPositionInfo 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,105 @@
/**
********************************************************************
* @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) 2021 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 <legacy_psdk2.x/psdk_typedef.h>
#include <legacy_psdk2.x/psdk_aircraft_info.h>
#include "dji_power_management.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/**
* @brief Pin state.
*/
typedef E_DjiPowerManagementPinState E_PsdkPowerManagementPinState;
#define PSDK_POWER_MANAGEMENT_PIN_STATE_RESET DJI_POWER_MANAGEMENT_PIN_STATE_RESET /*!< Specifies pin is in low level state. */
#define PSDK_POWER_MANAGEMENT_PIN_STATE_SET DJI_POWER_MANAGEMENT_PIN_STATE_SET /*!< Specifies pin is in high level state. */
/**
* @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 DjiWriteHighPowerApplyPinCallback WriteHighPowerApplyPinCallback;
/**
* @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 DjiPowerOffNotificationCallback PowerOffNotificationCallback;
/* 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,63 @@
/**
********************************************************************
* @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) 2021 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 <legacy_psdk2.x/psdk_typedef.h>
#include <dji_core.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,92 @@
/**
********************************************************************
* @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) 2021 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 "legacy_psdk2.x/psdk_typedef.h"
#include "dji_time_sync.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 DjiGetNewestPpsTriggerLocalTimeUsCallback GetNewestPpsTriggerLocalTimeUsCallback;
/**
* @brief Data structure of time in aircraft time system.
*/
typedef T_DjiTimeSyncAircraftTime 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,88 @@
/**
********************************************************************
* @file psdk_typedef.h
* @brief PSDK type define file.
*
* @copyright (c) 2021 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 "legacy_psdk2.x/psdk_error.h"
#include "dji_typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
#define PI DJI_PI
#define PSDK_FILE_NAME_SIZE_MAX DJI_FILE_NAME_SIZE_MAX
#define PSDK_FILE_PATH_SIZE_MAX DJI_FILE_PATH_SIZE_MAX
#define PSDK_IP_ADDR_STR_SIZE_MAX DJI_IP_ADDR_STR_SIZE_MAX
#define PSDK_MD5_BUFFER_LEN DJI_MD5_BUFFER_LEN
/* Exported types ------------------------------------------------------------*/
/**
* @brief Type define double as psdk_f64_t.
*/
typedef dji_f64_t psdk_f64_t;
/**
* @brief Type define float as psdk_f32_t.
*/
typedef dji_f32_t psdk_f32_t;
/**
* @brief Type define uint64 as T_PsdkReturnCode.
* @details The type can be any value of ::PsdkErrorCode.
*/
typedef T_DjiReturnCode T_PsdkReturnCode;
#pragma pack (1)
typedef T_DjiVector3d T_PsdkVector3d;
typedef T_DjiVector3f T_PsdkVector3f;
typedef T_DjiAttitude3d T_PsdkAttitude3d;
typedef T_DjiAttitude3f T_PsdkAttitude3f;
typedef T_DjiQuaternion4f T_PsdkQuaternion4f;
typedef T_DjiDataChannelState T_PsdkDataChannelState;
#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,140 @@
/**
********************************************************************
* @file psdk_upgrade.h
* @brief This is the header file for "psdk_upgrade.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2021 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 "legacy_psdk2.x/psdk_typedef.h"
#include <dji_typedef.h>
#include <dji_upgrade.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
typedef E_DjiFirmwareTransferType E_PsdkPayloadFirmwareTransferType;
/*!
* @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
*/
#define PSDK_PAYLOAD_FIRMWARE_TRANSFER_TYPE_FTP DJI_FIRMWARE_TRANSFER_TYPE_FTP
/*!
* @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.
*/
#define PSDK_PAYLOAD_FIRMWARE_TRANSFER_TYPE_DCFTP DJI_FIRMWARE_TRANSFER_TYPE_DCFTP
typedef E_DjiUpgradeStage E_PsdkUpgradeStage;
#define PSDK_UPGRADE_STAGE_IDLE DJI_UPGRADE_STAGE_IDLE /*!< Idle stage means not in upgrade mode. */
#define PSDK_UPGRADE_STAGE_ONGOING DJI_UPGRADE_STAGE_ONGOING /*!< Ongoing stage means payload is upgrading. */
#define PSDK_UPGRADE_STAGE_DEVICE_REBOOT DJI_UPGRADE_STAGE_DEVICE_REBOOT /*!< Device reboot stage means device is rebooting. */
#define PSDK_UPGRADE_STAGE_END DJI_UPGRADE_STAGE_END /*!< End Stage means upgrade finish and reporting upgrade result to the terminal APP. */
typedef E_DjiUpgradeEndState E_PsdkUpgradeEndState;
#define PSDK_UPGRADE_END_STATE_SUCCESS DJI_UPGRADE_END_STATE_SUCCESS /*!< Upgrade success. */
#define PSDK_UPGRADE_END_STATE_UNKNOWN_ERROR DJI_UPGRADE_END_STATE_UNKNOWN_ERROR /*!< Upgrade failure due to unknown reason. */
/**
* @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 T_DjiFirmwareVersion T_PsdkPayloadFirmwareVersion;
typedef T_DjiUpgradeOngoingInfo T_PsdkUpgradeOngoingInfo;
typedef T_DjiUpgradeRebootInfo T_PsdkUpgradeRebootInfo;
typedef T_DjiUpgradeEndInfo T_PsdkUpgradeEndInfo;
typedef T_DjiUpgradeFtpFileTransferInfo T_PsdkUpgradeFtpFileTransferInfo;
typedef T_DjiUpgradeFileInfo T_PsdkUpgradeFileInfo;
typedef T_DjiUpgradeDcftpFileTransferOpt T_PsdkUpgradeDcftpFileTransferOpt;
typedef T_DjiFirmwareTransferInfo T_PsdkPayloadFirmwareTransferInfo;
typedef T_DjiUpgradeState T_PsdkUpgradeState;
typedef T_DjiUpgradeConfig T_PsdkUpgradeConfig;
typedef T_DjiUpgradeHandler 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) 2021 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 ------------------------------------------------------------------*/
#include <dji_version.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
#define PSDK_VERSION_MAJOR DJI_VERSION_MAJOR /*!< Payload SDK major version num, when have incompatible API changes. Range from 0 to 99. */
#define PSDK_VERSION_MINOR DJI_VERSION_MINOR /*!< Payload SDK minor version num, when add functionality in a backwards compatible manner changes. Range from 0 to 99. */
#define PSDK_VERSION_MODIFY DJI_VERSION_MODIFY /*!< Payload SDK modify version num, when have backwards compatible bug fixes changes. Range from 0 to 99. */
#define PSDK_VERSION_BETA DJI_VERSION_BETA /*!< Payload SDK version beta info, release version will be 0, when beta version release changes. Range from 0 to 255. */
#define PSDK_VERSION_BUILD DJI_VERSION_BUILD /*!< 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,171 @@
/**
********************************************************************
* @file psdk_widget.h
* @brief This is the header file for "psdk_widget.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2021 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 <legacy_psdk2.x/psdk_typedef.h>
#include <legacy_psdk2.x/psdk_aircraft_info.h>
#include <dji_widget.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 DJI_WIDGET_FLOATING_WINDOW_MSG_MAX_LEN
/* Exported types ------------------------------------------------------------*/
/**
* @brief Widget types.
*/
typedef E_DjiWidgetType E_PsdkWidgetType;
#define PSDK_WIDGET_TYPE_BUTTON DJI_WIDGET_TYPE_BUTTON /*!< button widget type */
#define PSDK_WIDGET_TYPE_SWITCH DJI_WIDGET_TYPE_SWITCH /*!< switch widget type */
#define PSDK_WIDGET_TYPE_SCALE DJI_WIDGET_TYPE_SCALE /*!< scale widget type */
#define PSDK_WIDGET_TYPE_LIST DJI_WIDGET_TYPE_LIST /*!< list widget type */
#define PSDK_WIDGET_TYPE_INT_INPUT_BOX DJI_WIDGET_TYPE_INT_INPUT_BOX /*!< integer input box widget type */
/**
* @brief Button widget state.
*/
typedef E_DjiWidgetButtonState E_PsdkWidgetButtonState;
#define PSDK_WIDGET_BUTTON_STATE_PRESS_DOWN DJI_WIDGET_BUTTON_STATE_PRESS_DOWN /*!< Button is pressed down */
#define PSDK_WIDGET_BUTTON_STATE_RELEASE_UP DJI_WIDGET_BUTTON_STATE_RELEASE_UP /*!< Button is released up */
/**
* @brief Switch widget state.
*/
typedef E_DjiWidgetSwitchState E_PsdkWidgetSwitchState;
#define PSDK_WIDGET_SWITCH_STATE_OFF DJI_WIDGET_SWITCH_STATE_OFF /*!< Switch is turned off */
#define PSDK_WIDGET_SWITCH_STATE_ON DJI_WIDGET_SWITCH_STATE_ON /*!< Switch is turned on */
/**
* @brief Widget file binary array.
*/
typedef T_DjiWidgetFileBinaryArray T_PsdkWidgetFileBinaryArray;
/**
* @brief Widget binary array config.
*/
typedef T_DjiWidgetBinaryArrayConfig T_PsdkWidgetBinaryArrayConfig;
/**
* @brief Widget handler item.
*/
typedef T_DjiWidgetHandlerListItem 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);
/**
* @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);
/**
* @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,223 @@
/**
********************************************************************
* @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) 2021 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 "legacy_psdk2.x/psdk_typedef.h"
#include "legacy_psdk2.x/psdk_gimbal.h"
#include "dji_xport.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief XPort limit angle category.
*/
typedef E_DjiXPortLimitAngleCategory E_PsdkXPortLimitAngleCategory;
/*!< Joint angle limit of roll axis. */
#define PSDK_XPORT_LIMIT_ANGLE_CATEGORY_ROLL_JOINT_ANGLE DJI_XPORT_LIMIT_ANGLE_CATEGORY_ROLL_JOINT_ANGLE
/*!< Joint angle limit of pitch axis. */
#define PSDK_XPORT_LIMIT_ANGLE_CATEGORY_PITCH_JOINT_ANGLE DJI_XPORT_LIMIT_ANGLE_CATEGORY_PITCH_JOINT_ANGLE
/*!< Euler angle limit of pitch axis, just is limitation of angle in ground coordinate. */
#define PSDK_XPORT_LIMIT_ANGLE_CATEGORY_PITCH_EULER_ANGLE DJI_XPORT_LIMIT_ANGLE_CATEGORY_PITCH_EULER_ANGLE
/*!< 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. */
#define PSDK_XPORT_LIMIT_ANGLE_CATEGORY_PITCH_EULER_ANGLE_EXTENSION DJI_XPORT_LIMIT_ANGLE_CATEGORY_PITCH_EULER_ANGLE_EXTENSION
/*!< Joint angle limit of yaw axis. */
#define PSDK_XPORT_LIMIT_ANGLE_CATEGORY_YAW_JOINT_ANGLE DJI_XPORT_LIMIT_ANGLE_CATEGORY_YAW_JOINT_ANGLE
/**
* @brief Limit angle data structure.
*/
typedef T_DjiXPortLimitAngle 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 DjiReceiveXPortSystemStateCallback ReceiveXPortSystemStateCallback;
/**
* @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 DjiReceiveXPortAttitudeInformationCallback ReceiveXPortAttitudeInformationCallback;
/* 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(psdk_f32_t factor);
#ifdef __cplusplus
}
#endif
#endif // PSDK_XPORT_H
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/