NEW: release DJI Payload-SDK version 3.2
Signed-off-by: DJI-Martin <DJI-Martin@dji.com>
This commit is contained in:
34
samples/sample_c++/platform/linux/common/3rdparty/FindLIBUSB.cmake
vendored
Normal file
34
samples/sample_c++/platform/linux/common/3rdparty/FindLIBUSB.cmake
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
#
|
||||
# Find the native LIBUSB includes and library
|
||||
#
|
||||
# This module defines
|
||||
# LIBUSB_INCLUDE_DIR, where to find libusb.h
|
||||
# LIBUSB_LIBRARY, the libraries to link against to use LIBUSB.
|
||||
# LIBUSB_FOUND, If false, do not try to use LIBUSB.
|
||||
|
||||
FIND_PATH(LIBUSB_INCLUDE_DIR libusb.h
|
||||
PATHS
|
||||
/usr/local/include/libusb-1.0
|
||||
/usr/include/libusb-1.0
|
||||
/opt/local/include
|
||||
/opt/include
|
||||
)
|
||||
|
||||
get_filename_component(LIBUSB_INCLUDE_DIR ${LIBUSB_INCLUDE_DIR} ABSOLUTE)
|
||||
|
||||
FIND_LIBRARY(LIBUSB_LIBRARY usb-1.0
|
||||
/usr/local/lib
|
||||
/usr/lib
|
||||
)
|
||||
|
||||
IF (LIBUSB_INCLUDE_DIR)
|
||||
IF (LIBUSB_LIBRARY)
|
||||
SET(LIBUSB_FOUND "YES")
|
||||
ENDIF (LIBUSB_LIBRARY)
|
||||
ENDIF (LIBUSB_INCLUDE_DIR)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
LIBUSB_INCLUDE_DIR
|
||||
LIBUSB_LIBRARY
|
||||
LIBUSB_FOUND
|
||||
)
|
34
samples/sample_c++/platform/linux/common/3rdparty/FindOPUS.cmake
vendored
Normal file
34
samples/sample_c++/platform/linux/common/3rdparty/FindOPUS.cmake
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
#
|
||||
# Find the native OPUS includes and library
|
||||
#
|
||||
# This module defines
|
||||
# OPUS_INCLUDE_DIR, where to find opus.h
|
||||
# OPUS_LIBRARY, the libraries to link against to use OPUS.
|
||||
# OPUS_FOUND, If false, do not try to use OPUS.
|
||||
|
||||
FIND_PATH(OPUS_INCLUDE_DIR opus.h
|
||||
PATHS
|
||||
/usr/local/include/opus
|
||||
/usr/include/opus
|
||||
/opt/local/include
|
||||
/opt/include
|
||||
)
|
||||
|
||||
get_filename_component(OPUS_INCLUDE_DIR ${OPUS_INCLUDE_DIR} ABSOLUTE)
|
||||
|
||||
FIND_LIBRARY(OPUS_LIBRARY opus
|
||||
/usr/local/lib
|
||||
/usr/lib
|
||||
)
|
||||
|
||||
IF (OPUS_INCLUDE_DIR)
|
||||
IF (OPUS_LIBRARY)
|
||||
SET(OPUS_FOUND "YES")
|
||||
ENDIF (OPUS_LIBRARY)
|
||||
ENDIF (OPUS_INCLUDE_DIR)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
OPUS_INCLUDE_DIR
|
||||
OPUS_LIBRARY
|
||||
OPUS_FOUND
|
||||
)
|
@ -1,8 +1,6 @@
|
||||
/**
|
||||
********************************************************************
|
||||
* @file psdk_osal.c
|
||||
* @version V2.0.0
|
||||
* @date 2019/07/01
|
||||
* @file osal.c
|
||||
* @brief
|
||||
*
|
||||
* @copyright (c) 2021 DJI. All rights reserved.
|
||||
@ -32,6 +30,10 @@
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
|
||||
/* Private values -------------------------------------------------------------*/
|
||||
static uint32_t s_localTimeMsOffset = 0;
|
||||
static uint64_t s_localTimeUsOffset = 0;
|
||||
|
||||
/* Private functions declaration ---------------------------------------------*/
|
||||
|
||||
/* Exported functions definition ---------------------------------------------*/
|
||||
@ -281,6 +283,12 @@ T_DjiReturnCode Osal_GetTimeMs(uint32_t *ms)
|
||||
gettimeofday(&time, NULL);
|
||||
*ms = (time.tv_sec * 1000 + time.tv_usec / 1000);
|
||||
|
||||
if (s_localTimeMsOffset == 0) {
|
||||
s_localTimeMsOffset = *ms;
|
||||
} else {
|
||||
*ms = *ms - s_localTimeMsOffset;
|
||||
}
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -291,15 +299,17 @@ T_DjiReturnCode Osal_GetTimeUs(uint64_t *us)
|
||||
gettimeofday(&time, NULL);
|
||||
*us = (time.tv_sec * 1000000 + time.tv_usec);
|
||||
|
||||
if (s_localTimeUsOffset == 0) {
|
||||
s_localTimeUsOffset = *us;
|
||||
} else {
|
||||
*us = *us - s_localTimeMsOffset;
|
||||
}
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
void *Osal_Malloc(uint32_t size)
|
||||
{
|
||||
if (size == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
|
@ -7,19 +7,6 @@ set(CMAKE_C_COMPILER "gcc")
|
||||
set(CMAKE_CXX_COMPILER "g++")
|
||||
add_definitions(-D_GNU_SOURCE)
|
||||
|
||||
# Try to see if user has OpenCV installed
|
||||
# if yes, default callback will display the image
|
||||
find_package( OpenCV QUIET )
|
||||
if (OpenCV_FOUND)
|
||||
message( "\n${PROJECT_NAME}...")
|
||||
message( STATUS "Found OpenCV installed in the system, will use it to display image in AdvancedSensing APIs")
|
||||
message( STATUS " - Includes: ${OpenCV_INCLUDE_DIRS}")
|
||||
message( STATUS " - Libraries: ${OpenCV_LIBRARIES}")
|
||||
add_definitions(-DOPEN_CV_INSTALLED)
|
||||
else()
|
||||
message( STATUS "Did not find OpenCV in the system, image data is inside RecvContainer as raw data")
|
||||
endif ()
|
||||
|
||||
set(COMMON_CXX_FLAGS "-std=c++11 -pthread")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_CXX_FLAGS} -fprofile-arcs -ftest-coverage -Wno-deprecated-declarations")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||
@ -50,31 +37,72 @@ else ()
|
||||
message(FATAL_ERROR "FATAL: Please confirm your platform.")
|
||||
endif ()
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
find_package(FFMPEG REQUIRED)
|
||||
|
||||
if(FFMPEG_FOUND)
|
||||
message("Found FFMPEG FFMPEG_INCLUDE_DIR = ${FFMPEG_INCLUDE_DIR}")
|
||||
message("Found FFMPEG FFMPEG_LIBRARIES = ${FFMPEG_LIBRARIES}")
|
||||
else()
|
||||
message("Cannot Find FFMPEG")
|
||||
endif(FFMPEG_FOUND)
|
||||
include_directories(${FFMPEG_INCLUDE_DIR})
|
||||
include_directories(${CMAKE_CURRENT_LIST_DIR}/../../../../../psdk_lib/include)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../common/3rdparty)
|
||||
|
||||
link_directories(${CMAKE_CURRENT_LIST_DIR}/../../../../../psdk_lib/lib/${TOOLCHAIN_NAME})
|
||||
link_libraries(${CMAKE_CURRENT_LIST_DIR}/../../../../../psdk_lib/lib/${TOOLCHAIN_NAME}/libpayloadsdk.a -lstdc++)
|
||||
|
||||
if (NOT EXECUTABLE_OUTPUT_PATH)
|
||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
|
||||
endif ()
|
||||
|
||||
add_executable(${PROJECT_NAME}
|
||||
${MODULE_APP_SRC}
|
||||
${MODULE_SAMPLE_SRC}
|
||||
${MODULE_COMMON_SRC}
|
||||
${MODULE_HAL_SRC})
|
||||
target_link_libraries(${PROJECT_NAME} m usb-1.0 ${FFMPEG_LIBRARIES})
|
||||
|
||||
# Try to see if user has OpenCV installed因为额
|
||||
# if yes, default callback will display the image
|
||||
find_package(OpenCV QUIET)
|
||||
if (OpenCV_FOUND)
|
||||
message("\n${PROJECT_NAME}...")
|
||||
message(STATUS "Found OpenCV installed in the system, will use it to display image in AdvancedSensing APIs")
|
||||
message(STATUS " - Includes: ${OpenCV_INCLUDE_DIRS}")
|
||||
message(STATUS " - Libraries: ${OpenCV_LIBRARIES}")
|
||||
add_definitions(-DOPEN_CV_INSTALLED)
|
||||
else ()
|
||||
message(STATUS "Did not find OpenCV in the system, image data is inside RecvContainer as raw data")
|
||||
endif ()
|
||||
|
||||
find_package(FFMPEG REQUIRED)
|
||||
if (FFMPEG_FOUND)
|
||||
message(STATUS "Found FFMPEG installed in the system")
|
||||
message(STATUS " - Includes: ${FFMPEG_INCLUDE_DIR}")
|
||||
message(STATUS " - Libraries: ${FFMPEG_LIBRARIES}")
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} ${FFMPEG_LIBRARIES})
|
||||
else ()
|
||||
message(STATUS "Cannot Find FFMPEG")
|
||||
endif (FFMPEG_FOUND)
|
||||
include_directories(${FFMPEG_INCLUDE_DIR})
|
||||
include_directories(${CMAKE_CURRENT_LIST_DIR}/../../../../../psdk_lib/include)
|
||||
|
||||
find_package(OPUS REQUIRED)
|
||||
if (OPUS_FOUND)
|
||||
message(STATUS "Found OPUS installed in the system")
|
||||
message(STATUS " - Includes: ${OPUS_INCLUDE_DIR}")
|
||||
message(STATUS " - Libraries: ${OPUS_LIBRARY}")
|
||||
|
||||
add_definitions(-DOPUS_INSTALLED)
|
||||
target_link_libraries(${PROJECT_NAME} /usr/local/lib/libopus.a)
|
||||
else ()
|
||||
message(STATUS "Cannot Find OPUS")
|
||||
endif (OPUS_FOUND)
|
||||
|
||||
find_package(LIBUSB REQUIRED)
|
||||
if (LIBUSB_FOUND)
|
||||
message(STATUS "Found LIBUSB installed in the system")
|
||||
message(STATUS " - Includes: ${LIBUSB_INCLUDE_DIR}")
|
||||
message(STATUS " - Libraries: ${LIBUSB_LIBRARY}")
|
||||
|
||||
add_definitions(-DLIBUSB_INSTALLED)
|
||||
target_link_libraries(${PROJECT_NAME} usb-1.0)
|
||||
else ()
|
||||
message(STATUS "Cannot Find LIBUSB")
|
||||
endif (LIBUSB_FOUND)
|
||||
|
||||
if (NOT EXECUTABLE_OUTPUT_PATH)
|
||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
|
||||
endif ()
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} m)
|
||||
|
||||
add_custom_command(TARGET ${PROJECT_NAME}
|
||||
PRE_LINK COMMAND cmake ..
|
||||
|
@ -64,28 +64,29 @@ int main(int argc, char **argv)
|
||||
start:
|
||||
std::cout
|
||||
<< "\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 (only support on M30/30T) |\n"
|
||||
<< "| [a] Gimbal manager sample - rotate gimbal on free mode |\n"
|
||||
<< "| [b] Gimbal manager sample - rotate gimbal on yaw follow mode |\n"
|
||||
<< "| [c] Camera stream view sample - display the camera video stream |\n"
|
||||
<< "| [d] Stereo vision view sample - display the stereo image (only support on M300 RTK) |\n"
|
||||
<< "| [e] Start camera all feautes sample - you can operate the camera on DJI Pilot |\n"
|
||||
<< "| [f] Start gimbal all feautes sample - you can operate the gimbal on DJI Pilot |\n"
|
||||
<< "| [g] Start widget all feautes sample - you can operate the widget on DJI Pilot |\n"
|
||||
<< "| [h] Start widget speaker sample - you can operate the speaker on MSDK demo |\n"
|
||||
<< "| [i] Start power management sample - you will see notification when aircraft power off |\n"
|
||||
<< "| [j] Start data transmission sample - you can send or recv custom data on MSDK demo |\n"
|
||||
<< "| [l] Run camera manager sample - shoot photo by the selected camera mounted position |\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 (only support on M30/30T) |\n"
|
||||
<< "| [a] Gimbal manager sample - rotate gimbal on free mode |\n"
|
||||
<< "| [b] Gimbal manager sample - rotate gimbal on yaw follow mode |\n"
|
||||
<< "| [c] Camera stream view sample - display the camera video stream |\n"
|
||||
<< "| [d] Stereo vision view sample - display the stereo image (only support on M300 RTK) |\n"
|
||||
<< "| [e] Start camera all feautes sample - you can operate the camera on DJI Pilot |\n"
|
||||
<< "| [f] Start gimbal all feautes sample - you can operate the gimbal on DJI Pilot |\n"
|
||||
<< "| [g] Start widget all feautes sample - you can operate the widget on DJI Pilot |\n"
|
||||
<< "| [h] Start widget speaker sample - you can operate the speaker on MSDK demo |\n"
|
||||
<< "| [i] Start power management sample - you will see notification when aircraft power off |\n"
|
||||
<< "| [j] Start data transmission sample - you can send or recv custom data on MSDK demo |\n"
|
||||
<< "| [l] Run camera manager sample - shoot photo by the selected camera mounted position |\n"
|
||||
<< "| [m] Run camera manager download sample - download camera media file (only support on M300 RTK) |\n"
|
||||
<< std::endl;
|
||||
|
||||
std::cin >> inputChar;
|
||||
@ -206,6 +207,11 @@ start:
|
||||
DjiTest_CameraManagerRunSample(DJI_MOUNT_POSITION_PAYLOAD_PORT_NO1,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SHOOT_SINGLE_PHOTO);
|
||||
break;
|
||||
case 'm':
|
||||
DjiTest_CameraManagerRunSample(DJI_MOUNT_POSITION_PAYLOAD_PORT_NO1,
|
||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_DOWNLOAD_AND_DELETE_MEDIA_FILE);
|
||||
exit(1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -32,12 +32,16 @@
|
||||
|
||||
#define LINUX_USB_BULK_EP_OUT "/dev/usb-ffs/bulk/ep1"
|
||||
#define LINUX_USB_BULK_EP_IN "/dev/usb-ffs/bulk/ep2"
|
||||
#define LINUX_USB_PID (0x0955)
|
||||
#define LINUX_USB_VID (0x7020)
|
||||
#define LINUX_USB_PID (0x7020)
|
||||
#define LINUX_USB_VID (0x0955)
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
typedef struct {
|
||||
#ifdef LIBUSB_INSTALLED
|
||||
libusb_device_handle *handle;
|
||||
#else
|
||||
void *handle;
|
||||
#endif
|
||||
int32_t ep1;
|
||||
int32_t ep2;
|
||||
T_DjiHalUsbBulkInfo usbBulkInfo;
|
||||
@ -59,6 +63,7 @@ T_DjiReturnCode HalUsbBulk_Init(T_DjiHalUsbBulkInfo usbBulkInfo, T_DjiUsbBulkHan
|
||||
}
|
||||
|
||||
if (usbBulkInfo.isUsbHost == true) {
|
||||
#ifdef LIBUSB_INSTALLED
|
||||
ret = libusb_init(NULL);
|
||||
if (ret < 0) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
@ -78,7 +83,7 @@ T_DjiReturnCode HalUsbBulk_Init(T_DjiHalUsbBulkInfo usbBulkInfo, T_DjiUsbBulkHan
|
||||
|
||||
((T_HalUsbBulkObj *) *usbBulkHandle)->handle = handle;
|
||||
memcpy(&((T_HalUsbBulkObj *) *usbBulkHandle)->usbBulkInfo, &usbBulkInfo, sizeof(usbBulkInfo));
|
||||
|
||||
#endif
|
||||
} else {
|
||||
((T_HalUsbBulkObj *) *usbBulkHandle)->handle = handle;
|
||||
memcpy(&((T_HalUsbBulkObj *) *usbBulkHandle)->usbBulkInfo, &usbBulkInfo, sizeof(usbBulkInfo));
|
||||
@ -109,9 +114,11 @@ T_DjiReturnCode HalUsbBulk_DeInit(T_DjiUsbBulkHandle usbBulkHandle)
|
||||
handle = ((T_HalUsbBulkObj *) usbBulkHandle)->handle;
|
||||
|
||||
if (((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.isUsbHost == true) {
|
||||
#ifdef LIBUSB_INSTALLED
|
||||
libusb_release_interface(handle, ((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.channelInfo.interfaceNum);
|
||||
osalHandler->TaskSleepMs(100);
|
||||
libusb_exit(NULL);
|
||||
#endif
|
||||
} else {
|
||||
close(((T_HalUsbBulkObj *) usbBulkHandle)->ep1);
|
||||
close(((T_HalUsbBulkObj *) usbBulkHandle)->ep2);
|
||||
@ -136,18 +143,21 @@ T_DjiReturnCode HalUsbBulk_WriteData(T_DjiUsbBulkHandle usbBulkHandle, const uin
|
||||
handle = ((T_HalUsbBulkObj *) usbBulkHandle)->handle;
|
||||
|
||||
if (((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.isUsbHost == true) {
|
||||
#ifdef LIBUSB_INSTALLED
|
||||
ret = libusb_bulk_transfer(handle, ((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.channelInfo.endPointOut,
|
||||
(uint8_t *) buf, len, &actualLen, LINUX_USB_BULK_TRANSFER_TIMEOUT_MS);
|
||||
if (ret < 0) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
USER_LOG_ERROR("Write usb bulk data failed, errno = %d", ret);
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
}
|
||||
|
||||
*realLen = actualLen;
|
||||
#endif
|
||||
} else {
|
||||
*realLen = write(((T_HalUsbBulkObj *) usbBulkHandle)->ep1, buf, len);
|
||||
}
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
T_DjiReturnCode HalUsbBulk_ReadData(T_DjiUsbBulkHandle usbBulkHandle, uint8_t *buf, uint32_t len,
|
||||
@ -164,13 +174,16 @@ T_DjiReturnCode HalUsbBulk_ReadData(T_DjiUsbBulkHandle usbBulkHandle, uint8_t *b
|
||||
handle = ((T_HalUsbBulkObj *) usbBulkHandle)->handle;
|
||||
|
||||
if (((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.isUsbHost == true) {
|
||||
#ifdef LIBUSB_INSTALLED
|
||||
ret = libusb_bulk_transfer(handle, ((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.channelInfo.endPointIn,
|
||||
buf, len, &actualLen, LINUX_USB_BULK_TRANSFER_WAIT_FOREVER);
|
||||
if (ret < 0) {
|
||||
USER_LOG_ERROR("Read usb bulk data failed, errno = %d", ret);
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
}
|
||||
|
||||
*realLen = actualLen;
|
||||
#endif
|
||||
} else {
|
||||
*realLen = read(((T_HalUsbBulkObj *) usbBulkHandle)->ep2, buf, len);
|
||||
}
|
||||
|
@ -189,11 +189,16 @@ T_DjiReturnCode DjiTest_CameraEmuMediaStartService(void)
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||
}
|
||||
|
||||
returnCode = osalHandler->TaskCreate("user_camera_media_task", UserCameraMedia_SendVideoTask, 2048,
|
||||
NULL, &s_userSendVideoThread);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("user send video task create error.");
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
if (DjiPlatform_GetSocketHandler() != NULL) {
|
||||
returnCode = osalHandler->TaskCreate("user_camera_media_task", UserCameraMedia_SendVideoTask, 2048,
|
||||
NULL, &s_userSendVideoThread);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("user send video task create error.");
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
} else {
|
||||
USER_LOG_WARN(
|
||||
"Socket handler is null. Probably because socket handler is not be registered. Camera media sample may not be running.");
|
||||
}
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
|
@ -31,8 +31,8 @@
|
||||
#include "dji_logger.h"
|
||||
#include "dji_liveview.h"
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
#define TEST_CAMERA_MANAGER_MEDIA_FILE_NAME_MAX_SIZE 32
|
||||
#define TEST_CAMERA_MANAGER_MEDIA_EXTEND_INFO_MAX_SIZE 128
|
||||
#define TEST_CAMERA_MANAGER_MEDIA_FILE_NAME_MAX_SIZE 256
|
||||
#define TEST_CAMERA_MANAGER_MEDIA_DOWNLOAD_FILE_NUM 5
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
typedef struct {
|
||||
@ -53,10 +53,14 @@ static const T_DjiTestCameraTypeStr s_cameraTypeStrList[] = {
|
||||
{DJI_CAMERA_TYPE_L1, "Zenmuse L1"},
|
||||
{DJI_CAMERA_TYPE_M30, "Zenmuse M30"},
|
||||
{DJI_CAMERA_TYPE_M30T, "Zenmuse M30T"},
|
||||
{DJI_CAMERA_TYPE_H20N, "Zenmuse H20N"},
|
||||
};
|
||||
|
||||
static FILE *s_downloadMediaFile = NULL;
|
||||
static T_DjiCameraManagerFileList s_meidaFileList;
|
||||
static uint32_t downloadStartMs = 0;
|
||||
static uint32_t downloadEndMs = 0;
|
||||
static char downloadFileName[TEST_CAMERA_MANAGER_MEDIA_FILE_NAME_MAX_SIZE] = {0};
|
||||
|
||||
/* Private functions declaration ---------------------------------------------*/
|
||||
static uint8_t DjiTest_CameraManagerGetCameraTypeIndex(E_DjiCameraType cameraType);
|
||||
@ -817,7 +821,7 @@ T_DjiReturnCode DjiTest_CameraManagerRunSample(E_DjiMountPosition mountPosition,
|
||||
mountPosition, returnCode);
|
||||
goto exitCameraModule;
|
||||
}
|
||||
USER_LOG_INFO("Mounted position %d camera's firmware is V%d.%d.%d.%d\r\n", mountPosition,
|
||||
USER_LOG_INFO("Mounted position %d camera's firmware is V%02d.%02d.%02d.%02d\r\n", mountPosition,
|
||||
firmwareVersion.firmware_version[0], firmwareVersion.firmware_version[1],
|
||||
firmwareVersion.firmware_version[2], firmwareVersion.firmware_version[3]);
|
||||
|
||||
@ -850,7 +854,8 @@ T_DjiReturnCode DjiTest_CameraManagerRunSample(E_DjiMountPosition mountPosition,
|
||||
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_CAMERA_SHUTTER_SPEED: {
|
||||
USER_LOG_INFO("--> Function a: Set camera shutter speed to 1/100 s");
|
||||
DjiTest_WidgetLogAppend("--> Function a: Set camera shutter speed to 1/100 s");
|
||||
if (cameraType == DJI_CAMERA_TYPE_H20 || cameraType == DJI_CAMERA_TYPE_H20T) {
|
||||
if (cameraType == DJI_CAMERA_TYPE_H20 || cameraType == DJI_CAMERA_TYPE_H20T ||
|
||||
cameraType == DJI_CAMERA_TYPE_M30 || cameraType == DJI_CAMERA_TYPE_M30T) {
|
||||
USER_LOG_INFO("Set mounted position %d camera's exposure mode to manual mode.",
|
||||
mountPosition);
|
||||
returnCode = DjiTest_CameraManagerSetExposureMode(mountPosition,
|
||||
@ -886,7 +891,8 @@ T_DjiReturnCode DjiTest_CameraManagerRunSample(E_DjiMountPosition mountPosition,
|
||||
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_CAMERA_APERTURE: {
|
||||
USER_LOG_INFO("--> Function b: Set camera aperture to 400(F/4)");
|
||||
DjiTest_WidgetLogAppend("--> Function b: Set camera aperture to 400(F/4)");
|
||||
if (cameraType == DJI_CAMERA_TYPE_H20 || cameraType == DJI_CAMERA_TYPE_H20T) {
|
||||
if (cameraType == DJI_CAMERA_TYPE_H20 || cameraType == DJI_CAMERA_TYPE_H20T
|
||||
|| cameraType == DJI_CAMERA_TYPE_M30 || cameraType == DJI_CAMERA_TYPE_M30T) {
|
||||
USER_LOG_INFO("Set mounted position %d camera's exposure mode to manual mode.",
|
||||
mountPosition);
|
||||
returnCode = DjiTest_CameraManagerSetExposureMode(mountPosition,
|
||||
@ -1188,12 +1194,7 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadAndDeleteMediaFile(E_Dj
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||
|
||||
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);
|
||||
return returnCode;
|
||||
}
|
||||
uint16_t downloadCount = 0;
|
||||
|
||||
returnCode = DjiCameraManager_RegDownloadFileDataCallback(position, DjiTest_CameraManagerDownloadFileDataCallback);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
@ -1201,11 +1202,21 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadAndDeleteMediaFile(E_Dj
|
||||
return 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);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
if (s_meidaFileList.totalCount > 0) {
|
||||
for (int i = 0; i < s_meidaFileList.totalCount; ++i) {
|
||||
downloadCount = s_meidaFileList.totalCount;
|
||||
printf(
|
||||
"\033[1;33;40m -> Download file list finished, total file count is %d, the following %d is list details: \033[0m\r\n",
|
||||
s_meidaFileList.totalCount, downloadCount);
|
||||
for (int i = 0; i < downloadCount; ++i) {
|
||||
if (s_meidaFileList.fileListInfo[i].fileSize < 1 * 1024 * 1024) {
|
||||
USER_LOG_INFO(
|
||||
"Media file_%03d name: %s, index: %d, time:%04d-%02d-%02d_%02d:%02d:%02d, size: %.2f KB, type: %d",
|
||||
printf(
|
||||
"\033[1;32;40m ### Media file_%03d name: %s, index: %d, time:%04d-%02d-%02d_%02d:%02d:%02d, size: %.2f KB, type: %d \033[0m\r\n",
|
||||
i, s_meidaFileList.fileListInfo[i].fileName,
|
||||
s_meidaFileList.fileListInfo[i].fileIndex,
|
||||
s_meidaFileList.fileListInfo[i].createTime.year,
|
||||
@ -1217,8 +1228,8 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadAndDeleteMediaFile(E_Dj
|
||||
(dji_f32_t) s_meidaFileList.fileListInfo[i].fileSize / 1024,
|
||||
s_meidaFileList.fileListInfo[i].type);
|
||||
} else {
|
||||
USER_LOG_INFO(
|
||||
"Media file_%03d name: %s, index: %d, time:%04d-%02d-%02d_%02d:%02d:%02d, size: %.2f MB, type: %d",
|
||||
printf(
|
||||
"\033[1;32;40m ### Media file_%03d name: %s, index: %d, time:%04d-%02d-%02d_%02d:%02d:%02d, size: %.2f MB, type: %d \033[0m\r\n",
|
||||
i, s_meidaFileList.fileListInfo[i].fileName,
|
||||
s_meidaFileList.fileListInfo[i].fileIndex,
|
||||
s_meidaFileList.fileListInfo[i].createTime.year,
|
||||
@ -1231,16 +1242,23 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadAndDeleteMediaFile(E_Dj
|
||||
s_meidaFileList.fileListInfo[i].type);
|
||||
}
|
||||
}
|
||||
printf("\r\n");
|
||||
|
||||
osalHandler->TaskSleepMs(1000);
|
||||
|
||||
returnCode = DjiCameraManager_DownloadFileByIndex(position, s_meidaFileList.fileListInfo[0].fileIndex);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Download media file by index failed, error code: 0x%08X.", returnCode);
|
||||
return returnCode;
|
||||
if (s_meidaFileList.totalCount < TEST_CAMERA_MANAGER_MEDIA_DOWNLOAD_FILE_NUM) {
|
||||
downloadCount = s_meidaFileList.totalCount;
|
||||
} else {
|
||||
downloadCount = TEST_CAMERA_MANAGER_MEDIA_DOWNLOAD_FILE_NUM;
|
||||
}
|
||||
|
||||
osalHandler->TaskSleepMs(1000);
|
||||
for (int i = 0; i < downloadCount; ++i) {
|
||||
returnCode = DjiCameraManager_DownloadFileByIndex(position, s_meidaFileList.fileListInfo[i].fileIndex);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Download media file by index failed, error code: 0x%08X.", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
}
|
||||
|
||||
returnCode = DjiCameraManager_DeleteFileByIndex(position, s_meidaFileList.fileListInfo[0].fileIndex);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
@ -1250,7 +1268,7 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadAndDeleteMediaFile(E_Dj
|
||||
|
||||
osalHandler->TaskSleepMs(1000);
|
||||
} else {
|
||||
USER_LOG_WARN("Media file is not existed in sdcard.");
|
||||
USER_LOG_WARN("Media file is not existed in sdcard.\r\n");
|
||||
}
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
@ -1259,11 +1277,9 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadAndDeleteMediaFile(E_Dj
|
||||
static T_DjiReturnCode DjiTest_CameraManagerDownloadFileDataCallback(T_DjiDownloadFilePacketInfo packetInfo,
|
||||
const uint8_t *data, uint16_t len)
|
||||
{
|
||||
char fileName[TEST_CAMERA_MANAGER_MEDIA_FILE_NAME_MAX_SIZE];
|
||||
char extendInfo[TEST_CAMERA_MANAGER_MEDIA_EXTEND_INFO_MAX_SIZE];
|
||||
int32_t i;
|
||||
|
||||
sprintf(extendInfo, " FileIndex: %d", packetInfo.fileIndex);
|
||||
float downloadSpeed = 0.0f;
|
||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||
|
||||
if (packetInfo.downloadFileEvent == DJI_DOWNLOAD_FILE_EVENT_START) {
|
||||
for (i = 0; i < s_meidaFileList.totalCount; ++i) {
|
||||
@ -1271,9 +1287,12 @@ static T_DjiReturnCode DjiTest_CameraManagerDownloadFileDataCallback(T_DjiDownlo
|
||||
break;
|
||||
}
|
||||
}
|
||||
sprintf(fileName, "%s", s_meidaFileList.fileListInfo[i].fileName);
|
||||
USER_LOG_INFO("Start download media file %s", s_meidaFileList.fileListInfo[i].fileName);
|
||||
s_downloadMediaFile = fopen(fileName, "wb+");
|
||||
osalHandler->GetTimeMs(&downloadStartMs);
|
||||
|
||||
memset(downloadFileName, 0, sizeof(downloadFileName));
|
||||
snprintf(downloadFileName, sizeof(downloadFileName), "%s", s_meidaFileList.fileListInfo[i].fileName);
|
||||
USER_LOG_INFO("Start download media file");
|
||||
s_downloadMediaFile = fopen(downloadFileName, "wb+");
|
||||
if (s_downloadMediaFile == NULL) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
}
|
||||
@ -1282,13 +1301,24 @@ 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",
|
||||
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);
|
||||
}
|
||||
osalHandler->GetTimeMs(&downloadEndMs);
|
||||
|
||||
USER_LOG_INFO("End download media file");
|
||||
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",
|
||||
packetInfo.progressInPercent, downloadFileName, packetInfo.fileSize, packetInfo.fileIndex);
|
||||
printf("\033[1A");
|
||||
printf("\r\n");
|
||||
USER_LOG_INFO("End download media file, Download Speed %.2f KB/S\r\n\r\n", downloadSpeed);
|
||||
fclose(s_downloadMediaFile);
|
||||
s_downloadMediaFile = NULL;
|
||||
}
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
|
@ -156,8 +156,9 @@ T_DjiReturnCode DjiTest_FcSubscriptionRunSample(void)
|
||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("get value of topic velocity error.");
|
||||
} else {
|
||||
USER_LOG_INFO("velocity: x = %f y = %f z = %f healthFlag = %d.", velocity.data.x, velocity.data.y,
|
||||
velocity.data.z, velocity.health);
|
||||
USER_LOG_INFO("velocity: x = %f y = %f z = %f healthFlag = %d, timestamp ms = %d us = %d.", velocity.data.x,
|
||||
velocity.data.y,
|
||||
velocity.data.z, velocity.health, timestamp.millisecond, timestamp.microsecond);
|
||||
}
|
||||
|
||||
djiStat = DjiFcSubscription_GetLatestValueOfTopic(DJI_FC_SUBSCRIPTION_TOPIC_GPS_POSITION,
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "dji_logger.h"
|
||||
#include <math.h>
|
||||
#include <widget_interaction_test/test_widget_interaction.h>
|
||||
#include <dji_aircraft_info.h>
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
@ -665,6 +666,12 @@ void DjiTest_FlightControlSetGetParamSample()
|
||||
E_DjiFlightControllerGoHomeAltitude goHomeAltitude;
|
||||
E_DjiFlightControllerRtkPositionEnableStatus rtkEnableStatus;
|
||||
E_DjiFlightControllerRCLostAction rcLostAction;
|
||||
T_DjiAircraftInfoBaseInfo aircraftInfoBaseInfo;
|
||||
|
||||
returnCode = DjiAircraftInfo_GetBaseInfo(&aircraftInfoBaseInfo);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("get aircraft base info error");
|
||||
}
|
||||
|
||||
USER_LOG_INFO("Flight control set-get-param sample start");
|
||||
DjiTest_WidgetLogAppend("Flight control set-get-param sample start");
|
||||
@ -823,25 +830,27 @@ void DjiTest_FlightControlSetGetParamSample()
|
||||
s_osalHandler->TaskSleepMs(1000);
|
||||
|
||||
/*! Set rc lost action */
|
||||
USER_LOG_INFO("--> Step 15: Set rc lost action");
|
||||
DjiTest_WidgetLogAppend("--> Step 15: Set rc lost action");
|
||||
returnCode = DjiFlightController_SetRCLostAction(DJI_FLIGHT_CONTROLLER_RC_LOST_ACTION_GOHOME);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Set rc lost action failed, error code: 0x%08X", returnCode);
|
||||
goto out;
|
||||
}
|
||||
s_osalHandler->TaskSleepMs(1000);
|
||||
if (aircraftInfoBaseInfo.aircraftType != DJI_AIRCRAFT_TYPE_M300_RTK) {
|
||||
USER_LOG_INFO("--> Step 15: Set rc lost action");
|
||||
DjiTest_WidgetLogAppend("--> Step 15: Set rc lost action");
|
||||
returnCode = DjiFlightController_SetRCLostAction(DJI_FLIGHT_CONTROLLER_RC_LOST_ACTION_GOHOME);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Set rc lost action failed, error code: 0x%08X", returnCode);
|
||||
goto out;
|
||||
}
|
||||
s_osalHandler->TaskSleepMs(1000);
|
||||
|
||||
USER_LOG_INFO("--> Step 16: Get rc lost action\r\n");
|
||||
DjiTest_WidgetLogAppend("--> Step 16: Get rc lost action\r\n");
|
||||
returnCode = DjiFlightController_GetRCLostAction(&rcLostAction);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get rc lost action failed, error code: 0x%08X", returnCode);
|
||||
goto out;
|
||||
USER_LOG_INFO("--> Step 16: Get rc lost action\r\n");
|
||||
DjiTest_WidgetLogAppend("--> Step 16: Get rc lost action\r\n");
|
||||
returnCode = DjiFlightController_GetRCLostAction(&rcLostAction);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("Get rc lost action failed, error code: 0x%08X", returnCode);
|
||||
goto out;
|
||||
}
|
||||
USER_LOG_INFO("Current rc lost action is %d\r\n", rcLostAction);
|
||||
DjiTest_WidgetLogAppend("Current rc lost action is %d\r\n", rcLostAction);
|
||||
s_osalHandler->TaskSleepMs(1000);
|
||||
}
|
||||
USER_LOG_INFO("Current rc lost action is %d\r\n", rcLostAction);
|
||||
DjiTest_WidgetLogAppend("Current rc lost action is %d\r\n", rcLostAction);
|
||||
s_osalHandler->TaskSleepMs(1000);
|
||||
|
||||
out:
|
||||
USER_LOG_INFO("Flight control set-get-param sample end");
|
||||
|
@ -67,4 +67,4 @@ T_DjiReturnCode UtilFile_GetFileData(FILE *file, uint32_t offset, uint16_t len,
|
||||
|
||||
#endif // UTIL_FILE_H
|
||||
|
||||
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
|
||||
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
#ifdef OPUS_INSTALLED
|
||||
|
||||
#include <opus.h>
|
||||
#include <opus/opus.h>
|
||||
|
||||
#endif
|
||||
|
||||
@ -80,13 +80,10 @@ static bool s_isDecodeFinished = true;
|
||||
static void SetSpeakerState(E_DjiWidgetSpeakerState speakerState);
|
||||
static T_DjiReturnCode GetSpeakerState(T_DjiWidgetSpeakerState *speakerState);
|
||||
static T_DjiReturnCode SetWorkMode(E_DjiWidgetSpeakerWorkMode workMode);
|
||||
static T_DjiReturnCode GetWorkMode(E_DjiWidgetSpeakerWorkMode *workMode);
|
||||
static T_DjiReturnCode SetPlayMode(E_DjiWidgetSpeakerPlayMode playMode);
|
||||
static T_DjiReturnCode GetPlayMode(E_DjiWidgetSpeakerPlayMode *playMode);
|
||||
static T_DjiReturnCode StartPlay(void);
|
||||
static T_DjiReturnCode StopPlay(void);
|
||||
static T_DjiReturnCode SetVolume(uint8_t volume);
|
||||
static T_DjiReturnCode GetVolume(uint8_t *volume);
|
||||
static T_DjiReturnCode ReceiveTtsData(E_DjiWidgetTransmitDataEvent event,
|
||||
uint32_t offset, uint8_t *buf, uint16_t size);
|
||||
static T_DjiReturnCode ReceiveAudioData(E_DjiWidgetTransmitDataEvent event,
|
||||
@ -107,13 +104,10 @@ T_DjiReturnCode DjiTest_WidgetSpeakerStartService(void)
|
||||
|
||||
s_speakerHandler.GetSpeakerState = GetSpeakerState;
|
||||
s_speakerHandler.SetWorkMode = SetWorkMode;
|
||||
s_speakerHandler.GetWorkMode = GetWorkMode;
|
||||
s_speakerHandler.StartPlay = StartPlay;
|
||||
s_speakerHandler.StopPlay = StopPlay;
|
||||
s_speakerHandler.SetPlayMode = SetPlayMode;
|
||||
s_speakerHandler.GetPlayMode = GetPlayMode;
|
||||
s_speakerHandler.SetVolume = SetVolume;
|
||||
s_speakerHandler.GetVolume = GetVolume;
|
||||
s_speakerHandler.ReceiveTtsData = ReceiveTtsData;
|
||||
s_speakerHandler.ReceiveVoiceData = ReceiveAudioData;
|
||||
|
||||
@ -322,12 +316,13 @@ static T_DjiReturnCode DjiTest_PlayTtsData(void)
|
||||
|
||||
SetSpeakerState(DJI_WIDGET_SPEAKER_STATE_IN_TTS_CONVERSION);
|
||||
|
||||
#ifdef EKHO_INSTALLED
|
||||
#if EKHO_INSTALLED
|
||||
/*! Attention: you can use other tts opensource function to convert txt to speech, example used ekho v7.5 */
|
||||
snprintf(cmdStr, sizeof(cmdStr), " ekho %s -s 20 -p 20 -a 100", data);
|
||||
snprintf(cmdStr, sizeof(cmdStr), " ekho %s -s 20 -p 20 -a 100 -o %s", data, WIDGET_SPEAKER_TTS_OUTPUT_FILE_NAME);
|
||||
#else
|
||||
snprintf(cmdStr, sizeof(cmdStr), "tts_offline_sample '%s' %s", data,
|
||||
WIDGET_SPEAKER_TTS_OUTPUT_FILE_NAME);
|
||||
USER_LOG_WARN(
|
||||
"Ekho is not installed, please visit https://www.eguidedog.net/ekho.php to install it or use other TTS tools to convert audio");
|
||||
#endif
|
||||
DjiUserUtil_RunSystemCmd(cmdStr);
|
||||
|
||||
SetSpeakerState(DJI_WIDGET_SPEAKER_STATE_PLAYING);
|
||||
@ -335,7 +330,6 @@ static T_DjiReturnCode DjiTest_PlayTtsData(void)
|
||||
memset(cmdStr, 0, sizeof(cmdStr));
|
||||
snprintf(cmdStr, sizeof(cmdStr), "ffplay -nodisp -autoexit -ar 16000 -ac 1 -f s16le -i %s 2>/dev/null",
|
||||
WIDGET_SPEAKER_TTS_OUTPUT_FILE_NAME);
|
||||
#endif
|
||||
|
||||
return DjiUserUtil_RunSystemCmd(cmdStr);
|
||||
}
|
||||
@ -453,28 +447,6 @@ static T_DjiReturnCode SetWorkMode(E_DjiWidgetSpeakerWorkMode workMode)
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static T_DjiReturnCode GetWorkMode(E_DjiWidgetSpeakerWorkMode *workMode)
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||
|
||||
returnCode = osalHandler->MutexLock(s_speakerMutex);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("lock mutex error: 0x%08llX.", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
*workMode = s_speakerState.workMode;
|
||||
|
||||
returnCode = osalHandler->MutexUnlock(s_speakerMutex);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("unlock mutex error: 0x%08llX.", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static T_DjiReturnCode SetPlayMode(E_DjiWidgetSpeakerPlayMode playMode)
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
@ -498,28 +470,6 @@ static T_DjiReturnCode SetPlayMode(E_DjiWidgetSpeakerPlayMode playMode)
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static T_DjiReturnCode GetPlayMode(E_DjiWidgetSpeakerPlayMode *playMode)
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||
|
||||
returnCode = osalHandler->MutexLock(s_speakerMutex);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("lock mutex error: 0x%08llX.", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
*playMode = s_speakerState.playMode;
|
||||
|
||||
returnCode = osalHandler->MutexUnlock(s_speakerMutex);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("unlock mutex error: 0x%08llX.", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static T_DjiReturnCode StartPlay(void)
|
||||
{
|
||||
uint32_t pid;
|
||||
@ -581,9 +531,10 @@ static T_DjiReturnCode SetVolume(uint8_t volume)
|
||||
}
|
||||
|
||||
realVolume = 1.5f * (float) volume;
|
||||
USER_LOG_INFO("Set widget speaker volume: %d", volume);
|
||||
s_speakerState.volume = volume;
|
||||
|
||||
#ifdef PLATFORM_ARCH_x86_64
|
||||
USER_LOG_INFO("Set widget speaker volume: %d", volume);
|
||||
memset(cmdStr, 0, sizeof(cmdStr));
|
||||
snprintf(cmdStr, sizeof(cmdStr), "pactl set-sink-volume %s %d%%", WIDGET_SPEAKER_USB_AUDIO_DEVICE_NAME,
|
||||
(int32_t) realVolume);
|
||||
@ -592,28 +543,9 @@ static T_DjiReturnCode SetVolume(uint8_t volume)
|
||||
if (returnCode < 0) {
|
||||
USER_LOG_ERROR("Set widget speaker volume error: %d", ret);
|
||||
}
|
||||
|
||||
returnCode = osalHandler->MutexUnlock(s_speakerMutex);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("unlock mutex error: 0x%08llX.", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static T_DjiReturnCode GetVolume(uint8_t *volume)
|
||||
{
|
||||
T_DjiReturnCode returnCode;
|
||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||
|
||||
returnCode = osalHandler->MutexLock(s_speakerMutex);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("lock mutex error: 0x%08llX.", returnCode);
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
*volume = s_speakerState.volume;
|
||||
#else
|
||||
USER_LOG_WARN("Add set speaker volume function here!");
|
||||
#endif
|
||||
|
||||
returnCode = osalHandler->MutexUnlock(s_speakerMutex);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
@ -737,7 +669,7 @@ static void *DjiTest_WidgetSpeakerTask(void *arg)
|
||||
if (s_speakerState.state == DJI_WIDGET_SPEAKER_STATE_PLAYING) {
|
||||
if (s_speakerState.playMode == DJI_WIDGET_SPEAKER_PLAY_MODE_LOOP_PLAYBACK) {
|
||||
if (s_speakerState.workMode == DJI_WIDGET_SPEAKER_WORK_MODE_VOICE) {
|
||||
USER_LOG_WARN("Waiting opus decoder finished...");
|
||||
USER_LOG_DEBUG("Waiting opus decoder finished...");
|
||||
while (s_isDecodeFinished == false) {
|
||||
osalHandler->TaskSleepMs(1);
|
||||
}
|
||||
@ -754,7 +686,7 @@ static void *DjiTest_WidgetSpeakerTask(void *arg)
|
||||
osalHandler->TaskSleepMs(1000);
|
||||
} else {
|
||||
if (s_speakerState.workMode == DJI_WIDGET_SPEAKER_WORK_MODE_VOICE) {
|
||||
USER_LOG_WARN("Waiting opus decoder finished...");
|
||||
USER_LOG_DEBUG("Waiting opus decoder finished...");
|
||||
while (s_isDecodeFinished == false) {
|
||||
osalHandler->TaskSleepMs(1);
|
||||
}
|
||||
|
@ -7,6 +7,10 @@
|
||||
"floating_window": {
|
||||
"is_enable": true
|
||||
},
|
||||
"speaker": {
|
||||
"is_enable_tts": true,
|
||||
"is_enable_voice": true
|
||||
},
|
||||
"widget_list": [
|
||||
{
|
||||
"widget_index": 0,
|
||||
|
@ -7,6 +7,10 @@
|
||||
"floating_window": {
|
||||
"is_enable": true
|
||||
},
|
||||
"speaker": {
|
||||
"is_enable_tts": true,
|
||||
"is_enable_voice": true
|
||||
},
|
||||
"widget_list": [
|
||||
{
|
||||
"widget_index": 0,
|
||||
|
34
samples/sample_c/platform/linux/common/3rdparty/FindLIBUSB.cmake
vendored
Normal file
34
samples/sample_c/platform/linux/common/3rdparty/FindLIBUSB.cmake
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
#
|
||||
# Find the native LIBUSB includes and library
|
||||
#
|
||||
# This module defines
|
||||
# LIBUSB_INCLUDE_DIR, where to find libusb.h
|
||||
# LIBUSB_LIBRARY, the libraries to link against to use LIBUSB.
|
||||
# LIBUSB_FOUND, If false, do not try to use LIBUSB.
|
||||
|
||||
FIND_PATH(LIBUSB_INCLUDE_DIR libusb.h
|
||||
PATHS
|
||||
/usr/local/include/libusb-1.0
|
||||
/usr/include/libusb-1.0
|
||||
/opt/local/include
|
||||
/opt/include
|
||||
)
|
||||
|
||||
get_filename_component(LIBUSB_INCLUDE_DIR ${LIBUSB_INCLUDE_DIR} ABSOLUTE)
|
||||
|
||||
FIND_LIBRARY(LIBUSB_LIBRARY usb-1.0
|
||||
/usr/local/lib
|
||||
/usr/lib
|
||||
)
|
||||
|
||||
IF (LIBUSB_INCLUDE_DIR)
|
||||
IF (LIBUSB_LIBRARY)
|
||||
SET(LIBUSB_FOUND "YES")
|
||||
ENDIF (LIBUSB_LIBRARY)
|
||||
ENDIF (LIBUSB_INCLUDE_DIR)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
LIBUSB_INCLUDE_DIR
|
||||
LIBUSB_LIBRARY
|
||||
LIBUSB_FOUND
|
||||
)
|
34
samples/sample_c/platform/linux/common/3rdparty/FindOPUS.cmake
vendored
Normal file
34
samples/sample_c/platform/linux/common/3rdparty/FindOPUS.cmake
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
#
|
||||
# Find the native OPUS includes and library
|
||||
#
|
||||
# This module defines
|
||||
# OPUS_INCLUDE_DIR, where to find opus.h
|
||||
# OPUS_LIBRARY, the libraries to link against to use OPUS.
|
||||
# OPUS_FOUND, If false, do not try to use OPUS.
|
||||
|
||||
FIND_PATH(OPUS_INCLUDE_DIR opus.h
|
||||
PATHS
|
||||
/usr/local/include/opus
|
||||
/usr/include/opus
|
||||
/opt/local/include
|
||||
/opt/include
|
||||
)
|
||||
|
||||
get_filename_component(OPUS_INCLUDE_DIR ${OPUS_INCLUDE_DIR} ABSOLUTE)
|
||||
|
||||
FIND_LIBRARY(OPUS_LIBRARY opus
|
||||
/usr/local/lib
|
||||
/usr/lib
|
||||
)
|
||||
|
||||
IF (OPUS_INCLUDE_DIR)
|
||||
IF (OPUS_LIBRARY)
|
||||
SET(OPUS_FOUND "YES")
|
||||
ENDIF (OPUS_LIBRARY)
|
||||
ENDIF (OPUS_INCLUDE_DIR)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
OPUS_INCLUDE_DIR
|
||||
OPUS_LIBRARY
|
||||
OPUS_FOUND
|
||||
)
|
@ -30,6 +30,10 @@
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
|
||||
/* Private values -------------------------------------------------------------*/
|
||||
static uint32_t s_localTimeMsOffset = 0;
|
||||
static uint64_t s_localTimeUsOffset = 0;
|
||||
|
||||
/* Private functions declaration ---------------------------------------------*/
|
||||
|
||||
/* Exported functions definition ---------------------------------------------*/
|
||||
@ -279,6 +283,12 @@ T_DjiReturnCode Osal_GetTimeMs(uint32_t *ms)
|
||||
gettimeofday(&time, NULL);
|
||||
*ms = (time.tv_sec * 1000 + time.tv_usec / 1000);
|
||||
|
||||
if (s_localTimeMsOffset == 0) {
|
||||
s_localTimeMsOffset = *ms;
|
||||
} else {
|
||||
*ms = *ms - s_localTimeMsOffset;
|
||||
}
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -289,6 +299,12 @@ T_DjiReturnCode Osal_GetTimeUs(uint64_t *us)
|
||||
gettimeofday(&time, NULL);
|
||||
*us = (time.tv_sec * 1000000 + time.tv_usec);
|
||||
|
||||
if (s_localTimeUsOffset == 0) {
|
||||
s_localTimeUsOffset = *us;
|
||||
} else {
|
||||
*us = *us - s_localTimeMsOffset;
|
||||
}
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,33 @@ add_executable(${PROJECT_NAME}
|
||||
${MODULE_SAMPLE_SRC}
|
||||
${MODULE_COMMON_SRC}
|
||||
${MODULE_HAL_SRC})
|
||||
target_link_libraries(${PROJECT_NAME} m usb-1.0)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../common/3rdparty)
|
||||
find_package(OPUS REQUIRED)
|
||||
if (OPUS_FOUND)
|
||||
message(STATUS "Found OPUS installed in the system")
|
||||
message(STATUS " - Includes: ${OPUS_INCLUDE_DIR}")
|
||||
message(STATUS " - Libraries: ${OPUS_LIBRARY}")
|
||||
|
||||
add_definitions(-DOPUS_INSTALLED)
|
||||
target_link_libraries(${PROJECT_NAME} /usr/local/lib/libopus.a)
|
||||
else ()
|
||||
message(STATUS "Cannot Find OPUS")
|
||||
endif (OPUS_FOUND)
|
||||
|
||||
find_package(LIBUSB REQUIRED)
|
||||
if (LIBUSB_FOUND)
|
||||
message(STATUS "Found LIBUSB installed in the system")
|
||||
message(STATUS " - Includes: ${LIBUSB_INCLUDE_DIR}")
|
||||
message(STATUS " - Libraries: ${LIBUSB_LIBRARY}")
|
||||
|
||||
add_definitions(-DLIBUSB_INSTALLED)
|
||||
target_link_libraries(${PROJECT_NAME} usb-1.0)
|
||||
else ()
|
||||
message(STATUS "Cannot Find LIBUSB")
|
||||
endif (LIBUSB_FOUND)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} m)
|
||||
|
||||
add_custom_command(TARGET ${PROJECT_NAME}
|
||||
PRE_LINK COMMAND cmake ..
|
||||
|
@ -162,6 +162,11 @@ int main(int argc, char **argv)
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("widget interaction sample init error");
|
||||
}
|
||||
|
||||
returnCode = DjiTest_WidgetSpeakerStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("widget speaker test init error");
|
||||
}
|
||||
} else {
|
||||
#ifdef CONFIG_MODULE_SAMPLE_CAMERA_EMU_ON
|
||||
returnCode = DjiTest_CameraEmuBaseStartService();
|
||||
@ -216,11 +221,9 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MODULE_SAMPLE_WIDGET_SPEAKER_ON
|
||||
if (aircraftInfoBaseInfo.djiAdapterType == DJI_SDK_ADAPTER_TYPE_NONE) {
|
||||
returnCode = DjiTest_WidgetSpeakerStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("widget speaker test init error");
|
||||
}
|
||||
returnCode = DjiTest_WidgetSpeakerStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("widget speaker test init error");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -32,12 +32,16 @@
|
||||
|
||||
#define LINUX_USB_BULK_EP_OUT "/dev/usb-ffs/bulk/ep1"
|
||||
#define LINUX_USB_BULK_EP_IN "/dev/usb-ffs/bulk/ep2"
|
||||
#define LINUX_USB_PID (0x0955)
|
||||
#define LINUX_USB_VID (0x7020)
|
||||
#define LINUX_USB_PID (0x7020)
|
||||
#define LINUX_USB_VID (0x0955)
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
typedef struct {
|
||||
#ifdef LIBUSB_INSTALLED
|
||||
libusb_device_handle *handle;
|
||||
#else
|
||||
void *handle;
|
||||
#endif
|
||||
int32_t ep1;
|
||||
int32_t ep2;
|
||||
T_DjiHalUsbBulkInfo usbBulkInfo;
|
||||
@ -59,6 +63,7 @@ T_DjiReturnCode HalUsbBulk_Init(T_DjiHalUsbBulkInfo usbBulkInfo, T_DjiUsbBulkHan
|
||||
}
|
||||
|
||||
if (usbBulkInfo.isUsbHost == true) {
|
||||
#ifdef LIBUSB_INSTALLED
|
||||
ret = libusb_init(NULL);
|
||||
if (ret < 0) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
@ -78,7 +83,7 @@ T_DjiReturnCode HalUsbBulk_Init(T_DjiHalUsbBulkInfo usbBulkInfo, T_DjiUsbBulkHan
|
||||
|
||||
((T_HalUsbBulkObj *) *usbBulkHandle)->handle = handle;
|
||||
memcpy(&((T_HalUsbBulkObj *) *usbBulkHandle)->usbBulkInfo, &usbBulkInfo, sizeof(usbBulkInfo));
|
||||
|
||||
#endif
|
||||
} else {
|
||||
((T_HalUsbBulkObj *) *usbBulkHandle)->handle = handle;
|
||||
memcpy(&((T_HalUsbBulkObj *) *usbBulkHandle)->usbBulkInfo, &usbBulkInfo, sizeof(usbBulkInfo));
|
||||
@ -109,9 +114,11 @@ T_DjiReturnCode HalUsbBulk_DeInit(T_DjiUsbBulkHandle usbBulkHandle)
|
||||
handle = ((T_HalUsbBulkObj *) usbBulkHandle)->handle;
|
||||
|
||||
if (((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.isUsbHost == true) {
|
||||
#ifdef LIBUSB_INSTALLED
|
||||
libusb_release_interface(handle, ((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.channelInfo.interfaceNum);
|
||||
osalHandler->TaskSleepMs(100);
|
||||
libusb_exit(NULL);
|
||||
#endif
|
||||
} else {
|
||||
close(((T_HalUsbBulkObj *) usbBulkHandle)->ep1);
|
||||
close(((T_HalUsbBulkObj *) usbBulkHandle)->ep2);
|
||||
@ -136,18 +143,21 @@ T_DjiReturnCode HalUsbBulk_WriteData(T_DjiUsbBulkHandle usbBulkHandle, const uin
|
||||
handle = ((T_HalUsbBulkObj *) usbBulkHandle)->handle;
|
||||
|
||||
if (((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.isUsbHost == true) {
|
||||
#ifdef LIBUSB_INSTALLED
|
||||
ret = libusb_bulk_transfer(handle, ((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.channelInfo.endPointOut,
|
||||
(uint8_t *) buf, len, &actualLen, LINUX_USB_BULK_TRANSFER_TIMEOUT_MS);
|
||||
if (ret < 0) {
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
USER_LOG_ERROR("Write usb bulk data failed, errno = %d", ret);
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
}
|
||||
|
||||
*realLen = actualLen;
|
||||
#endif
|
||||
} else {
|
||||
*realLen = write(((T_HalUsbBulkObj *) usbBulkHandle)->ep1, buf, len);
|
||||
}
|
||||
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
T_DjiReturnCode HalUsbBulk_ReadData(T_DjiUsbBulkHandle usbBulkHandle, uint8_t *buf, uint32_t len,
|
||||
@ -164,13 +174,16 @@ T_DjiReturnCode HalUsbBulk_ReadData(T_DjiUsbBulkHandle usbBulkHandle, uint8_t *b
|
||||
handle = ((T_HalUsbBulkObj *) usbBulkHandle)->handle;
|
||||
|
||||
if (((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.isUsbHost == true) {
|
||||
#ifdef LIBUSB_INSTALLED
|
||||
ret = libusb_bulk_transfer(handle, ((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.channelInfo.endPointIn,
|
||||
buf, len, &actualLen, LINUX_USB_BULK_TRANSFER_WAIT_FOREVER);
|
||||
if (ret < 0) {
|
||||
USER_LOG_ERROR("Read usb bulk data failed, errno = %d", ret);
|
||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||
}
|
||||
|
||||
*realLen = actualLen;
|
||||
#endif
|
||||
} else {
|
||||
*realLen = read(((T_HalUsbBulkObj *) usbBulkHandle)->ep2, buf, len);
|
||||
}
|
||||
|
@ -38,10 +38,13 @@
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <libusb-1.0/libusb.h>
|
||||
|
||||
#include "dji_platform.h"
|
||||
|
||||
#ifdef LIBUSB_INSTALLED
|
||||
#include <libusb-1.0/libusb.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -46,7 +46,7 @@ include_directories(../../../../../module_sample
|
||||
../../drivers/USB_HOST/App
|
||||
../../drivers/BSP
|
||||
../../hal/
|
||||
../../osal/
|
||||
../../../common/osal/
|
||||
../../middlewares/Third_Party/FreeRTOS/Source/include
|
||||
../../middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS
|
||||
../../middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F
|
||||
@ -79,7 +79,7 @@ file(GLOB_RECURSE MODULE_SAMPLE_SRC
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE SOURCES
|
||||
"../../osal/*.*"
|
||||
"../../../common/osal/*.*"
|
||||
"../../drivers/BSP/*.*"
|
||||
"../../hal/*.*"
|
||||
"../../drivers/USB_HOST/*.*"
|
||||
|
Reference in New Issue
Block a user