Camera Function
This is the header file for "psdk_payload_camera.c", defining the structure and (exported) function prototypes.
Enum
E_PsdkCameraMode
E_PsdkCameraShootPhotoMode
E_PsdkCameraShootingState
E_PsdkCameraBurstCount
E_PsdkCameraMeteringMode
E_PsdkCameraFocusMode
E_PsdkCameraZoomDirection
E_PsdkCameraZoomSpeed
E_PsdkCameraMediaFileType
E_PsdkCameraPlaybackMode
E_PsdkCameraVideoFrameRate
E_PsdkCameraVideoResolution
E_PsdkCameraTapZoomState
E_PsdkCameraVideoStreamTypeStructure
T_PsdkCameraSDCardState
T_PsdkCameraPhotoTimeIntervalSettings
T_PsdkCameraSpotMeteringTarget
T_PsdkCameraSystemState
T_PsdkCameraPointInScreen
T_PsdkCameraFocusAssistantSettings
T_PsdkCameraPlaybackStatus
T_PsdkCameraMediaFileAttr
T_PsdkCameraMediaFileInfo
T_PsdkCameraOpticalZoomSpec
T_PsdkCameraTapZoomState
T_PsdkCameraCommonHandler
T_PsdkCameraExposureMeteringHandler
T_PsdkCameraFocusHandler
T_PsdkCameraDigitalZoomHandler
T_PsdkCameraOpticalZoomHandler
T_PsdkCameraMediaDownloadPlaybackHandler
T_PsdkCameraTapZoomHandlerFunction
PsdkPayloadCamera_Init
PsdkPayloadCamera_RegCommonHandler
PsdkPayloadCamera_RegExposureMeteringHandler
PsdkPayloadCamera_RegFocusHandler
PsdkPayloadCamera_RegDigitalZoomHandler
PsdkPayloadCamera_RegOpticalZoomHandler
PsdkPayloadCamera_RegTapZoomHandler
PsdkPayloadCamera_RegMediaDownloadPlaybackHandler
PsdkPayloadCamera_SendVideoStream
PsdkPayloadCamera_GetVideoStreamState
PsdkPayloadCamera_SetVideoStreamType
PsdkPayloadCamera_GetVideoStreamRemoteAddress
PsdkPayloadCamera_PushAddedMediaFileInfo
Enum
typedef enum E_PsdkCameraMode
Camera work mode
typedef enum {
PSDK_CAMERA_MODE_SHOOT_PHOTO = 0, Shoot photo work mode.
PSDK_CAMERA_MODE_RECORD_VIDEO = 1, Record video work mode.
PSDK_CAMERA_MODE_PLAYBACK = 2, Media playback work mode.
} E_PsdkCameraMode;
typedef enum E_PsdkCameraShootPhotoMode
Camera shoot photo mode
typedef enum {
PSDK_CAMERA_SHOOT_PHOTO_MODE_SINGLE = 1, Single photographing mode.
PSDK_CAMERA_SHOOT_PHOTO_MODE_BURST = 4, Burst photographing mode.
PSDK_CAMERA_SHOOT_PHOTO_MODE_INTERVAL = 6, Interval photographing mode.
} E_PsdkCameraShootPhotoMode;
typedef enum E_PsdkCameraShootingState
Camera shooting state when photographing
typedef enum {
PSDK_CAMERA_SHOOTING_PHOTO_IDLE = 0, Photographing in idle state.
PSDK_CAMERA_SHOOTING_SINGLE_PHOTO = 1, Photographing in single photograph state .
PSDK_CAMERA_SHOOTING_BURST_PHOTO = 2, Photographing in burst photograph state.
PSDK_CAMERA_SHOOTING_INTERVAL_PHOTO = 6, Photographing in interval photograph state.
} E_PsdkCameraShootingState;
typedef enum E_PsdkCameraBurstCount
Camera burst count setting when photographing
typedef enum {
PSDK_CAMERA_BURST_COUNT_2 = 2, Photo number of burst photographing: 2.
PSDK_CAMERA_BURST_COUNT_3 = 3, Photo number of burst photographing: 3.
PSDK_CAMERA_BURST_COUNT_5 = 5, Photo number of burst photographing: 5.
PSDK_CAMERA_BURST_COUNT_7 = 7, Photo number of burst photographing: 7.
PSDK_CAMERA_BURST_COUNT_10 = 10, Photo number of burst photographing: 10.
PSDK_CAMERA_BURST_COUNT_14 = 14, Photo number of burst photographing: 14.
} E_PsdkCameraBurstCount;
typedef enum E_PsdkCameraMeteringMode
Camera metering mode
typedef enum {
PSDK_CAMERA_METERING_MODE_CENTER = 0, Center metering mode.
PSDK_CAMERA_METERING_MODE_AVERAGE = 1, Average metering mode.
PSDK_CAMERA_METERING_MODE_SPOT = 2, Spot metering mode.
} E_PsdkCameraMeteringMode;
typedef enum E_PsdkCameraFocusMode
Camera focus mode
typedef enum {
PSDK_CAMERA_FOCUS_MODE_MANUAL = 0, Manual focus mode.
PSDK_CAMERA_FOCUS_MODE_AUTO = 1, Auto focus mode.
} E_PsdkCameraFocusMode;
typedef enum E_PsdkCameraZoomDirection
Camera zoom direction
typedef enum {
PSDK_CAMERA_ZOOM_DIRECTION_OUT = 0, The lens moves in the far direction, the zoom factor becomes smaller.
PSDK_CAMERA_ZOOM_DIRECTION_IN = 1, The lens moves in the near direction, the zoom factor becomes larger.
} E_PsdkCameraZoomDirection;
typedef enum E_PsdkCameraZoomSpeed
Camera zoom speed
typedef enum {
PSDK_CAMERA_ZOOM_SPEED_SLOWEST = 72, Lens zooms in slowest speed.
PSDK_CAMERA_ZOOM_SPEED_SLOW = 73, Lens zooms in slow speed.
PSDK_CAMERA_ZOOM_SPEED_MODERATELY_SLOW = 74, Lens zooms in speed slightly slower than normal speed.
PSDK_CAMERA_ZOOM_SPEED_NORMAL = 75, Lens zooms in normal speed.
PSDK_CAMERA_ZOOM_SPEED_MODERATELY_FAST = 76, Lens zooms very in speed slightly faster than normal speed.
PSDK_CAMERA_ZOOM_SPEED_FAST = 77, Lens zooms very in fast speed.
PSDK_CAMERA_ZOOM_SPEED_FASTEST = 78, Lens zooms very in fastest speed.
} E_PsdkCameraZoomSpeed;
typedef enum E_PsdkCameraMediaFileType
Camera supported media file type
typedef enum {
PSDK_CAMERA_FILE_TYPE_JPEG = 0, Media file JPEG type.
PSDK_CAMERA_FILE_TYPE_DNG = 1, Media file DNG type.
PSDK_CAMERA_FILE_TYPE_MOV = 2, Media file MOV type.
PSDK_CAMERA_FILE_TYPE_MP4 = 3, Media file MP4 type.
} E_PsdkCameraMediaFileType;
typedef enum E_PsdkCameraPlaybackMode
Camera playback mode in playback process
typedef enum {
PSDK_CAMERA_PLAYBACK_MODE_PLAY = 2, Play playbacking mode.
PSDK_CAMERA_PLAYBACK_MODE_PAUSE = 3, Pause playbacking mode.
PSDK_CAMERA_PLAYBACK_MODE_STOP = 7, Stop playbacking mode.
} E_PsdkCameraPlaybackMode;
typedef enum E_PsdkCameraVideoFrameRate
Camera supported video frames when working in playback mode
typedef enum {
PSDK_CAMERA_VIDEO_FRAME_RATE_8_DOT_8_FPS = 23, The camera's video frame rate is 8.8fps (frames per second)
PSDK_CAMERA_VIDEO_FRAME_RATE_23_DOT_976_FPS = 1, The camera's video frame rate is 23.96fps (frames per second)
PSDK_CAMERA_VIDEO_FRAME_RATE_24_FPS = 13, The camera's video frame rate is 24fps (frames per second)
PSDK_CAMERA_VIDEO_FRAME_RATE_25_FPS = 2, The camera's video frame rate is 25fps (frames per second)
PSDK_CAMERA_VIDEO_FRAME_RATE_29_DOT_970_FPS = 3, The camera's video frame rate is 29.97fps (frames per second)
PSDK_CAMERA_VIDEO_FRAME_RATE_30_FPS = 14, The camera's video frame rate is 30fps (frames per second)
PSDK_CAMERA_VIDEO_FRAME_RATE_47_DOT_950_FPS = 4, The camera's video frame rate is 47.95fps (frames per second)
PSDK_CAMERA_VIDEO_FRAME_RATE_48_FPS = 15, The camera's video frame rate is 48fps (frames per second)
PSDK_CAMERA_VIDEO_FRAME_RATE_50_FPS = 5, The camera's video frame rate is 50fps (frames per second)
PSDK_CAMERA_VIDEO_FRAME_RATE_59_DOT_940_FPS = 6, The camera's video frame rate is 59.94fps (frames per second)
PSDK_CAMERA_VIDEO_FRAME_RATE_60_FPS = 16, The camera's video frame rate is 60fps (frames per second)
PSDK_CAMERA_VIDEO_FRAME_RATE_90_FPS = 17, The camera's video frame rate is 90fps (frames per second)
PSDK_CAMERA_VIDEO_FRAME_RATE_96_FPS = 11, The camera's video frame rate is 96fps (frames per second)
PSDK_CAMERA_VIDEO_FRAME_RATE_100_FPS = 10, The camera's video frame rate is 100fps (frames per second)
PSDK_CAMERA_VIDEO_FRAME_RATE_120_FPS = 7, The camera's video frame rate is 120fps (frames per second)
PSDK_CAMERA_VIDEO_FRAME_RATE_UNKNOWN = 0, The camera's video frame rate is unknown (frames per second)
} E_PsdkCameraVideoFrameRate;
typedef enum E_PsdkCameraVideoResolution
Camera supported video resolutions when working in playback mode
typedef enum {
PSDK_CAMERA_VIDEO_RESOLUTION_336x256 = 38, The camera's video resolution is 336x256.
PSDK_CAMERA_VIDEO_RESOLUTION_640x360 = 46, The camera's video resolution is 640x360.
PSDK_CAMERA_VIDEO_RESOLUTION_640x480 = 0, The camera's video resolution is 640x480.
PSDK_CAMERA_VIDEO_RESOLUTION_640x512 = 26, The camera's video resolution is 640x512.
PSDK_CAMERA_VIDEO_RESOLUTION_1280x720 = 4, The camera's video resolution is 1280x720.
PSDK_CAMERA_VIDEO_RESOLUTION_1920x1080 = 10, The camera's video resolution is 1920x1080.
PSDK_CAMERA_VIDEO_RESOLUTION_2048x1080 = 37, The camera's video resolution is 2048x1080.
PSDK_CAMERA_VIDEO_RESOLUTION_2688x1512 = 45, The camera's video resolution is 2688x1512.
PSDK_CAMERA_VIDEO_RESOLUTION_2704x1520 = 24, The camera's video resolution is 2704x1520.
PSDK_CAMERA_VIDEO_RESOLUTION_2720x1530 = 42, The camera's video resolution is 2720x1530.
PSDK_CAMERA_VIDEO_RESOLUTION_3840x1572 = 34, The camera's video resolution is 3840x1572.
PSDK_CAMERA_VIDEO_RESOLUTION_3840x2160 = 41, The camera's video resolution is 3840x2160.
PSDK_CAMERA_VIDEO_RESOLUTION_4096x2160 = 22, The camera's video resolution is 4096x2160.
PSDK_CAMERA_VIDEO_RESOLUTION_4608x2160 = 27, The camera's video resolution is 4608x2160.
PSDK_CAMERA_VIDEO_RESOLUTION_4608x2592 = 28, The camera's video resolution is 4608x2592.
PSDK_CAMERA_VIDEO_RESOLUTION_5280x2160 = 32, The camera's video resolution is 5280x2160.
PSDK_CAMERA_VIDEO_RESOLUTION_5280x2972 = 33, The camera's video resolution is 5280x2972.
PSDK_CAMERA_VIDEO_RESOLUTION_5760X3240 = 35, The camera's video resolution is 5760X3240.
PSDK_CAMERA_VIDEO_RESOLUTION_6016X3200 = 36, The camera's video resolution is 6016X3200.
PSDK_CAMERA_VIDEO_RESOLUTION_UNKNOWN = 255, The camera's video resolution is unknown.
} E_PsdkCameraVideoResolution;
typedef enum E_PsdkCameraTapZoomState
Camera zoom state in tap zoom process
typedef enum {
PSDK_CAMERA_TAP_ZOOM_STATE_IDLE = 0, Camera is not in tap zoom process.
PSDK_CAMERA_TAP_ZOOM_STATE_ZOOM_IN = 1, Camera is zooming in.
PSDK_CAMERA_TAP_ZOOM_STATE_ZOOM_OUT = 2, Camera is zooming out.
PSDK_CAMERA_TAP_ZOOM_STATE_ZOOM_LIMITED = 3, Camera has reached zoom limit.
} E_PsdkCameraTapZoomState;
typedef enum E_PsdkCameraVideoStreamType
Camera video stream type.
typedef enum {
PSDK_CAMERA_VIDEO_STREAM_TYPE_H264_CUSTOM_FORMAT = 0, Camera video stream by h264 custom format, which needs to comply
with the user document Custom-H264 video stream format standard.
When using this format to send a video stream, the bit rate
of the video stream needs must not exceed the real-time
bandwidth limit of the channel that feedback by
interface #PsdkPayloadCamera_GetVideoStreamState
PSDK_CAMERA_VIDEO_STREAM_TYPE_H264_DJI_FORMAT = 1, 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.
} E_PsdkCameraVideoStreamType;
Structure
typedef struct T_PsdkCameraSDCardState
Camera sdcard state
typedef struct {
bool isInserted; Specifies if the SD card is inserted in the camera. This parameter is boolean type.
bool isVerified; Specifies if the SD card is verified as genuine. This parameter is boolean type.
bool isInitializing; Specifies if the SD card is initializing. This parameter is boolean type.
bool isReadOnly; Specifies if the SD card is read only type. This parameter is boolean type.
bool isFormatting; Specifies if the SD card is in formatting process. This parameter is boolean type.
bool isFull; Specifies if the SD card's capacity is full. This parameter is boolean type.
bool isInvalidFormat; Specifies if the SD card is invaild formated. This parameter is boolean type.
bool hasError; Specifies if the SD card has error. This parameter is boolean type.
uint32_t totalSpaceInMB; SD card total capacity, unit: MB.
uint32_t remainSpaceInMB; SD card remaining capacity, unit: MB.
uint32_t availableCaptureCount; Available capture photo count.
uint32_t availableRecordingTimeInSeconds; Available video recording second time, unit: s.
} T_PsdkCameraSDCardState;
typedef struct T_PsdkCameraPhotoTimeIntervalSettings
Camera time interval settings when in interval shootphoto mode
typedef struct {
uint8_t captureCount; Specifies the totol capture count of intereval settings
uint16_t timeIntervalSeconds; Specifies the interval time between two captures, unit: s
} T_PsdkCameraPhotoTimeIntervalSettings;
typedef struct T_PsdkCameraSpotMeteringTarget
Camera metering target when in spot metering mode
typedef struct {
uint8_t col; Specifies column coordinate. This parameter is between 0 and 11.
uint8_t row; Specifies row coordinate. This parameter is between 0 and 7.
} T_PsdkCameraSpotMeteringTarget;
typedef struct T_PsdkCameraSystemState
Camera system state
typedef struct {
E_PsdkCameraMode cameraMode; Specifies the camera current work mode, #E_PsdkCameraMode.
E_PsdkCameraShootingState shootingState; Specifies the camera state of shooting, #E_PsdkCameraShootingState.
bool isStoring; Specifies if the camera is in storing status. This parameter is boolean type.
bool isShootingIntervalStart; Specifies if the camera is in interval shooting start status. This parameter is boolean type.
uint16_t currentPhotoShootingIntervalTimeInSeconds; Specifies the current interval shoot time countdown time, the value is decreasing,when
the value equals to zero trigger the interval take photo, uint:s.
uint16_t currentPhotoShootingIntervalCount; Specifies the current interval photo count, the value is decreasing step by one from the setted count when interval taking photo
bool isRecording; Specifies if the camera is in recording status. This parameter is boolean type.
uint16_t currentVideoRecordingTimeInSeconds; Specifies the current recording process time, uint:s.
bool isOverheating; Specifies if the camera is in overheating status. This parameter is boolean type.
bool hasError; Specifies if the camera in error status. This parameter is boolean type.
} T_PsdkCameraSystemState;
typedef struct T_PsdkCameraPointInScreen
Camera focus target point when in focus mode
typedef struct {
psdk_f32_t focusX; Specifies horizontal zone coordinate. This parameter is between 0 and 1.
The point [0.0, 0.0] represents the top-left angle of the screen.
psdk_f32_t focusY; Specifies vertical zone coordinate. This parameter is between 0 and 1.
} T_PsdkCameraPointInScreen;
typedef struct T_PsdkCameraFocusAssistantSettings
Camera focus assistant settings
typedef struct {
bool isEnabledMF; Specifies if the lens focus assistant is enabled for manual focusing. This parameter is boolean type.
bool isEnabledAF; Specifies if the lens focus assistant is enabled for auto focusing. This parameter is boolean type.
} T_PsdkCameraFocusAssistantSettings;
typedef struct T_PsdkCameraPlaybackStatus
Camera playback status
typedef struct {
E_PsdkCameraPlaybackMode playbackMode; Specifies the duration of video media file, #E_PsdkCameraPlaybackMode.
uint8_t videoPlayProcess; Specifies the current play process of video media file. This parameter is between 0 and 100.
uint32_t videoLengthMs; Specifies the total duration of video media file, uint:ms.
uint32_t playPosMs; Specifies the current play position of video media file, uint:ms.
} T_PsdkCameraPlaybackStatus;
typedef struct T_PsdkCameraMediaFileAttr
Camera focus assistant settings
typedef struct {
uint16_t attrVideoDuration; Specifies the playback duration of video media file, uint:s.
uint16_t attrVideoFrameRate; Specifies the frame rate of video media file, uint:fps.
uint16_t attrVideoResolution; Specifies the resolution of video media file, uint:px.
} T_PsdkCameraMediaFileAttr;
typedef struct T_PsdkCameraMediaFileInfo
Camera media file info
typedef struct {
E_PsdkCameraMediaFileType type; Specifies the type of media file, for details please refer to
E_PsdkCameraMediaFileType.
T_PsdkCameraMediaFileAttr mediaFileAttr; Specifies the attributes of media file.
uint32_t fileSize; Specifies the size of media file, uint:byte.
} T_PsdkCameraMediaFileInfo;
typedef struct T_PsdkCameraOpticalZoomSpec
Camera optical zoom specifies
typedef struct {
uint16_t maxFocalLength; The maximum focal length of the lens, unit: 0.1mm.
uint16_t minFocalLength; The minimum focal length of the lens, unit: 0.1mm.
uint16_t focalLengthStep; The minimum interval of focal length change, unit: 0.1mm.
} T_PsdkCameraOpticalZoomSpec;
typedef struct T_PsdkCameraTapZoomState
Camera tap zoom state
typedef struct {
E_PsdkCameraTapZoomState zoomState; Camera zoom state.
bool isGimbalMoving; Flag that specifies whether gimbal is moving for tap zoom.
} T_PsdkCameraTapZoomState;
typedef struct T_PsdkCameraCommonHandler
Please construct the callback function of the camera:
- Get the current status
- Set the working mode
- Get the current working mode
- Control the camera start recording
- Control the camera stop recording
- Control the camera start taking photos
- Control the camera stop taking photos
- Set the camera working mode
- Get the current camera working mode
- Set the number of continuous shots in continuous shooting mode
- Get the current number of continuous shots
- Set the shooting interval in the timer shooting mode
- Obtain the shooting interval in the timer shooting mode
- Get the current SD card status which in the payload
- Control camera format SD card
NOTE Developer can not execute blocking style operations or functions in callback function, because that will block PSDK root thread, causing problems such as slow system response, payload disconnection or infinite loop.
typedef struct {
@brief Prototype of callback function used to get camera system state.
@param systemState: pointer to memory space used to store camera system state.
@return Execution result.
T_PsdkReturnCode (*GetSystemState)(T_PsdkCameraSystemState *systemState);
@brief Prototype of callback function used to set camera work mode.
@note Sets the camera's work mode to taking pictures, video, playback. Please note that you cannot change the mode when a certain task is executing, such as taking photo(s), recording video, or downloading and saving files. Also supported by thermal imaging camera.
@param mode: camera work mode.
@return Execution result.
T_PsdkReturnCode (*SetMode)(E_PsdkCameraMode mode);
@brief Prototype of callback function used to get camera current work mode.
@param mode: pointer to memory space used to store camera work mode.
@return Execution result.
T_PsdkReturnCode (*GetMode)(E_PsdkCameraMode *mode);
@brief Prototype of callback function used to start record video.
@return Execution result.
T_PsdkReturnCode (*StartRecordVideo)(void);
@brief Prototype of callback function used to stop record video.
@return Execution result.
T_PsdkReturnCode (*StopRecordVideo)(void);
@brief Prototype of callback function used to start shoot photo.
@return Execution result.
T_PsdkReturnCode (*StartShootPhoto)(void);
@brief Prototype of callback function used to stop shoot photo.
@return Execution result.
T_PsdkReturnCode (*StopShootPhoto)(void);
@brief Prototype of callback function used to set camera shoot photo mode.
@param mode: camera shoot photo mode.
@return Execution result.
T_PsdkReturnCode (*SetShootPhotoMode)(E_PsdkCameraShootPhotoMode mode);
@brief Prototype of callback function used to get camera current shoot photo mode.
@param mode: pointer to memory space used to store camera shoot photo mode.
@return Execution result.
T_PsdkReturnCode (*GetShootPhotoMode)(E_PsdkCameraShootPhotoMode *mode);
@brief Prototype of callback function used to set camera shoot burst count.
@param burstCount: camera shoot burst count.
@return Execution result.
T_PsdkReturnCode (*SetPhotoBurstCount)(E_PsdkCameraBurstCount burstCount);
@brief Prototype of callback function used to get camera current burst count.
@param burstCount: pointer to memory space used to store camera shoot burst count.
@return Execution result.
T_PsdkReturnCode (*GetPhotoBurstCount)(E_PsdkCameraBurstCount *burstCount);
@brief Prototype of callback function used to set camera shoot time interval settings.
@note The value range of interval photograph count is [2, 255]. If 255 is selected, then the camera will continue to take pictures until StopShootPhoto is called.
@param settings: camera shoot time interval settings.
@return Execution result.
T_PsdkReturnCode (*SetPhotoTimeIntervalSettings)(T_PsdkCameraPhotoTimeIntervalSettings settings);
@brief Prototype of callback function used to get camera shoot time interval settings.
@param settings: pointer to memory space used to store camera shoot time interval settings.
@return Execution result.
T_PsdkReturnCode (*GetPhotoTimeIntervalSettings)(T_PsdkCameraPhotoTimeIntervalSettings *settings);
@brief Prototype of callback function used to get camera current SDCard state.
@param sdCardState: pointer to memory space used to store camera SDCard state.
@return Execution result.
T_PsdkReturnCode (*GetSDCardState)(T_PsdkCameraSDCardState *sdCardState);
@brief Prototype of callback function used to format the SDCard inserted.
@return Execution result.
T_PsdkReturnCode (*FormatSDCard)(void);
} T_PsdkCameraCommonHandler;
typedef struct T_PsdkCameraExposureMeteringHandler
Please construct the callback function of the camera exposure metering:
- Set the metering mode
- Get the current metering mode
- Set the metering object in the spot metering mode
- Obtain the metering object in the spot metering mode
NOTE Developer can not execute blocking style operations or functions in callback function, because that will block PSDK root thread, causing problems such as slow system response, payload disconnection or infinite loop.
typedef struct {
@brief Prototype of callback function used to set camera metering mode.
@param mode: camera metering mode.
@return Execution result.
T_PsdkReturnCode (*SetMeteringMode)(E_PsdkCameraMeteringMode mode);
@brief Prototype of callback function used to get camera current metering mode.
@param mode: pointer to memory space used to store camera metering mode.
@return Execution result.
T_PsdkReturnCode (*GetMeteringMode)(E_PsdkCameraMeteringMode *mode);
@brief Prototype of callback function used to set camera spot metering target area.
@param target: camera spot metering target area.
@return Execution result. T_PsdkReturnCode (*SetSpotMeteringTarget)(T_PsdkCameraSpotMeteringTarget target);
@brief Prototype of callback function used to get camera spot metering target area.
@param target: pointer to memory space used to store camera spot metering target area.
@return Execution result. T_PsdkReturnCode (*GetSpotMeteringTarget)(T_PsdkCameraSpotMeteringTarget *target);
} T_PsdkCameraExposureMeteringHandler;
typedef struct T_PsdkCameraFocusHandler
Please construct the callback function of the camera focus:
- Set the focus mode
- Get the current focus mode
- Set the focus area
- Obtain the focus area
- Set focus assistant
- Get the status of the focus assistant
- Set the value of the focus ring
- Get the value of the focus ring
- Get the upper limit value of the focus ring
NOTE Developer can not execute blocking style operations or functions in callback function, because that will block PSDK root thread, causing problems such as slow system response, payload disconnection or infinite loop.
typedef struct {
@brief Prototype of callback function used to set camera focus mode.
@param mode: camera focus mode.
@return Execution result.
T_PsdkReturnCode (*SetFocusMode)(E_PsdkCameraFocusMode mode);
@brief Prototype of callback function used to get camera current focus mode.
@param mode: pointer to memory space used to store camera focus mode.
@return Execution result.
T_PsdkReturnCode (*GetFocusMode)(E_PsdkCameraFocusMode *mode);
@brief Prototype of callback function used to set camera focus target area.
@param target: camera focus target area.
@return Execution result.
T_PsdkReturnCode (*SetFocusTarget)(T_PsdkCameraPointInScreen target);
@brief Prototype of callback function used to get camera focus target area.
@param target: pointer to memory space used to store camera focus target area.
@return Execution result.
T_PsdkReturnCode (*GetFocusTarget)(T_PsdkCameraPointInScreen *target);
@brief Prototype of callback function used to set camera focus assistant settings.
@param settings: camera focus assistant settings.
@return Execution result.
T_PsdkReturnCode (*SetFocusAssistantSettings)(T_PsdkCameraFocusAssistantSettings settings);
@brief Prototype of callback function used to get camera focus assistant settings.
@param settings: pointer to memory space used to store camera focus assistant settings.
@return Execution result.
T_PsdkReturnCode (*GetFocusAssistantSettings)(T_PsdkCameraFocusAssistantSettings *settings);
@brief Prototype of callback function used to set camera focus ring value.
@param value: camera focus ring value.
@return Execution result.
T_PsdkReturnCode (*SetFocusRingValue)(uint32_t value);
@brief Prototype of callback function used to get camera focus ring value.
@param value: pointer to memory space used to store camera focus ring value.
@return Execution result.
T_PsdkReturnCode (*GetFocusRingValue)(uint32_t *value);
@brief Prototype of callback function used to get camera focus upper bound ring value.
@param value: pointer to memory space used to store camera focus upper bound value.
@return Execution result.
T_PsdkReturnCode (*GetFocusRingValueUpperBound)(uint32_t *value);
} T_PsdkCameraFocusHandler;
typedef struct T_PsdkCameraDigitalZoomHandler
Please construct the callback function of the camera digital zoom:
- Set the callback function of the digital zoom factor
- Get the callback function of the digital zoom factor
NOTE Developer can not execute blocking style operations or functions in callback function, because that will block PSDK root thread, causing problems such as slow system response, payload disconnection or infinite loop.
typedef struct {
@brief Prototype of callback function used to set camera digital zoom factor.
@param factor: camera digital zoom factor.
@return Execution result.
T_PsdkReturnCode (*SetDigitalZoomFactor)(psdk_f32_t factor);
@brief Prototype of callback function used to get camera current digital zoom factor.
@param factor: pointer to memory space used to store camera current digital zoom factor.
@return Execution result.
T_PsdkReturnCode (*GetDigitalZoomFactor)(psdk_f32_t *factor);
} T_PsdkCameraDigitalZoomHandler;
typedef struct T_PsdkCameraOpticalZoomHandler
Please construct the callback function of the camera optical zoom:
- Set the focal length of the optical zoom
- Obtain the focal length of the optical zoom
- Obtain the optical zoom
- Get the current optical zoom multiple
- Control the camera start to continuous optical zoom
- Control camera stop continuous optical zoom
NOTE Developer can not execute blocking style operations or functions in callback function, because that will block PSDK root thread, causing problems such as slow system response, payload disconnection or infinite loop.
typedef struct {
@brief Prototype of callback function used to set camera optical zoom focal length.
@param focalLength: camera optical zoom focal length.
@return Execution result.
T_PsdkReturnCode (*SetOpticalZoomFocalLength)(uint32_t focalLength);
@brief Prototype of callback function used to get camera optical zoom focal length.
@param focalLength: pointer to memory space used to store camera optical zoom focal length.
@return Execution result.
T_PsdkReturnCode (*GetOpticalZoomFocalLength)(uint32_t *focalLength);
@brief Prototype of callback function used to get camera optical zoom factor.
@param factor: pointer to memory space used to store camera optical zoom factor.
@return Execution result.
T_PsdkReturnCode (*GetOpticalZoomFactor)(psdk_f32_t *factor);
@brief Prototype of callback function used to get camera optical zoom specifies.
@param spec: pointer to memory space used to store camera optical zoom specifies.
@return Execution result.
T_PsdkReturnCode (*GetOpticalZoomSpec)(T_PsdkCameraOpticalZoomSpec *spec);
@brief Prototype of callback function used to start continuous optical zoom.
@param direction: camera zoom direction.
@param speed: camera zoom speed.
@return Execution result.
T_PsdkReturnCode (*StartContinuousOpticalZoom)(E_PsdkCameraZoomDirection direction, E_PsdkCameraZoomSpeed speed);
@brief Prototype of callback function used to stop continuous optical zoom.
@return Execution result.
T_PsdkReturnCode (*StopContinuousOpticalZoom)(void);
} T_PsdkCameraOpticalZoomHandler;
typedef struct T_PsdkCameraMediaDownloadPlaybackHandler
Please construct the callback function of the camera media download and playback:
- Get the path of media files which in the payload
- Obtain the information of the specified media file which in the payload
- Get the specified media file (source file) which in the payload
- Create thumbnails for the media files specified which in the payload
- Get the thumbnail information created which in the payload
- Get the thumbnails created which in the payload
- Destroy the thumbnails created for the specified media files which in the payload
- Create screenshots for the media files specified which in the payload
- Obtain the screenshots created which in the payload
- Obtain the screenshot information created which in the payload
- Destroy the screenshots created for the specified media files which in the payload
- Notify users to start downloading media files
- Notify users to stop downloading media files
- Delete the media files specified by the user which in the payload
- Get the playback status of media files which in the payload
- Set the path of the media file to be played back which in the payload
- Control the payload to start playback of the specified media file in playback mode
- Control the payload to stop playing the specified media file in the playback mode
- Control the payload to pause playback of the specified media file in playback mode
- Control the payload to play back the specified media file from the specified position in the playback mode
NOTE Developer 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.
@brief Prototype of callback function used to get camera media file path.
@warning The maximum length of path that users can pass in is 256, including end character '\0'.
@param dirPath: pointer to memory space used to store camera media file path.
@return Execution result.
T_PsdkReturnCode (*GetMediaFileDir)(char *dirPath);
@brief Prototype of callback function used to get the file info of the selected origin media file.
@param dirPath: pointer to memory space used to store camera current media file path.
@param fileInfo: pointer to memory space used to store file info of the selected origin media file.
@return Execution result.
T_PsdkReturnCode (*GetMediaFileOriginInfo)(const char *filePath, T_PsdkCameraMediaFileInfo *fileInfo);
@brief Prototype of callback function used to get the data of the selected origin media file.
@param dirPath: pointer to memory space used to store camera current media file path.
@param offset: the offset of origin file data that need get from the selected media file.
@param length: the length of origin file data that need get from the selected media file.
@param data: pointer to memory space used to store the selected origin media file.
@return Execution result.
T_PsdkReturnCode (*GetMediaFileOriginData)(const char *filePath, uint32_t offset, uint32_t length, uint8_t *data);
@brief Prototype of callback function used to create the thumb nail of selected media file.
@param dirPath: pointer to memory space used to store camera current media file path.
@return Execution result.
T_PsdkReturnCode (*CreateMediaFileThumbNail)(const char *filePath);
@brief Prototype of callback function used to get the file info of the created thumbnail.
@param dirPath: pointer to memory space used to store camera current media file path.
@param fileInfo: pointer to memory space used to store file info of the created thumbnail.
@return Execution result.
T_PsdkReturnCode (*GetMediaFileThumbNailInfo)(const char *filePath, T_PsdkCameraMediaFileInfo *fileInfo);
@brief Prototype of callback function used to get the data of the created thumbnail.
@param dirPath: pointer to memory space used to store camera current media file path.
@param offset: the offset of thumb nail data that need get from the selected media file.
@param length: the length of thumb nail data that need get from the selected media file.
@param data: pointer to memory space used to store the created thumbnail data.
@return Execution result.
T_PsdkReturnCode (*GetMediaFileThumbNailData)(const char *filePath, uint32_t offset, uint32_t length,
uint8_t *data);
@brief Prototype of callback function used to destroy the created thumb nail of selected media file.
@param dirPath: pointer to memory space used to store camera current media file path.
@return Execution result.
T_PsdkReturnCode (*DestroyMediaFileThumbNail)(const char *filePath);
@brief Prototype of callback function used to create the screen nail of selected media file.
@param dirPath: pointer to memory space used to store camera current media file path.
@return Execution result.
T_PsdkReturnCode (*CreateMediaFileScreenNail)(const char *filePath);
@brief Prototype of callback function used to get the data of the created screen nail.
@param dirPath: pointer to memory space used to store camera current media file path.
@param offset: the offset of screen nail data that need get from selected media file.
@param length: the length of screen nail data that need get from selected media file.
@param data: pointer to memory space used to store the created screen nail data.
@return Execution result.
T_PsdkReturnCode (*GetMediaFileScreenNailData)(const char *filePath, uint32_t offset, uint32_t length,
uint8_t *data);
@brief Prototype of callback function used to get the file info of the created screen nail.
@param dirPath: pointer to memory space used to store camera current media file path.
@param fileInfo: pointer to memory space used to store file info of the created screen nail.
@return Execution result.
T_PsdkReturnCode (*GetMediaFileScreenNailInfo)(const char *filePath, T_PsdkCameraMediaFileInfo *fileInfo);
@brief Prototype of callback function used to destroy the created screen nail of selected media file.
@param dirPath: pointer to memory space used to store camera current media file path.
@return Execution result.
T_PsdkReturnCode (*DestroyMediaFileScreenNail)(const char *filePath);
@brief Prototype of callback function used to notification when download starting.
@note You can adjust the bandwidth proportion of each high speed channel in the notification callback.
@return Execution result.
T_PsdkReturnCode (*StartDownloadNotification)(void);
@brief Prototype of callback function used to notification when download stoping.
@note You can adjust the bandwidth proportion of each high speed channel in the notification callback.
@return Execution result.
T_PsdkReturnCode (*StopDownloadNotification)(void);
@brief Prototype of callback function used to delete the user's media files.
@param filePath: pointer to memory space used to store camera current media file path.
@return Execution result.
T_PsdkReturnCode (*DeleteMediaFile)(char *filePath);
@brief Prototype of callback function used to get camera media playback status.
@param status: pointer to memory space used to store camera media file path.
@return Execution result.
T_PsdkReturnCode (*GetMediaPlaybackStatus)(T_PsdkCameraPlaybackStatus *status);
@brief Prototype of callback function used to set the file path of media file that need playback.
@param filePath: pointer to memory space used to store the file path of media file that need playback.
@return Execution result.
T_PsdkReturnCode (*SetMediaPlaybackFile)(const char *filePath);
@brief Prototype of callback function used to start media video playback when camera work in playback mode.
@return Execution result.
T_PsdkReturnCode (*StartMediaPlayback)(void);
@brief Prototype of callback function used to stop media video playback when camera work in playback mode.
@return Execution result.
T_PsdkReturnCode (*StopMediaPlayback)(void);
@brief Prototype of callback function used to pause media video playback when camera work in playback mode.
@return Execution result.
T_PsdkReturnCode (*PauseMediaPlayback)(void);
@brief Prototype of callback function used to seek to the playback position of media video when camera work in playback mode.
@param playbackPosition: playback position of video media, unit: ms.
@return Execution result.
T_PsdkReturnCode (*SeekMediaPlayback)(uint32_t playbackPosition);
} T_PsdkCameraMediaDownloadPlaybackHandler;
typedef struct T_PsdkCameraTapZoomHandler
Please construct the callback function of the camera tap zoom:
- Get the status of the camera zoom
- Turn on or off the camera zoom
- Obtain the status of the camera's pointing zoom
- Set the magnification of camera zoom
- Get the pointing zoom of camera
- Trigger the payload to perform pointing zoom
NOTE Developer can not execute blocking style operations or functions in callback function, like PsdkXPort_RotateSync() function, because that will block PSDK root thread, causing problems such as slow system response, payload disconnection or infinite loop.
typedef struct {
@brief Prototype of callback function used to get tap zoom state.
@param state: pointer to memory space used to store tap zoom state.
@return Execution result.
T_PsdkReturnCode (*GetTapZoomState)(T_PsdkCameraTapZoomState *state);
@brief Prototype of callback function used to enable or disable tap zoom function.
@details PSDK application should response tap zoom command only if tap zoom function is enabled.
@param enabledFlag: enabled flag.
@return Execution result.
T_PsdkReturnCode (*SetTapZoomEnabled)(bool enabledFlag);
@brief Prototype of callback function used to get the flag that specifies whether tap zoom function has been enabled,
@param enabledFlag: pointer to memory space used to store enabled flag.
@return Execution result.
T_PsdkReturnCode (*GetTapZoomEnabled)(bool *enabledFlag);
@brief Prototype of callback function used to set multiplier of single tap zoom.
@param multiplier: multiplier of single tap zoom.
@return Execution result.
T_PsdkReturnCode (*SetTapZoomMultiplier)(uint8_t multiplier);
@brief Prototype of callback function used to get multiplier of single tap zoom.
@param multiplier: pointer to memory space use to store multiplier of single tap zoom.
@return Execution result.
T_PsdkReturnCode (*GetTapZoomMultiplier)(uint8_t *multiplier);
@brief Prototype of callback function used to trigger tap zoom.
@details Users trigger tap zoom in screen of mobile end, this callback function will be called. Then, PSDK application should rotate gimbal to orientation of target point and zoom by specified multiplier.
@param target: position information of target point in screen.
@return Execution result.
T_PsdkReturnCode (*TapZoomAtTarget)(T_PsdkCameraPointInScreen target);
} T_PsdkCameraTapZoomHandler;
Function
function PsdkPayloadCamera_Init
Function:Initialize the PSDK's camera module. | product:all |
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 payload 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.
T_PsdkReturnCode PsdkPayloadCamera_Init(void);
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkPayloadCamera_RegCommonHandler
Function:Register the payload's camera common functions | product:all |
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.
T_PsdkReturnCode PsdkPayloadCamera_RegCommonHandler(const T_PsdkCameraCommonHandler *cameraCommonHandler);
cameraCommonHandler:pointer to the handler for payload camera common functions.
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkPayloadCamera_RegExposureMeteringHandler
Function: Register the function for payload exposure and metering. | product:all |
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.
T_PsdkReturnCode PsdkPayloadCamera_RegExposureMeteringHandler(const T_PsdkCameraExposureMeteringHandler
*cameraExposureMeteringHandler);
function PsdkPayloadCamera_RegFocusHandler
Function: Register the handler for payload focus | product:all |
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.
T_PsdkReturnCode PsdkPayloadCamera_RegFocusHandler(const T_PsdkCameraFocusHandler *cameraFocusHandler);
cameraFocusHandler: pointer to the handler for payload camera focus functions.
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkPayloadCamera_RegDigitalZoomHandler
Function:Register the handler for payload digital zoom | product:all |
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.
T_PsdkReturnCode PsdkPayloadCamera_RegDigitalZoomHandler(const T_PsdkCameraDigitalZoomHandler
*cameraDigitalZoomHandler);
cameraDigitalZoomHandler:pointer to the handler for payload camera digital zoom functions.
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkPayloadCamera_RegOpticalZoomHandler
Function:Register the handler for payload optical zoom | product:all |
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.
T_PsdkReturnCode PsdkPayloadCamera_RegOpticalZoomHandler(const T_PsdkCameraOpticalZoomHandler
*cameraOpticalZoomHandler);
cameraOpticalZoomHandler: pointer to the handler for payload camera optical zoom functions.
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkPayloadCamera_RegTapZoomHandler
Function: Register handler functions for payload tap zoom | product:all |
Register handler functions for payload camera tap zoom function.
T_PsdkReturnCode PsdkPayloadCamera_RegTapZoomHandler(const T_PsdkCameraTapZoomHandler *cameraTapZoomHandler);
cameraTapZoomHandler:pointer to structure of handler functions for tap zoom function.
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkPayloadCamera_RegMediaDownloadPlaybackHandler
Function:Register the handler for media download and playback | product:all |
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.
T_PsdkReturnCode PsdkPayloadCamera_RegMediaDownloadPlaybackHandler(const T_PsdkCameraMediaDownloadPlaybackHandler
*cameraMediaHandler);
cameraMediaHandler: pointer to the handler for payload camera media download and playback functions.
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkPayloadCamera_SendVideoStream
Function:Send the video to mobile | product:all |
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.
T_PsdkReturnCode PsdkPayloadCamera_SendVideoStream(const uint8_t *data, uint16_t len);
data:pointer to data to be sent.
len:length of data to be sent via data stream, and it must be less than or equal to 65000, unit: byte.
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkPayloadCamera_GetVideoStreamState
Function:Get data transmission state of "videoStream" channel | product:all |
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.
T_PsdkReturnCode PsdkPayloadCamera_GetVideoStreamState(T_PsdkDataChannelState *state);
state: pointer to "videoStream" channel state.
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkPayloadCamera_SetVideoStreamType
Function:Set camera video stream type | product:all |
Set the type of camera video stream.
NOTE 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.
T_PsdkReturnCode PsdkPayloadCamera_SetVideoStreamType(E_PsdkCameraVideoStreamType videoStreamType);
videoStreamType:camera video stream type.
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkPayloadCamera_GetVideoStreamRemoteAddress
Function:Get video stream remote address | product:all |
Get the network remote address for sending camera video stream. You can get this info for another system to send the video stream.
NOTE This interface should be used after calling PsdkCore_Init function.
T_PsdkReturnCode PsdkPayloadCamera_GetVideoStreamRemoteAddress(char *ipAddr, uint16_t *port);
ipAddr: the remote ip address for sending camera video stream.
port: the remote port for sending camera video stream.
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkPayloadCamera_PushAddedMediaFileInfo
Function:Push added media file information | product:all |
Push added media file information to aircraft system.
T_PsdkReturnCode
PsdkPayloadCamera_PushAddedMediaFileInfo(const char *filePath, T_PsdkCameraMediaFileInfo mediaFileInfo);
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.
mediaFileInfo: information of added media file.
Return
The details for the return code please refer to:PsdkErrorCode