NEW: release DJI Payload-SDK version 3.7
Signed-off-by: Martin <Martin@dji.com>
This commit is contained in:
@ -70,6 +70,7 @@ static const char *s_cameraManagerSampleSelectList[] = {
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_FFC_MODE_AND_TRRIGER] = "Set FFC mode and trriger a FFC |",
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_GAIN_MODE] = "Set infrared camera gain mode |",
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_GET_CAMERA_STATUS] = "Get camera status, capturing & recording status etc |",
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SUBSCRIBE_POINT_CLOUD] = "Subscribe point cloud |",
|
||||
};
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
#include "dji_flight_controller.h"
|
||||
#include "dji_logger.h"
|
||||
#include "dji_fc_subscription.h"
|
||||
#include "cmath"
|
||||
|
||||
#ifdef OPEN_CV_INSTALLED
|
||||
|
||||
@ -814,6 +815,8 @@ static T_DjiReturnCode DjiUser_FlightControlUpdateConfig(void)
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
}
|
||||
|
||||
memset(jsonData, 0, fileSize);
|
||||
|
||||
UtilFile_GetFileDataByPath(tempFileDirPath, 0, fileSize, jsonData, &readRealSize);
|
||||
|
||||
jsonData[readRealSize] = '\0';
|
||||
|
||||
@ -40,9 +40,17 @@
|
||||
#include "../manifold2/hal/hal_uart.h"
|
||||
#include "../manifold2/hal/hal_network.h"
|
||||
|
||||
#include <gimbal_emu/test_payload_gimbal_emu.h>
|
||||
#include <camera_emu/test_payload_cam_emu_media.h>
|
||||
#include <camera_emu/test_payload_cam_emu_base.h>
|
||||
#include "widget/test_widget.h"
|
||||
#include "widget/test_widget_speaker.h"
|
||||
#include <power_management/test_power_management.h>
|
||||
#include "data_transmission/test_data_transmission.h"
|
||||
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
#define DJI_LOG_PATH "Logs/DJI"
|
||||
#define DJI_LOG_INDEX_FILE_NAME "Logs/latest"
|
||||
#define DJI_LOG_INDEX_FILE_NAME "Logs/index"
|
||||
#define DJI_LOG_FOLDER_NAME "Logs"
|
||||
#define DJI_LOG_PATH_MAX_SIZE (128)
|
||||
#define DJI_LOG_FOLDER_NAME_MAX_SIZE (32)
|
||||
@ -63,6 +71,8 @@ static FILE *s_djiLogFileCnt;
|
||||
|
||||
/* Private functions declaration ---------------------------------------------*/
|
||||
static void DjiUser_NormalExitHandler(int signalNum);
|
||||
static T_DjiReturnCode DjiTest_HighPowerApplyPinInit();
|
||||
static T_DjiReturnCode DjiTest_WriteHighPowerApplyPin(E_DjiPowerManagementPinState pinState);
|
||||
|
||||
/* Exported functions definition ---------------------------------------------*/
|
||||
Application::Application(int argc, char **argv)
|
||||
@ -266,7 +276,8 @@ void Application::DjiUser_ApplicationStart()
|
||||
throw std::runtime_error("Get aircraft base info error.");
|
||||
}
|
||||
|
||||
if (aircraftInfoBaseInfo.mountPosition != DJI_MOUNT_POSITION_EXTENSION_PORT) {
|
||||
if (aircraftInfoBaseInfo.mountPosition != DJI_MOUNT_POSITION_EXTENSION_PORT
|
||||
&& DJI_MOUNT_POSITION_EXTENSION_LITE_PORT != aircraftInfoBaseInfo.mountPosition) {
|
||||
throw std::runtime_error("Please run this sample on extension port.");
|
||||
}
|
||||
|
||||
@ -285,6 +296,65 @@ void Application::DjiUser_ApplicationStart()
|
||||
throw std::runtime_error("Set serial number error");
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MODULE_SAMPLE_CAMERA_EMU_ON
|
||||
returnCode = DjiTest_CameraEmuBaseStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("camera emu common init error");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MODULE_SAMPLE_CAMERA_MEDIA_ON
|
||||
returnCode = DjiTest_CameraEmuMediaStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("camera emu media init error");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MODULE_SAMPLE_GIMBAL_EMU_ON
|
||||
returnCode = DjiTest_GimbalStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("psdk gimbal init error");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MODULE_SAMPLE_WIDGET_ON
|
||||
returnCode = DjiTest_WidgetStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("widget sample init error");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MODULE_SAMPLE_WIDGET_SPEAKER_ON
|
||||
returnCode = DjiTest_WidgetSpeakerStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("widget speaker test init error");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MODULE_SAMPLE_POWER_MANAGEMENT_ON
|
||||
T_DjiTestApplyHighPowerHandler applyHighPowerHandler = {
|
||||
.pinInit = DjiTest_HighPowerApplyPinInit,
|
||||
.pinWrite = DjiTest_WriteHighPowerApplyPin,
|
||||
};
|
||||
|
||||
returnCode = DjiTest_RegApplyHighPowerHandler(&applyHighPowerHandler);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("regsiter apply high power handler error");
|
||||
}
|
||||
|
||||
returnCode = DjiTest_PowerManagementStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("power management init error");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MODULE_SAMPLE_DATA_TRANSMISSION_ON
|
||||
returnCode = DjiTest_DataTransmissionStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("widget sample init error");
|
||||
}
|
||||
#endif
|
||||
|
||||
returnCode = DjiCore_ApplicationStart();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
throw std::runtime_error("Start sdk application error.");
|
||||
@ -440,6 +510,8 @@ T_DjiReturnCode Application::DjiUser_LocalWriteFsInit(const char *path)
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(systemCmd, "ln -sfrv %s " DJI_LOG_FOLDER_NAME "/latest.log", filePath);
|
||||
system(systemCmd);
|
||||
return djiReturnCode;
|
||||
}
|
||||
|
||||
@ -449,4 +521,15 @@ static void DjiUser_NormalExitHandler(int signalNum)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static T_DjiReturnCode DjiTest_HighPowerApplyPinInit()
|
||||
{
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static T_DjiReturnCode DjiTest_WriteHighPowerApplyPin(E_DjiPowerManagementPinState pinState)
|
||||
{
|
||||
//attention: please pull up the HWPR pin state by hardware.
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/
|
||||
|
||||
@ -125,6 +125,8 @@ static T_DjiReturnCode DjiUserConfigManager_GetAppInfoInner(const char *path, T_
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
memset(jsonData, 0, fileSize);
|
||||
|
||||
UtilFile_GetFileDataByPath(path, 0, fileSize, jsonData, &readRealSize);
|
||||
|
||||
jsonData[readRealSize] = '\0';
|
||||
@ -223,6 +225,8 @@ static T_DjiReturnCode DjiUserConfigManager_GetLinkConfigInner(const char *path,
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
memset(jsonData, 0, fileSize);
|
||||
|
||||
UtilFile_GetFileDataByPath(path, 0, fileSize, jsonData, &readRealSize);
|
||||
|
||||
jsonData[readRealSize] = '\0';
|
||||
|
||||
@ -42,6 +42,18 @@ extern "C" {
|
||||
* */
|
||||
#define CONFIG_HARDWARE_CONNECTION DJI_USE_ONLY_UART
|
||||
|
||||
/*!< Attention: Select the sample you want to run here.
|
||||
* */
|
||||
#define CONFIG_MODULE_SAMPLE_GIMBAL_EMU_ON
|
||||
|
||||
#define CONFIG_MODULE_SAMPLE_WIDGET_ON
|
||||
|
||||
#define CONFIG_MODULE_SAMPLE_WIDGET_SPEAKER_ON
|
||||
|
||||
#define CONFIG_MODULE_SAMPLE_POWER_MANAGEMENT_ON
|
||||
|
||||
#define CONFIG_MODULE_SAMPLE_DATA_TRANSMISSION_ON
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
{
|
||||
"dji_sdk_app_info": {
|
||||
"user_app_name": "PSDK_APPNAME",
|
||||
"user_app_id": "53453",
|
||||
"user_app_key": "871bf75511531682636f0db7243a9e7",
|
||||
"user_app_license": "BO86stxOf200Sv9FMEZUSFCZhJhWxKG1jVYBACSnFvz42nnWEnc8vU+GKGHc/OUTxuFH+5TizymlZkuIxq6WAonqut3Y58KAcmTU6HHCVCW5HJSidwbNv0Gf3Gm+O7tc18lpHiSNRr/uEbSTJeVPkshOlcEEwpSc4tUUlRBb37BkUpZQFAPKaykyznLdxdYDlFh5OAqSl6kLltdt+A3/VOiZavKfsKHM7J9jbjsTDETe3fRRRiauE5K+s8yO6uAFLE0fwHWnanl7gPkzgNJJ53qVqnKiGwEtlim5E8WvnnaiEoxLOWrDijFOEmh9tLOU7Kx/oDEM2l9O/idaqmLxKA==",
|
||||
"user_develop_account": "payloadsdk_account@163.com",
|
||||
"user_baud_rate": "921600"
|
||||
"user_app_name": "your_app_name",
|
||||
"user_app_id": "your_app_id",
|
||||
"user_app_key": "your_app_key",
|
||||
"user_app_license": "your_app_license",
|
||||
"user_develop_account": "your_developer_account",
|
||||
"user_baud_rate": "460800"
|
||||
},
|
||||
"dji_sdk_link_config": {
|
||||
"link_available": "use_only_uart/use_uart_and_usb_bulk_device/use_uart_and_network_device",
|
||||
|
||||
@ -49,8 +49,6 @@
|
||||
/* Private values -------------------------------------------------------------*/
|
||||
|
||||
/* Private functions declaration ---------------------------------------------*/
|
||||
static T_DjiReturnCode DjiTest_HighPowerApplyPinInit();
|
||||
static T_DjiReturnCode DjiTest_WriteHighPowerApplyPin(E_DjiPowerManagementPinState pinState);
|
||||
|
||||
/* Exported functions definition ---------------------------------------------*/
|
||||
int main(int argc, char **argv)
|
||||
@ -71,14 +69,8 @@ start:
|
||||
<< "| [a] Gimbal manager sample - you can control gimbal by PSDK |\n"
|
||||
<< "| [c] Camera stream view sample - display the camera video stream |\n"
|
||||
<< "| [d] Stereo vision view sample - display the stereo image |\n"
|
||||
<< "| [e] Start camera all features sample - you can operate the camera on DJI Pilot |\n"
|
||||
<< "| [f] Start gimbal all features sample - you can operate the gimbal on DJI Pilot |\n"
|
||||
<< "| [g] Start widget all features sample - you can operate the widget on DJI Pilot |\n"
|
||||
<< "| [h] Start widget speaker sample - you can operate the speaker on DJI Pilot2 |\n"
|
||||
<< "| [i] Start power management sample - you will see notification when aircraft power off |\n"
|
||||
<< "| [j] Start data transmission sample - you can send or recv custom data on MSDK demo |\n"
|
||||
<< "| [k] Run camera manager sample - you can test camera's functions interactively |\n"
|
||||
<< "| [l] Start rtk positioning sample - you can receive rtk rtcm data when rtk signal is ok |\n"
|
||||
<< "| [e] Run camera manager sample - you can test camera's functions interactively |\n"
|
||||
<< "| [f] Start rtk positioning sample - you can receive rtk rtcm data when rtk signal is ok |\n"
|
||||
<< std::endl;
|
||||
|
||||
std::cin >> inputChar;
|
||||
@ -102,79 +94,9 @@ start:
|
||||
DjiUser_RunStereoVisionViewSample();
|
||||
break;
|
||||
case 'e':
|
||||
returnCode = DjiTest_CameraEmuBaseStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("camera emu common init error");
|
||||
break;
|
||||
}
|
||||
|
||||
if (DjiPlatform_GetSocketHandler() != nullptr) {
|
||||
returnCode = DjiTest_CameraEmuMediaStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("camera emu media init error");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Start camera all feautes sample successfully");
|
||||
break;
|
||||
case 'f':
|
||||
if (DjiTest_GimbalStartService() != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("psdk gimbal init error");
|
||||
break;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Start gimbal all feautes sample successfully");
|
||||
break;
|
||||
case 'g':
|
||||
returnCode = DjiTest_WidgetStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("widget sample init error");
|
||||
break;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Start widget all feautes sample successfully");
|
||||
break;
|
||||
case 'h':
|
||||
returnCode = DjiTest_WidgetSpeakerStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("widget speaker test init error");
|
||||
break;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Start widget speaker sample successfully");
|
||||
break;
|
||||
case 'i':
|
||||
applyHighPowerHandler.pinInit = DjiTest_HighPowerApplyPinInit;
|
||||
applyHighPowerHandler.pinWrite = DjiTest_WriteHighPowerApplyPin;
|
||||
|
||||
returnCode = DjiTest_RegApplyHighPowerHandler(&applyHighPowerHandler);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("regsiter apply high power handler error");
|
||||
break;
|
||||
}
|
||||
|
||||
returnCode = DjiTest_PowerManagementStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("power management init error");
|
||||
break;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Start power management sample successfully");
|
||||
break;
|
||||
case 'j':
|
||||
returnCode = DjiTest_DataTransmissionStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("data transmission sample init error");
|
||||
break;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Start data transmission sample successfully");
|
||||
break;
|
||||
case 'k':
|
||||
DjiUser_RunCameraManagerSample();
|
||||
break;
|
||||
case 'l':
|
||||
case 'f':
|
||||
returnCode = DjiTest_PositioningStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("rtk positioning sample init error");
|
||||
@ -193,15 +115,5 @@ start:
|
||||
}
|
||||
|
||||
/* Private functions definition-----------------------------------------------*/
|
||||
static T_DjiReturnCode DjiTest_HighPowerApplyPinInit()
|
||||
{
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static T_DjiReturnCode DjiTest_WriteHighPowerApplyPin(E_DjiPowerManagementPinState pinState)
|
||||
{
|
||||
//attention: please pull up the HWPR pin state by hardware.
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/
|
||||
|
||||
Reference in New Issue
Block a user