NEW: release DJI Payload-SDK version 3.6
Signed-off-by: DJI-Martin <DJI-Martin@dji.com>
This commit is contained in:
@ -54,6 +54,22 @@ static const char *s_cameraManagerSampleSelectList[] = {
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_THERMOMETRY] = "Thermometry test |",
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_GET_LIDAR_RANGING_INFO] = "Get lidar ranging info |",
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_IR_CAMERA_ZOOM_PARAM] = "Set ir camera zoom param |",
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_NIGHT_SCENE_MODE] = "Set night scene mode |",
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_CAPTURE_RECORDING_STREAMS] = "Set capture or recording streams storage type |",
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SHOW_STORAGE_INFO] = "Show storage info |",
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_FORMAT_SD_CARD] = "Format SD card |",
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_LINK_ZOOM] = "Set synchronized split screen zoom |",
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_USER_CUSTOM_DIR_FILE_NAME] = "Set custom directory or file name of media file |",
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_RESET_CAMERA_SETTINGS] = "Reset camera settings |",
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_AE_LOCK_MODE] = "Set AE lock mode |",
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_FOCUS_RING_VALUE] = "Set focus ring value |",
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_CONNECT_STATUS_TEST] = "Camera connect status test |",
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_GET_PHOTO_VIDEO_PARAM] = "Set camera photo and video storage param |",
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_METERING_MODE] = "Set camera metering mode |",
|
||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_METERING_POINT] = "Set and get camera metering point |",
|
||||
[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 |",
|
||||
};
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
|
||||
@ -0,0 +1,68 @@
|
||||
{
|
||||
"rc_lost_action": {
|
||||
"desc_cn": "失控行为",
|
||||
"desc_en": "rc lost action",
|
||||
"desc_range": "go_home/hover/landing",
|
||||
"value": "go_home"
|
||||
},
|
||||
"go_home_altitude": {
|
||||
"desc_cn": "返航高度",
|
||||
"desc_en": "go home altitude",
|
||||
"desc_range": "0 - 1500",
|
||||
"value": 60
|
||||
},
|
||||
"flying_speed": {
|
||||
"desc_cn": "飞行速度",
|
||||
"desc_en": "flying speed",
|
||||
"desc_range": "0 - 10",
|
||||
"value": 5.0
|
||||
},
|
||||
"home_point_latitude": {
|
||||
"desc_cn": "home点纬度",
|
||||
"desc_en": "home point latitude",
|
||||
"desc_range": "-90 - 90",
|
||||
"value": 22.5425
|
||||
},
|
||||
"home_point_longitude": {
|
||||
"desc_cn": "home点经度",
|
||||
"desc_en": "home point longitude",
|
||||
"desc_range": "-180 - 180",
|
||||
"value": 113.9575
|
||||
},
|
||||
"rtk_enable": {
|
||||
"desc_cn": "RTK开关",
|
||||
"desc_en": "RTK Enable",
|
||||
"desc_range": "true/false",
|
||||
"value": "false"
|
||||
},
|
||||
"HorizontalVisualObstacleAvoidanceEnable": {
|
||||
"desc_cn": "水平视觉避障开关",
|
||||
"desc_en": "Horizontal Visual Avoidance",
|
||||
"desc_range": "true/false",
|
||||
"value": "false"
|
||||
},
|
||||
"HorizontalRadarObstacleAvoidanceEnable": {
|
||||
"desc_cn": "水平TOF避障开关",
|
||||
"desc_en": "Horizontal TOF Avoidance",
|
||||
"desc_range": "true/false",
|
||||
"value": "false"
|
||||
},
|
||||
"UpwardsVisualObstacleAvoidanceEnable": {
|
||||
"desc_cn": "上视觉避障开关",
|
||||
"desc_en": "Upwards Visual Avoidance",
|
||||
"desc_range": "true/false",
|
||||
"value": "false"
|
||||
},
|
||||
"UpwardsRadarObstacleAvoidanceEnable": {
|
||||
"desc_cn": "上TOF开关",
|
||||
"desc_en": "Upwards TOF Avoidance",
|
||||
"desc_range": "true/false",
|
||||
"value": "false"
|
||||
},
|
||||
"DownwardsVisualObstacleAvoidanceEnable": {
|
||||
"desc_cn": "下视觉避障开关",
|
||||
"desc_en": "Downwards Visual Avoidance",
|
||||
"desc_range": "true/false",
|
||||
"value": "false"
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,48 @@
|
||||
/**
|
||||
********************************************************************
|
||||
* @file test_flight_controller_command_flying.h
|
||||
* @brief This is the header file for "test_flight_controller_command_flying.c", defining the structure and
|
||||
* (exported) function prototypes.
|
||||
*
|
||||
* @copyright (c) 2018 DJI. All rights reserved.
|
||||
*
|
||||
* All information contained herein is, and remains, the property of DJI.
|
||||
* The intellectual and technical concepts contained herein are proprietary
|
||||
* to DJI and may be covered by U.S. and foreign patents, patents in process,
|
||||
* and protected by trade secret or copyright law. Dissemination of this
|
||||
* information, including but not limited to data and other proprietary
|
||||
* material(s) incorporated within the information, in any form, is strictly
|
||||
* prohibited without the express written consent of DJI.
|
||||
*
|
||||
* If you receive this source code without DJI’s 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 TEST_FLIGHT_CONTROLLER_COMMAND_FLYING_H
|
||||
#define TEST_FLIGHT_CONTROLLER_COMMAND_FLYING_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
void DjiUser_RunFlightControllerCommandFlyingSample(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // TEST_FLIGHT_CONTROLLER_COMMAND_FLYING_H
|
||||
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
|
||||
@ -0,0 +1,109 @@
|
||||
/**
|
||||
********************************************************************
|
||||
* @file test_flight_controller_entry.cpp
|
||||
* @brief
|
||||
*
|
||||
* @copyright (c) 2018 DJI. All rights reserved.
|
||||
*
|
||||
* All information contained herein is, and remains, the property of DJI.
|
||||
* The intellectual and technical concepts contained herein are proprietary
|
||||
* to DJI and may be covered by U.S. and foreign patents, patents in process,
|
||||
* and protected by trade secret or copyright law. Dissemination of this
|
||||
* information, including but not limited to data and other proprietary
|
||||
* material(s) incorporated within the information, in any form, is strictly
|
||||
* prohibited without the express written consent of DJI.
|
||||
*
|
||||
* If you receive this source code without DJI’s 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.
|
||||
*
|
||||
*********************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <iostream>
|
||||
#include <flight_control/test_flight_control.h>
|
||||
#include "test_flight_controller_entry.h"
|
||||
#include "dji_logger.h"
|
||||
#include "test_flight_controller_command_flying.h"
|
||||
#include <waypoint_v2/test_waypoint_v2.h>
|
||||
#include <waypoint_v3/test_waypoint_v3.h>
|
||||
#include <interest_point/test_interest_point.h>
|
||||
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
|
||||
/* Private values -------------------------------------------------------------*/
|
||||
|
||||
/* Private functions declaration ---------------------------------------------*/
|
||||
|
||||
/* Exported functions definition ---------------------------------------------*/
|
||||
void DjiUser_RunFlightControllerSample(void)
|
||||
{
|
||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||
char inputSelectSample;
|
||||
|
||||
start:
|
||||
osalHandler->TaskSleepMs(100);
|
||||
|
||||
std::cout
|
||||
<< "\n"
|
||||
<< "| Available commands: |\n"
|
||||
<< "| [0] Flight controller sample - control flying with keyboard |\n"
|
||||
<< "| [1] Flight controller sample - take off landing |\n"
|
||||
<< "| [2] Flight controller sample - take off position ctrl landing |\n"
|
||||
<< "| [3] Flight controller sample - take off go home force landing |\n"
|
||||
<< "| [4] Flight controller sample - take off velocity ctrl landing |\n"
|
||||
<< "| [5] Flight controller sample - arrest flying |\n"
|
||||
<< "| [6] Flight controller sample - set get parameters |\n"
|
||||
<< "| [7] Waypoint 2.0 sample - run airline mission by settings (only support on M300 RTK) |\n"
|
||||
<< "| [8] Waypoint 3.0 sample - run airline mission by kmz file (not support on M300 RTK) |\n"
|
||||
<< "| [9] Interest point sample - run interest point mission by settings (only support on M3E/M3T) |\n"
|
||||
<< std::endl;
|
||||
|
||||
std::cin >> inputSelectSample;
|
||||
switch (inputSelectSample) {
|
||||
case '0':
|
||||
DjiUser_RunFlightControllerCommandFlyingSample();
|
||||
goto start;
|
||||
case '1':
|
||||
DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_TAKE_OFF_LANDING);
|
||||
goto start;
|
||||
case '2':
|
||||
DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_TAKE_OFF_POSITION_CTRL_LANDING);
|
||||
goto start;
|
||||
case '3':
|
||||
DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_TAKE_OFF_GO_HOME_FORCE_LANDING);
|
||||
goto start;
|
||||
case '4':
|
||||
DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_TAKE_OFF_VELOCITY_CTRL_LANDING);
|
||||
goto start;
|
||||
case '5':
|
||||
DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_ARREST_FLYING);
|
||||
goto start;
|
||||
case '6':
|
||||
DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_SET_GET_PARAM);
|
||||
goto start;
|
||||
case '7':
|
||||
DjiTest_WaypointV2RunSample();
|
||||
break;
|
||||
case '8':
|
||||
DjiTest_WaypointV3RunSample();
|
||||
break;
|
||||
case '9':
|
||||
DjiTest_InterestPointRunSample();
|
||||
break;
|
||||
case 'q':
|
||||
break;
|
||||
default:
|
||||
USER_LOG_ERROR("Input command is invalid");
|
||||
goto start;
|
||||
}
|
||||
}
|
||||
|
||||
/* Private functions definition-----------------------------------------------*/
|
||||
|
||||
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/
|
||||
@ -0,0 +1,49 @@
|
||||
/**
|
||||
********************************************************************
|
||||
* @file test_flight_controller_entry.h
|
||||
* @brief This is the header file for "test_flight_controller_entry.c", defining the structure and
|
||||
* (exported) function prototypes.
|
||||
*
|
||||
* @copyright (c) 2018 DJI. All rights reserved.
|
||||
*
|
||||
* All information contained herein is, and remains, the property of DJI.
|
||||
* The intellectual and technical concepts contained herein are proprietary
|
||||
* to DJI and may be covered by U.S. and foreign patents, patents in process,
|
||||
* and protected by trade secret or copyright law. Dissemination of this
|
||||
* information, including but not limited to data and other proprietary
|
||||
* material(s) incorporated within the information, in any form, is strictly
|
||||
* prohibited without the express written consent of DJI.
|
||||
*
|
||||
* If you receive this source code without DJI’s 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 TEST_FLIGHT_CONTROLLER_ENTRY_H
|
||||
#define TEST_FLIGHT_CONTROLLER_ENTRY_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <gimbal_manager/test_gimbal_manager.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
void DjiUser_RunFlightControllerSample(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // TEST_FLIGHT_CONTROLLER_ENTRY_H
|
||||
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
|
||||
@ -29,7 +29,12 @@
|
||||
#include "test_gimbal_entry.hpp"
|
||||
#include "dji_logger.h"
|
||||
#include "utils/util_misc.h"
|
||||
#include "dji_gimbal.h"
|
||||
#include "dji_gimbal_manager.h"
|
||||
#include <iostream>
|
||||
#include "dji_aircraft_info.h"
|
||||
#include "dji_fc_subscription.h"
|
||||
#include <math.h>
|
||||
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
|
||||
@ -37,6 +42,11 @@
|
||||
typedef enum {
|
||||
E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_ROTATE_GIMBAL_ON_FREE_MODE,
|
||||
E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_ROTATE_GIMBAL_ON_YAW_FOLLOW_MODE,
|
||||
E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_SET_PITCH_RANGE_EXTENSION_MODE,
|
||||
E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_SET_CONTROLLER_MAX_SPEED_PERCENTAGE,
|
||||
E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_SET_CONTROLLER_SMOOTH_FACTOR,
|
||||
E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_RESET_GIMBAL_SETTINGS,
|
||||
E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_ROTATE_GIMBAL_BY_KEYBOARD,
|
||||
E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_QUIT,
|
||||
} E_DjiTestGimbalManagerSampleSelect;
|
||||
|
||||
@ -46,6 +56,16 @@ static const char *s_gimbalManagerSampleList[] = {
|
||||
"| [0] Gimbal manager sample - Rotate gimbal on free mode |",
|
||||
[E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_ROTATE_GIMBAL_ON_YAW_FOLLOW_MODE] =
|
||||
"| [1] Gimbal manager sample - Rotate gimbal on yaw follow mode |",
|
||||
[E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_SET_PITCH_RANGE_EXTENSION_MODE] =
|
||||
"| [2] Gimbal manager sample - Set pitch range extension mode |",
|
||||
[E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_SET_CONTROLLER_MAX_SPEED_PERCENTAGE] =
|
||||
"| [3] Gimbal manager sample - Set controller max speed percentage |",
|
||||
[E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_SET_CONTROLLER_SMOOTH_FACTOR] =
|
||||
"| [4] Gimbal manager sample - Set controller smooth factor |",
|
||||
[E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_RESET_GIMBAL_SETTINGS] =
|
||||
"| [5] Gimbal manager sample - Reset gimbal settings |",
|
||||
[E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_ROTATE_GIMBAL_BY_KEYBOARD] =
|
||||
"| [6] Gimbal manager sample - Rotate gimbal by keyboard input and read back value |",
|
||||
[E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_QUIT] =
|
||||
"| [q] Gimbal manager sample - Quit |",
|
||||
};
|
||||
@ -60,6 +80,7 @@ void DjiUser_RunGimbalManagerSample(void)
|
||||
char inputTestCase;
|
||||
char mountPosition;
|
||||
E_DjiMountPosition gimbalMountPosition;
|
||||
T_DjiReturnCode returnCode;
|
||||
|
||||
start:
|
||||
osalHandler->TaskSleepMs(100);
|
||||
@ -110,6 +131,297 @@ start:
|
||||
case '1':
|
||||
DjiTest_GimbalManagerRunSample(gimbalMountPosition, DJI_GIMBAL_MODE_YAW_FOLLOW);
|
||||
goto start;
|
||||
case '2': {
|
||||
int32_t enableFlag;
|
||||
|
||||
osalHandler->TaskSleepMs(10);
|
||||
printf("Input enable flag: ");
|
||||
scanf("%d", &enableFlag);
|
||||
|
||||
returnCode = DjiGimbalManager_Init();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Init gimbal manager error, return code 0x%08X", returnCode);
|
||||
return;
|
||||
}
|
||||
|
||||
returnCode = DjiGimbalManager_SetPitchRangeExtensionEnabled(gimbalMountPosition, (bool)enableFlag);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Failed!");
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Set gimbal's pitch range extension mode as %d successfully!", enableFlag);
|
||||
|
||||
goto start;
|
||||
break;
|
||||
}
|
||||
case '3': {
|
||||
int32_t percentage;
|
||||
|
||||
osalHandler->TaskSleepMs(10);
|
||||
printf("Input max speed percentage of yaw axis: ");
|
||||
scanf("%d", &percentage);
|
||||
|
||||
returnCode = DjiGimbalManager_Init();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Init gimbal manager error, return code 0x%08X", returnCode);
|
||||
return;
|
||||
}
|
||||
|
||||
returnCode = DjiGimbalManager_SetControllerMaxSpeedPercentage(gimbalMountPosition, DJI_GIMBAL_AXIS_YAW, (uint8_t)percentage);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Failed!");
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Set yaw axis's max speed percentage to %d successfully!", percentage);
|
||||
|
||||
osalHandler->TaskSleepMs(10);
|
||||
printf("Input max speed percentage of pitch axis: ");
|
||||
scanf("%d", &percentage);
|
||||
|
||||
returnCode = DjiGimbalManager_SetControllerMaxSpeedPercentage(gimbalMountPosition, DJI_GIMBAL_AXIS_PITCH, (uint8_t)percentage);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Failed!");
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Set pitch axis's max speed percentage to %d successfully!", percentage);
|
||||
|
||||
goto start;
|
||||
break;
|
||||
}
|
||||
case '4': {
|
||||
int32_t factor;
|
||||
|
||||
osalHandler->TaskSleepMs(10);
|
||||
printf("Input yaw axis's smooth factor: ");
|
||||
scanf("%d", &factor);
|
||||
|
||||
returnCode = DjiGimbalManager_Init();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Init gimbal manager error, return code 0x%08X", returnCode);
|
||||
return;
|
||||
}
|
||||
|
||||
returnCode = DjiGimbalManager_SetControllerSmoothFactor(gimbalMountPosition, DJI_GIMBAL_AXIS_YAW, (uint8_t)factor);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Failed!");
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Set yaw axis smooth factor to %d successfully!", factor);
|
||||
|
||||
osalHandler->TaskSleepMs(10);
|
||||
printf("Input pitch axis's smooth factor: ");
|
||||
scanf("%d", &factor);
|
||||
|
||||
returnCode = DjiGimbalManager_SetControllerSmoothFactor(gimbalMountPosition, DJI_GIMBAL_AXIS_PITCH, (uint8_t)factor);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Failed!");
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Set pitch axis smooth factor to %d successfully!", factor);
|
||||
|
||||
goto start;
|
||||
break;
|
||||
}
|
||||
case '5': {
|
||||
|
||||
returnCode = DjiGimbalManager_Init();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Init gimbal manager error, return code 0x%08X", returnCode);
|
||||
return;
|
||||
}
|
||||
|
||||
returnCode = DjiGimbalManager_RestoreFactorySettings(gimbalMountPosition);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Failed!");
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Reset gimbal factory settings successfully!");
|
||||
|
||||
goto start;
|
||||
break;
|
||||
}
|
||||
case '6': {
|
||||
uint32_t gimbalMode;
|
||||
uint32_t rotateMode;
|
||||
dji_f32_t pitch, roll, yaw;
|
||||
T_DjiGimbalManagerRotation rotation;
|
||||
T_DjiAircraftInfoBaseInfo baseInfo;
|
||||
E_DjiAircraftSeries aircraftSeries;
|
||||
|
||||
returnCode = DjiGimbalManager_Init();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Init gimbal manager error, return code 0x%08X", returnCode);
|
||||
return;
|
||||
}
|
||||
|
||||
returnCode = DjiAircraftInfo_GetBaseInfo(&baseInfo);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Failed to get aircraft base info, return code 0x%08X", returnCode);
|
||||
goto end;
|
||||
}
|
||||
|
||||
aircraftSeries = baseInfo.aircraftSeries;
|
||||
|
||||
if (aircraftSeries == DJI_AIRCRAFT_SERIES_M300 || aircraftSeries == DJI_AIRCRAFT_SERIES_M350) {
|
||||
returnCode = DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_IMU_ATTI_NAVI_DATA_WITH_TIMESTAMP, DJI_DATA_SUBSCRIPTION_TOPIC_50_HZ, NULL);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("DjiFcSubscription_SubscribeTopic %d return %d",
|
||||
DJI_FC_SUBSCRIPTION_TOPIC_IMU_ATTI_NAVI_DATA_WITH_TIMESTAMP, returnCode);
|
||||
goto end;
|
||||
}
|
||||
|
||||
returnCode = DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_QUATERNION, DJI_DATA_SUBSCRIPTION_TOPIC_50_HZ, NULL);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("DjiFcSubscription_SubscribeTopic %d return %d", DJI_FC_SUBSCRIPTION_TOPIC_QUATERNION, returnCode);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (aircraftSeries == DJI_AIRCRAFT_SERIES_M300 || aircraftSeries == DJI_AIRCRAFT_SERIES_M350) {
|
||||
returnCode = DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_THREE_GIMBAL_DATA, DJI_DATA_SUBSCRIPTION_TOPIC_50_HZ, NULL);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("DjiFcSubscription_SubscribeTopic %d return %d", DJI_FC_SUBSCRIPTION_TOPIC_THREE_GIMBAL_DATA, returnCode);
|
||||
goto end;
|
||||
}
|
||||
USER_LOG_INFO("Subscribe topic DJI_FC_SUBSCRIPTION_TOPIC_THREE_GIMBAL_DATA succefully.");
|
||||
}
|
||||
else if (aircraftSeries == DJI_AIRCRAFT_SERIES_M30 || aircraftSeries == DJI_AIRCRAFT_SERIES_M3) {
|
||||
returnCode = DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_GIMBAL_ANGLES, DJI_DATA_SUBSCRIPTION_TOPIC_50_HZ, NULL);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("DjiFcSubscription_SubscribeTopic %d return %d", DJI_FC_SUBSCRIPTION_TOPIC_GIMBAL_ANGLES, returnCode);
|
||||
goto end;
|
||||
}
|
||||
USER_LOG_INFO("Subscribe topic DJI_FC_SUBSCRIPTION_TOPIC_GIMBAL_ANGLES succefully.");
|
||||
}
|
||||
|
||||
|
||||
while (1) {
|
||||
T_DjiFcSubscriptionQuaternion quat;
|
||||
T_DjiFcSubscriptionThreeGimbalData threeGimbalData = {0};
|
||||
T_DjiFcSubscriptionGimbalAngles gimbalAngles = {0};
|
||||
T_DjiDataTimestamp timestamp = {0};
|
||||
dji_f32_t nPitch, nRoll, nYaw;
|
||||
dji_f32_t qPitch, qRoll, qYaw;
|
||||
dji_f32_t yawOffset = 0;
|
||||
T_DjiFcSubscriptionImuAttiNaviDataWithTimestamp naviData = {0};
|
||||
|
||||
osalHandler->TaskSleepMs(5);
|
||||
printf("gimbal mode: 0: free, 1: fpv, 2: yaw-follow, 3: exit sample\n");
|
||||
printf("rotate mode: 0: rel, 1: abs\n");
|
||||
printf("Input gimbal mode, rotate mode, p, r, y(range in 0 ~ 360 deg if in abs mode): ");
|
||||
|
||||
scanf("%d", &gimbalMode);
|
||||
if (gimbalMode == 3) {
|
||||
break;
|
||||
}
|
||||
|
||||
scanf("%d %f %f %f", &rotateMode, &pitch, &roll, &yaw);
|
||||
|
||||
printf("gimbale mode %d, rotate mode %d, p %f, r %f, y %f\n",
|
||||
gimbalMode, rotateMode, pitch, roll, yaw);
|
||||
|
||||
returnCode = DjiGimbalManager_SetMode(gimbalMountPosition, (E_DjiGimbalMode)gimbalMode);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("DjiGimbalManager_SetMode return 0x%08X", returnCode);
|
||||
goto end;
|
||||
}
|
||||
|
||||
rotation.rotationMode = (E_DjiGimbalRotationMode)rotateMode;
|
||||
rotation.pitch = pitch;
|
||||
rotation.roll = roll;
|
||||
rotation.yaw = yaw;
|
||||
rotation.time = 0.5;
|
||||
|
||||
if (aircraftSeries == DJI_AIRCRAFT_SERIES_M300 || aircraftSeries == DJI_AIRCRAFT_SERIES_M350) {
|
||||
osalHandler->TaskSleepMs(20);
|
||||
returnCode = DjiFcSubscription_GetLatestValueOfTopic(DJI_FC_SUBSCRIPTION_TOPIC_IMU_ATTI_NAVI_DATA_WITH_TIMESTAMP,
|
||||
(uint8_t *) &naviData,
|
||||
sizeof(T_DjiFcSubscriptionImuAttiNaviDataWithTimestamp),
|
||||
×tamp);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("returnCode = 0x%08X", returnCode);
|
||||
}
|
||||
|
||||
nYaw = (dji_f64_t) atan2f(2 * naviData.q[1] * naviData.q[2] + 2 * naviData.q[0] * naviData.q[3],
|
||||
-2 * naviData.q[2] * naviData.q[2] - 2 * naviData.q[3] * naviData.q[3] + 1) * 57.3;
|
||||
|
||||
returnCode = DjiFcSubscription_GetLatestValueOfTopic(DJI_FC_SUBSCRIPTION_TOPIC_QUATERNION,
|
||||
(uint8_t *) &quat,
|
||||
sizeof(T_DjiFcSubscriptionQuaternion),
|
||||
×tamp);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("DjiFcSubscription_GetLatestValueOfTopic return %x%08X", returnCode);
|
||||
goto end;
|
||||
}
|
||||
|
||||
qYaw = (dji_f64_t) atan2f(2 * quat.q1 * quat.q2 + 2 * quat.q0 * quat.q3,
|
||||
-2 * quat.q2 * quat.q2 - 2 * quat.q3 * quat.q3 + 1) * 57.3;
|
||||
|
||||
|
||||
yawOffset = nYaw - qYaw;
|
||||
|
||||
if (rotation.rotationMode == DJI_GIMBAL_ROTATION_MODE_ABSOLUTE_ANGLE) {
|
||||
rotation.yaw += yawOffset;
|
||||
}
|
||||
}
|
||||
|
||||
returnCode = DjiGimbalManager_Rotate(gimbalMountPosition, rotation);
|
||||
if (returnCode == DJI_ERROR_GIMBAL_MODULE_CODE_PITCH_REACH_POSITIVE_LIMIT ||
|
||||
returnCode == DJI_ERROR_GIMBAL_MODULE_CODE_PITCH_REACH_NEGATIVE_LIMIT ||
|
||||
returnCode == DJI_ERROR_GIMBAL_MODULE_CODE_ROLL_REACH_POSITIVE_LIMIT ||
|
||||
returnCode == DJI_ERROR_GIMBAL_MODULE_CODE_ROLL_REACH_NEGATIVE_LIMIT ||
|
||||
returnCode == DJI_ERROR_GIMBAL_MODULE_CODE_YAW_REACH_POSITIVE_LIMIT ||
|
||||
returnCode == DJI_ERROR_GIMBAL_MODULE_CODE_YAW_REACH_NEGATIVE_LIMIT) {
|
||||
USER_LOG_WARN("Reach limitation!");
|
||||
}
|
||||
else if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("DjiGimbalManager_Rotate return %x%08X", returnCode);
|
||||
goto end;
|
||||
}
|
||||
|
||||
osalHandler->TaskSleepMs(2000);
|
||||
|
||||
if (aircraftSeries == DJI_AIRCRAFT_SERIES_M300 || aircraftSeries == DJI_AIRCRAFT_SERIES_M350) {
|
||||
returnCode = DjiFcSubscription_GetLatestValueOfTopic(DJI_FC_SUBSCRIPTION_TOPIC_THREE_GIMBAL_DATA,
|
||||
(uint8_t *) &threeGimbalData,
|
||||
sizeof(T_DjiFcSubscriptionThreeGimbalData),
|
||||
×tamp);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("DjiFcSubscription_GetLatestValueOfTopic return %x%08X", returnCode);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (threeGimbalData.anglesData[0].yaw < 0) {
|
||||
threeGimbalData.anglesData[0].yaw = 360 + threeGimbalData.anglesData[0].yaw;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("reab back gimbal's (p, r, y): p=%.4f r=%.4f y=%.4f",
|
||||
threeGimbalData.anglesData[gimbalMountPosition - 1].pitch,
|
||||
threeGimbalData.anglesData[gimbalMountPosition - 1].roll,
|
||||
threeGimbalData.anglesData[gimbalMountPosition - 1].yaw);
|
||||
}
|
||||
else if (aircraftSeries == DJI_AIRCRAFT_SERIES_M30 || aircraftSeries == DJI_AIRCRAFT_SERIES_M3) {
|
||||
returnCode = DjiFcSubscription_GetLatestValueOfTopic(DJI_FC_SUBSCRIPTION_TOPIC_GIMBAL_ANGLES,
|
||||
(uint8_t *) &gimbalAngles,
|
||||
sizeof(T_DjiFcSubscriptionGimbalAngles),
|
||||
×tamp);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("DjiFcSubscription_GetLatestValueOfTopic return %x%08X", returnCode);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (gimbalAngles.z < 0) {
|
||||
gimbalAngles.z = 360 + gimbalAngles.z;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("read back gimbal's (p, r, y): p=%.4f r=%.4f y=%.4f",
|
||||
gimbalAngles.x, gimbalAngles.y, gimbalAngles.z);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 'q':
|
||||
break;
|
||||
default:
|
||||
@ -117,6 +429,15 @@ start:
|
||||
goto start;
|
||||
}
|
||||
|
||||
end:
|
||||
returnCode = DjiGimbalManager_Deinit();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Deinit gimbal manager error, return code 0x%08X", returnCode);
|
||||
return;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Gimbal sample end");
|
||||
|
||||
return;
|
||||
}
|
||||
/* Private functions definition-----------------------------------------------*/
|
||||
|
||||
@ -0,0 +1,82 @@
|
||||
/**
|
||||
********************************************************************
|
||||
* @file hms_manager_entry.cpp
|
||||
* @brief
|
||||
*
|
||||
* @copyright (c) 2018 DJI. All rights reserved.
|
||||
*
|
||||
* All information contained herein is, and remains, the property of DJI.
|
||||
* The intellectual and technical concepts contained herein are proprietary
|
||||
* to DJI and may be covered by U.S. and foreign patents, patents in process,
|
||||
* and protected by trade secret or copyright law. Dissemination of this
|
||||
* information, including but not limited to data and other proprietary
|
||||
* material(s) incorporated within the information, in any form, is strictly
|
||||
* prohibited without the express written consent of DJI.
|
||||
*
|
||||
* If you receive this source code without DJI’s 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.
|
||||
*
|
||||
*********************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "hms_manager_entry.h"
|
||||
#include "dji_platform.h"
|
||||
#include <iostream>
|
||||
#include "dji_logger.h"
|
||||
#include "hms/test_hms.h"
|
||||
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
|
||||
/* Private values -------------------------------------------------------------*/
|
||||
|
||||
/* Private functions declaration ---------------------------------------------*/
|
||||
|
||||
/* Exported functions definition ---------------------------------------------*/
|
||||
void DjiUser_RunHmsManagerSample(void)
|
||||
{
|
||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||
char inputSelectSample;
|
||||
|
||||
start:
|
||||
osalHandler->TaskSleepMs(100);
|
||||
|
||||
std::cout
|
||||
<< "\n"
|
||||
<< "| Available commands: |\n"
|
||||
<< "| [0] Hms manager sample - Chinese language |\n"
|
||||
<< "| [1] Hms manager sample - English language |\n"
|
||||
<< "| [2] Hms manager sample - Japanese language |\n"
|
||||
<< "| [3] Hms manager sample - French language |\n"
|
||||
<< std::endl;
|
||||
|
||||
std::cin >> inputSelectSample;
|
||||
switch (inputSelectSample) {
|
||||
case '0':
|
||||
DjiTest_HmsManagerRunSample(DJI_MOBILE_APP_LANGUAGE_CHINESE);
|
||||
goto start;
|
||||
case '1':
|
||||
DjiTest_HmsManagerRunSample(DJI_MOBILE_APP_LANGUAGE_ENGLISH);
|
||||
goto start;
|
||||
case '2':
|
||||
DjiTest_HmsManagerRunSample(DJI_MOBILE_APP_LANGUAGE_JAPANESE);
|
||||
goto start;
|
||||
case '3':
|
||||
DjiTest_HmsManagerRunSample(DJI_MOBILE_APP_LANGUAGE_FRENCH);
|
||||
goto start;
|
||||
case 'q':
|
||||
break;
|
||||
default:
|
||||
USER_LOG_ERROR("Input command is invalid");
|
||||
goto start;
|
||||
}
|
||||
}
|
||||
|
||||
/* Private functions definition-----------------------------------------------*/
|
||||
|
||||
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/
|
||||
@ -0,0 +1,49 @@
|
||||
|
||||
/**
|
||||
********************************************************************
|
||||
* @file hms_manager_entry.h
|
||||
* @brief This is the header file for "hms_manager_entry.c", defining the structure and
|
||||
* (exported) function prototypes.
|
||||
*
|
||||
* @copyright (c) 2018 DJI. All rights reserved.
|
||||
*
|
||||
* All information contained herein is, and remains, the property of DJI.
|
||||
* The intellectual and technical concepts contained herein are proprietary
|
||||
* to DJI and may be covered by U.S. and foreign patents, patents in process,
|
||||
* and protected by trade secret or copyright law. Dissemination of this
|
||||
* information, including but not limited to data and other proprietary
|
||||
* material(s) incorporated within the information, in any form, is strictly
|
||||
* prohibited without the express written consent of DJI.
|
||||
*
|
||||
* If you receive this source code without DJI’s 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 HMS_MANAGER_ENTRY_H
|
||||
#define HMS_MANAGER_ENTRY_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
void DjiUser_RunHmsManagerSample(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // HMS_MANAGER_ENTRY_H
|
||||
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
|
||||
@ -111,6 +111,11 @@ FIND_LIBRARY(FFMPEG_z_LIBRARY z
|
||||
/usr/lib
|
||||
)
|
||||
|
||||
FIND_LIBRARY(FFMPEG_swresample_LIBRARY swresample
|
||||
/usr/local/lib
|
||||
/usr/lib
|
||||
)
|
||||
|
||||
SET(FFMPEG_LIBRARIES)
|
||||
IF(FFMPEG_INCLUDE_DIR)
|
||||
IF(FFMPEG_avformat_LIBRARY)
|
||||
@ -120,7 +125,8 @@ IF(FFMPEG_INCLUDE_DIR)
|
||||
SET( FFMPEG_BASIC_LIBRARIES
|
||||
${FFMPEG_avcodec_LIBRARY}
|
||||
${FFMPEG_avformat_LIBRARY}
|
||||
${FFMPEG_avutil_LIBRARY}
|
||||
${FFMPEG_avutil_LIBRARY}
|
||||
${FFMPEG_swresample_LIBRARY}
|
||||
)
|
||||
|
||||
# swscale is always a part of newer ffmpeg distros
|
||||
@ -178,4 +184,5 @@ MARK_AS_ADVANCED(
|
||||
FFMPEG_gsm_LIBRARY
|
||||
FFMPEG_swscale_LIBRARY
|
||||
FFMPEG_z_LIBRARY
|
||||
FFMPEG_swresample_LIBRARY
|
||||
)
|
||||
|
||||
@ -31,6 +31,8 @@ file(GLOB_RECURSE MODULE_SAMPLE_SRC
|
||||
../../../module_sample/camera_manager/*.c*
|
||||
../../../module_sample/perception/*.c*
|
||||
../../../module_sample/gimbal/*.c*
|
||||
../../../module_sample/flight_controller/*.c*
|
||||
../../../module_sample/hms_manager/*.c*
|
||||
../../../../sample_c/module_sample/*.c
|
||||
)
|
||||
file(GLOB_RECURSE MODULE_COMMON_SRC ../common/*.c*)
|
||||
@ -72,9 +74,11 @@ if (OpenCV_FOUND)
|
||||
execute_process(COMMAND opencv_version OUTPUT_VARIABLE OPENCV_VERSION)
|
||||
if (${OPENCV_VERSION} STRLESS "4.0.0")
|
||||
add_definitions(-DOPEN_CV_VERSION_3)
|
||||
else()
|
||||
|
||||
else ()
|
||||
add_definitions(-DOPEN_CV_VERSION_4)
|
||||
endif()
|
||||
|
||||
endif ()
|
||||
else ()
|
||||
message(STATUS "Did not find OpenCV in the system, image data is inside RecvContainer as raw data")
|
||||
endif ()
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
#include <dji_aircraft_info.h>
|
||||
#include <csignal>
|
||||
#include "dji_sdk_config.h"
|
||||
#include "dji_config_manager.h"
|
||||
|
||||
#include "../common/osal/osal.h"
|
||||
#include "../common/osal/osal_fs.h"
|
||||
@ -52,6 +53,8 @@
|
||||
#define USER_UTIL_MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define USER_UTIL_MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
|
||||
#define DJI_USE_SDK_CONFIG_BY_JSON (0)
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
|
||||
/* Private values -------------------------------------------------------------*/
|
||||
@ -64,7 +67,7 @@ static void DjiUser_NormalExitHandler(int signalNum);
|
||||
/* Exported functions definition ---------------------------------------------*/
|
||||
Application::Application(int argc, char **argv)
|
||||
{
|
||||
Application::DjiUser_SetupEnvironment();
|
||||
Application::DjiUser_SetupEnvironment(argc, argv);
|
||||
Application::DjiUser_ApplicationStart();
|
||||
|
||||
Osal_TaskSleepMs(3000);
|
||||
@ -74,7 +77,7 @@ Application::~Application()
|
||||
= default;
|
||||
|
||||
/* Private functions definition-----------------------------------------------*/
|
||||
void Application::DjiUser_SetupEnvironment()
|
||||
void Application::DjiUser_SetupEnvironment(int argc, char **argv)
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
T_DjiOsalHandler osalHandler = {0};
|
||||
@ -83,8 +86,9 @@ void Application::DjiUser_SetupEnvironment()
|
||||
T_DjiLoggerConsole printConsole;
|
||||
T_DjiLoggerConsole localRecordConsole;
|
||||
T_DjiFileSystemHandler fileSystemHandler = {0};
|
||||
T_DjiSocketHandler socketHandler {0};
|
||||
T_DjiSocketHandler socketHandler{0};
|
||||
T_DjiHalNetworkHandler networkHandler = {0};
|
||||
T_DjiUserLinkConfig linkConfig;
|
||||
|
||||
networkHandler.NetworkInit = HalNetWork_Init;
|
||||
networkHandler.NetworkDeInit = HalNetWork_DeInit;
|
||||
@ -163,6 +167,28 @@ void Application::DjiUser_SetupEnvironment()
|
||||
throw std::runtime_error("Register hal uart handler error.");
|
||||
}
|
||||
|
||||
#if DJI_USE_SDK_CONFIG_BY_JSON
|
||||
if (argc > 1) {
|
||||
DjiUserConfigManager_LoadConfiguration(argv[1]);
|
||||
} else {
|
||||
DjiUserConfigManager_LoadConfiguration(nullptr);
|
||||
}
|
||||
|
||||
DjiUserConfigManager_GetLinkConfig(&linkConfig);
|
||||
if (linkConfig.type == DJI_USER_LINK_CONFIG_USE_UART_AND_NETWORK_DEVICE) {
|
||||
returnCode = DjiPlatform_RegHalNetworkHandler(&networkHandler);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
throw std::runtime_error("Register hal network handler error");
|
||||
}
|
||||
} else if (linkConfig.type == DJI_USER_LINK_CONFIG_USE_UART_AND_USB_BULK_DEVICE) {
|
||||
returnCode = DjiPlatform_RegHalUsbBulkHandler(&usbBulkHandler);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
throw std::runtime_error("Register hal usb bulk handler error.");
|
||||
}
|
||||
} else {
|
||||
/*!< Attention: Only use uart hardware connection. */
|
||||
}
|
||||
#else
|
||||
#if (CONFIG_HARDWARE_CONNECTION == DJI_USE_UART_AND_USB_BULK_DEVICE)
|
||||
returnCode = DjiPlatform_RegHalUsbBulkHandler(&usbBulkHandler);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
@ -176,6 +202,7 @@ void Application::DjiUser_SetupEnvironment()
|
||||
#elif (CONFIG_HARDWARE_CONNECTION == DJI_USE_ONLY_UART)
|
||||
/*!< Attention: Only use uart hardware connection.
|
||||
*/
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Attention: if you want to use camera stream view function, please uncomment it.
|
||||
@ -219,13 +246,18 @@ void Application::DjiUser_ApplicationStart()
|
||||
// attention: when the program is hand up ctrl-c will generate the coredump file
|
||||
signal(SIGTERM, DjiUser_NormalExitHandler);
|
||||
|
||||
#if DJI_USE_SDK_CONFIG_BY_JSON
|
||||
DjiUserConfigManager_GetAppInfo(&userInfo);
|
||||
#else
|
||||
returnCode = DjiUser_FillInUserInfo(&userInfo);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
throw std::runtime_error("Fill user info error, please check user info config.");
|
||||
}
|
||||
#endif
|
||||
|
||||
returnCode = DjiCore_Init(&userInfo);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
sleep(1);
|
||||
throw std::runtime_error("Core init error.");
|
||||
}
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ public:
|
||||
~Application();
|
||||
|
||||
private:
|
||||
static void DjiUser_SetupEnvironment();
|
||||
static void DjiUser_SetupEnvironment(int argc, char **argv);
|
||||
static void DjiUser_ApplicationStart();
|
||||
static T_DjiReturnCode DjiUser_PrintConsole(const uint8_t *data, uint16_t dataLen);
|
||||
static T_DjiReturnCode DjiUser_LocalWrite(const uint8_t *data, uint16_t dataLen);
|
||||
|
||||
@ -0,0 +1,342 @@
|
||||
/**
|
||||
********************************************************************
|
||||
* @file dji_config_manager.c
|
||||
* @brief
|
||||
*
|
||||
* @copyright (c) 2018 DJI. All rights reserved.
|
||||
*
|
||||
* All information contained herein is, and remains, the property of DJI.
|
||||
* The intellectual and technical concepts contained herein are proprietary
|
||||
* to DJI and may be covered by U.S. and foreign patents, patents in process,
|
||||
* and protected by trade secret or copyright law. Dissemination of this
|
||||
* information, including but not limited to data and other proprietary
|
||||
* material(s) incorporated within the information, in any form, is strictly
|
||||
* prohibited without the express written consent of DJI.
|
||||
*
|
||||
* If you receive this source code without DJI’s 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.
|
||||
*
|
||||
*********************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <utils/util_misc.h>
|
||||
#include <dji_logger.h>
|
||||
#include <utils/util_file.h>
|
||||
#include <dji_aircraft_info.h>
|
||||
#include "dji_config_manager.h"
|
||||
#include "utils/cJSON.h"
|
||||
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
|
||||
/* Private values -------------------------------------------------------------*/
|
||||
static T_DjiUserInfo s_configManagerUserInfo = {0};
|
||||
static T_DjiUserLinkConfig s_configManagerLinkInfo = {0};
|
||||
static bool s_configManagerIsEnable = false;
|
||||
|
||||
/* Private functions declaration ---------------------------------------------*/
|
||||
static T_DjiReturnCode DjiUserConfigManager_GetAppInfoInner(const char *path, T_DjiUserInfo *userInfo);
|
||||
static T_DjiReturnCode DjiUserConfigManager_GetLinkConfigInner(const char *path, T_DjiUserLinkConfig *linkConfig);
|
||||
|
||||
/* Exported functions definition ---------------------------------------------*/
|
||||
T_DjiReturnCode DjiUserConfigManager_LoadConfiguration(const char *path)
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
char curFileDirPath[DJI_FILE_PATH_SIZE_MAX];
|
||||
char tempFileDirPath[DJI_FILE_PATH_SIZE_MAX];
|
||||
|
||||
if (path == NULL) {
|
||||
returnCode = DjiUserUtil_GetCurrentFileDirPath(__FILE__, DJI_FILE_PATH_SIZE_MAX,
|
||||
curFileDirPath);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get file current path error, stat = 0x%08llX", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
snprintf(tempFileDirPath, DJI_FILE_PATH_SIZE_MAX, "%s/dji_sdk_config.json",
|
||||
curFileDirPath);
|
||||
} else {
|
||||
strcpy(tempFileDirPath, path);
|
||||
}
|
||||
|
||||
printf("Load configuration start.\r\n");
|
||||
|
||||
returnCode = DjiUserConfigManager_GetAppInfoInner(tempFileDirPath, &s_configManagerUserInfo);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
perror("Get app info failed.\n");
|
||||
}
|
||||
|
||||
returnCode = DjiUserConfigManager_GetLinkConfigInner(tempFileDirPath, &s_configManagerLinkInfo);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
perror("Get link info failed.\n");
|
||||
}
|
||||
|
||||
printf("\r\nLoad configuration successfully.\r\n");
|
||||
|
||||
s_configManagerIsEnable = true;
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
void DjiUserConfigManager_GetAppInfo(T_DjiUserInfo *userInfo)
|
||||
{
|
||||
memcpy(userInfo, &s_configManagerUserInfo, sizeof(T_DjiUserInfo));
|
||||
}
|
||||
|
||||
void DjiUserConfigManager_GetLinkConfig(T_DjiUserLinkConfig *linkConfig)
|
||||
{
|
||||
memcpy(linkConfig, &s_configManagerLinkInfo, sizeof(T_DjiUserLinkConfig));
|
||||
}
|
||||
|
||||
bool DjiUserConfigManager_IsEnable(void)
|
||||
{
|
||||
return s_configManagerIsEnable;
|
||||
}
|
||||
|
||||
/* Private functions definition-----------------------------------------------*/
|
||||
static T_DjiReturnCode DjiUserConfigManager_GetAppInfoInner(const char *path, T_DjiUserInfo *userInfo)
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
uint32_t fileSize = 0;
|
||||
uint32_t readRealSize = 0;
|
||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||
uint8_t *jsonData = NULL;
|
||||
cJSON *jsonRoot = NULL;
|
||||
cJSON *jsonItem = NULL;
|
||||
cJSON *jsonValue = NULL;
|
||||
|
||||
#ifdef SYSTEM_ARCH_LINUX
|
||||
returnCode = UtilFile_GetFileSizeByPath(path, &fileSize);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get file size by path failed, stat = 0x%08llX", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
USER_LOG_DEBUG("Get config json file size is %d", fileSize);
|
||||
|
||||
jsonData = osalHandler->Malloc(fileSize + 1);
|
||||
if (jsonData == NULL) {
|
||||
USER_LOG_ERROR("Malloc failed.");
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
UtilFile_GetFileDataByPath(path, 0, fileSize, jsonData, &readRealSize);
|
||||
|
||||
jsonData[readRealSize] = '\0';
|
||||
|
||||
jsonRoot = cJSON_Parse((char *) jsonData);
|
||||
if (jsonRoot == NULL) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||
}
|
||||
|
||||
jsonItem = cJSON_GetObjectItem(jsonRoot, "dji_sdk_app_info");
|
||||
if (jsonItem != NULL) {
|
||||
jsonValue = cJSON_GetObjectItem(jsonItem, "user_app_name");
|
||||
if (jsonValue != NULL) {
|
||||
strcpy(userInfo->appName, jsonValue->valuestring);
|
||||
}
|
||||
|
||||
jsonValue = cJSON_GetObjectItem(jsonItem, "user_app_id");
|
||||
if (jsonValue != NULL) {
|
||||
strcpy(userInfo->appId, jsonValue->valuestring);
|
||||
}
|
||||
|
||||
jsonValue = cJSON_GetObjectItem(jsonItem, "user_app_key");
|
||||
if (jsonValue != NULL) {
|
||||
strcpy(userInfo->appKey, jsonValue->valuestring);
|
||||
}
|
||||
|
||||
jsonValue = cJSON_GetObjectItem(jsonItem, "user_app_license");
|
||||
if (jsonValue != NULL) {
|
||||
strcpy(userInfo->appLicense, jsonValue->valuestring);
|
||||
}
|
||||
|
||||
jsonValue = cJSON_GetObjectItem(jsonItem, "user_develop_account");
|
||||
if (jsonValue != NULL) {
|
||||
strcpy(userInfo->developerAccount, jsonValue->valuestring);
|
||||
}
|
||||
|
||||
jsonValue = cJSON_GetObjectItem(jsonItem, "user_baud_rate");
|
||||
if (jsonValue != NULL) {
|
||||
strcpy(userInfo->baudRate, jsonValue->valuestring);
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen(userInfo->appName) >= sizeof(userInfo->appName) ||
|
||||
strlen(userInfo->appId) > sizeof(userInfo->appId) ||
|
||||
strlen(userInfo->appKey) > sizeof(userInfo->appKey) ||
|
||||
strlen(userInfo->appLicense) > sizeof(userInfo->appLicense) ||
|
||||
strlen(userInfo->developerAccount) >= sizeof(userInfo->developerAccount) ||
|
||||
strlen(userInfo->baudRate) > sizeof(userInfo->baudRate)) {
|
||||
USER_LOG_ERROR("Length of user information string is beyond limit. Please check.");
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (!strcmp(userInfo->appName, "your_app_name") ||
|
||||
!strcmp(userInfo->appId, "your_app_id") ||
|
||||
!strcmp(userInfo->appKey, "your_app_key") ||
|
||||
!strcmp(userInfo->appLicense, "your_app_license") ||
|
||||
!strcmp(userInfo->developerAccount, "your_developer_account") ||
|
||||
!strcmp(userInfo->baudRate, "your_baud_rate")) {
|
||||
USER_LOG_ERROR(
|
||||
"Please fill in correct user information to 'samples/sample_c++/platform/linux/manifold2/application/dji_sdk_config.json' file.");
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
osalHandler->Free(jsonData);
|
||||
#endif
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static T_DjiReturnCode DjiUserConfigManager_GetLinkConfigInner(const char *path, T_DjiUserLinkConfig *linkConfig)
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
uint32_t fileSize = 0;
|
||||
uint32_t readRealSize = 0;
|
||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||
uint8_t *jsonData = NULL;
|
||||
cJSON *jsonRoot = NULL;
|
||||
cJSON *jsonItem = NULL;
|
||||
cJSON *jsonValue = NULL;
|
||||
cJSON *jsonConfig = NULL;
|
||||
int32_t configValue;
|
||||
|
||||
#ifdef SYSTEM_ARCH_LINUX
|
||||
|
||||
returnCode = UtilFile_GetFileSizeByPath(path, &fileSize);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get file size by path failed, stat = 0x%08llX", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
USER_LOG_DEBUG("Get config json file size is %d", fileSize);
|
||||
|
||||
jsonData = osalHandler->Malloc(fileSize + 1);
|
||||
if (jsonData == NULL) {
|
||||
USER_LOG_ERROR("Malloc failed.");
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
UtilFile_GetFileDataByPath(path, 0, fileSize, jsonData, &readRealSize);
|
||||
|
||||
jsonData[readRealSize] = '\0';
|
||||
|
||||
jsonRoot = cJSON_Parse((char *) jsonData);
|
||||
if (jsonRoot == NULL) {
|
||||
goto jsonDataFree;
|
||||
}
|
||||
|
||||
jsonItem = cJSON_GetObjectItem(jsonRoot, "dji_sdk_link_config");
|
||||
if (jsonItem != NULL) {
|
||||
jsonValue = cJSON_GetObjectItem(jsonItem, "link_select");
|
||||
if (jsonValue != NULL) {
|
||||
printf("\r\nSelect link type: %s\r\n", jsonValue->valuestring);
|
||||
if (strcmp(jsonValue->valuestring, "use_only_uart") == 0) {
|
||||
linkConfig->type = DJI_USER_LINK_CONFIG_USE_ONLY_UART;
|
||||
} else if (strcmp(jsonValue->valuestring, "use_uart_and_network_device") == 0) {
|
||||
linkConfig->type = DJI_USER_LINK_CONFIG_USE_UART_AND_NETWORK_DEVICE;
|
||||
} else if (strcmp(jsonValue->valuestring, "use_uart_and_usb_bulk_device") == 0) {
|
||||
linkConfig->type = DJI_USER_LINK_CONFIG_USE_UART_AND_USB_BULK_DEVICE;
|
||||
}
|
||||
}
|
||||
|
||||
jsonValue = cJSON_GetObjectItem(jsonItem, "uart_config");
|
||||
if (jsonValue != NULL) {
|
||||
jsonConfig = cJSON_GetObjectItem(jsonValue, "uart1_device_name");
|
||||
printf("\r\nConfig uart1 device name: %s\r\n", jsonConfig->valuestring);
|
||||
strcpy(linkConfig->uartConfig.uart1DeviceName, jsonConfig->valuestring);
|
||||
|
||||
jsonConfig = cJSON_GetObjectItem(jsonValue, "uart2_device_name");
|
||||
printf("Config uart2 device name: %s\r\n", jsonConfig->valuestring);
|
||||
strcpy(linkConfig->uartConfig.uart2DeviceName, jsonConfig->valuestring);
|
||||
|
||||
jsonConfig = cJSON_GetObjectItem(jsonValue, "uart2_device_enable");
|
||||
printf("Config uart2 device enable: %s\r\n", jsonConfig->valuestring);
|
||||
if (strcmp(jsonConfig->valuestring, "true") == 0) {
|
||||
linkConfig->uartConfig.uart2DeviceEnable = true;
|
||||
} else {
|
||||
linkConfig->uartConfig.uart2DeviceEnable = false;
|
||||
}
|
||||
}
|
||||
|
||||
jsonValue = cJSON_GetObjectItem(jsonItem, "network_config");
|
||||
if (jsonValue != NULL) {
|
||||
jsonConfig = cJSON_GetObjectItem(jsonValue, "network_device_name");
|
||||
printf("\r\nConfig network device name: %s\r\n", jsonConfig->valuestring);
|
||||
strcpy(linkConfig->networkConfig.networkDeviceName, jsonConfig->valuestring);
|
||||
|
||||
jsonConfig = cJSON_GetObjectItem(jsonValue, "network_usb_adapter_vid");
|
||||
printf("Config network usb adapter vid: %s\r\n", jsonConfig->valuestring);
|
||||
sscanf(jsonConfig->valuestring, "%X", &configValue);
|
||||
linkConfig->networkConfig.networkUsbAdapterVid = configValue;
|
||||
|
||||
jsonConfig = cJSON_GetObjectItem(jsonValue, "network_usb_adapter_pid");
|
||||
printf("Config network usb adapter vid: %s\r\n", jsonConfig->valuestring);
|
||||
sscanf(jsonConfig->valuestring, "%X", &configValue);
|
||||
linkConfig->networkConfig.networkUsbAdapterPid = configValue;
|
||||
}
|
||||
|
||||
jsonValue = cJSON_GetObjectItem(jsonItem, "usb_bulk_config");
|
||||
if (jsonValue != NULL) {
|
||||
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_device_vid");
|
||||
printf("\r\nConfig usb device vid: %s\r\n", jsonConfig->valuestring);
|
||||
sscanf(jsonConfig->valuestring, "%X", &configValue);
|
||||
linkConfig->usbBulkConfig.usbDeviceVid = configValue;
|
||||
|
||||
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_device_pid");
|
||||
printf("Config usb device pid: %s\r\n", jsonConfig->valuestring);
|
||||
sscanf(jsonConfig->valuestring, "%X", &configValue);
|
||||
linkConfig->usbBulkConfig.usbDevicePid = configValue;
|
||||
|
||||
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_bulk1_device_name");
|
||||
printf("Config usb bulk1 device name: %s\r\n", jsonConfig->valuestring);
|
||||
strcpy(linkConfig->usbBulkConfig.usbBulk1DeviceName, jsonConfig->valuestring);
|
||||
|
||||
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_bulk1_interface_num");
|
||||
printf("Config usb bulk1 interface num: %s\r\n", jsonConfig->valuestring);
|
||||
sscanf(jsonConfig->valuestring, "%X", &configValue);
|
||||
linkConfig->usbBulkConfig.usbBulk1InterfaceNum = configValue;
|
||||
|
||||
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_bulk1_endpoint_in");
|
||||
printf("Config usb bulk1 endpoint in: %s\r\n", jsonConfig->valuestring);
|
||||
sscanf(jsonConfig->valuestring, "%X", &configValue);
|
||||
linkConfig->usbBulkConfig.usbBulk1EndpointIn = configValue;
|
||||
|
||||
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_bulk1_endpoint_out");
|
||||
printf("Config usb bulk1 endpoint out: %s\r\n", jsonConfig->valuestring);
|
||||
sscanf(jsonConfig->valuestring, "%X", &configValue);
|
||||
linkConfig->usbBulkConfig.usbBulk1EndpointOut = configValue;
|
||||
|
||||
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_bulk2_device_name");
|
||||
printf("Config usb bulk2 device name: %s\r\n", jsonConfig->valuestring);
|
||||
strcpy(linkConfig->usbBulkConfig.usbBulk2DeviceName, jsonConfig->valuestring);
|
||||
|
||||
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_bulk2_interface_num");
|
||||
printf("Config usb bulk2 interface num: %s\r\n", jsonConfig->valuestring);
|
||||
sscanf(jsonConfig->valuestring, "%X", &configValue);
|
||||
linkConfig->usbBulkConfig.usbBulk2InterfaceNum = configValue;
|
||||
|
||||
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_bulk2_endpoint_in");
|
||||
printf("Config usb bulk2 endpoint in: %s\r\n", jsonConfig->valuestring);
|
||||
linkConfig->usbBulkConfig.usbBulk2EndpointIn = configValue;
|
||||
|
||||
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_bulk2_endpoint_out");
|
||||
printf("Config usb bulk2 endpoint out: %s\r\n", jsonConfig->valuestring);
|
||||
linkConfig->usbBulkConfig.usbBulk2EndpointOut = configValue;
|
||||
}
|
||||
}
|
||||
|
||||
jsonDataFree:
|
||||
osalHandler->Free(jsonData);
|
||||
#endif
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/
|
||||
@ -0,0 +1,88 @@
|
||||
/**
|
||||
********************************************************************
|
||||
* @file dji_config_manager.h
|
||||
* @brief This is the header file for "dji_config_manager.c", defining the structure and
|
||||
* (exported) function prototypes.
|
||||
*
|
||||
* @copyright (c) 2018 DJI. All rights reserved.
|
||||
*
|
||||
* All information contained herein is, and remains, the property of DJI.
|
||||
* The intellectual and technical concepts contained herein are proprietary
|
||||
* to DJI and may be covered by U.S. and foreign patents, patents in process,
|
||||
* and protected by trade secret or copyright law. Dissemination of this
|
||||
* information, including but not limited to data and other proprietary
|
||||
* material(s) incorporated within the information, in any form, is strictly
|
||||
* prohibited without the express written consent of DJI.
|
||||
*
|
||||
* If you receive this source code without DJI’s 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 DJI_CONFIG_MANAGER_H
|
||||
#define DJI_CONFIG_MANAGER_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "dji_platform.h"
|
||||
#include "dji_core.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
#define USER_DEVICE_NAME_STR_MAX_SIZE (64)
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
typedef enum {
|
||||
DJI_USER_LINK_CONFIG_USE_ONLY_UART,
|
||||
DJI_USER_LINK_CONFIG_USE_UART_AND_NETWORK_DEVICE,
|
||||
DJI_USER_LINK_CONFIG_USE_UART_AND_USB_BULK_DEVICE,
|
||||
} E_DjiUserLinkConfigType;
|
||||
|
||||
typedef struct {
|
||||
E_DjiUserLinkConfigType type;
|
||||
struct {
|
||||
char uart1DeviceName[USER_DEVICE_NAME_STR_MAX_SIZE];
|
||||
bool uart2DeviceEnable;
|
||||
char uart2DeviceName[USER_DEVICE_NAME_STR_MAX_SIZE];
|
||||
} uartConfig;
|
||||
struct {
|
||||
char networkDeviceName[USER_DEVICE_NAME_STR_MAX_SIZE];
|
||||
// M300/M350 RTK payload port no need
|
||||
uint16_t networkUsbAdapterVid;
|
||||
uint16_t networkUsbAdapterPid;
|
||||
} networkConfig;
|
||||
struct {
|
||||
uint16_t usbDeviceVid;
|
||||
uint16_t usbDevicePid;
|
||||
|
||||
char usbBulk1DeviceName[USER_DEVICE_NAME_STR_MAX_SIZE];
|
||||
uint8_t usbBulk1InterfaceNum;
|
||||
uint8_t usbBulk1EndpointIn;
|
||||
uint8_t usbBulk1EndpointOut;
|
||||
|
||||
char usbBulk2DeviceName[USER_DEVICE_NAME_STR_MAX_SIZE];
|
||||
uint8_t usbBulk2InterfaceNum;
|
||||
uint8_t usbBulk2EndpointIn;
|
||||
uint8_t usbBulk2EndpointOut;
|
||||
} usbBulkConfig;
|
||||
} T_DjiUserLinkConfig;
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
T_DjiReturnCode DjiUserConfigManager_LoadConfiguration(const char *path);
|
||||
void DjiUserConfigManager_GetAppInfo(T_DjiUserInfo *userInfo);
|
||||
void DjiUserConfigManager_GetLinkConfig(T_DjiUserLinkConfig *linkConfig);
|
||||
bool DjiUserConfigManager_IsEnable(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // DJI_CONFIG_MANAGER_H
|
||||
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
|
||||
@ -40,7 +40,7 @@ extern "C" {
|
||||
|
||||
/*!< Attention: Select your hardware connection mode here.
|
||||
* */
|
||||
#define CONFIG_HARDWARE_CONNECTION DJI_USE_UART_AND_NETWORK_DEVICE
|
||||
#define CONFIG_HARDWARE_CONNECTION DJI_USE_ONLY_UART
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
{
|
||||
"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"
|
||||
},
|
||||
"dji_sdk_link_config": {
|
||||
"link_available": "use_only_uart/use_uart_and_usb_bulk_device/use_uart_and_network_device",
|
||||
"link_select": "use_uart_and_network_device",
|
||||
"uart_config": {
|
||||
"uart1_device_name": "/dev/ttyUSB0",
|
||||
"uart2_device_enable": "true",
|
||||
"uart2_device_name": "/dev/ttyACM0"
|
||||
},
|
||||
"network_config": {
|
||||
"network_device_name": "enxf8e43b7bbc2c",
|
||||
"network_usb_adapter_vid": "0x0B95",
|
||||
"network_usb_adapter_pid": "0x1790"
|
||||
},
|
||||
"usb_bulk_config": {
|
||||
"usb_device_vid": "0x0B95",
|
||||
"usb_device_pid": "0x1790",
|
||||
"usb_bulk1_device_name": "/dev/usb-ffs/bulk1",
|
||||
"usb_bulk1_interface_num": "2",
|
||||
"usb_bulk1_endpoint_in": "0x83",
|
||||
"usb_bulk1_endpoint_out": "0x02",
|
||||
"usb_bulk2_device_name": "/dev/usb-ffs/bulk2",
|
||||
"usb_bulk2_interface_num": "3",
|
||||
"usb_bulk2_endpoint_in": "0x84",
|
||||
"usb_bulk2_endpoint_out": "0x03"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -27,9 +27,6 @@
|
||||
#include <perception/test_perception_entry.hpp>
|
||||
#include <flight_control/test_flight_control.h>
|
||||
#include <gimbal/test_gimbal_entry.hpp>
|
||||
#include <hms/test_hms.h>
|
||||
#include <waypoint_v2/test_waypoint_v2.h>
|
||||
#include <waypoint_v3/test_waypoint_v3.h>
|
||||
#include "application.hpp"
|
||||
#include "fc_subscription/test_fc_subscription.h"
|
||||
#include <gimbal_emu/test_payload_gimbal_emu.h>
|
||||
@ -40,7 +37,9 @@
|
||||
#include "widget/test_widget_speaker.h"
|
||||
#include <power_management/test_power_management.h>
|
||||
#include "data_transmission/test_data_transmission.h"
|
||||
#include <camera_manager/test_camera_manager.h>
|
||||
#include <flight_controller/test_flight_controller_entry.h>
|
||||
#include <positioning/test_positioning.h>
|
||||
#include <hms_manager/hms_manager_entry.h>
|
||||
#include "camera_manager/test_camera_manager_entry.h"
|
||||
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
@ -67,16 +66,9 @@ start:
|
||||
<< "\n"
|
||||
<< "| Available commands: |\n"
|
||||
<< "| [0] Fc subscribe sample - subscribe quaternion and gps data |\n"
|
||||
<< "| [1] Flight controller sample - take off landing |\n"
|
||||
<< "| [2] Flight controller sample - take off position ctrl landing |\n"
|
||||
<< "| [3] Flight controller sample - take off go home force landing |\n"
|
||||
<< "| [4] Flight controller sample - take off velocity ctrl landing |\n"
|
||||
<< "| [5] Flight controller sample - arrest flying |\n"
|
||||
<< "| [6] Flight controller sample - set get parameters |\n"
|
||||
<< "| [7] Hms info sample - get health manger system info |\n"
|
||||
<< "| [8] Waypoint 2.0 sample - run airline mission by settings (only support on M300 RTK) |\n"
|
||||
<< "| [9] Waypoint 3.0 sample - run airline mission by kmz file (not support on M300 RTK) |\n"
|
||||
<< "| [a] Gimbal manager sample |\n"
|
||||
<< "| [1] Flight controller sample - you can control flying by PSDK |\n"
|
||||
<< "| [2] Hms info manager sample - get health manger system info by language |\n"
|
||||
<< "| [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"
|
||||
@ -86,6 +78,7 @@ start:
|
||||
<< "| [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"
|
||||
<< std::endl;
|
||||
|
||||
std::cin >> inputChar;
|
||||
@ -94,31 +87,10 @@ start:
|
||||
DjiTest_FcSubscriptionRunSample();
|
||||
break;
|
||||
case '1':
|
||||
DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_TAKE_OFF_LANDING);
|
||||
DjiUser_RunFlightControllerSample();
|
||||
break;
|
||||
case '2':
|
||||
DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_TAKE_OFF_POSITION_CTRL_LANDING);
|
||||
break;
|
||||
case '3':
|
||||
DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_TAKE_OFF_GO_HOME_FORCE_LANDING);
|
||||
break;
|
||||
case '4':
|
||||
DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_TAKE_OFF_VELOCITY_CTRL_LANDING);
|
||||
break;
|
||||
case '5':
|
||||
DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_ARREST_FLYING);
|
||||
break;
|
||||
case '6':
|
||||
DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_SET_GET_PARAM);
|
||||
break;
|
||||
case '7':
|
||||
DjiTest_HmsRunSample();
|
||||
break;
|
||||
case '8':
|
||||
DjiTest_WaypointV2RunSample();
|
||||
break;
|
||||
case '9':
|
||||
DjiTest_WaypointV3RunSample();
|
||||
DjiUser_RunHmsManagerSample();
|
||||
break;
|
||||
case 'a':
|
||||
DjiUser_RunGimbalManagerSample();
|
||||
@ -202,6 +174,15 @@ start:
|
||||
case 'k':
|
||||
DjiUser_RunCameraManagerSample();
|
||||
break;
|
||||
case 'l':
|
||||
returnCode = DjiTest_PositioningStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("rtk positioning sample init error");
|
||||
break;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Start rtk positioning sample successfully");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
#include "stdio.h"
|
||||
#include "hal_network.h"
|
||||
#include "dji_logger.h"
|
||||
#include "dji_config_manager.h"
|
||||
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
|
||||
@ -44,6 +45,8 @@ T_DjiReturnCode HalNetWork_Init(const char *ipAddr, const char *netMask, T_DjiNe
|
||||
{
|
||||
int32_t ret;
|
||||
char cmdStr[LINUX_CMD_STR_MAX_SIZE];
|
||||
char networkDeviceName[USER_DEVICE_NAME_STR_MAX_SIZE];
|
||||
T_DjiUserLinkConfig linkConfig = {0};
|
||||
|
||||
if (ipAddr == NULL || netMask == NULL) {
|
||||
USER_LOG_ERROR("hal network config param error");
|
||||
@ -53,6 +56,13 @@ T_DjiReturnCode HalNetWork_Init(const char *ipAddr, const char *netMask, T_DjiNe
|
||||
//Attention: need root permission to config ip addr and netmask.
|
||||
memset(cmdStr, 0, sizeof(cmdStr));
|
||||
|
||||
if (DjiUserConfigManager_IsEnable()) {
|
||||
DjiUserConfigManager_GetLinkConfig(&linkConfig);
|
||||
strcpy(networkDeviceName, linkConfig.networkConfig.networkDeviceName);
|
||||
} else {
|
||||
strcpy(networkDeviceName, LINUX_NETWORK_DEV);
|
||||
}
|
||||
|
||||
snprintf(cmdStr, sizeof(cmdStr), "ifconfig %s up", LINUX_NETWORK_DEV);
|
||||
ret = system(cmdStr);
|
||||
if (ret != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
@ -81,8 +91,16 @@ T_DjiReturnCode HalNetWork_DeInit(T_DjiNetworkHandle halObj)
|
||||
|
||||
T_DjiReturnCode HalNetWork_GetDeviceInfo(T_DjiHalNetworkDeviceInfo *deviceInfo)
|
||||
{
|
||||
deviceInfo->usbNetAdapter.vid = USB_NET_ADAPTER_VID;
|
||||
deviceInfo->usbNetAdapter.pid = USB_NET_ADAPTER_PID;
|
||||
T_DjiUserLinkConfig linkConfig = {0};
|
||||
|
||||
if (DjiUserConfigManager_IsEnable()) {
|
||||
DjiUserConfigManager_GetLinkConfig(&linkConfig);
|
||||
deviceInfo->usbNetAdapter.vid = linkConfig.networkConfig.networkUsbAdapterVid;
|
||||
deviceInfo->usbNetAdapter.pid = linkConfig.networkConfig.networkUsbAdapterPid;
|
||||
} else {
|
||||
deviceInfo->usbNetAdapter.vid = USB_NET_ADAPTER_VID;
|
||||
deviceInfo->usbNetAdapter.pid = USB_NET_ADAPTER_PID;
|
||||
}
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <dji_logger.h>
|
||||
#include "hal_uart.h"
|
||||
#include "dji_config_manager.h"
|
||||
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
#define UART_DEV_NAME_STR_SIZE (128)
|
||||
@ -48,20 +49,32 @@ T_DjiReturnCode HalUart_Init(E_DjiHalUartNum uartNum, uint32_t baudRate, T_DjiUa
|
||||
struct flock lock;
|
||||
T_DjiReturnCode returnCode = DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
char uartName[UART_DEV_NAME_STR_SIZE];
|
||||
char uart1Name[UART_DEV_NAME_STR_SIZE];
|
||||
char uart2Name[UART_DEV_NAME_STR_SIZE];
|
||||
char systemCmd[DJI_SYSTEM_CMD_STR_MAX_SIZE];
|
||||
char *ret = NULL;
|
||||
char lineBuf[DJI_SYSTEM_RESULT_STR_MAX_SIZE] = {0};
|
||||
FILE *fp;
|
||||
T_DjiUserLinkConfig linkConfig = {0};
|
||||
|
||||
uartHandleStruct = malloc(sizeof(T_UartHandleStruct));
|
||||
if (uartHandleStruct == NULL) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_MEMORY_ALLOC_FAILED;
|
||||
}
|
||||
|
||||
if (DjiUserConfigManager_IsEnable()) {
|
||||
DjiUserConfigManager_GetLinkConfig(&linkConfig);
|
||||
strcpy(uart1Name, linkConfig.uartConfig.uart1DeviceName);
|
||||
strcpy(uart2Name, linkConfig.uartConfig.uart2DeviceName);
|
||||
} else {
|
||||
strcpy(uart1Name, LINUX_UART_DEV1);
|
||||
strcpy(uart2Name, LINUX_UART_DEV2);
|
||||
}
|
||||
|
||||
if (uartNum == DJI_HAL_UART_NUM_0) {
|
||||
strcpy(uartName, LINUX_UART_DEV1);
|
||||
strcpy(uartName, uart1Name);
|
||||
} else if (uartNum == DJI_HAL_UART_NUM_1) {
|
||||
strcpy(uartName, LINUX_UART_DEV2);
|
||||
strcpy(uartName, uart2Name);
|
||||
} else {
|
||||
goto free_uart_handle;
|
||||
}
|
||||
@ -88,7 +101,7 @@ T_DjiReturnCode HalUart_Init(E_DjiHalUartNum uartNum, uint32_t baudRate, T_DjiUa
|
||||
sprintf(systemCmd, "chmod 777 %s", uartName);
|
||||
fp = popen(systemCmd, "r");
|
||||
if (fp == NULL) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
goto free_uart_handle;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -244,10 +257,17 @@ T_DjiReturnCode HalUart_ReadData(T_DjiUartHandle uartHandle, uint8_t *buf, uint3
|
||||
|
||||
T_DjiReturnCode HalUart_GetStatus(E_DjiHalUartNum uartNum, T_DjiUartStatus *status)
|
||||
{
|
||||
T_DjiUserLinkConfig linkConfig = {0};
|
||||
|
||||
if (uartNum == DJI_HAL_UART_NUM_0) {
|
||||
status->isConnect = true;
|
||||
} else if (uartNum == DJI_HAL_UART_NUM_1) {
|
||||
status->isConnect = true;
|
||||
if (DjiUserConfigManager_IsEnable()) {
|
||||
DjiUserConfigManager_GetLinkConfig(&linkConfig);
|
||||
status->isConnect = linkConfig.uartConfig.uart2DeviceEnable;
|
||||
} else {
|
||||
status->isConnect = true;
|
||||
}
|
||||
} else {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "hal_usb_bulk.h"
|
||||
#include "dji_logger.h"
|
||||
#include "dji_config_manager.h"
|
||||
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
#define LINUX_USB_BULK_TRANSFER_TIMEOUT_MS (50)
|
||||
@ -52,6 +53,13 @@ T_DjiReturnCode HalUsbBulk_Init(T_DjiHalUsbBulkInfo usbBulkInfo, T_DjiUsbBulkHan
|
||||
{
|
||||
int32_t ret;
|
||||
struct libusb_device_handle *handle = NULL;
|
||||
T_DjiUserLinkConfig linkConfig = {0};
|
||||
char usbBulk1EpInFd[USER_DEVICE_NAME_STR_MAX_SIZE];
|
||||
char usbBulk1EpOutFd[USER_DEVICE_NAME_STR_MAX_SIZE];
|
||||
char usbBulk2EpInFd[USER_DEVICE_NAME_STR_MAX_SIZE];
|
||||
char usbBulk2EpOutFd[USER_DEVICE_NAME_STR_MAX_SIZE];
|
||||
uint8_t usbBulk1InterfaceNum;
|
||||
uint8_t usbBulk2InterfaceNum;
|
||||
|
||||
*usbBulkHandle = malloc(sizeof(T_HalUsbBulkObj));
|
||||
if (*usbBulkHandle == NULL) {
|
||||
@ -67,7 +75,7 @@ T_DjiReturnCode HalUsbBulk_Init(T_DjiHalUsbBulkInfo usbBulkInfo, T_DjiUsbBulkHan
|
||||
}
|
||||
|
||||
handle = libusb_open_device_with_vid_pid(NULL, usbBulkInfo.vid, usbBulkInfo.pid);
|
||||
if(handle == NULL) {
|
||||
if (handle == NULL) {
|
||||
USER_LOG_ERROR("open usb device failed");
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
}
|
||||
@ -87,23 +95,44 @@ T_DjiReturnCode HalUsbBulk_Init(T_DjiHalUsbBulkInfo usbBulkInfo, T_DjiUsbBulkHan
|
||||
memcpy(&((T_HalUsbBulkObj *) *usbBulkHandle)->usbBulkInfo, &usbBulkInfo, sizeof(usbBulkInfo));
|
||||
((T_HalUsbBulkObj *) *usbBulkHandle)->interfaceNum = usbBulkInfo.channelInfo.interfaceNum;
|
||||
|
||||
if (usbBulkInfo.channelInfo.interfaceNum == LINUX_USB_BULK1_INTERFACE_NUM) {
|
||||
((T_HalUsbBulkObj *) *usbBulkHandle)->ep1 = open(LINUX_USB_BULK1_EP_OUT_FD, O_RDWR);
|
||||
if (DjiUserConfigManager_IsEnable()) {
|
||||
DjiUserConfigManager_GetLinkConfig(&linkConfig);
|
||||
usbBulk1InterfaceNum = linkConfig.usbBulkConfig.usbBulk1InterfaceNum;
|
||||
usbBulk2InterfaceNum = linkConfig.usbBulkConfig.usbBulk2InterfaceNum;
|
||||
snprintf(usbBulk1EpOutFd, sizeof(usbBulk1EpOutFd), "%s/ep1",
|
||||
linkConfig.usbBulkConfig.usbBulk1DeviceName);
|
||||
snprintf(usbBulk1EpInFd, sizeof(usbBulk1EpInFd), "%s/ep2",
|
||||
linkConfig.usbBulkConfig.usbBulk1DeviceName);
|
||||
snprintf(usbBulk2EpOutFd, sizeof(usbBulk2EpOutFd), "%s/ep1",
|
||||
linkConfig.usbBulkConfig.usbBulk2DeviceName);
|
||||
snprintf(usbBulk2EpInFd, sizeof(usbBulk2EpInFd), "%s/ep2",
|
||||
linkConfig.usbBulkConfig.usbBulk2DeviceName);
|
||||
} else {
|
||||
usbBulk1InterfaceNum = LINUX_USB_BULK1_INTERFACE_NUM;
|
||||
usbBulk2InterfaceNum = LINUX_USB_BULK2_INTERFACE_NUM;
|
||||
strcpy(usbBulk1EpInFd, LINUX_USB_BULK1_EP_IN_FD);
|
||||
strcpy(usbBulk1EpOutFd, LINUX_USB_BULK1_EP_OUT_FD);
|
||||
strcpy(usbBulk2EpInFd, LINUX_USB_BULK2_EP_IN_FD);
|
||||
strcpy(usbBulk2EpOutFd, LINUX_USB_BULK2_EP_OUT_FD);
|
||||
}
|
||||
|
||||
if (usbBulkInfo.channelInfo.interfaceNum == usbBulk1InterfaceNum) {
|
||||
((T_HalUsbBulkObj *) *usbBulkHandle)->ep1 = open(usbBulk1EpOutFd, O_RDWR);
|
||||
if (((T_HalUsbBulkObj *) *usbBulkHandle)->ep1 < 0) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
}
|
||||
|
||||
((T_HalUsbBulkObj *) *usbBulkHandle)->ep2 = open(LINUX_USB_BULK1_EP_IN_FD, O_RDWR);
|
||||
((T_HalUsbBulkObj *) *usbBulkHandle)->ep2 = open(usbBulk1EpInFd, O_RDWR);
|
||||
if (((T_HalUsbBulkObj *) *usbBulkHandle)->ep2 < 0) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
}
|
||||
} else if (usbBulkInfo.channelInfo.interfaceNum == LINUX_USB_BULK2_INTERFACE_NUM) {
|
||||
((T_HalUsbBulkObj *) *usbBulkHandle)->ep1 = open(LINUX_USB_BULK2_EP_OUT_FD, O_RDWR);
|
||||
} else if (usbBulkInfo.channelInfo.interfaceNum == usbBulk2InterfaceNum) {
|
||||
((T_HalUsbBulkObj *) *usbBulkHandle)->ep1 = open(usbBulk2EpOutFd, O_RDWR);
|
||||
if (((T_HalUsbBulkObj *) *usbBulkHandle)->ep1 < 0) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
}
|
||||
|
||||
((T_HalUsbBulkObj *) *usbBulkHandle)->ep2 = open(LINUX_USB_BULK2_EP_IN_FD, O_RDWR);
|
||||
((T_HalUsbBulkObj *) *usbBulkHandle)->ep2 = open(usbBulk2EpInFd, O_RDWR);
|
||||
if (((T_HalUsbBulkObj *) *usbBulkHandle)->ep2 < 0) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
}
|
||||
@ -127,8 +156,9 @@ T_DjiReturnCode HalUsbBulk_DeInit(T_DjiUsbBulkHandle usbBulkHandle)
|
||||
|
||||
if (((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.isUsbHost == true) {
|
||||
#ifdef LIBUSB_INSTALLED
|
||||
ret = libusb_release_interface(handle, ((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.channelInfo.interfaceNum);
|
||||
if(ret != 0) {
|
||||
ret = libusb_release_interface(handle,
|
||||
((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.channelInfo.interfaceNum);
|
||||
if (ret != 0) {
|
||||
USER_LOG_ERROR("release usb bulk interface failed, errno = %d", ret);
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
}
|
||||
@ -208,19 +238,39 @@ T_DjiReturnCode HalUsbBulk_ReadData(T_DjiUsbBulkHandle usbBulkHandle, uint8_t *b
|
||||
|
||||
T_DjiReturnCode HalUsbBulk_GetDeviceInfo(T_DjiHalUsbBulkDeviceInfo *deviceInfo)
|
||||
{
|
||||
//attention: this interface only be called in usb device mode.
|
||||
deviceInfo->vid = LINUX_USB_VID;
|
||||
deviceInfo->pid = LINUX_USB_PID;
|
||||
T_DjiUserLinkConfig linkConfig = {0};
|
||||
|
||||
// This bulk channel is used to obtain DJI camera video stream and push 3rd-party camera video stream.
|
||||
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_0].interfaceNum = LINUX_USB_BULK1_INTERFACE_NUM;
|
||||
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_0].endPointIn = LINUX_USB_BULK1_END_POINT_IN;
|
||||
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_0].endPointOut = LINUX_USB_BULK1_END_POINT_OUT;
|
||||
if (DjiUserConfigManager_IsEnable()) {
|
||||
DjiUserConfigManager_GetLinkConfig(&linkConfig);
|
||||
|
||||
// This bulk channel is used to obtain DJI perception image and download camera media file.
|
||||
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_1].interfaceNum = LINUX_USB_BULK2_INTERFACE_NUM;
|
||||
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_1].endPointIn = LINUX_USB_BULK2_END_POINT_IN;
|
||||
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_1].endPointOut = LINUX_USB_BULK2_END_POINT_OUT;
|
||||
//attention: this interface only be called in usb device mode.
|
||||
deviceInfo->vid = linkConfig.usbBulkConfig.usbDeviceVid;
|
||||
deviceInfo->pid = linkConfig.usbBulkConfig.usbDevicePid;
|
||||
|
||||
// This bulk channel is used to obtain DJI camera video stream and push 3rd-party camera video stream.
|
||||
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_0].interfaceNum = linkConfig.usbBulkConfig.usbBulk1InterfaceNum;
|
||||
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_0].endPointIn = linkConfig.usbBulkConfig.usbBulk1EndpointIn;
|
||||
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_0].endPointOut = linkConfig.usbBulkConfig.usbBulk1EndpointOut;
|
||||
|
||||
// This bulk channel is used to obtain DJI perception image and download camera media file.
|
||||
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_1].interfaceNum = linkConfig.usbBulkConfig.usbBulk2InterfaceNum;
|
||||
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_1].endPointIn = linkConfig.usbBulkConfig.usbBulk2EndpointIn;
|
||||
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_1].endPointOut = linkConfig.usbBulkConfig.usbBulk2EndpointOut;
|
||||
} else {
|
||||
//attention: this interface only be called in usb device mode.
|
||||
deviceInfo->vid = LINUX_USB_VID;
|
||||
deviceInfo->pid = LINUX_USB_PID;
|
||||
|
||||
// This bulk channel is used to obtain DJI camera video stream and push 3rd-party camera video stream.
|
||||
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_0].interfaceNum = LINUX_USB_BULK1_INTERFACE_NUM;
|
||||
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_0].endPointIn = LINUX_USB_BULK1_END_POINT_IN;
|
||||
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_0].endPointOut = LINUX_USB_BULK1_END_POINT_OUT;
|
||||
|
||||
// This bulk channel is used to obtain DJI perception image and download camera media file.
|
||||
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_1].interfaceNum = LINUX_USB_BULK2_INTERFACE_NUM;
|
||||
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_1].endPointIn = LINUX_USB_BULK2_END_POINT_IN;
|
||||
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_1].endPointOut = LINUX_USB_BULK2_END_POINT_OUT;
|
||||
}
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ T_DjiReturnCode DjiMediaFile_GetMediaFileAttr(T_DjiMediaFileHandle mediaFileHand
|
||||
}
|
||||
|
||||
T_DjiReturnCode DjiMediaFile_GetDataOrg(struct _DjiMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen)
|
||||
uint8_t *data, uint32_t *realLen)
|
||||
{
|
||||
if (mediaFileHandle->mediaFileOptItem.getDataOrgFunc == NULL) {
|
||||
USER_LOG_ERROR("Media file handle getDataOrgFunc null error");
|
||||
|
||||
@ -57,7 +57,7 @@ typedef struct {
|
||||
T_DjiReturnCode (*getAttrFunc)(struct _DjiMediaFile *mediaFileHandle, T_DjiCameraMediaFileAttr *mediaFileAttr);
|
||||
|
||||
T_DjiReturnCode (*getDataOrgFunc)(struct _DjiMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen);
|
||||
uint8_t *data, uint32_t *realLen);
|
||||
T_DjiReturnCode (*getFileSizeOrgFunc)(struct _DjiMediaFile *mediaFileHandle, uint32_t *fileSize);
|
||||
|
||||
T_DjiReturnCode (*createThmFunc)(struct _DjiMediaFile *mediaFileHandle);
|
||||
@ -91,7 +91,7 @@ T_DjiReturnCode DjiMediaFile_GetMediaFileAttr(T_DjiMediaFileHandle mediaFileHand
|
||||
T_DjiCameraMediaFileAttr *mediaFileAttr);
|
||||
|
||||
T_DjiReturnCode DjiMediaFile_GetDataOrg(struct _DjiMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen);
|
||||
uint8_t *data, uint32_t *realLen);
|
||||
T_DjiReturnCode DjiMediaFile_GetFileSizeOrg(struct _DjiMediaFile *mediaFileHandle, uint32_t *fileSize);
|
||||
|
||||
T_DjiReturnCode DjiMediaFile_CreateThm(T_DjiMediaFileHandle mediaFileHandle);
|
||||
|
||||
@ -770,7 +770,7 @@ static T_DjiReturnCode GetMediaFileDir(char *dirPath)
|
||||
static T_DjiReturnCode GetMediaFileOriginData(const char *filePath, uint32_t offset, uint32_t length, uint8_t *data)
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
uint16_t realLen = 0;
|
||||
uint32_t realLen = 0;
|
||||
T_DjiMediaFileHandle mediaFileHandle;
|
||||
|
||||
returnCode = DjiMediaFile_CreateHandle(filePath, &mediaFileHandle);
|
||||
|
||||
@ -55,6 +55,7 @@ static const T_DjiTestCameraTypeStr s_cameraTypeStrList[] = {
|
||||
{DJI_CAMERA_TYPE_H20T, "Zenmuse H20T"},
|
||||
{DJI_CAMERA_TYPE_P1, "Zenmuse P1"},
|
||||
{DJI_CAMERA_TYPE_L1, "Zenmuse L1"},
|
||||
{DJI_CAMERA_TYPE_L2, "Zenmuse L2"},
|
||||
{DJI_CAMERA_TYPE_H20N, "Zenmuse H20N"},
|
||||
{DJI_CAMERA_TYPE_M30, "M30 Camera"},
|
||||
{DJI_CAMERA_TYPE_M30T, "M30T Camera"},
|
||||
@ -906,7 +907,8 @@ T_DjiReturnCode DjiTest_CameraManagerRunSample(E_DjiMountPosition mountPosition,
|
||||
if (cameraType == DJI_CAMERA_TYPE_H20 || cameraType == DJI_CAMERA_TYPE_H20T ||
|
||||
cameraType == DJI_CAMERA_TYPE_H20N || cameraType == DJI_CAMERA_TYPE_M30 ||
|
||||
cameraType == DJI_CAMERA_TYPE_M30T || cameraType == DJI_CAMERA_TYPE_M3E ||
|
||||
cameraType == DJI_CAMERA_TYPE_M3T) {
|
||||
cameraType == DJI_CAMERA_TYPE_M3T || cameraType == DJI_CAMERA_TYPE_M3T ||
|
||||
cameraType == DJI_CAMERA_TYPE_L2) {
|
||||
USER_LOG_INFO("Set mounted position %d camera's exposure mode to manual mode.",
|
||||
mountPosition);
|
||||
returnCode = DjiTest_CameraManagerSetExposureMode(mountPosition,
|
||||
@ -945,7 +947,7 @@ T_DjiReturnCode DjiTest_CameraManagerRunSample(E_DjiMountPosition mountPosition,
|
||||
if (cameraType == DJI_CAMERA_TYPE_H20 || cameraType == DJI_CAMERA_TYPE_H20N
|
||||
|| cameraType == DJI_CAMERA_TYPE_H20T || cameraType == DJI_CAMERA_TYPE_M30
|
||||
|| cameraType == DJI_CAMERA_TYPE_M30T || cameraType == DJI_CAMERA_TYPE_M3E
|
||||
|| cameraType == DJI_CAMERA_TYPE_M3T) {
|
||||
|| cameraType == DJI_CAMERA_TYPE_M3T || cameraType == DJI_CAMERA_TYPE_L2) {
|
||||
USER_LOG_INFO("Set mounted position %d camera's exposure mode to manual mode.",
|
||||
mountPosition);
|
||||
returnCode = DjiTest_CameraManagerSetExposureMode(mountPosition,
|
||||
@ -1245,6 +1247,876 @@ T_DjiReturnCode DjiTest_CameraManagerRunSample(E_DjiMountPosition mountPosition,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_NIGHT_SCENE_MODE: {
|
||||
E_DjiCameraManagerNightSceneMode nightSceneMode;
|
||||
T_DjiCameraManagerRangeList nightSceneModeRange;
|
||||
|
||||
if (cameraType == DJI_CAMERA_TYPE_XT2 || cameraType == DJI_CAMERA_TYPE_XTS ||
|
||||
cameraType == DJI_CAMERA_TYPE_H20 || cameraType == DJI_CAMERA_TYPE_P1 ||
|
||||
cameraType == DJI_CAMERA_TYPE_L1 || cameraType == DJI_CAMERA_TYPE_L2 ||
|
||||
cameraType == DJI_CAMERA_TYPE_M3E || cameraType == DJI_CAMERA_TYPE_M3T) {
|
||||
USER_LOG_INFO("Camera type %d does not support night scene mode!", cameraType);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Step 1: Change camera stream source to zoom camera.");
|
||||
returnCode = DjiCameraManager_SetStreamSource(mountPosition, DJI_CAMERA_MANAGER_SOURCE_ZOOM_CAM);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
if (returnCode == DJI_ERROR_CAMERA_MANAGER_MODULE_CODE_UNSUPPORTED_COMMAND) {
|
||||
USER_LOG_WARN("For camera type %d, it does not need to change stream source.\r\n", cameraType);
|
||||
}
|
||||
else {
|
||||
goto exitCameraModule;
|
||||
}
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Step 2: Get night scene mode range.");
|
||||
returnCode = DjiCameraManager_GetNightSceneModeRange(mountPosition, &nightSceneModeRange);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get night scene mode range of camera at position %d failed, return code 0x%08llX",
|
||||
mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
osalHandler->TaskSleepMs(10);
|
||||
printf("Supported night scene mode:");
|
||||
for(uint32_t i = 0; i < nightSceneModeRange.size; i++) {
|
||||
printf(" %d", nightSceneModeRange.nightSceneMode[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
USER_LOG_INFO("Step 3: Set ningh scene mode as enable.");
|
||||
returnCode = DjiCameraManager_SetNightSceneMode(mountPosition, DJI_CAMERA_MANAGER_NIGHT_SCENE_MODE_ENABLE);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Set ningh scene mode as enable failed at position %d, error code: 0x%08X\r\n",
|
||||
mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
returnCode = DjiCameraManager_GetNightSceneMode(mountPosition, &nightSceneMode);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get night scene mode failed at position %d, error code: 0x%08X\r\n",
|
||||
mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Now the night scene mode is %d", nightSceneMode);
|
||||
|
||||
USER_LOG_INFO("Sleep 2s...");
|
||||
osalHandler->TaskSleepMs(2000);
|
||||
|
||||
USER_LOG_INFO("Step 4: Set night scene mode as auto.");
|
||||
if (cameraType == DJI_CAMERA_TYPE_H20T) {
|
||||
USER_LOG_WARN("Camera H20T does not support set night scene mode as auto");
|
||||
}
|
||||
else {
|
||||
returnCode = DjiCameraManager_SetNightSceneMode(mountPosition, DJI_CAMERA_MANAGER_NIGHT_SCENE_MODE_AUTO);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Set ningh scene mode as auto failed at position %d, error code: 0x%08X\r\n",
|
||||
mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
returnCode = DjiCameraManager_GetNightSceneMode(mountPosition, &nightSceneMode);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get night scene mode failed at position %d, error code: 0x%08X\r\n",
|
||||
mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Now the night scene mode is %d", nightSceneMode);
|
||||
|
||||
USER_LOG_INFO("Sleep 2s...");
|
||||
osalHandler->TaskSleepMs(2000);
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Step 5: Set ningt scene mode as disable.");
|
||||
returnCode = DjiCameraManager_SetNightSceneMode(mountPosition, DJI_CAMERA_MANAGER_NIGHT_SCENE_MODE_DISABLE);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get lidar ranging info failed at position %d, error code: 0x%08X\r\n",
|
||||
mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
returnCode = DjiCameraManager_GetNightSceneMode(mountPosition, &nightSceneMode);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get lidar ranging info failed at position %d, error code: 0x%08X\r\n",
|
||||
mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Now the night scene mode is %d", nightSceneMode);
|
||||
|
||||
break;
|
||||
}
|
||||
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_CAPTURE_RECORDING_STREAMS: {
|
||||
T_DjiCameraManagerStreamList streamList;
|
||||
T_DjiCameraManagerStreamList getStreamList = {0};
|
||||
T_DjiCameraManagerRangeList streamStorageRange = {0};
|
||||
|
||||
if (cameraType == DJI_CAMERA_TYPE_Z30 || cameraType == DJI_CAMERA_TYPE_XT2 ||
|
||||
cameraType == DJI_CAMERA_TYPE_XTS || cameraType == DJI_CAMERA_TYPE_P1 ||
|
||||
cameraType == DJI_CAMERA_TYPE_L1) {
|
||||
USER_LOG_INFO("Camera type %d does not support set capture or recording stream(s) to storage.",
|
||||
cameraType);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
returnCode = DjiCameraManager_SetMode(mountPosition, DJI_CAMERA_MANAGER_WORK_MODE_SHOOT_PHOTO);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_WARN("Set camera work mode failed, position %d, error code: 0x%08X\r\n", mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
returnCode = DjiCameraManager_GetStreamStorageRange(mountPosition,
|
||||
&streamStorageRange);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < streamStorageRange.size; i++) {
|
||||
streamList.streamStorage[i] = streamStorageRange.streamStorage[i];
|
||||
}
|
||||
streamList.size = streamStorageRange.size;
|
||||
|
||||
USER_LOG_INFO("Step 1: Select all capture stream to be storaged.");
|
||||
returnCode = DjiCameraManager_SetCaptureRecordingStreams(mountPosition,
|
||||
DJI_CAMERA_MANAGER_CAPTURE_OR_RECORDING_CAPTURE,
|
||||
&streamList);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_WARN("Set capture storaged streams failed %d, error code: 0x%08X\r\n", mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Step 2: Read back capture storage streams:");
|
||||
returnCode = DjiCameraManager_GetCaptureRecordingStreams(mountPosition,
|
||||
DJI_CAMERA_MANAGER_CAPTURE_OR_RECORDING_CAPTURE,
|
||||
&getStreamList);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_WARN("Get capture storage streams failed %d, error code: 0x%08X\r\n", mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < getStreamList.size; i++) {
|
||||
USER_LOG_INFO(" stream %d is %d", i, getStreamList.streamStorage[i]);
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Sleep 2s...");
|
||||
osalHandler->TaskSleepMs(2000);
|
||||
|
||||
USER_LOG_INFO("Step 3: Select all video stream to be storaged.");
|
||||
returnCode = DjiCameraManager_SetMode(mountPosition, DJI_CAMERA_MANAGER_WORK_MODE_RECORD_VIDEO);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_WARN("Failed %d, error code: 0x%08X\r\n", mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
returnCode = DjiCameraManager_SetCaptureRecordingStreams(mountPosition,
|
||||
DJI_CAMERA_MANAGER_CAPTURE_OR_RECORDING_RECORDING,
|
||||
&streamList);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_WARN("Set recording storage streams failed %d, error code: 0x%08X\r\n", mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Step 4: Read back video storage streams:");
|
||||
returnCode = DjiCameraManager_GetCaptureRecordingStreams(mountPosition,
|
||||
DJI_CAMERA_MANAGER_CAPTURE_OR_RECORDING_RECORDING,
|
||||
&getStreamList);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_WARN("Get capture storage streams failed %d, error code: 0x%08X\r\n", mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < getStreamList.size; i++) {
|
||||
USER_LOG_INFO(" stream %d is %d", i, getStreamList.streamStorage[i]);
|
||||
}
|
||||
|
||||
streamList.streamStorage[0] = streamStorageRange.streamStorage[0];
|
||||
streamList.size = 1;
|
||||
|
||||
USER_LOG_INFO("Sleep 2s...");
|
||||
osalHandler->TaskSleepMs(2000);
|
||||
|
||||
USER_LOG_INFO("Step 5: Select default video stream to storage.");
|
||||
returnCode = DjiCameraManager_SetMode(mountPosition, DJI_CAMERA_MANAGER_WORK_MODE_RECORD_VIDEO);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_WARN("Failed %d, error code: 0x%08X\r\n", mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
returnCode = DjiCameraManager_SetCaptureRecordingStreams(mountPosition,
|
||||
DJI_CAMERA_MANAGER_CAPTURE_OR_RECORDING_RECORDING,
|
||||
&streamList);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_WARN("Set recording storage streams failed %d, error code: 0x%08X\r\n", mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Step 6: Read back video storage streams:");
|
||||
returnCode = DjiCameraManager_GetCaptureRecordingStreams(mountPosition,
|
||||
DJI_CAMERA_MANAGER_CAPTURE_OR_RECORDING_RECORDING,
|
||||
&getStreamList);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_WARN("Get capture storage streams failed %d, error code: 0x%08X\r\n", mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < getStreamList.size; i++) {
|
||||
USER_LOG_INFO(" stream %d is %d", i, getStreamList.streamStorage[i]);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SHOW_STORAGE_INFO: {
|
||||
T_DjiCameraManagerStorageInfo storageInfo;
|
||||
|
||||
for (uint32_t i = 0; i < 30; i++) {
|
||||
returnCode = DjiCameraManager_GetStorageInfo(mountPosition, &storageInfo);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_INFO("Get storage info failed!");
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("total capacity: %d, remainCapcity: %d", storageInfo.totalCapacity, storageInfo.remainCapacity);
|
||||
|
||||
osalHandler->TaskSleepMs(200);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_FORMAT_SD_CARD: {
|
||||
returnCode = DjiCameraManager_FormatStorage(mountPosition);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Faile to Format SD card.");
|
||||
goto exitCameraModule;
|
||||
}
|
||||
USER_LOG_INFO("Format SD card successfully!");
|
||||
break;
|
||||
}
|
||||
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_LINK_ZOOM: {
|
||||
|
||||
USER_LOG_INFO("Set synchronized split screen zoom enabled");
|
||||
returnCode = DjiCameraManager_SetSynchronizedSplitScreenZoomEnabled(mountPosition, true);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Sleep 5s...");
|
||||
osalHandler->TaskSleepMs(5000);
|
||||
|
||||
USER_LOG_INFO("Set synchronized split screen zoom disabled");
|
||||
returnCode = DjiCameraManager_SetSynchronizedSplitScreenZoomEnabled(mountPosition, false);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_USER_CUSTOM_DIR_FILE_NAME: {
|
||||
uint8_t dirName[240] = {0};
|
||||
uint32_t dirNameSize = 0;
|
||||
uint8_t fileName[240] = {0};
|
||||
uint32_t fileNameSize = 0;
|
||||
uint8_t getNameString[100] = {0};
|
||||
uint32_t getNameStringSize;
|
||||
|
||||
osalHandler->TaskSleepMs(5);
|
||||
printf("Input expand directory name: ");
|
||||
scanf("%s", dirName);
|
||||
dirNameSize = strlen(dirName);
|
||||
|
||||
returnCode = DjiCameraManager_SetCustomExpandName(mountPosition,
|
||||
DJI_CAMERA_MANAGER_EXPAND_NAME_TYPE_DIR,
|
||||
dirName,
|
||||
dirNameSize);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Set Custom expand directory name failed");
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
if (cameraType != DJI_CAMERA_TYPE_L1) {
|
||||
osalHandler->TaskSleepMs(5);
|
||||
printf("Input expand file name: ");
|
||||
scanf("%s", fileName);
|
||||
fileNameSize = strlen(fileName);
|
||||
|
||||
returnCode = DjiCameraManager_SetCustomExpandName(mountPosition,
|
||||
DJI_CAMERA_MANAGER_EXPAND_NAME_TYPE_FILE,
|
||||
fileName,
|
||||
fileNameSize);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Set Custom expand file name failed");
|
||||
goto exitCameraModule;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
getNameStringSize = sizeof(getNameString) - 1;
|
||||
returnCode = DjiCameraManager_GetCustomExpandName(mountPosition,
|
||||
DJI_CAMERA_MANAGER_EXPAND_NAME_TYPE_DIR,
|
||||
getNameString,
|
||||
&getNameStringSize);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get Custom expand directory name failed, stat = 0x%08llX", returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
getNameString[getNameStringSize] = '\0';
|
||||
USER_LOG_INFO("Latest directory name: %s", getNameString);
|
||||
|
||||
if (cameraType != DJI_CAMERA_TYPE_L1) {
|
||||
getNameStringSize = sizeof(getNameString) - 1;
|
||||
returnCode = DjiCameraManager_GetCustomExpandName(mountPosition,
|
||||
DJI_CAMERA_MANAGER_EXPAND_NAME_TYPE_FILE,
|
||||
getNameString,
|
||||
&getNameStringSize);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get Custom expand file name failed");
|
||||
goto exitCameraModule;
|
||||
}
|
||||
getNameString[getNameStringSize] = '\0';
|
||||
USER_LOG_INFO("Latest file name: %s", getNameString);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_RESET_CAMERA_SETTINGS: {
|
||||
returnCode = DjiCameraManager_ResetCameraSetting(mountPosition);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("reset camera at position %d failed", mountPosition);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Reset camera settings success!");
|
||||
|
||||
break;
|
||||
}
|
||||
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_AE_LOCK_MODE: {
|
||||
bool enable;
|
||||
|
||||
if (cameraType == DJI_CAMERA_TYPE_H20 || cameraType == DJI_CAMERA_TYPE_H20T ||
|
||||
cameraType == DJI_CAMERA_TYPE_H20N || cameraType == DJI_CAMERA_TYPE_M30 ||
|
||||
cameraType == DJI_CAMERA_TYPE_M30T || cameraType == DJI_CAMERA_TYPE_M3E ||
|
||||
cameraType == DJI_CAMERA_TYPE_M3T) {
|
||||
returnCode = DjiCameraManager_SetStreamSource(mountPosition, DJI_CAMERA_MANAGER_SOURCE_ZOOM_CAM);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_WARN("Change camera stream source to zoom camera failed at position %d, error code: 0x%08X\r\n",
|
||||
mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Try to set ae locked...");
|
||||
returnCode = DjiCameraManager_SetAELockEnabled(mountPosition, true);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Set camera ae lock mode at position %d failed", mountPosition);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
osalHandler->TaskSleepMs(2000);
|
||||
USER_LOG_INFO("Sleep 2s...");
|
||||
|
||||
returnCode = DjiCameraManager_GetAELockEnabled(mountPosition, &enable);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get camera ae lock mode at position %d failed", mountPosition);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("The camera ae lock mode now is %d", enable);
|
||||
|
||||
USER_LOG_INFO("Try to set ae unlocked...");
|
||||
returnCode = DjiCameraManager_SetAELockEnabled(mountPosition, false);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Set camera ae lock mode at position %d failed", mountPosition);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
osalHandler->TaskSleepMs(2000);
|
||||
USER_LOG_INFO("Sleep 2s...");
|
||||
|
||||
if (cameraType == DJI_CAMERA_TYPE_L1 || cameraType == DJI_CAMERA_TYPE_P1) {
|
||||
USER_LOG_INFO("Camera type %d does not support get AE lock mode, please check by yourself.",
|
||||
cameraType);
|
||||
}
|
||||
else {
|
||||
returnCode = DjiCameraManager_GetAELockEnabled(mountPosition, &enable);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get camera ae lock mode at position %d failed", mountPosition);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("The camera ae lock mode now is %d", enable);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_FOCUS_RING_VALUE: {
|
||||
uint16_t focusRingValue;
|
||||
T_DjiCameraManagerRangeList focusRingRange;
|
||||
|
||||
if (cameraType == DJI_CAMERA_TYPE_H20 || cameraType == DJI_CAMERA_TYPE_H20N ||
|
||||
cameraType == DJI_CAMERA_TYPE_H20T || cameraType == DJI_CAMERA_TYPE_M30 ||
|
||||
cameraType == DJI_CAMERA_TYPE_M30T || cameraType == DJI_CAMERA_TYPE_M3E ||
|
||||
cameraType == DJI_CAMERA_TYPE_M3T) {
|
||||
USER_LOG_INFO("Set camera stream source to zoom camera.");
|
||||
returnCode = DjiCameraManager_SetStreamSource(mountPosition, DJI_CAMERA_MANAGER_SOURCE_ZOOM_CAM);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_WARN("Change camera stream source to zoom camera failed at position %d, error code: 0x%08X\r\n",
|
||||
mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Set camera's focus mode to manual mode.");
|
||||
returnCode = DjiCameraManager_SetFocusMode(mountPosition, DJI_CAMERA_MANAGER_FOCUS_MODE_MANUAL);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Set mounted position %d camera's focus mode(%d) failed,"
|
||||
" error code :0x%08X.", mountPosition, DJI_CAMERA_MANAGER_FOCUS_MODE_MANUAL,
|
||||
returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
returnCode = DjiCameraManager_GetFocusRingRange(mountPosition, &focusRingRange);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get range failed!");
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Focus ring vlaue range: %d to %d.", focusRingRange.minValue, focusRingRange.maxValue);
|
||||
|
||||
osalHandler->TaskSleepMs(10);
|
||||
printf("Input focus ring value to set: ");
|
||||
scanf("%d", &focusRingValue);
|
||||
|
||||
USER_LOG_INFO("Try to set focus ring value as %d", focusRingValue);
|
||||
returnCode = DjiCameraManager_SetFocusRingValue(mountPosition, focusRingValue);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Set camera focus ring value at position %d failed", mountPosition);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
osalHandler->TaskSleepMs(2000);
|
||||
|
||||
if (cameraType != DJI_CAMERA_TYPE_Z30) {
|
||||
returnCode = DjiCameraManager_GetFocusRingValue(mountPosition, &focusRingValue);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get camera focus ring value at position %d failed", mountPosition);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
USER_LOG_INFO("Current focus ring value is %d", focusRingValue);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_CONNECT_STATUS_TEST: {
|
||||
bool connectStatus;
|
||||
uint32_t loopTime = 10;
|
||||
|
||||
osalHandler->TaskSleepMs(10);
|
||||
printf("Please input checking time: ");
|
||||
scanf("%d", &loopTime);
|
||||
|
||||
do {
|
||||
returnCode = DjiCameraManager_GetCameraConnectStatus(mountPosition,
|
||||
&connectStatus);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Camera's connect state is %d", connectStatus);
|
||||
|
||||
osalHandler->TaskSleepMs(1500);
|
||||
} while(loopTime--);
|
||||
|
||||
break;
|
||||
}
|
||||
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_GET_PHOTO_VIDEO_PARAM: {
|
||||
E_DjiCameraManagerPhotoRatio photoRatio;
|
||||
E_DjiCameraManagerPhotoStorageFormat photoFormat;
|
||||
E_DjiCameraManagerVideoStorageFormat videoFormat;
|
||||
T_DjiCameraManagerRangeList photoRatioRange;
|
||||
T_DjiCameraManagerRangeList photoFormatRange;
|
||||
T_DjiCameraManagerRangeList videoFormatRange;
|
||||
T_DjiCameraManagerVideoFormat videoParam;
|
||||
|
||||
returnCode = DjiCameraManager_GetPhotoRatioRange(mountPosition, &photoRatioRange);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get range failed!");
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
osalHandler->TaskSleepMs(5);
|
||||
printf("photo ratio range:");
|
||||
for (uint32_t i = 0; i < photoRatioRange.size; i++) {
|
||||
printf(" %d", photoRatioRange.photoRatioFormat[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
returnCode = DjiCameraManager_GetPhotoFormatStorageRange(mountPosition, &photoFormatRange);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get range failed!");
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
osalHandler->TaskSleepMs(5);
|
||||
printf("photo storage format range:");
|
||||
for (uint32_t i = 0; i < photoFormatRange.size; i++) {
|
||||
printf(" %d", photoFormatRange.photoStorageFormat[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
returnCode = DjiCameraManager_GetVideoFormatRange(mountPosition, &videoFormatRange);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get range failed!");
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
osalHandler->TaskSleepMs(5);
|
||||
printf("video storage format range:");
|
||||
for (uint32_t i = 0; i < videoFormatRange.size; i++) {
|
||||
printf(" %d", videoFormatRange.videoStorageFormat[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
USER_LOG_INFO("Set camera work mode as shoot photo.");
|
||||
returnCode = DjiCameraManager_SetMode(mountPosition, DJI_CAMERA_MANAGER_WORK_MODE_SHOOT_PHOTO);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS &&
|
||||
returnCode != DJI_ERROR_CAMERA_MANAGER_MODULE_CODE_UNSUPPORTED_COMMAND) {
|
||||
USER_LOG_ERROR("set mounted position %d camera's work mode as shoot-photo mode failed,"
|
||||
" error code :0x%08X", mountPosition, returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Set photo ratio to type %d", photoRatioRange.photoRatioFormat[0]);
|
||||
returnCode = DjiCameraManager_SetPhotoRatio(mountPosition,
|
||||
photoRatioRange.photoRatioFormat[0]);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
||||
{
|
||||
USER_LOG_ERROR("Set photo ratio failed.");
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
if (cameraType == DJI_CAMERA_TYPE_XTS) {
|
||||
USER_LOG_INFO("Camera type %d does not support get photo ratio.", cameraType);
|
||||
}
|
||||
else {
|
||||
returnCode = DjiCameraManager_GetPhotoRatio(mountPosition,
|
||||
&photoRatio);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get camera photo ratio at position %d failed, ret = 0x%08llX",
|
||||
mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
USER_LOG_INFO("Current photo ratio type: %d", photoRatio);
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Set photo storage format to type %d", photoFormatRange.photoStorageFormat[0]);
|
||||
returnCode = DjiCameraManager_SetPhotoFormat(mountPosition, photoFormatRange.photoStorageFormat[0]);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
||||
{
|
||||
USER_LOG_ERROR("Set photo storage format failed.");
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
if (cameraType == DJI_CAMERA_TYPE_XTS) {
|
||||
USER_LOG_INFO("Camera type %d does not support get photo storage format.", cameraType);
|
||||
}
|
||||
else {
|
||||
returnCode = DjiCameraManager_GetPhotoFormat(mountPosition, &photoFormat);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get camera photo storage format at position %d failed, ret = 0x%08llX",
|
||||
mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
USER_LOG_INFO("Current photo storage format type: %d", photoFormat);
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Sleep 2s...");
|
||||
osalHandler->TaskSleepMs(2000);
|
||||
|
||||
USER_LOG_INFO("Set camera work mode as record video.");
|
||||
returnCode = DjiCameraManager_SetMode(mountPosition, DJI_CAMERA_MANAGER_WORK_MODE_RECORD_VIDEO);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS &&
|
||||
returnCode != DJI_ERROR_CAMERA_MANAGER_MODULE_CODE_UNSUPPORTED_COMMAND) {
|
||||
USER_LOG_ERROR("set mounted position %d camera's work mode as shoot-photo mode failed,"
|
||||
" error code :0x%08X", mountPosition, returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Set video storage format as type %d", videoFormatRange.videoStorageFormat[0]);
|
||||
returnCode = DjiCameraManager_SetVideoStorageFormat(mountPosition, videoFormatRange.videoStorageFormat[0]);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
||||
{
|
||||
USER_LOG_ERROR("Set video storage format failed.");
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
if (cameraType == DJI_CAMERA_TYPE_XTS) {
|
||||
USER_LOG_INFO("Camera type %d does not support get video storage format, video resolution and frame rate.",
|
||||
cameraType);
|
||||
}
|
||||
else {
|
||||
returnCode = DjiCameraManager_GetVideoFormat(mountPosition, &videoFormat);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get camera video storage format at position %d failed, ret = 0x%08llX",
|
||||
mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
USER_LOG_INFO("Current video stroage format: %d", videoFormat);
|
||||
|
||||
returnCode = DjiCameraManager_GetVideoResolutionFrameRate(mountPosition,
|
||||
&videoParam);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get camera video resolution and framerate failed at position %d failed",
|
||||
mountPosition);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
USER_LOG_INFO("resolution: %d, frame rate: %d", videoParam.videoResolution, videoParam.videoFrameRate);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_METERING_MODE: {
|
||||
E_DjiCameraManagerMeteringMode meteringMode;
|
||||
|
||||
USER_LOG_INFO("Set metering mode as %d", DJI_CAMERA_MANAGER_METERING_MODE_AVERAGE);
|
||||
returnCode = DjiCameraManager_SetMeteringMode(mountPosition, DJI_CAMERA_MANAGER_METERING_MODE_AVERAGE);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Set camera metering mode %d failed", DJI_CAMERA_MANAGER_METERING_MODE_AVERAGE);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
osalHandler->TaskSleepMs(200);
|
||||
|
||||
returnCode = DjiCameraManager_GetMeteringMode(mountPosition, &meteringMode);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get camera metering mode failed.");
|
||||
goto exitCameraModule;
|
||||
}
|
||||
USER_LOG_INFO("Current metering mode is %d", meteringMode);
|
||||
|
||||
USER_LOG_INFO("Sleep 2s...");
|
||||
osalHandler->TaskSleepMs(2000);
|
||||
|
||||
USER_LOG_INFO("Set metering mode as %d", DJI_CAMERA_MANAGER_METERING_MODE_SPOT);
|
||||
returnCode = DjiCameraManager_SetMeteringMode(mountPosition, DJI_CAMERA_MANAGER_METERING_MODE_SPOT);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Set camera metering mode %d failed", DJI_CAMERA_MANAGER_METERING_MODE_SPOT);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
osalHandler->TaskSleepMs(200);
|
||||
|
||||
returnCode = DjiCameraManager_GetMeteringMode(mountPosition, &meteringMode);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get camera metering mode failed.");
|
||||
goto exitCameraModule;
|
||||
}
|
||||
USER_LOG_INFO("Current metering mode is %d", meteringMode);
|
||||
|
||||
USER_LOG_INFO("Sleep 2s...");
|
||||
osalHandler->TaskSleepMs(2000);
|
||||
|
||||
USER_LOG_INFO("Set metering mode as %d", DJI_CAMERA_MANAGER_METERING_MODE_CENTRAL);
|
||||
returnCode = DjiCameraManager_SetMeteringMode(mountPosition, DJI_CAMERA_MANAGER_METERING_MODE_CENTRAL);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Set camera metering mode %d failed", DJI_CAMERA_MANAGER_METERING_MODE_CENTRAL);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
osalHandler->TaskSleepMs(200);
|
||||
|
||||
returnCode = DjiCameraManager_GetMeteringMode(mountPosition, &meteringMode);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get camera metering mode failed.");
|
||||
goto exitCameraModule;
|
||||
}
|
||||
USER_LOG_INFO("Current metering mode is %d", meteringMode);
|
||||
|
||||
break;
|
||||
}
|
||||
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_METERING_POINT: {
|
||||
int32_t x, y;
|
||||
uint8_t horizonRegionNum;
|
||||
uint8_t viticalRegionNum;
|
||||
|
||||
if (cameraType == DJI_CAMERA_TYPE_XTS) {
|
||||
USER_LOG_INFO("Camera type %d does not support to set metering point.", cameraType);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
returnCode = DjiCameraManager_GetMeteringPointRegionRange(mountPosition, &horizonRegionNum, &viticalRegionNum);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get metering point region range failed!");
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("region range: horizon %d, vitical %d", horizonRegionNum, viticalRegionNum);
|
||||
|
||||
osalHandler->TaskSleepMs(5);
|
||||
printf("Input meterting point (x, y) you want to set: ");
|
||||
scanf("%d %d", &x, &y);
|
||||
|
||||
USER_LOG_INFO("Try to set metering point as (%d, %d)", (uint8_t)x, (uint8_t)y);
|
||||
returnCode = DjiCameraManager_SetMeteringPoint(mountPosition, x, y);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Set metering point failed");
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
osalHandler->TaskSleepMs(500);
|
||||
|
||||
returnCode = DjiCameraManager_GetMeteringPoint(mountPosition, &x, &y);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get metering point failed");
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Current metering point: (%d, %d)", x, y);
|
||||
|
||||
break;
|
||||
}
|
||||
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_FFC_MODE_AND_TRRIGER: {
|
||||
E_DjiCameraManagerFfcMode ffcMode;
|
||||
|
||||
if (cameraType == DJI_CAMERA_TYPE_Z30 || cameraType == DJI_CAMERA_TYPE_XT2 ||
|
||||
cameraType == DJI_CAMERA_TYPE_H20 || cameraType == DJI_CAMERA_TYPE_P1 ||
|
||||
cameraType == DJI_CAMERA_TYPE_L1 || cameraType == DJI_CAMERA_TYPE_M30 ||
|
||||
cameraType == DJI_CAMERA_TYPE_M3E) {
|
||||
USER_LOG_WARN("Camera type %d don't support FFC function.", cameraType);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
osalHandler->TaskSleepMs(10);
|
||||
printf("Input mode to set FFC (0 manual, 1 auto):");
|
||||
scanf("%d", &ffcMode);
|
||||
|
||||
if (cameraType != DJI_CAMERA_TYPE_XTS) {
|
||||
USER_LOG_INFO("Set camera stream source to infrared camera.");
|
||||
returnCode = DjiCameraManager_SetStreamSource(mountPosition, DJI_CAMERA_MANAGER_SOURCE_IR_CAM);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Change camera stream source to infrared camera failed at position %d, error code: 0x%08X\r\n",
|
||||
mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
}
|
||||
|
||||
returnCode = DjiCameraManager_SetFfcMode(mountPosition, ffcMode);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Set FFC mode %d failed, camera position %d, error code 0x%08llX",
|
||||
ffcMode, mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
returnCode = DjiCameraManager_TriggerFfc(mountPosition);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Trigger FFC mode, camera position %d, error code 0x%08llX",
|
||||
mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Trriger FFC successfully!");
|
||||
|
||||
break;
|
||||
}
|
||||
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_GAIN_MODE: {
|
||||
E_DjiCameraManagerIrGainMode gainMode;
|
||||
T_DjiCameraManagerIrTempMeterRange tempRange = {0};
|
||||
|
||||
if (cameraType == DJI_CAMERA_TYPE_Z30 || cameraType == DJI_CAMERA_TYPE_XT2 ||
|
||||
cameraType == DJI_CAMERA_TYPE_H20 || cameraType == DJI_CAMERA_TYPE_P1 ||
|
||||
cameraType == DJI_CAMERA_TYPE_L1 || cameraType == DJI_CAMERA_TYPE_M30 ||
|
||||
cameraType == DJI_CAMERA_TYPE_M3E) {
|
||||
USER_LOG_WARN("Camera type %d don't support infrared function.", cameraType);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
osalHandler->TaskSleepMs(10);
|
||||
printf("Input gain mode to set (1 low, 2 high):");
|
||||
scanf("%d", &gainMode);
|
||||
|
||||
if (cameraType != DJI_CAMERA_TYPE_XTS) {
|
||||
USER_LOG_INFO("Set camera stream source to infrared camera.");
|
||||
returnCode = DjiCameraManager_SetStreamSource(mountPosition, DJI_CAMERA_MANAGER_SOURCE_IR_CAM);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Change camera stream source to infrared camera failed at position %d, error code: 0x%08X\r\n",
|
||||
mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Get temperature range of different gain mode...");
|
||||
returnCode = DjiCameraManager_GetInfraredCameraGainModeTemperatureRange(mountPosition, &tempRange);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Fail to get infrared mode temperature range. position %d, error code 0x%08llX",
|
||||
mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("low_min: %.2f, low_max: %.2f, high_min: %.2f, high_max: %.2f",
|
||||
tempRange.lowGainTempMin, tempRange.lowGainTempMax,
|
||||
tempRange.highGainTempMin, tempRange.highGainTempMax);
|
||||
|
||||
returnCode = DjiCameraManager_SetInfraredCameraGainMode(mountPosition, gainMode);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_INFO("Fail to set infrared camera gain mode. position %d, error code 0x%08llX",
|
||||
mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Set gain mode to %d successfully!", gainMode);
|
||||
|
||||
break;
|
||||
}
|
||||
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_GET_CAMERA_STATUS: {
|
||||
E_DjiCameraManagerCapturingState capturingState;
|
||||
E_DjiCameraManagerRecordingState recordingState;
|
||||
uint16_t recordingTime;
|
||||
uint8_t remainingTime;
|
||||
|
||||
if (cameraType == DJI_CAMERA_TYPE_L1 || cameraType == DJI_CAMERA_TYPE_P1) {
|
||||
USER_LOG_INFO("Camera type %d does not support to get camera stauts such as "
|
||||
"capturing state, recording state.", cameraType);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < 30; i++) {
|
||||
returnCode = DjiCameraManager_GetCapturingState(mountPosition, &capturingState);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_INFO("Get capturing state failed!");
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
returnCode = DjiCameraManager_GetRecordingState(mountPosition, &recordingState);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_INFO("Get recording state failed!");
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
returnCode = DjiCameraManager_GetRecordingTime(mountPosition, &recordingTime);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_INFO("Get recording time failed!");
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
returnCode = DjiCameraManager_GetIntervalShootingRemainTime(mountPosition, &remainingTime);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_INFO("Get interval shooting remain time failed!");
|
||||
goto exitCameraModule;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("cap_state: %d, rec_state: %d, rec_time: %d, cap_remain: %d",
|
||||
capturingState,
|
||||
recordingState,
|
||||
recordingTime,
|
||||
remainingTime);
|
||||
|
||||
osalHandler->TaskSleepMs(200);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
USER_LOG_ERROR("There is no valid command input!");
|
||||
break;
|
||||
@ -1289,6 +2161,11 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadAndDeleteMediaFile(E_Dj
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
returnCode = DjiCameraManager_ObtainDownloaderRights(position);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Obtain downloader rights failed, error code: 0x%08X.", returnCode);
|
||||
}
|
||||
|
||||
returnCode = DjiCameraManager_DownloadFileList(position, &s_meidaFileList);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Download file list failed, error code: 0x%08X.", returnCode);
|
||||
@ -1360,6 +2237,11 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadAndDeleteMediaFile(E_Dj
|
||||
USER_LOG_WARN("Media file is not existed in sdcard.\r\n");
|
||||
}
|
||||
|
||||
returnCode = DjiCameraManager_ReleaseDownloaderRights(position);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Release downloader rights failed, error code: 0x%08X.", returnCode);
|
||||
}
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1377,6 +2259,11 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadFileListBySlices(E_DjiM
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
returnCode = DjiCameraManager_ObtainDownloaderRights(position);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Obtain downloader rights failed, error code: 0x%08X.", returnCode);
|
||||
}
|
||||
|
||||
sliceConfig.countPerSlice = DJI_CAMERA_MANAGER_FILE_LIST_COUNT_ALL_PER_SLICE;
|
||||
sliceConfig.sliceStartIndex = 0;
|
||||
|
||||
@ -1431,6 +2318,11 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadFileListBySlices(E_DjiM
|
||||
USER_LOG_WARN("Media file is not existed in sdcard.\r\n");
|
||||
}
|
||||
|
||||
returnCode = DjiCameraManager_ReleaseDownloaderRights(position);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Release downloader rights failed, error code: 0x%08X.", returnCode);
|
||||
}
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1463,18 +2355,21 @@ static T_DjiReturnCode DjiTest_CameraManagerDownloadFileDataCallback(T_DjiDownlo
|
||||
if (s_downloadMediaFile != NULL) {
|
||||
fwrite(data, 1, len, s_downloadMediaFile);
|
||||
}
|
||||
printf("\033[1;32;40m ### [Complete rate : %0.1f%%] (%s), size: %d, fileIndex: %d\033[0m\r\n",
|
||||
printf("\033[1;32;40m ### [Complete rate : %0.1f%%] (%s), size: %u, fileIndex: %d\033[0m\r\n",
|
||||
packetInfo.progressInPercent, downloadFileName, packetInfo.fileSize, packetInfo.fileIndex);
|
||||
printf("\033[1A");
|
||||
USER_LOG_DEBUG("Transfer download media file data, len: %d, percent: %.1f", len, packetInfo.progressInPercent);
|
||||
} else if (packetInfo.downloadFileEvent == DJI_DOWNLOAD_FILE_EVENT_END) {
|
||||
if (s_downloadMediaFile != NULL) {
|
||||
fwrite(data, 1, len, s_downloadMediaFile);
|
||||
if (s_downloadMediaFile == NULL) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
}
|
||||
|
||||
fwrite(data, 1, len, s_downloadMediaFile);
|
||||
|
||||
osalHandler->GetTimeMs(&downloadEndMs);
|
||||
|
||||
downloadSpeed = (float) packetInfo.fileSize / (float) (downloadEndMs - downloadStartMs);
|
||||
printf("\033[1;32;40m ### [Complete rate : %0.1f%%] (%s), size: %d, fileIndex: %d\033[0m\r\n",
|
||||
printf("\033[1;32;40m ### [Complete rate : %0.1f%%] (%s), size: %u, fileIndex: %d\033[0m\r\n",
|
||||
packetInfo.progressInPercent, downloadFileName, packetInfo.fileSize, packetInfo.fileIndex);
|
||||
printf("\033[1A");
|
||||
printf("\r\n");
|
||||
|
||||
@ -56,6 +56,22 @@ typedef enum {
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_THERMOMETRY,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_GET_LIDAR_RANGING_INFO,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_IR_CAMERA_ZOOM_PARAM,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_NIGHT_SCENE_MODE,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_CAPTURE_RECORDING_STREAMS,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SHOW_STORAGE_INFO,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_FORMAT_SD_CARD,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_LINK_ZOOM,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_USER_CUSTOM_DIR_FILE_NAME,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_RESET_CAMERA_SETTINGS,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_AE_LOCK_MODE,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_FOCUS_RING_VALUE,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_CONNECT_STATUS_TEST,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_GET_PHOTO_VIDEO_PARAM,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_METERING_MODE,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_METERING_POINT,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_FFC_MODE_AND_TRRIGER,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_GAIN_MODE,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_GET_CAMERA_STATUS,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_INDEX_MAX
|
||||
} E_DjiTestCameraManagerSampleSelect;
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
|
||||
@ -42,7 +42,8 @@
|
||||
/* Private functions declaration ---------------------------------------------*/
|
||||
static void *UserDataTransmission_Task(void *arg);
|
||||
static T_DjiReturnCode ReceiveDataFromMobile(const uint8_t *data, uint16_t len);
|
||||
static T_DjiReturnCode ReceiveDataFromOnboardComputer(const uint8_t *data, uint16_t len);
|
||||
static T_DjiReturnCode ReceiveDataFromCloud(const uint8_t *data, uint16_t len);
|
||||
static T_DjiReturnCode ReceiveDataFromExtensionPort(const uint8_t *data, uint16_t len);
|
||||
static T_DjiReturnCode ReceiveDataFromPayload(const uint8_t *data, uint16_t len);
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
@ -79,13 +80,23 @@ T_DjiReturnCode DjiTest_DataTransmissionStartService(void)
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||
}
|
||||
|
||||
if (s_aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30 ||
|
||||
s_aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30T) {
|
||||
channelAddress = DJI_CHANNEL_ADDRESS_CLOUD_API;
|
||||
djiStat = DjiLowSpeedDataChannel_RegRecvDataCallback(channelAddress, ReceiveDataFromCloud);
|
||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("register receive data from cloud error.");
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
if (s_aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO1 ||
|
||||
s_aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO2 ||
|
||||
s_aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO3) {
|
||||
channelAddress = DJI_CHANNEL_ADDRESS_EXTENSION_PORT;
|
||||
djiStat = DjiLowSpeedDataChannel_RegRecvDataCallback(channelAddress, ReceiveDataFromOnboardComputer);
|
||||
djiStat = DjiLowSpeedDataChannel_RegRecvDataCallback(channelAddress, ReceiveDataFromExtensionPort);
|
||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("register receive data from onboard coputer error.");
|
||||
USER_LOG_ERROR("register receive data from extension port error.");
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||
}
|
||||
|
||||
@ -152,7 +163,7 @@ T_DjiReturnCode DjiTest_DataTransmissionStopService(void)
|
||||
static void *UserDataTransmission_Task(void *arg)
|
||||
{
|
||||
T_DjiReturnCode djiStat;
|
||||
const uint8_t dataToBeSent[] = "DJI Data Transmission Test Data.\r\n";
|
||||
const uint8_t dataToBeSent[] = "DJI Data Transmission Test Data.";
|
||||
T_DjiDataChannelState state = {0};
|
||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||
E_DjiChannelAddress channelAddress;
|
||||
@ -177,25 +188,44 @@ static void *UserDataTransmission_Task(void *arg)
|
||||
USER_LOG_ERROR("get send to mobile channel state error.");
|
||||
}
|
||||
|
||||
if (s_aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30 ||
|
||||
s_aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30T) {
|
||||
channelAddress = DJI_CHANNEL_ADDRESS_CLOUD_API;
|
||||
djiStat = DjiLowSpeedDataChannel_SendData(channelAddress, dataToBeSent, sizeof(dataToBeSent));
|
||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
||||
USER_LOG_ERROR("send data to cloud error.");
|
||||
|
||||
djiStat = DjiLowSpeedDataChannel_GetSendDataState(channelAddress, &state);
|
||||
if (djiStat == DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_DEBUG(
|
||||
"send to cloud state: realtimeBandwidthBeforeFlowController: %d, realtimeBandwidthAfterFlowController: %d, busyState: %d.",
|
||||
state.realtimeBandwidthBeforeFlowController, state.realtimeBandwidthAfterFlowController,
|
||||
state.busyState);
|
||||
} else {
|
||||
USER_LOG_ERROR("get send to cloud channel state error.");
|
||||
}
|
||||
}
|
||||
|
||||
if (s_aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO1 ||
|
||||
s_aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO2 ||
|
||||
s_aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO3) {
|
||||
channelAddress = DJI_CHANNEL_ADDRESS_EXTENSION_PORT;
|
||||
djiStat = DjiLowSpeedDataChannel_SendData(channelAddress, dataToBeSent, sizeof(dataToBeSent));
|
||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
||||
USER_LOG_ERROR("send data to onboard computer error.");
|
||||
USER_LOG_ERROR("send data to extension port error.");
|
||||
|
||||
djiStat = DjiLowSpeedDataChannel_GetSendDataState(channelAddress, &state);
|
||||
if (djiStat == DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_DEBUG(
|
||||
"send to onboard computer state: realtimeBandwidthBeforeFlowController: %d, realtimeBandwidthAfterFlowController: %d, busyState: %d.",
|
||||
"send to extension port state: realtimeBandwidthBeforeFlowController: %d, realtimeBandwidthAfterFlowController: %d, busyState: %d.",
|
||||
state.realtimeBandwidthBeforeFlowController, state.realtimeBandwidthAfterFlowController,
|
||||
state.busyState);
|
||||
} else {
|
||||
USER_LOG_ERROR("get send to onboard computer channel state error.");
|
||||
USER_LOG_ERROR("get send to extension port channel state error.");
|
||||
}
|
||||
|
||||
if (DjiPlatform_GetSocketHandler() != NULL) {
|
||||
#ifdef SYSTEM_ARCH_LINUX
|
||||
djiStat = DjiHighSpeedDataChannel_SendDataStreamData(dataToBeSent, sizeof(dataToBeSent));
|
||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
||||
USER_LOG_ERROR("send data to data stream error.");
|
||||
@ -208,21 +238,22 @@ static void *UserDataTransmission_Task(void *arg)
|
||||
} else {
|
||||
USER_LOG_ERROR("get data stream state error.");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else if (s_aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_EXTENSION_PORT) {
|
||||
channelAddress = DJI_CHANNEL_ADDRESS_PAYLOAD_PORT_NO1;
|
||||
djiStat = DjiLowSpeedDataChannel_SendData(channelAddress, dataToBeSent, sizeof(dataToBeSent));
|
||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
||||
USER_LOG_ERROR("send data to onboard computer error.");
|
||||
USER_LOG_ERROR("send data to extension port error.");
|
||||
|
||||
djiStat = DjiLowSpeedDataChannel_GetSendDataState(channelAddress, &state);
|
||||
if (djiStat == DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_DEBUG(
|
||||
"send to onboard computer state: realtimeBandwidthBeforeFlowController: %d, realtimeBandwidthAfterFlowController: %d, busyState: %d.",
|
||||
"send to extension port state: realtimeBandwidthBeforeFlowController: %d, realtimeBandwidthAfterFlowController: %d, busyState: %d.",
|
||||
state.realtimeBandwidthBeforeFlowController, state.realtimeBandwidthAfterFlowController,
|
||||
state.busyState);
|
||||
} else {
|
||||
USER_LOG_ERROR("get send to onboard computer channel state error.");
|
||||
USER_LOG_ERROR("get send to extension port channel state error.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -253,7 +284,7 @@ static T_DjiReturnCode ReceiveDataFromMobile(const uint8_t *data, uint16_t len)
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static T_DjiReturnCode ReceiveDataFromOnboardComputer(const uint8_t *data, uint16_t len)
|
||||
static T_DjiReturnCode ReceiveDataFromCloud(const uint8_t *data, uint16_t len)
|
||||
{
|
||||
char *printData = NULL;
|
||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||
@ -266,7 +297,28 @@ static T_DjiReturnCode ReceiveDataFromOnboardComputer(const uint8_t *data, uint1
|
||||
|
||||
strncpy(printData, (const char *) data, len);
|
||||
printData[len] = '\0';
|
||||
USER_LOG_INFO("receive data from onboard computer: %s, len:%d.", printData, len);
|
||||
USER_LOG_INFO("receive data from cloud: %s, len:%d.", printData, len);
|
||||
DjiTest_WidgetLogAppend("receive data: %s, len:%d.", printData, len);
|
||||
|
||||
osalHandler->Free(printData);
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static T_DjiReturnCode ReceiveDataFromExtensionPort(const uint8_t *data, uint16_t len)
|
||||
{
|
||||
char *printData = NULL;
|
||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||
|
||||
printData = osalHandler->Malloc(len + 1);
|
||||
if (printData == NULL) {
|
||||
USER_LOG_ERROR("malloc memory for printData fail.");
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_MEMORY_ALLOC_FAILED;
|
||||
}
|
||||
|
||||
strncpy(printData, (const char *) data, len);
|
||||
printData[len] = '\0';
|
||||
USER_LOG_INFO("receive data from extension port: %s, len:%d.", printData, len);
|
||||
DjiTest_WidgetLogAppend("receive data: %s, len:%d.", printData, len);
|
||||
|
||||
osalHandler->Free(printData);
|
||||
|
||||
@ -147,9 +147,9 @@ T_DjiReturnCode DjiTest_FcSubscriptionRunSample(void)
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("--> Step 3: Get latest value of the subscribed topics in the next 20 seconds\r\n");
|
||||
USER_LOG_INFO("--> Step 3: Get latest value of the subscribed topics in the next 10 seconds\r\n");
|
||||
|
||||
for (int i = 0; i < 20; ++i) {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
osalHandler->TaskSleepMs(1000 / FC_SUBSCRIPTION_TASK_FREQ);
|
||||
djiStat = DjiFcSubscription_GetLatestValueOfTopic(DJI_FC_SUBSCRIPTION_TOPIC_VELOCITY,
|
||||
(uint8_t *) &velocity,
|
||||
@ -204,7 +204,26 @@ T_DjiReturnCode DjiTest_FcSubscriptionRunSample(void)
|
||||
}
|
||||
}
|
||||
|
||||
USER_LOG_INFO("--> Step 4: Deinit fc subscription module");
|
||||
USER_LOG_INFO("--> Step 4: Unsubscribe the topics of quaternion, velocity and gps position");
|
||||
djiStat = DjiFcSubscription_UnSubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_QUATERNION);
|
||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("UnSubscribe topic quaternion error.");
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||
}
|
||||
|
||||
djiStat = DjiFcSubscription_UnSubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_VELOCITY);
|
||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("UnSubscribe topic quaternion error.");
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||
}
|
||||
|
||||
djiStat = DjiFcSubscription_UnSubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_GPS_POSITION);
|
||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("UnSubscribe topic quaternion error.");
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("--> Step 5: Deinit fc subscription module");
|
||||
|
||||
djiStat = DjiFcSubscription_DeInit();
|
||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
|
||||
@ -34,14 +34,6 @@
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
dji_f32_t x;
|
||||
dji_f32_t y;
|
||||
dji_f32_t z;
|
||||
} T_DjiTestFlightControlVector3f; // pack(1)
|
||||
#pragma pack()
|
||||
|
||||
typedef struct {
|
||||
E_DjiFcSubscriptionDisplayMode displayMode;
|
||||
char *displayModeStr;
|
||||
@ -96,8 +88,6 @@ static bool DjiTest_FlightControlMoveByPositionOffset(T_DjiTestFlightControlVect
|
||||
float yawDesiredInDeg,
|
||||
float posThresholdInM,
|
||||
float yawThresholdInDeg);
|
||||
static void DjiTest_FlightControlVelocityAndYawRateCtrl(T_DjiTestFlightControlVector3f offsetDesired, float yawRate,
|
||||
uint32_t timeMs);
|
||||
static T_DjiReturnCode DjiTest_FlightControlInit(void);
|
||||
static T_DjiReturnCode DjiTest_FlightControlDeInit(void);
|
||||
static void DjiTest_FlightControlTakeOffLandingSample(void);
|
||||
@ -138,11 +128,16 @@ T_DjiReturnCode DjiTest_FlightControlRunSample(E_DjiTestFlightCtrlSampleSelect f
|
||||
T_DjiReturnCode DjiTest_FlightControlInit(void)
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
T_DjiFlightControllerRidInfo ridInfo = {0};
|
||||
|
||||
s_osalHandler = DjiPlatform_GetOsalHandler();
|
||||
if (!s_osalHandler) return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||
|
||||
returnCode = DjiFlightController_Init();
|
||||
ridInfo.latitude = 22.542812;
|
||||
ridInfo.longitude = 113.958902;
|
||||
ridInfo.altitude = 10;
|
||||
|
||||
returnCode = DjiFlightController_Init(ridInfo);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Init flight controller module failed, error code:0x%08llX", returnCode);
|
||||
return returnCode;
|
||||
@ -236,7 +231,7 @@ T_DjiReturnCode DjiTest_FlightControlDeInit(void)
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
|
||||
returnCode = DjiFlightController_Deinit();
|
||||
returnCode = DjiFlightController_DeInit();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Deinit flight controller module failed, error code:0x%08llX",
|
||||
returnCode);
|
||||
@ -325,25 +320,25 @@ void DjiTest_FlightControlPositionControlSample()
|
||||
USER_LOG_INFO("Successful take off\r\n");
|
||||
DjiTest_WidgetLogAppend("Successful take off\r\n");
|
||||
|
||||
USER_LOG_INFO("--> Step 3: Move to north:0(m), earth:6(m), up:6(m) , yaw:30(degree) from current point");
|
||||
DjiTest_WidgetLogAppend("--> Step 3: Move to north:0(m), earth:6(m), up:6(m) , yaw:30(degree) from current point");
|
||||
USER_LOG_INFO("--> Step 3: Move to north:0(m), east:6(m), up:6(m) , yaw:30(degree) from current point");
|
||||
DjiTest_WidgetLogAppend("--> Step 3: Move to north:0(m), east:6(m), up:6(m) , yaw:30(degree) from current point");
|
||||
if (!DjiTest_FlightControlMoveByPositionOffset((T_DjiTestFlightControlVector3f) {0, 6, 6}, 30, 0.8, 1)) {
|
||||
USER_LOG_ERROR("Move to north:0(m), earth:6(m), up:6(m) , yaw:30(degree) from current point failed");
|
||||
USER_LOG_ERROR("Move to north:0(m), east:6(m), up:6(m) , yaw:30(degree) from current point failed");
|
||||
goto out;
|
||||
};
|
||||
|
||||
USER_LOG_INFO("--> Step 4: Move to north:6(m), earth:0(m), up:-3(m) , yaw:-30(degree) from current point");
|
||||
USER_LOG_INFO("--> Step 4: Move to north:6(m), east:0(m), up:-3(m) , yaw:-30(degree) from current point");
|
||||
DjiTest_WidgetLogAppend(
|
||||
"--> Step 4: Move to north:6(m), earth:0(m), up:-3(m) , yaw:-30(degree) from current point");
|
||||
"--> Step 4: Move to north:6(m), east:0(m), up:-3(m) , yaw:-30(degree) from current point");
|
||||
if (!DjiTest_FlightControlMoveByPositionOffset((T_DjiTestFlightControlVector3f) {6, 0, -3}, -30, 0.8, 1)) {
|
||||
USER_LOG_ERROR("Move to north:6(m), earth:0(m), up:-3(m) , yaw:-30(degree) from current point failed");
|
||||
USER_LOG_ERROR("Move to north:6(m), east:0(m), up:-3(m) , yaw:-30(degree) from current point failed");
|
||||
goto out;
|
||||
};
|
||||
|
||||
USER_LOG_INFO("--> Step 5: Move to north:-6(m), earth:-6(m), up:0(m) , yaw:0(degree) from current point");
|
||||
DjiTest_WidgetLogAppend("--> Step 5: Move to north:-6(m), earth:-6(m), up:0(m) , yaw:0(degree) from current point");
|
||||
USER_LOG_INFO("--> Step 5: Move to north:-6(m), east:-6(m), up:0(m) , yaw:0(degree) from current point");
|
||||
DjiTest_WidgetLogAppend("--> Step 5: Move to north:-6(m), east:-6(m), up:0(m) , yaw:0(degree) from current point");
|
||||
if (!DjiTest_FlightControlMoveByPositionOffset((T_DjiTestFlightControlVector3f) {-6, -6, 0}, 0, 0.8, 1)) {
|
||||
USER_LOG_ERROR("Move to north:-6(m), earth:-6(m), up:0(m) , yaw:0(degree) from current point failed");
|
||||
USER_LOG_ERROR("Move to north:-6(m), east:-6(m), up:0(m) , yaw:0(degree) from current point failed");
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -394,17 +389,17 @@ void DjiTest_FlightControlGoHomeForceLandingSample()
|
||||
USER_LOG_INFO("Successful take off\r\n");
|
||||
DjiTest_WidgetLogAppend("Successful take off\r\n");
|
||||
|
||||
USER_LOG_INFO("--> Step 3: Move to north:0(m), earth:0(m), up:30(m) , yaw:0(degree) from current point");
|
||||
DjiTest_WidgetLogAppend("--> Step 3: Move to north:0(m), earth:0(m), up:30(m) , yaw:0(degree) from current point");
|
||||
USER_LOG_INFO("--> Step 3: Move to north:0(m), east:0(m), up:30(m) , yaw:0(degree) from current point");
|
||||
DjiTest_WidgetLogAppend("--> Step 3: Move to north:0(m), east:0(m), up:30(m) , yaw:0(degree) from current point");
|
||||
if (!DjiTest_FlightControlMoveByPositionOffset((T_DjiTestFlightControlVector3f) {0, 0, 30}, 0, 0.8, 1)) {
|
||||
USER_LOG_ERROR("Move to north:0(m), earth:0(m), up:30(m) , yaw:0(degree) from current point failed");
|
||||
USER_LOG_ERROR("Move to north:0(m), east:0(m), up:30(m) , yaw:0(degree) from current point failed");
|
||||
goto out;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("--> Step 4: Move to north:10(m), earth:0(m), up:0(m) , yaw:0(degree) from current point");
|
||||
DjiTest_WidgetLogAppend("--> Step 4: Move to north:10(m), earth:0(m), up:0(m) , yaw:0(degree) from current point");
|
||||
USER_LOG_INFO("--> Step 4: Move to north:10(m), east:0(m), up:0(m) , yaw:0(degree) from current point");
|
||||
DjiTest_WidgetLogAppend("--> Step 4: Move to north:10(m), east:0(m), up:0(m) , yaw:0(degree) from current point");
|
||||
if (!DjiTest_FlightControlMoveByPositionOffset((T_DjiTestFlightControlVector3f) {10, 0, 0}, 0, 0.8, 1)) {
|
||||
USER_LOG_ERROR("Move to north:10(m), earth:0(m), up:0(m) , yaw:0(degree) from current point failed");
|
||||
USER_LOG_ERROR("Move to north:10(m), east:0(m), up:0(m) , yaw:0(degree) from current point failed");
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -434,10 +429,10 @@ void DjiTest_FlightControlGoHomeForceLandingSample()
|
||||
USER_LOG_INFO("Current go home altitude is %d m\r\n", goHomeAltitude);
|
||||
DjiTest_WidgetLogAppend("Current go home altitude is %d m\r\n", goHomeAltitude);
|
||||
|
||||
USER_LOG_INFO("--> Step 7: Move to north:20(m), earth:0(m), up:0(m) , yaw:0(degree) from current point");
|
||||
DjiTest_WidgetLogAppend("--> Step 7: Move to north:20(m), earth:0(m), up:0(m) , yaw:0(degree) from current point");
|
||||
USER_LOG_INFO("--> Step 7: Move to north:20(m), east:0(m), up:0(m) , yaw:0(degree) from current point");
|
||||
DjiTest_WidgetLogAppend("--> Step 7: Move to north:20(m), east:0(m), up:0(m) , yaw:0(degree) from current point");
|
||||
if (!DjiTest_FlightControlMoveByPositionOffset((T_DjiTestFlightControlVector3f) {20, 0, 0}, 0, 0.8, 1)) {
|
||||
USER_LOG_ERROR("Move to north:20(m), earth:0(m), up:0(m) , yaw:0(degree) from current point failed");
|
||||
USER_LOG_ERROR("Move to north:20(m), east:0(m), up:0(m) , yaw:0(degree) from current point failed");
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -489,9 +484,9 @@ void DjiTest_FlightControlVelocityControlSample()
|
||||
DjiTest_WidgetLogAppend("Successful take off\r\n");
|
||||
|
||||
USER_LOG_INFO(
|
||||
"--> Step 3: Move with north:0(m/s), earth:0(m/s), up:5(m/s), yaw:0(deg/s) from current point for 2s!");
|
||||
"--> Step 3: Move with north:0(m/s), east:0(m/s), up:5(m/s), yaw:0(deg/s) from current point for 2s!");
|
||||
DjiTest_WidgetLogAppend(
|
||||
"--> Step 3: Move with north:0(m/s), earth:0(m/s), up:5(m/s), yaw:0(deg/s) from current point for 2s!");
|
||||
"--> Step 3: Move with north:0(m/s), east:0(m/s), up:5(m/s), yaw:0(deg/s) from current point for 2s!");
|
||||
DjiTest_FlightControlVelocityAndYawRateCtrl((T_DjiTestFlightControlVector3f) {0, 0, 5.0}, 0, 2000);
|
||||
|
||||
USER_LOG_INFO("--> Step 4: Emergency brake for 2s");
|
||||
@ -509,9 +504,9 @@ void DjiTest_FlightControlVelocityControlSample()
|
||||
}
|
||||
|
||||
USER_LOG_INFO(
|
||||
"--> Step 5: Move with north:-1.5(m/s), earth:2(m/s), up:0(m/s), yaw:20(deg/s) from current point for 2s!");
|
||||
"--> Step 5: Move with north:-1.5(m/s), east:2(m/s), up:0(m/s), yaw:20(deg/s) from current point for 2s!");
|
||||
DjiTest_WidgetLogAppend(
|
||||
"--> Step 5: Move with north:-1.5(m/s), earth:2(m/s), up:0(m/s), yaw:20(deg/s) from current point for 2s!");
|
||||
"--> Step 5: Move with north:-1.5(m/s), east:2(m/s), up:0(m/s), yaw:20(deg/s) from current point for 2s!");
|
||||
DjiTest_FlightControlVelocityAndYawRateCtrl((T_DjiTestFlightControlVector3f) {-1.5, 2, 0}, 20, 2000);
|
||||
|
||||
USER_LOG_INFO("--> Step 6: Emergency brake for 2s");
|
||||
@ -529,9 +524,9 @@ void DjiTest_FlightControlVelocityControlSample()
|
||||
}
|
||||
|
||||
USER_LOG_INFO(
|
||||
"--> Step 7: Move with north:3(m/s), earth:0(m/s), up:0(m/s), yaw:0(deg/s) from current point for 2.5s!");
|
||||
"--> Step 7: Move with north:3(m/s), east:0(m/s), up:0(m/s), yaw:0(deg/s) from current point for 2.5s!");
|
||||
DjiTest_WidgetLogAppend(
|
||||
"--> Step 7: Move with north:3(m/s), earth:0(m/s), up:0(m/s), yaw:0(deg/s) from current point for 2.5s!");
|
||||
"--> Step 7: Move with north:3(m/s), east:0(m/s), up:0(m/s), yaw:0(deg/s) from current point for 2.5s!");
|
||||
DjiTest_FlightControlVelocityAndYawRateCtrl((T_DjiTestFlightControlVector3f) {3, 0, 0}, 0, 2500);
|
||||
|
||||
USER_LOG_INFO("--> Step 8: Emergency brake for 2s");
|
||||
@ -549,9 +544,9 @@ void DjiTest_FlightControlVelocityControlSample()
|
||||
}
|
||||
|
||||
USER_LOG_INFO(
|
||||
"--> Step 9: Move with north:-1.6(m/s), earth:-2(m/s), up:0(m/s), yaw:0(deg/s) from current point for 2.2s!");
|
||||
"--> Step 9: Move with north:-1.6(m/s), east:-2(m/s), up:0(m/s), yaw:0(deg/s) from current point for 2.2s!");
|
||||
DjiTest_WidgetLogAppend(
|
||||
"--> Step 9: Move with north:-1.6(m/s), earth:-2(m/s), up:0(m/s), yaw:0(deg/s) from current point for 2.2s!");
|
||||
"--> Step 9: Move with north:-1.6(m/s), east:-2(m/s), up:0(m/s), yaw:0(deg/s) from current point for 2.2s!");
|
||||
DjiTest_FlightControlVelocityAndYawRateCtrl((T_DjiTestFlightControlVector3f) {-1.6, -2, 0}, 0, 2200);
|
||||
|
||||
USER_LOG_INFO("--> Step 10: Emergency brake for 2s");
|
||||
@ -1218,6 +1213,12 @@ bool DjiTest_FlightControlGoHomeAndConfirmLanding(void)
|
||||
{
|
||||
T_DjiReturnCode djiStat;
|
||||
T_DjiAircraftInfoBaseInfo aircraftInfoBaseInfo;
|
||||
E_DjiFlightControllerObstacleAvoidanceEnableStatus enableStatus;
|
||||
|
||||
djiStat = DjiFlightController_GetDownwardsVisualObstacleAvoidanceEnableStatus(&enableStatus);
|
||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("get downwards visual obstacle avoidance enable status error");
|
||||
}
|
||||
|
||||
djiStat = DjiAircraftInfo_GetBaseInfo(&aircraftInfoBaseInfo);
|
||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
@ -1272,11 +1273,20 @@ bool DjiTest_FlightControlGoHomeAndConfirmLanding(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!DjiTest_FlightControlCheckActionStarted(DJI_FC_SUBSCRIPTION_DISPLAY_MODE_FORCE_AUTO_LANDING)) {
|
||||
return false;
|
||||
if (enableStatus == DJI_FLIGHT_CONTROLLER_ENABLE_OBSTACLE_AVOIDANCE) {
|
||||
if (!DjiTest_FlightControlCheckActionStarted(DJI_FC_SUBSCRIPTION_DISPLAY_MODE_FORCE_AUTO_LANDING)) {
|
||||
return false;
|
||||
} else {
|
||||
while (DjiTest_FlightControlGetValueOfFlightStatus() == DJI_FC_SUBSCRIPTION_FLIGHT_STATUS_IN_AIR &&
|
||||
DjiTest_FlightControlGetValueOfDisplayMode() ==
|
||||
DJI_FC_SUBSCRIPTION_DISPLAY_MODE_FORCE_AUTO_LANDING) {
|
||||
s_osalHandler->TaskSleepMs(1000);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
while (DjiTest_FlightControlGetValueOfFlightStatus() == DJI_FC_SUBSCRIPTION_FLIGHT_STATUS_IN_AIR &&
|
||||
DjiTest_FlightControlGetValueOfDisplayMode() == DJI_FC_SUBSCRIPTION_DISPLAY_MODE_FORCE_AUTO_LANDING) {
|
||||
DjiTest_FlightControlGetValueOfDisplayMode() ==
|
||||
DJI_FC_SUBSCRIPTION_DISPLAY_MODE_FORCE_AUTO_LANDING) {
|
||||
s_osalHandler->TaskSleepMs(1000);
|
||||
}
|
||||
}
|
||||
@ -1454,11 +1464,12 @@ DjiTest_FlightControlMoveByPositionOffset(const T_DjiTestFlightControlVector3f o
|
||||
void DjiTest_FlightControlVelocityAndYawRateCtrl(const T_DjiTestFlightControlVector3f offsetDesired, float yawRate,
|
||||
uint32_t timeMs)
|
||||
{
|
||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||
uint32_t originTime = 0;
|
||||
uint32_t currentTime = 0;
|
||||
uint32_t elapsedTimeInMs = 0;
|
||||
s_osalHandler->GetTimeMs(&originTime);
|
||||
s_osalHandler->GetTimeMs(¤tTime);
|
||||
osalHandler->GetTimeMs(&originTime);
|
||||
osalHandler->GetTimeMs(¤tTime);
|
||||
elapsedTimeInMs = currentTime - originTime;
|
||||
T_DjiFlightControllerJoystickMode joystickMode = {
|
||||
DJI_FLIGHT_CONTROLLER_HORIZONTAL_VELOCITY_CONTROL_MODE,
|
||||
@ -1474,8 +1485,8 @@ void DjiTest_FlightControlVelocityAndYawRateCtrl(const T_DjiTestFlightControlVec
|
||||
|
||||
while (elapsedTimeInMs <= timeMs) {
|
||||
DjiFlightController_ExecuteJoystickAction(joystickCommand);
|
||||
s_osalHandler->TaskSleepMs(2);
|
||||
s_osalHandler->GetTimeMs(¤tTime);
|
||||
osalHandler->TaskSleepMs(2);
|
||||
osalHandler->GetTimeMs(¤tTime);
|
||||
elapsedTimeInMs = currentTime - originTime;
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,10 +44,20 @@ typedef enum {
|
||||
E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_SET_GET_PARAM,
|
||||
} E_DjiTestFlightCtrlSampleSelect;
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
dji_f32_t x;
|
||||
dji_f32_t y;
|
||||
dji_f32_t z;
|
||||
} T_DjiTestFlightControlVector3f; // pack(1)
|
||||
#pragma pack()
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
T_DjiReturnCode DjiTest_FlightControlRunSample(E_DjiTestFlightCtrlSampleSelect flightCtrlSampleSelect);
|
||||
void DjiTest_FlightControlVelocityAndYawRateCtrl(const T_DjiTestFlightControlVector3f offsetDesired, float yawRate,
|
||||
uint32_t timeMs);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@ -29,6 +29,8 @@
|
||||
#include "dji_platform.h"
|
||||
#include "dji_logger.h"
|
||||
#include "dji_gimbal_manager.h"
|
||||
#include "dji_fc_subscription.h"
|
||||
#include "dji_aircraft_info.h"
|
||||
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
|
||||
@ -73,10 +75,26 @@ T_DjiReturnCode DjiTest_GimbalManagerRunSample(E_DjiMountPosition mountPosition,
|
||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||
T_DjiReturnCode returnCode;
|
||||
T_DjiGimbalManagerRotation rotation;
|
||||
T_DjiAircraftInfoBaseInfo baseInfo;
|
||||
E_DjiAircraftSeries aircraftSeries;
|
||||
|
||||
returnCode = DjiAircraftInfo_GetBaseInfo(&baseInfo);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Failed to get aircraft base info, return code 0x%08X", returnCode);
|
||||
goto out;
|
||||
}
|
||||
|
||||
aircraftSeries = baseInfo.aircraftSeries;
|
||||
|
||||
USER_LOG_INFO("Gimbal manager sample start");
|
||||
DjiTest_WidgetLogAppend("Gimbal manager sample start");
|
||||
|
||||
returnCode = DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_GIMBAL_ANGLES, DJI_DATA_SUBSCRIPTION_TOPIC_50_HZ, NULL);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Failed to subscribe topic %d, 0x%08X", DJI_FC_SUBSCRIPTION_TOPIC_GIMBAL_ANGLES, returnCode);
|
||||
goto out;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("--> Step 1: Init gimbal manager module");
|
||||
DjiTest_WidgetLogAppend("--> Step 1: Init gimbal manager module");
|
||||
returnCode = DjiGimbalManager_Init();
|
||||
@ -99,7 +117,7 @@ T_DjiReturnCode DjiTest_GimbalManagerRunSample(E_DjiMountPosition mountPosition,
|
||||
}
|
||||
|
||||
USER_LOG_INFO("--> Step 3: Reset gimbal angles.\r\n");
|
||||
returnCode = DjiGimbalManager_Reset(mountPosition);
|
||||
returnCode = DjiGimbalManager_Reset(mountPosition, DJI_GIMBAL_RESET_MODE_PITCH_AND_YAW);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Reset gimbal failed, error code: 0x%08X", returnCode);
|
||||
}
|
||||
@ -108,7 +126,7 @@ T_DjiReturnCode DjiTest_GimbalManagerRunSample(E_DjiMountPosition mountPosition,
|
||||
for (int i = 0; i < sizeof(s_rotationActionList) / sizeof(T_DjiTestGimbalActionList); ++i) {
|
||||
if (s_rotationActionList[i].action == DJI_TEST_GIMBAL_RESET) {
|
||||
USER_LOG_INFO("Target gimbal reset.\r\n");
|
||||
returnCode = DjiGimbalManager_Reset(mountPosition);
|
||||
returnCode = DjiGimbalManager_Reset(mountPosition, DJI_GIMBAL_RESET_MODE_PITCH_AND_YAW);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Reset gimbal failed, error code: 0x%08X", returnCode);
|
||||
}
|
||||
@ -120,11 +138,22 @@ T_DjiReturnCode DjiTest_GimbalManagerRunSample(E_DjiMountPosition mountPosition,
|
||||
continue;
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Target gimbal pry = (%.1f, %.1f, %.1f)",
|
||||
s_rotationActionList[i].rotation.pitch, s_rotationActionList[i].rotation.roll,
|
||||
s_rotationActionList[i].rotation.yaw);
|
||||
|
||||
rotation = s_rotationActionList[i].rotation;
|
||||
|
||||
if (aircraftSeries == DJI_AIRCRAFT_SERIES_M3 || aircraftSeries == DJI_AIRCRAFT_SERIES_M30) {
|
||||
if (s_rotationActionList[i].rotation.rotationMode == DJI_GIMBAL_ROTATION_MODE_ABSOLUTE_ANGLE) {
|
||||
T_DjiFcSubscriptionGimbalAngles gimbalAngles = {0};
|
||||
T_DjiDataTimestamp timestamp = {0};
|
||||
returnCode = DjiFcSubscription_GetLatestValueOfTopic(DJI_FC_SUBSCRIPTION_TOPIC_GIMBAL_ANGLES,
|
||||
(uint8_t *) &gimbalAngles,
|
||||
sizeof(T_DjiFcSubscriptionGimbalAngles),
|
||||
×tamp);
|
||||
rotation.yaw = gimbalAngles.z;
|
||||
}
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Target gimbal pry = (%.1f, %.1f, %.1f)", rotation.pitch, rotation.roll, rotation.yaw);
|
||||
|
||||
returnCode = DjiGimbalManager_Rotate(mountPosition, rotation);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Target gimbal pry = (%.1f, %.1f, %.1f) failed, error code: 0x%08X",
|
||||
@ -136,6 +165,11 @@ T_DjiReturnCode DjiTest_GimbalManagerRunSample(E_DjiMountPosition mountPosition,
|
||||
}
|
||||
}
|
||||
|
||||
returnCode = DjiFcSubscription_UnSubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_GIMBAL_ANGLES);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Failed to unsubscribe topic %d, 0x%08X", DJI_FC_SUBSCRIPTION_TOPIC_GIMBAL_ANGLES, returnCode);
|
||||
}
|
||||
|
||||
USER_LOG_INFO("--> Step 5: Deinit gimbal manager module");
|
||||
DjiTest_WidgetLogAppend("--> Step 5: Deinit gimbal manager module");
|
||||
returnCode = DjiGimbalManager_Deinit();
|
||||
|
||||
28290
samples/sample_c/module_sample/hms/data/hms_2023_05_18.json
Normal file
28290
samples/sample_c/module_sample/hms/data/hms_2023_05_18.json
Normal file
File diff suppressed because it is too large
Load Diff
30819
samples/sample_c/module_sample/hms/data/hms_2023_08_22.json
Normal file
30819
samples/sample_c/module_sample/hms/data/hms_2023_08_22.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -25,6 +25,8 @@
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <widget_interaction_test/test_widget_interaction.h>
|
||||
#include <utils/util_misc.h>
|
||||
#include <utils/cJSON.h>
|
||||
#include <utils/util_file.h>
|
||||
#include "test_hms.h"
|
||||
#include "dji_hms.h"
|
||||
#include "dji_hms_info_table.h"
|
||||
@ -52,28 +54,32 @@ static const char *oldReplaceComponentIndexStr = "%component_index";
|
||||
static T_DjiHmsFileBinaryArray s_EnHmsTextConfigFileBinaryArrayList[] = {
|
||||
{hms_text_config_json_fileName, hms_text_config_json_fileSize, hms_text_config_json_fileBinaryArray},
|
||||
};
|
||||
static bool s_hmsServiceRunFlag = false;
|
||||
static uint8_t *s_hmsJsonData = NULL;
|
||||
static E_DjiMobileAppLanguage s_hmsLanguage = DJI_MOBILE_APP_LANGUAGE_ENGLISH;
|
||||
|
||||
/* Private functions declaration ---------------------------------------------*/
|
||||
static T_DjiReturnCode DjiTest_HmsInit(void);
|
||||
static T_DjiReturnCode DjiTest_HmsDeInit(void);
|
||||
static T_DjiReturnCode DjiTest_HmsManagerInit(void);
|
||||
static T_DjiReturnCode DjiTest_HmsManagerDeInit(void);
|
||||
static T_DjiFcSubscriptionFlightStatus DjiTest_GetValueOfFlightStatus(void);
|
||||
static bool DjiTest_ReplaceStr(char *buffer, uint32_t bufferMaxLen, const char *target, const char *dest);
|
||||
static bool DjiTest_MarchErrCodeInfoTable(T_DjiHmsInfoTable hmsInfoTable);
|
||||
static bool DjiTest_MarchErrCodeInfoTableByJson(T_DjiHmsInfoTable hmsInfoTable);
|
||||
static T_DjiReturnCode DjiTest_HmsInfoCallback(T_DjiHmsInfoTable hmsInfoTable);
|
||||
|
||||
/* Exported functions definition ---------------------------------------------*/
|
||||
T_DjiReturnCode DjiTest_HmsRunSample(void)
|
||||
T_DjiReturnCode DjiTest_HmsManagerRunSample(E_DjiMobileAppLanguage language)
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
T_DjiOsalHandler *osalHandler;
|
||||
|
||||
s_hmsLanguage = language;
|
||||
|
||||
USER_LOG_INFO("Hms Sample Start");
|
||||
DjiTest_WidgetLogAppend("Hms Sample Start");
|
||||
|
||||
USER_LOG_INFO("--> Step 1: Init hms sample");
|
||||
DjiTest_WidgetLogAppend("--> Step 1: Init hms sample");
|
||||
returnCode = DjiTest_HmsInit();
|
||||
returnCode = DjiTest_HmsManagerInit();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Hms sample init error, error code:0x%08llX", returnCode);
|
||||
goto out;
|
||||
@ -82,7 +88,7 @@ T_DjiReturnCode DjiTest_HmsRunSample(void)
|
||||
osalHandler = DjiPlatform_GetOsalHandler();
|
||||
USER_LOG_INFO("--> Step 2: Register callback function of push HMS information");
|
||||
DjiTest_WidgetLogAppend("--> Step 2: Register callback function of push HMS information");
|
||||
returnCode = DjiHms_RegHmsInfoCallback(DjiTest_HmsInfoCallback);
|
||||
returnCode = DjiHmsManager_RegHmsInfoCallback(DjiTest_HmsInfoCallback);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Register callback function of push HMS information failed, error code:0x%08llX", returnCode);
|
||||
goto out;
|
||||
@ -93,7 +99,7 @@ T_DjiReturnCode DjiTest_HmsRunSample(void)
|
||||
out:
|
||||
USER_LOG_INFO("--> Step 3: Deinit hms sample");
|
||||
DjiTest_WidgetLogAppend("--> Step 3: Deinit hms sample");
|
||||
returnCode = DjiTest_HmsDeInit();
|
||||
returnCode = DjiTest_HmsManagerDeInit();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Hms sample deinit error, error code:0x%08llX", returnCode);
|
||||
}
|
||||
@ -104,7 +110,7 @@ out:
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
T_DjiReturnCode DjiTest_HmsStartService(void)
|
||||
T_DjiReturnCode DjiTest_HmsCustomizationStartService(void)
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
#ifdef SYSTEM_ARCH_LINUX
|
||||
@ -112,7 +118,7 @@ T_DjiReturnCode DjiTest_HmsStartService(void)
|
||||
char tempPath[HMS_DIR_PATH_LEN_MAX];
|
||||
#endif
|
||||
|
||||
returnCode = DjiHms_Init();
|
||||
returnCode = DjiHmsCustomization_Init();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Hms init error, error code:0x%08llX", returnCode);
|
||||
return returnCode;
|
||||
@ -129,15 +135,15 @@ T_DjiReturnCode DjiTest_HmsStartService(void)
|
||||
snprintf(tempPath, HMS_DIR_PATH_LEN_MAX, "%shms_text/en", curFileDirPath);
|
||||
|
||||
//set default hms text config path
|
||||
returnCode = DjiHms_RegDefaultHmsTextConfigByDirPath(tempPath);
|
||||
returnCode = DjiHmsCustomization_RegDefaultHmsTextConfigByDirPath(tempPath);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Add default hms text config error, stat = 0x%08llX", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
//set hms text config for English language
|
||||
returnCode = DjiHms_RegHmsTextConfigByDirPath(DJI_MOBILE_APP_LANGUAGE_ENGLISH,
|
||||
tempPath);
|
||||
returnCode = DjiHmsCustomization_RegHmsTextConfigByDirPath(DJI_MOBILE_APP_LANGUAGE_ENGLISH,
|
||||
tempPath);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Add hms text config error, stat = 0x%08llX", returnCode);
|
||||
return returnCode;
|
||||
@ -145,8 +151,8 @@ T_DjiReturnCode DjiTest_HmsStartService(void)
|
||||
|
||||
//set hms text config for Chinese language
|
||||
snprintf(tempPath, HMS_DIR_PATH_LEN_MAX, "%shms_text/cn", curFileDirPath);
|
||||
returnCode = DjiHms_RegHmsTextConfigByDirPath(DJI_MOBILE_APP_LANGUAGE_CHINESE,
|
||||
tempPath);
|
||||
returnCode = DjiHmsCustomization_RegHmsTextConfigByDirPath(DJI_MOBILE_APP_LANGUAGE_CHINESE,
|
||||
tempPath);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Add hms text config error, stat = 0x%08llX", returnCode);
|
||||
return returnCode;
|
||||
@ -159,7 +165,7 @@ T_DjiReturnCode DjiTest_HmsStartService(void)
|
||||
};
|
||||
|
||||
//set default hms text config
|
||||
returnCode = DjiHms_RegDefaultHmsTextConfigByBinaryArray(&enHmsTextBinaryArrayConfig);
|
||||
returnCode = DjiHmsCustomization_RegDefaultHmsTextConfigByBinaryArray(&enHmsTextBinaryArrayConfig);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Add default hms text config error, stat = 0x%08llX", returnCode);
|
||||
return returnCode;
|
||||
@ -167,18 +173,21 @@ T_DjiReturnCode DjiTest_HmsStartService(void)
|
||||
#endif
|
||||
|
||||
#if DJI_CUSTOM_HMS_CODE_INJECT_ON
|
||||
DjiHms_InjectHmsErrorCode(0x1E020000, DJI_HMS_ERROR_LEVEL_FATAL);
|
||||
DjiHmsCustomization_InjectHmsErrorCode(0x1E020000, DJI_HMS_ERROR_LEVEL_FATAL);
|
||||
#endif
|
||||
|
||||
s_hmsServiceRunFlag = true;
|
||||
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
/* Private functions definition-----------------------------------------------*/
|
||||
static T_DjiReturnCode DjiTest_HmsInit(void)
|
||||
static T_DjiReturnCode DjiTest_HmsManagerInit(void)
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
char curFileDirPath[HMS_DIR_PATH_LEN_MAX];
|
||||
char tempFileDirPath[HMS_DIR_PATH_LEN_MAX];
|
||||
uint32_t fileSize = 0;
|
||||
uint32_t readRealSize = 0;
|
||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||
|
||||
returnCode = DjiFcSubscription_Init();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
@ -196,16 +205,38 @@ static T_DjiReturnCode DjiTest_HmsInit(void)
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
if (s_hmsServiceRunFlag == true) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
#ifdef SYSTEM_ARCH_LINUX
|
||||
returnCode = DjiUserUtil_GetCurrentFileDirPath(__FILE__, HMS_DIR_PATH_LEN_MAX, curFileDirPath);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get file current path error, stat = 0x%08llX", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
return DjiHms_Init();
|
||||
snprintf(tempFileDirPath, HMS_DIR_PATH_LEN_MAX, "%s/data/hms_2023_08_22.json", curFileDirPath);
|
||||
|
||||
returnCode = UtilFile_GetFileSizeByPath(tempFileDirPath, &fileSize);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get file size by path failed, stat = 0x%08llX", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
USER_LOG_DEBUG("Hms json file size is %d", fileSize);
|
||||
|
||||
s_hmsJsonData = osalHandler->Malloc(fileSize);
|
||||
if (s_hmsJsonData == NULL) {
|
||||
USER_LOG_ERROR("Malloc failed.");
|
||||
}
|
||||
|
||||
UtilFile_GetFileDataByPath(tempFileDirPath, 0, fileSize, s_hmsJsonData, &readRealSize);
|
||||
#endif
|
||||
|
||||
return DjiHmsManager_Init();
|
||||
}
|
||||
|
||||
static T_DjiReturnCode DjiTest_HmsDeInit(void)
|
||||
static T_DjiReturnCode DjiTest_HmsManagerDeInit(void)
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||
|
||||
returnCode = DjiFcSubscription_DeInit();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
@ -214,11 +245,11 @@ static T_DjiReturnCode DjiTest_HmsDeInit(void)
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
if (s_hmsServiceRunFlag == true) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
#ifdef SYSTEM_ARCH_LINUX
|
||||
osalHandler->Free(s_hmsJsonData);
|
||||
#endif
|
||||
|
||||
return DjiHms_DeInit();
|
||||
return DjiHmsManager_DeInit();
|
||||
}
|
||||
|
||||
static T_DjiFcSubscriptionFlightStatus DjiTest_GetValueOfFlightStatus(void)
|
||||
@ -326,12 +357,67 @@ static bool DjiTest_MarchErrCodeInfoTable(T_DjiHmsInfoTable hmsInfoTable)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool DjiTest_MarchErrCodeInfoTableByJson(T_DjiHmsInfoTable hmsInfoTable)
|
||||
{
|
||||
cJSON *hmsJsonRoot = NULL;
|
||||
cJSON *hmsErrorCode = NULL;
|
||||
cJSON *hmsLanguage = NULL;
|
||||
char hmsErrorCodeString[HMS_DIR_PATH_LEN_MAX] = {0};
|
||||
|
||||
hmsJsonRoot = cJSON_Parse((char *) s_hmsJsonData);
|
||||
if (hmsJsonRoot == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < hmsInfoTable.hmsInfoNum; i++) {
|
||||
if (DjiTest_GetValueOfFlightStatus() == DJI_FC_SUBSCRIPTION_FLIGHT_STATUS_IN_AIR) {
|
||||
sprintf(hmsErrorCodeString, "fpv_tip_0x%08X_in_the_sky", hmsInfoTable.hmsInfo[i].errorCode);
|
||||
} else {
|
||||
sprintf(hmsErrorCodeString, "fpv_tip_0x%08X", hmsInfoTable.hmsInfo[i].errorCode);
|
||||
}
|
||||
|
||||
hmsErrorCode = cJSON_GetObjectItem(hmsJsonRoot, hmsErrorCodeString);
|
||||
if (hmsErrorCode != NULL) {
|
||||
if (s_hmsLanguage == DJI_MOBILE_APP_LANGUAGE_CHINESE) {
|
||||
hmsLanguage = cJSON_GetObjectItem(hmsErrorCode, "zh");
|
||||
} else if (s_hmsLanguage == DJI_MOBILE_APP_LANGUAGE_ENGLISH) {
|
||||
hmsLanguage = cJSON_GetObjectItem(hmsErrorCode, "en");
|
||||
} else if (s_hmsLanguage == DJI_MOBILE_APP_LANGUAGE_JAPANESE) {
|
||||
hmsLanguage = cJSON_GetObjectItem(hmsErrorCode, "ja");
|
||||
} else if (s_hmsLanguage == DJI_MOBILE_APP_LANGUAGE_FRENCH) {
|
||||
hmsLanguage = cJSON_GetObjectItem(hmsErrorCode, "fr");
|
||||
}
|
||||
if (hmsLanguage != NULL) {
|
||||
if (hmsInfoTable.hmsInfo[i].errorLevel > MIN_HMS_ERROR_LEVEL &&
|
||||
hmsInfoTable.hmsInfo[i].errorLevel < MID_HMS_ERROR_LEVEL) {
|
||||
USER_LOG_WARN("[ErrorCode: 0x%2x]: %s", hmsInfoTable.hmsInfo[i].errorCode,
|
||||
hmsLanguage->valuestring);
|
||||
} else if (hmsInfoTable.hmsInfo[i].errorLevel >= MID_HMS_ERROR_LEVEL &&
|
||||
hmsInfoTable.hmsInfo[i].errorLevel < MAX_HMS_ERROR_LEVEL) {
|
||||
USER_LOG_ERROR("[ErrorCode: 0x%2x]: %s", hmsInfoTable.hmsInfo[i].errorCode,
|
||||
hmsLanguage->valuestring);
|
||||
}
|
||||
} else {
|
||||
USER_LOG_WARN("[ErrorCode: 0x%2x] There are no matching documents for this language for now.",
|
||||
hmsInfoTable.hmsInfo[i].errorCode);
|
||||
}
|
||||
} else {
|
||||
USER_LOG_WARN("[ErrorCode: 0x%2x] There are no matching documents in the current json for now.",
|
||||
hmsInfoTable.hmsInfo[i].errorCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static T_DjiReturnCode DjiTest_HmsInfoCallback(T_DjiHmsInfoTable hmsInfoTable)
|
||||
{
|
||||
#ifdef SYSTEM_ARCH_LINUX
|
||||
DjiTest_MarchErrCodeInfoTableByJson(hmsInfoTable);
|
||||
#else
|
||||
if (!DjiTest_MarchErrCodeInfoTable(hmsInfoTable)) {
|
||||
USER_LOG_ERROR("March HMS Information failed.");
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (hmsInfoTable.hmsInfoNum == 0) {
|
||||
USER_LOG_INFO("All systems of drone are running well now.");
|
||||
|
||||
@ -39,8 +39,8 @@ extern "C" {
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
T_DjiReturnCode DjiTest_HmsRunSample(void);
|
||||
T_DjiReturnCode DjiTest_HmsStartService(void);
|
||||
T_DjiReturnCode DjiTest_HmsManagerRunSample(E_DjiMobileAppLanguage language);
|
||||
T_DjiReturnCode DjiTest_HmsCustomizationStartService(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@ -0,0 +1,131 @@
|
||||
/**
|
||||
********************************************************************
|
||||
* @file test_interest_point.c
|
||||
* @brief
|
||||
*
|
||||
* @copyright (c) 2018 DJI. All rights reserved.
|
||||
*
|
||||
* All information contained herein is, and remains, the property of DJI.
|
||||
* The intellectual and technical concepts contained herein are proprietary
|
||||
* to DJI and may be covered by U.S. and foreign patents, patents in process,
|
||||
* and protected by trade secret or copyright law. Dissemination of this
|
||||
* information, including but not limited to data and other proprietary
|
||||
* material(s) incorporated within the information, in any form, is strictly
|
||||
* prohibited without the express written consent of DJI.
|
||||
*
|
||||
* If you receive this source code without DJI’s 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.
|
||||
*
|
||||
*********************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "test_interest_point.h"
|
||||
#include "dji_interest_point.h"
|
||||
#include "dji_logger.h"
|
||||
#include "dji_flight_controller.h"
|
||||
#include "flight_control/test_flight_control.h"
|
||||
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
|
||||
/* Private values -------------------------------------------------------------*/
|
||||
static T_DjiReturnCode DjiUser_InterestPointMissionStateCallback(T_DjiInterestPointMissionState missionState);
|
||||
|
||||
/* Private functions declaration ---------------------------------------------*/
|
||||
|
||||
/* Exported functions definition ---------------------------------------------*/
|
||||
T_DjiReturnCode DjiTest_InterestPointRunSample(void)
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
T_DjiInterestPointSettings interestPointSettings = {0};
|
||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||
T_DjiFlightControllerRidInfo ridInfo = {0};
|
||||
|
||||
ridInfo.latitude = 22.542812;
|
||||
ridInfo.longitude = 113.958902;
|
||||
ridInfo.altitude = 10;
|
||||
|
||||
returnCode = DjiFlightController_Init(ridInfo);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_INFO("Flight control init failed, errno=%lld", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
returnCode = DjiInterestPoint_Init();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_INFO("Point interest init failed, errno=%lld", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
osalHandler->TaskSleepMs(1000);
|
||||
DjiFlightController_ObtainJoystickCtrlAuthority();
|
||||
|
||||
osalHandler->TaskSleepMs(1000);
|
||||
DjiFlightController_StartTakeoff();
|
||||
|
||||
osalHandler->TaskSleepMs(1000);
|
||||
DjiTest_FlightControlVelocityAndYawRateCtrl((T_DjiTestFlightControlVector3f) {0, 0, 5}, 0, 10000);
|
||||
|
||||
osalHandler->TaskSleepMs(1000);
|
||||
DjiTest_FlightControlVelocityAndYawRateCtrl((T_DjiTestFlightControlVector3f) {3, 0, 0}, 0, 5000);
|
||||
|
||||
interestPointSettings.latitude = 22.542812;
|
||||
interestPointSettings.longitude = 113.958902;
|
||||
|
||||
returnCode = DjiInterestPoint_RegMissionStateCallback(DjiUser_InterestPointMissionStateCallback);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Register mission state callback failed, errno=%lld", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
returnCode = DjiInterestPoint_Start(interestPointSettings);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Point interest start failed, errno=%lld", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
DjiInterestPoint_SetSpeed(5.0f);
|
||||
|
||||
for (int i = 0; i < 60; ++i) {
|
||||
USER_LOG_ERROR("Interest point mission running %d.", i);
|
||||
osalHandler->TaskSleepMs(1000);
|
||||
}
|
||||
|
||||
returnCode = DjiInterestPoint_Stop();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Point interest stop failed, errno=%lld", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
DjiFlightController_StartForceLanding();
|
||||
|
||||
returnCode = DjiInterestPoint_DeInit();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Point interest deinit failed, errno=%lld", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
returnCode = DjiFlightController_DeInit();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Flight control init failed, errno=%lld", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
/* Private functions definition-----------------------------------------------*/
|
||||
static T_DjiReturnCode DjiUser_InterestPointMissionStateCallback(T_DjiInterestPointMissionState missionState)
|
||||
{
|
||||
USER_LOG_INFO("Interest point state: %d, radius: %.2f m, speed: %.2f m/s", missionState.state, missionState.radius,
|
||||
missionState.curSpeed);
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/
|
||||
@ -0,0 +1,49 @@
|
||||
/**
|
||||
********************************************************************
|
||||
* @file test_interest_point.h
|
||||
* @brief This is the header file for "test_interest_point.c", defining the structure and
|
||||
* (exported) function prototypes.
|
||||
*
|
||||
* @copyright (c) 2018 DJI. All rights reserved.
|
||||
*
|
||||
* All information contained herein is, and remains, the property of DJI.
|
||||
* The intellectual and technical concepts contained herein are proprietary
|
||||
* to DJI and may be covered by U.S. and foreign patents, patents in process,
|
||||
* and protected by trade secret or copyright law. Dissemination of this
|
||||
* information, including but not limited to data and other proprietary
|
||||
* material(s) incorporated within the information, in any form, is strictly
|
||||
* prohibited without the express written consent of DJI.
|
||||
*
|
||||
* If you receive this source code without DJI’s 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 TEST_INTEREST_POINT_H
|
||||
#define TEST_INTEREST_POINT_H
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "dji_typedef.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
T_DjiReturnCode DjiTest_InterestPointRunSample(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // TEST_INTEREST_POINT_H
|
||||
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
|
||||
@ -32,22 +32,34 @@
|
||||
#include "dji_platform.h"
|
||||
#include "time_sync/test_time_sync.h"
|
||||
|
||||
#ifdef SYSTEM_ARCH_LINUX
|
||||
|
||||
#include "time.h"
|
||||
|
||||
#endif
|
||||
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
#define POSITIONING_TASK_FREQ (1)
|
||||
#define POSITIONING_TASK_STACK_SIZE (1024)
|
||||
#define POSITIONING_TASK_STACK_SIZE (2048)
|
||||
#define TEST_RTCM_FILE_PATH_STR_MAX_SIZE (64)
|
||||
|
||||
#define DJI_TEST_POSITIONING_EVENT_COUNT (2)
|
||||
#define DJI_TEST_TIME_INTERVAL_AMONG_EVENTS_US (200000)
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
|
||||
|
||||
/* Private functions declaration ---------------------------------------------*/
|
||||
static void *DjiTest_PositioningTask(void *arg);
|
||||
static T_DjiReturnCode DjiTest_ReceiveRtkOnAircraftRtcmDataCallback(uint8_t index, const uint8_t *data,
|
||||
uint16_t dataLen);
|
||||
static T_DjiReturnCode DjiTest_ReceiveRtkBaseStationRtcmDataCallback(uint8_t index, const uint8_t *data,
|
||||
uint16_t dataLen);
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
static T_DjiTaskHandle s_userPositioningThread;
|
||||
static int32_t s_eventIndex = 0;
|
||||
static char s_rtkOnAircraftRtcmFilePath[TEST_RTCM_FILE_PATH_STR_MAX_SIZE];
|
||||
static char s_rtkBaseStationRtcmFilePath[TEST_RTCM_FILE_PATH_STR_MAX_SIZE];
|
||||
|
||||
/* Exported functions definition ---------------------------------------------*/
|
||||
T_DjiReturnCode DjiTest_PositioningStartService(void)
|
||||
@ -63,12 +75,40 @@ T_DjiReturnCode DjiTest_PositioningStartService(void)
|
||||
|
||||
DjiPositioning_SetTaskIndex(0);
|
||||
|
||||
#ifndef SYSTEM_ARCH_LINUX
|
||||
if (osalHandler->TaskCreate("user_positioning_task", DjiTest_PositioningTask,
|
||||
POSITIONING_TASK_STACK_SIZE, NULL, &s_userPositioningThread) !=
|
||||
DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("user positioning task create error.");
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||
}
|
||||
#else
|
||||
time_t currentTime = time(NULL);
|
||||
struct tm *localTime = NULL;
|
||||
|
||||
localTime = localtime(¤tTime);
|
||||
sprintf(s_rtkOnAircraftRtcmFilePath, "rtk_on_aircraft_%04d%02d%02d_%02d-%02d-%02d.rtcm",
|
||||
localTime->tm_year + 1900, localTime->tm_mon + 1, localTime->tm_mday,
|
||||
localTime->tm_hour, localTime->tm_min, localTime->tm_sec);
|
||||
|
||||
localTime = localtime(¤tTime);
|
||||
sprintf(s_rtkBaseStationRtcmFilePath, "rtk_base_station_%04d%02d%02d_%02d-%02d-%02d.rtcm",
|
||||
localTime->tm_year + 1900, localTime->tm_mon + 1, localTime->tm_mday,
|
||||
localTime->tm_hour, localTime->tm_min, localTime->tm_sec);
|
||||
#endif
|
||||
djiStat = DjiPositioning_RegReceiveRtcmDataCallback(DJI_POSITIONING_RTCM_DATA_TYPE_RTK_BASE_STATION,
|
||||
DjiTest_ReceiveRtkBaseStationRtcmDataCallback);
|
||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Register receive rtk base station callback error.");
|
||||
return djiStat;
|
||||
}
|
||||
|
||||
djiStat = DjiPositioning_RegReceiveRtcmDataCallback(DJI_POSITIONING_RTCM_DATA_TYPE_RTK_ON_AIRCRAFT,
|
||||
DjiTest_ReceiveRtkOnAircraftRtcmDataCallback);
|
||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Register receive rtk on aircraft callback error.");
|
||||
return djiStat;
|
||||
}
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
@ -158,4 +198,51 @@ static void *DjiTest_PositioningTask(void *arg)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
static int32_t DjiTest_SaveRtcmData(char *filePath, const uint8_t *data, uint32_t len)
|
||||
{
|
||||
#ifdef SYSTEM_ARCH_LINUX
|
||||
FILE *fp = NULL;
|
||||
size_t size;
|
||||
|
||||
fp = fopen(filePath, "ab+");
|
||||
if (fp == NULL) {
|
||||
printf("fopen failed!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
size = fwrite(data, 1, len, fp);
|
||||
if (size != len) {
|
||||
fclose(fp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fflush(fp);
|
||||
fclose(fp);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static T_DjiReturnCode DjiTest_ReceiveRtkOnAircraftRtcmDataCallback(uint8_t index, const uint8_t *data,
|
||||
uint16_t dataLen)
|
||||
{
|
||||
USER_LOG_INFO("Receive rtcm data from rtk on aircraft, index: %d, len: %d", index, dataLen);
|
||||
|
||||
#ifdef SYSTEM_ARCH_LINUX
|
||||
DjiTest_SaveRtcmData(s_rtkOnAircraftRtcmFilePath, data, dataLen);
|
||||
#endif
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static T_DjiReturnCode DjiTest_ReceiveRtkBaseStationRtcmDataCallback(uint8_t index, const uint8_t *data,
|
||||
uint16_t dataLen)
|
||||
{
|
||||
USER_LOG_INFO("Receive rtcm data from rtk base station, index: %d, len: %d", index, dataLen);
|
||||
|
||||
#ifdef SYSTEM_ARCH_LINUX
|
||||
DjiTest_SaveRtcmData(s_rtkBaseStationRtcmFilePath, data, dataLen);
|
||||
#endif
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/
|
||||
|
||||
2688
samples/sample_c/module_sample/utils/cJSON.c
Normal file
2688
samples/sample_c/module_sample/utils/cJSON.c
Normal file
File diff suppressed because it is too large
Load Diff
290
samples/sample_c/module_sample/utils/cJSON.h
Normal file
290
samples/sample_c/module_sample/utils/cJSON.h
Normal file
@ -0,0 +1,290 @@
|
||||
/*
|
||||
Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef cJSON__h
|
||||
#define cJSON__h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32))
|
||||
#define __WINDOWS__
|
||||
#endif
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
|
||||
/* When compiling for windows, we specify a specific calling convention to avoid issues where we are being called from a project with a different default calling convention. For windows you have 3 define options:
|
||||
|
||||
CJSON_HIDE_SYMBOLS - Define this in the case where you don't want to ever dllexport symbols
|
||||
CJSON_EXPORT_SYMBOLS - Define this on library build when you want to dllexport symbols (default)
|
||||
CJSON_IMPORT_SYMBOLS - Define this if you want to dllimport symbol
|
||||
|
||||
For *nix builds that support visibility attribute, you can define similar behavior by
|
||||
|
||||
setting default visibility to hidden by adding
|
||||
-fvisibility=hidden (for gcc)
|
||||
or
|
||||
-xldscope=hidden (for sun cc)
|
||||
to CFLAGS
|
||||
|
||||
then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJSON_EXPORT_SYMBOLS does
|
||||
|
||||
*/
|
||||
|
||||
#define CJSON_CDECL __cdecl
|
||||
#define CJSON_STDCALL __stdcall
|
||||
|
||||
/* export symbols by default, this is necessary for copy pasting the C and header file */
|
||||
#if !defined(CJSON_HIDE_SYMBOLS) && !defined(CJSON_IMPORT_SYMBOLS) && !defined(CJSON_EXPORT_SYMBOLS)
|
||||
#define CJSON_EXPORT_SYMBOLS
|
||||
#endif
|
||||
|
||||
#if defined(CJSON_HIDE_SYMBOLS)
|
||||
#define CJSON_PUBLIC(type) type CJSON_STDCALL
|
||||
#elif defined(CJSON_EXPORT_SYMBOLS)
|
||||
#define CJSON_PUBLIC(type) __declspec(dllexport) type CJSON_STDCALL
|
||||
#elif defined(CJSON_IMPORT_SYMBOLS)
|
||||
#define CJSON_PUBLIC(type) __declspec(dllimport) type CJSON_STDCALL
|
||||
#endif
|
||||
#else /* !__WINDOWS__ */
|
||||
#define CJSON_CDECL
|
||||
#define CJSON_STDCALL
|
||||
|
||||
#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY)
|
||||
#define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type
|
||||
#else
|
||||
#define CJSON_PUBLIC(type) type
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* project version */
|
||||
#define CJSON_VERSION_MAJOR 1
|
||||
#define CJSON_VERSION_MINOR 7
|
||||
#define CJSON_VERSION_PATCH 12
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* cJSON Types: */
|
||||
#define cJSON_Invalid (0)
|
||||
#define cJSON_False (1 << 0)
|
||||
#define cJSON_True (1 << 1)
|
||||
#define cJSON_NULL (1 << 2)
|
||||
#define cJSON_Number (1 << 3)
|
||||
#define cJSON_String (1 << 4)
|
||||
#define cJSON_Array (1 << 5)
|
||||
#define cJSON_Object (1 << 6)
|
||||
#define cJSON_Raw (1 << 7) /* raw json */
|
||||
|
||||
#define cJSON_IsReference 256
|
||||
#define cJSON_StringIsConst 512
|
||||
|
||||
/* The cJSON structure: */
|
||||
typedef struct cJSON {
|
||||
/* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
|
||||
struct cJSON *next;
|
||||
struct cJSON *prev;
|
||||
/* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
|
||||
struct cJSON *child;
|
||||
|
||||
/* The type of the item, as above. */
|
||||
int type;
|
||||
|
||||
/* The item's string, if type==cJSON_String and type == cJSON_Raw */
|
||||
char *valuestring;
|
||||
/* writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead */
|
||||
int valueint;
|
||||
/* The item's number, if type==cJSON_Number */
|
||||
double valuedouble;
|
||||
|
||||
/* The item's name string, if this item is the child of, or is in the list of subitems of an object. */
|
||||
char *string;
|
||||
} cJSON;
|
||||
|
||||
typedef struct cJSON_Hooks {
|
||||
/* malloc/free are CDECL on Windows regardless of the default calling convention of the compiler, so ensure the hooks allow passing those functions directly. */
|
||||
void *(CJSON_CDECL *malloc_fn)(size_t sz);
|
||||
void (CJSON_CDECL *free_fn)(void *ptr);
|
||||
} cJSON_Hooks;
|
||||
|
||||
typedef int cJSON_bool;
|
||||
|
||||
/* Limits how deeply nested arrays/objects can be before cJSON rejects to parse them.
|
||||
* This is to prevent stack overflows. */
|
||||
#ifndef CJSON_NESTING_LIMIT
|
||||
#define CJSON_NESTING_LIMIT 1000
|
||||
#endif
|
||||
|
||||
/* returns the version of cJSON as a string */
|
||||
CJSON_PUBLIC(const char*)cJSON_Version(void);
|
||||
|
||||
/* Supply malloc, realloc and free functions to cJSON */
|
||||
CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks *hooks);
|
||||
|
||||
/* Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, where the caller has full responsibility of the buffer. */
|
||||
/* Supply a block of JSON, and this returns a cJSON object you can interrogate. */
|
||||
CJSON_PUBLIC(cJSON *)cJSON_Parse(const char *value);
|
||||
CJSON_PUBLIC(cJSON *)cJSON_ParseByJsonData(const uint8_t *json_data, uint16_t data_len);
|
||||
/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */
|
||||
/* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr(). */
|
||||
CJSON_PUBLIC(cJSON *)cJSON_ParseWithOpts(const char *value, const char **return_parse_end,
|
||||
cJSON_bool require_null_terminated);
|
||||
|
||||
/* Render a cJSON entity to text for transfer/storage. */
|
||||
CJSON_PUBLIC(char *)cJSON_Print(const cJSON *item);
|
||||
/* Render a cJSON entity to text for transfer/storage without any formatting. */
|
||||
CJSON_PUBLIC(char *)cJSON_PrintUnformatted(const cJSON *item);
|
||||
/* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */
|
||||
CJSON_PUBLIC(char *)cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt);
|
||||
/* Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. */
|
||||
/* NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, so to be safe allocate 5 bytes more than you actually need */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format);
|
||||
/* Delete a cJSON entity and all subentities. */
|
||||
CJSON_PUBLIC(void) cJSON_Delete(cJSON *item);
|
||||
|
||||
/* Returns the number of items in an array (or object). */
|
||||
CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array);
|
||||
/* Retrieve item number "index" from array "array". Returns NULL if unsuccessful. */
|
||||
CJSON_PUBLIC(cJSON *)cJSON_GetArrayItem(const cJSON *array, int index);
|
||||
/* Get item "string" from object. Case insensitive. */
|
||||
CJSON_PUBLIC(cJSON *)cJSON_GetObjectItem(const cJSON *const object, const char *const string);
|
||||
CJSON_PUBLIC(cJSON *)cJSON_GetObjectItemCaseSensitive(const cJSON *const object, const char *const string);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string);
|
||||
/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
|
||||
CJSON_PUBLIC(const char *)cJSON_GetErrorPtr(void);
|
||||
|
||||
/* Check if the item is a string and return its valuestring */
|
||||
CJSON_PUBLIC(char *)cJSON_GetStringValue(cJSON *item);
|
||||
|
||||
/* These functions check the type of an item */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON *const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON *const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON *const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON *const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON *const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON *const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON *const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON *const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON *const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON *const item);
|
||||
|
||||
/* These calls create a cJSON item of the appropriate type. */
|
||||
CJSON_PUBLIC(cJSON *)cJSON_CreateNull(void);
|
||||
CJSON_PUBLIC(cJSON *)cJSON_CreateTrue(void);
|
||||
CJSON_PUBLIC(cJSON *)cJSON_CreateFalse(void);
|
||||
CJSON_PUBLIC(cJSON *)cJSON_CreateBool(cJSON_bool boolean);
|
||||
CJSON_PUBLIC(cJSON *)cJSON_CreateNumber(double num);
|
||||
CJSON_PUBLIC(cJSON *)cJSON_CreateString(const char *string);
|
||||
/* raw json */
|
||||
CJSON_PUBLIC(cJSON *)cJSON_CreateRaw(const char *raw);
|
||||
CJSON_PUBLIC(cJSON *)cJSON_CreateArray(void);
|
||||
CJSON_PUBLIC(cJSON *)cJSON_CreateObject(void);
|
||||
|
||||
/* Create a string where valuestring references a string so
|
||||
* it will not be freed by cJSON_Delete */
|
||||
CJSON_PUBLIC(cJSON *)cJSON_CreateStringReference(const char *string);
|
||||
/* Create an object/array that only references it's elements so
|
||||
* they will not be freed by cJSON_Delete */
|
||||
CJSON_PUBLIC(cJSON *)cJSON_CreateObjectReference(const cJSON *child);
|
||||
CJSON_PUBLIC(cJSON *)cJSON_CreateArrayReference(const cJSON *child);
|
||||
|
||||
/* These utilities create an Array of count items.
|
||||
* The parameter count cannot be greater than the number of elements in the number array, otherwise array access will be out of bounds.*/
|
||||
CJSON_PUBLIC(cJSON *)cJSON_CreateIntArray(const int *numbers, int count);
|
||||
CJSON_PUBLIC(cJSON *)cJSON_CreateFloatArray(const float *numbers, int count);
|
||||
CJSON_PUBLIC(cJSON *)cJSON_CreateDoubleArray(const double *numbers, int count);
|
||||
CJSON_PUBLIC(cJSON *)cJSON_CreateStringArray(const char **strings, int count);
|
||||
|
||||
/* Append item to the specified array/object. */
|
||||
CJSON_PUBLIC(void) cJSON_AddItemToArray(cJSON *array, cJSON *item);
|
||||
CJSON_PUBLIC(void) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item);
|
||||
/* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object.
|
||||
* WARNING: When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before
|
||||
* writing to `item->string` */
|
||||
CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item);
|
||||
/* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */
|
||||
CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
|
||||
CJSON_PUBLIC(void) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item);
|
||||
|
||||
/* Remove/Detach items from Arrays/Objects. */
|
||||
CJSON_PUBLIC(cJSON *)cJSON_DetachItemViaPointer(cJSON *parent, cJSON *const item);
|
||||
CJSON_PUBLIC(cJSON *)cJSON_DetachItemFromArray(cJSON *array, int which);
|
||||
CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which);
|
||||
CJSON_PUBLIC(cJSON *)cJSON_DetachItemFromObject(cJSON *object, const char *string);
|
||||
CJSON_PUBLIC(cJSON *)cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string);
|
||||
CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string);
|
||||
CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string);
|
||||
|
||||
/* Update array items. */
|
||||
CJSON_PUBLIC(void)
|
||||
cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON *const parent, cJSON *const item, cJSON *replacement);
|
||||
CJSON_PUBLIC(void) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem);
|
||||
CJSON_PUBLIC(void) cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem);
|
||||
CJSON_PUBLIC(void) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object, const char *string, cJSON *newitem);
|
||||
|
||||
/* Duplicate a cJSON item */
|
||||
CJSON_PUBLIC(cJSON *)cJSON_Duplicate(const cJSON *item, cJSON_bool recurse);
|
||||
/* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will
|
||||
* need to be released. With recurse!=0, it will duplicate any children connected to the item.
|
||||
* The item->next and ->prev pointers are always zero on return from Duplicate. */
|
||||
/* Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, they will be considered unequal.
|
||||
* case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0) */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON *const a, const cJSON *const b, const cJSON_bool case_sensitive);
|
||||
|
||||
/* Minify a strings, remove blank characters(such as ' ', '\t', '\r', '\n') from strings.
|
||||
* The input pointer json cannot point to a read-only address area, such as a string constant,
|
||||
* but should point to a readable and writable adress area. */
|
||||
CJSON_PUBLIC(void) cJSON_Minify(char *json);
|
||||
|
||||
/* Helper functions for creating and adding items to an object at the same time.
|
||||
* They return the added item or NULL on failure. */
|
||||
CJSON_PUBLIC(cJSON*)cJSON_AddNullToObject(cJSON *const object, const char *const name);
|
||||
CJSON_PUBLIC(cJSON*)cJSON_AddTrueToObject(cJSON *const object, const char *const name);
|
||||
CJSON_PUBLIC(cJSON*)cJSON_AddFalseToObject(cJSON *const object, const char *const name);
|
||||
CJSON_PUBLIC(cJSON*)cJSON_AddBoolToObject(cJSON *const object, const char *const name, const cJSON_bool boolean);
|
||||
CJSON_PUBLIC(cJSON*)cJSON_AddNumberToObject(cJSON *const object, const char *const name, const double number);
|
||||
CJSON_PUBLIC(cJSON*)cJSON_AddStringToObject(cJSON *const object, const char *const name, const char *const string);
|
||||
CJSON_PUBLIC(cJSON*)cJSON_AddRawToObject(cJSON *const object, const char *const name, const char *const raw);
|
||||
CJSON_PUBLIC(cJSON*)cJSON_AddObjectToObject(cJSON *const object, const char *const name);
|
||||
CJSON_PUBLIC(cJSON*)cJSON_AddArrayToObject(cJSON *const object, const char *const name);
|
||||
|
||||
/* When assigning an integer value, it needs to be propagated to valuedouble too. */
|
||||
#define cJSON_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number))
|
||||
/* helper for the cJSON_SetNumberValue macro */
|
||||
CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number);
|
||||
#define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number))
|
||||
|
||||
/* Macro for iterating over an array or object */
|
||||
#define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next)
|
||||
|
||||
/* malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks */
|
||||
CJSON_PUBLIC(void *)cJSON_malloc(size_t size);
|
||||
CJSON_PUBLIC(void) cJSON_free(void *object);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -89,8 +89,8 @@ T_DjiReturnCode UtilFile_GetFileSizeByPath(const char *filePath, uint32_t *fileS
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
T_DjiReturnCode UtilFile_GetFileDataByPath(const char *filePath, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen)
|
||||
T_DjiReturnCode UtilFile_GetFileDataByPath(const char *filePath, uint32_t offset, uint32_t len,
|
||||
uint8_t *data, uint32_t *realLen)
|
||||
{
|
||||
FILE *pF;
|
||||
T_DjiReturnCode psdkStat;
|
||||
|
||||
@ -52,8 +52,8 @@ typedef struct {
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
T_DjiReturnCode UtilFile_GetCreateTime(const char *filePath, T_UtilFileCreateTime *createTime);
|
||||
T_DjiReturnCode UtilFile_GetFileSizeByPath(const char *filePath, uint32_t *fileSize);
|
||||
T_DjiReturnCode UtilFile_GetFileDataByPath(const char *filePath, uint32_t offset, uint16_t len,
|
||||
uint8_t *data, uint16_t *realLen);
|
||||
T_DjiReturnCode UtilFile_GetFileDataByPath(const char *filePath, uint32_t offset, uint32_t len,
|
||||
uint8_t *data, uint32_t *realLen);
|
||||
T_DjiReturnCode DjiFile_Delete(const char *filePath);
|
||||
|
||||
T_DjiReturnCode UtilFile_GetFileSize(FILE *file, uint32_t *fileSize);
|
||||
|
||||
@ -384,6 +384,7 @@ static T_DjiReturnCode DjiTest_CheckFileMd5Sum(const char *path, uint8_t *buf, u
|
||||
file = fopen(path, "rb");
|
||||
if (file == NULL) {
|
||||
USER_LOG_ERROR("Open tts file error.");
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
@ -585,7 +586,7 @@ static T_DjiReturnCode SetVolume(uint8_t volume)
|
||||
(int32_t) realVolume);
|
||||
|
||||
returnCode = DjiUserUtil_RunSystemCmd(cmdStr);
|
||||
if (returnCode < 0) {
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Set widget speaker volume error: %d", ret);
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -73,7 +73,7 @@ typedef enum {
|
||||
E_DJI_SAMPLE_INDEX_FLIGHT_CONTROL_TAKE_OFF_VELOCITY_CTRL_LANDING = 6,
|
||||
E_DJI_SAMPLE_INDEX_FLIGHT_CONTROL_ARREST_FLYING = 7,
|
||||
E_DJI_SAMPLE_INDEX_FLIGHT_CONTROL_SET_GET_PARAM = 8,
|
||||
E_DJI_SAMPLE_INDEX_HMS = 9,
|
||||
E_DJI_SAMPLE_INDEX_HMS_MANAGER = 9,
|
||||
E_DJI_SAMPLE_INDEX_GIMBAL_MANAGER_FREE_MODE = 10,
|
||||
E_DJI_SAMPLE_INDEX_GIMBAL_MANAGER_YAW_FOLLOW_MODE = 11,
|
||||
E_DJI_SAMPLE_INDEX_LIVEVIEW = 12,
|
||||
@ -102,7 +102,7 @@ typedef enum {
|
||||
E_DJI_HMS_ERROR_CODE_INDEX3,
|
||||
E_DJI_HMS_ERROR_CODE_INDEX4,
|
||||
E_DJI_HMS_ERROR_CODE_INDEX5,
|
||||
}E_DjiExtensionPortHmsErrorCodeIndex;
|
||||
} E_DjiExtensionPortHmsErrorCodeIndex;
|
||||
|
||||
typedef enum {
|
||||
E_DJI_HMS_ERROR_LEVEL_INDEX1 = 0,
|
||||
@ -110,7 +110,7 @@ typedef enum {
|
||||
E_DJI_HMS_ERROR_LEVEL_INDEX3,
|
||||
E_DJI_HMS_ERROR_LEVEL_INDEX4,
|
||||
E_DJI_HMS_ERROR_LEVEL_INDEX5,
|
||||
}E_DjiExtensionPortHmsErrorLevelIndex;
|
||||
} E_DjiExtensionPortHmsErrorLevelIndex;
|
||||
|
||||
typedef struct {
|
||||
bool valid;
|
||||
@ -418,7 +418,7 @@ static void *DjiTest_WidgetInteractionTask(void *arg)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
DjiHms_InjectHmsErrorCode(errorCode, errorLevel);
|
||||
DjiHmsCustomization_InjectHmsErrorCode(errorCode, errorLevel);
|
||||
osalHandler->TaskSleepMs(500);
|
||||
s_isInjectErrcode = false;
|
||||
s_isEliminateErrcode = false;
|
||||
@ -444,7 +444,7 @@ static void *DjiTest_WidgetInteractionTask(void *arg)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
DjiHms_EliminateHmsErrorCode(errorCode);
|
||||
DjiHmsCustomization_EliminateHmsErrorCode(errorCode);
|
||||
osalHandler->TaskSleepMs(500);
|
||||
s_isInjectErrcode = false;
|
||||
s_isEliminateErrcode = false;
|
||||
@ -530,8 +530,8 @@ static void *DjiTest_WidgetInteractionTask(void *arg)
|
||||
case E_DJI_SAMPLE_INDEX_GIMBAL_MANAGER_YAW_FOLLOW_MODE:
|
||||
DjiTest_GimbalManagerRunSample(s_mountPosition, DJI_GIMBAL_MODE_YAW_FOLLOW);
|
||||
break;
|
||||
case E_DJI_SAMPLE_INDEX_HMS:
|
||||
DjiTest_HmsRunSample();
|
||||
case E_DJI_SAMPLE_INDEX_HMS_MANAGER:
|
||||
DjiTest_HmsManagerRunSample(DJI_MOBILE_APP_LANGUAGE_ENGLISH);
|
||||
break;
|
||||
case E_DJI_SAMPLE_INDEX_LIVEVIEW:
|
||||
#ifdef SYSTEM_ARCH_LINUX
|
||||
|
||||
@ -142,7 +142,7 @@ T_DjiReturnCode Osal_UdpSendData(T_DjiSocketHandle socketHandle, const char *ipA
|
||||
T_SocketHandleStruct *socketHandleStruct = (T_SocketHandleStruct *) socketHandle;
|
||||
int32_t ret;
|
||||
|
||||
if (socketHandle <= 0 || ipAddr == NULL || port == 0 || buf == NULL || len == 0 || realLen == NULL) {
|
||||
if (socketHandle == NULL || ipAddr == NULL || port == 0 || buf == NULL || len == 0 || realLen == NULL) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.5)
|
||||
project(dji_sdk_demo_linux C)
|
||||
|
||||
set(CMAKE_C_FLAGS "-pthread -std=gnu99")
|
||||
set(CMAKE_CXX_FLAGS "-std=c++11 -pthread")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-pthread")
|
||||
set(CMAKE_C_COMPILER "gcc")
|
||||
set(CMAKE_CXX_COMPILER "g++")
|
||||
@ -11,10 +12,11 @@ if (NOT USE_SYSTEM_ARCH)
|
||||
add_definitions(-DSYSTEM_ARCH_LINUX)
|
||||
endif ()
|
||||
|
||||
set(COMMON_CXX_FLAGS "-std=c++11 -pthread")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov")
|
||||
if (BUILD_TEST_CASES_ON MATCHES TRUE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov")
|
||||
endif ()
|
||||
|
||||
set(PACKAGE_NAME payloadsdk)
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ extern "C" {
|
||||
|
||||
#define CONFIG_MODULE_SAMPLE_FC_SUBSCRIPTION_ON
|
||||
|
||||
#define CONFIG_MODULE_SAMPLE_HMS_ON
|
||||
#define CONFIG_MODULE_SAMPLE_HMS_CUSTOMIZATION_ON
|
||||
|
||||
/*!< Attention: This function needs to be used together with mobile sdk mop sample.
|
||||
* */
|
||||
|
||||
@ -97,6 +97,7 @@ int main(int argc, char **argv)
|
||||
T_DjiReturnCode returnCode;
|
||||
T_DjiUserInfo userInfo;
|
||||
T_DjiAircraftInfoBaseInfo aircraftInfoBaseInfo;
|
||||
T_DjiAircraftVersion aircraftInfoVersion;
|
||||
T_DjiFirmwareVersion firmwareVersion = {
|
||||
.majorVersion = 1,
|
||||
.minorVersion = 0,
|
||||
@ -137,6 +138,17 @@ int main(int argc, char **argv)
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
}
|
||||
|
||||
if (aircraftInfoBaseInfo.mountPositionType != DJI_MOUNT_POSITION_TYPE_PAYLOAD_PORT) {
|
||||
returnCode = DjiAircraftInfo_GetAircraftVersion(&aircraftInfoVersion);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("get aircraft version info error");
|
||||
} else {
|
||||
USER_LOG_INFO("Aircraft version is V%d.%d.%d.%d", aircraftInfoVersion.debugVersion,
|
||||
aircraftInfoVersion.modifyVersion, aircraftInfoVersion.minorVersion,
|
||||
aircraftInfoVersion.majorVersion);
|
||||
}
|
||||
}
|
||||
|
||||
returnCode = DjiCore_SetAlias("PSDK_APPALIAS");
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("set alias error");
|
||||
@ -193,6 +205,30 @@ int main(int argc, char **argv)
|
||||
USER_LOG_ERROR("widget speaker test init error");
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MODULE_SAMPLE_UPGRADE_ON
|
||||
T_DjiTestUpgradePlatformOpt linuxUpgradePlatformOpt = {
|
||||
.rebootSystem = DjiUpgradePlatformLinux_RebootSystem,
|
||||
.cleanUpgradeProgramFileStoreArea = DjiUpgradePlatformLinux_CleanUpgradeProgramFileStoreArea,
|
||||
.createUpgradeProgramFile = DjiUpgradePlatformLinux_CreateUpgradeProgramFile,
|
||||
.writeUpgradeProgramFile = DjiUpgradePlatformLinux_WriteUpgradeProgramFile,
|
||||
.readUpgradeProgramFile = DjiUpgradePlatformLinux_ReadUpgradeProgramFile,
|
||||
.closeUpgradeProgramFile = DjiUpgradePlatformLinux_CloseUpgradeProgramFile,
|
||||
.replaceOldProgram = DjiUpgradePlatformLinux_ReplaceOldProgram,
|
||||
.setUpgradeRebootState = DjiUpgradePlatformLinux_SetUpgradeRebootState,
|
||||
.getUpgradeRebootState = DjiUpgradePlatformLinux_GetUpgradeRebootState,
|
||||
.cleanUpgradeRebootState = DjiUpgradePlatformLinux_CleanUpgradeRebootState,
|
||||
};
|
||||
T_DjiTestUpgradeConfig testUpgradeConfig = {
|
||||
.firmwareVersion = {1, 0, 0, 0},
|
||||
.transferType = DJI_FIRMWARE_TRANSFER_TYPE_DCFTP,
|
||||
.needReplaceProgramBeforeReboot = true
|
||||
};
|
||||
if (DjiTest_UpgradeStartService(&linuxUpgradePlatformOpt, testUpgradeConfig) !=
|
||||
DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("psdk upgrade init error");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MODULE_SAMPLE_MOP_CHANNEL_ON
|
||||
returnCode = DjiTest_MopChannelStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
@ -301,8 +337,8 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MODULE_SAMPLE_HMS_ON
|
||||
returnCode = DjiTest_HmsStartService();
|
||||
#ifdef CONFIG_MODULE_SAMPLE_HMS_CUSTOMIZATION_ON
|
||||
returnCode = DjiTest_HmsCustomizationStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("hms test init error");
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ T_DjiReturnCode HalUart_Init(E_DjiHalUartNum uartNum, uint32_t baudRate, T_DjiUa
|
||||
sprintf(systemCmd, "chmod 777 %s", uartName);
|
||||
fp = popen(systemCmd, "r");
|
||||
if (fp == NULL) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
goto free_uart_handle;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.5)
|
||||
project(dji_sdk_demo_on_jetson C)
|
||||
|
||||
set(CMAKE_C_FLAGS "-pthread -std=gnu99")
|
||||
set(CMAKE_CXX_FLAGS "-std=c++11 -pthread")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-pthread")
|
||||
set(CMAKE_C_COMPILER "gcc")
|
||||
set(CMAKE_CXX_COMPILER "g++")
|
||||
@ -11,10 +12,11 @@ if (NOT USE_SYSTEM_ARCH)
|
||||
add_definitions(-DSYSTEM_ARCH_LINUX)
|
||||
endif ()
|
||||
|
||||
set(COMMON_CXX_FLAGS "-std=c++11 -pthread")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov")
|
||||
if (BUILD_TEST_CASES_ON MATCHES TRUE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov")
|
||||
endif ()
|
||||
|
||||
set(PACKAGE_NAME payloadsdk)
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ extern "C" {
|
||||
|
||||
#define CONFIG_MODULE_SAMPLE_UPGRADE_ON
|
||||
|
||||
#define CONFIG_MODULE_SAMPLE_HMS_ON
|
||||
#define CONFIG_MODULE_SAMPLE_HMS_CUSTOMIZATION_ON
|
||||
|
||||
#define CONFIG_MODULE_SAMPLE_FC_SUBSCRIPTION_ON
|
||||
|
||||
|
||||
@ -96,6 +96,7 @@ int main(int argc, char **argv)
|
||||
T_DjiReturnCode returnCode;
|
||||
T_DjiUserInfo userInfo;
|
||||
T_DjiAircraftInfoBaseInfo aircraftInfoBaseInfo;
|
||||
T_DjiAircraftVersion aircraftInfoVersion;
|
||||
T_DjiFirmwareVersion firmwareVersion = {
|
||||
.majorVersion = 1,
|
||||
.minorVersion = 0,
|
||||
@ -136,6 +137,15 @@ int main(int argc, char **argv)
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
}
|
||||
|
||||
returnCode = DjiAircraftInfo_GetAircraftVersion(&aircraftInfoVersion);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("get aircraft version info error");
|
||||
} else {
|
||||
USER_LOG_INFO("Aircraft version is V%d.%d.%d.%d", aircraftInfoVersion.debugVersion,
|
||||
aircraftInfoVersion.modifyVersion, aircraftInfoVersion.minorVersion,
|
||||
aircraftInfoVersion.majorVersion);
|
||||
}
|
||||
|
||||
returnCode = DjiCore_SetAlias("PSDK_APPALIAS");
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("set alias error");
|
||||
@ -291,8 +301,8 @@ int main(int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MODULE_SAMPLE_HMS_ON
|
||||
returnCode = DjiTest_HmsStartService();
|
||||
#ifdef CONFIG_MODULE_SAMPLE_HMS_CUSTOMIZATION_ON
|
||||
returnCode = DjiTest_HmsCustomizationStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("hms test init error");
|
||||
}
|
||||
|
||||
@ -226,8 +226,8 @@ void DjiUser_StartTask(void const *argument)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MODULE_SAMPLE_HMS_ON
|
||||
returnCode = DjiTest_HmsStartService();
|
||||
#ifdef CONFIG_MODULE_SAMPLE_HMS_CUSTOMIZATION_ON
|
||||
returnCode = DjiTest_HmsCustomizationStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("hms test init error");
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ extern "C" {
|
||||
|
||||
#define CONFIG_MODULE_SAMPLE_UPGRADE_ON
|
||||
|
||||
#define CONFIG_MODULE_SAMPLE_HMS_ON
|
||||
#define CONFIG_MODULE_SAMPLE_HMS_CUSTOMIZATION_ON
|
||||
|
||||
/*!< Attention: Please uncomment it in gps environment.
|
||||
* */
|
||||
|
||||
@ -1,9 +1,13 @@
|
||||
# This is an STM32F4 discovery board with a single STM32F407VGT6 chip.
|
||||
# http://www.st.com/internet/evalboard/product/252419.jsp
|
||||
|
||||
source [find interface/jlink.cfg]
|
||||
### use stlink-v2-1
|
||||
source [find interface/stlink-v2-1.cfg]
|
||||
transport select hla_swd
|
||||
|
||||
transport select swd
|
||||
### use jlink
|
||||
# source [find interface/jlink.cfg]
|
||||
# transport select swd
|
||||
|
||||
# increase working area to 64KB
|
||||
set WORKAREASIZE 0x10000
|
||||
|
||||
@ -405,6 +405,11 @@
|
||||
<Files>
|
||||
<File>
|
||||
<FileType>1</FileType>
|
||||
<FileName>cJSON.c</FileName>
|
||||
<FilePath>..\..\..\..\..\module_sample\utils\cJSON.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileType>1</FileType>
|
||||
<FileName>file_binary_array_list_en.c</FileName>
|
||||
<FilePath>..\..\..\..\..\module_sample\widget\file_binary_array_list_en.c</FilePath>
|
||||
</File>
|
||||
@ -940,11 +945,21 @@
|
||||
</File>
|
||||
<File>
|
||||
<FileType>5</FileType>
|
||||
<FileName>dji_hms_customization.h</FileName>
|
||||
<FilePath>..\..\..\..\..\..\..\psdk_lib\include\dji_hms_customization.h</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileType>5</FileType>
|
||||
<FileName>dji_hms_info_table.h</FileName>
|
||||
<FilePath>..\..\..\..\..\..\..\psdk_lib\include\dji_hms_info_table.h</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileType>5</FileType>
|
||||
<FileName>dji_hms_manager.h</FileName>
|
||||
<FilePath>..\..\..\..\..\..\..\psdk_lib\include\dji_hms_manager.h</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileType>5</FileType>
|
||||
<FileName>dji_liveview.h</FileName>
|
||||
<FilePath>..\..\..\..\..\..\..\psdk_lib\include\dji_liveview.h</FilePath>
|
||||
</File>
|
||||
|
||||
Reference in New Issue
Block a user