作者 ookk303

增加h150a

正在显示 54 个修改的文件 包含 1054 行增加2143 行删除

要显示太多修改。

为保证性能只显示 54 of 54+ 个文件。

... ... @@ -26,11 +26,11 @@ project_build/GDU_普宙PSDK
# !project_build/DJI_大疆PSDK/samples/sample_c/platform/linux/all/hal
# !project_build/DJI_大疆PSDK/samples/sample_c/platform/linux/all/CMakeLists.txt
project_build/Payload-SDK-release-v3.12.0/*
project_build/Psdk312/*
project_build/特殊固件
project_build/DJI_Test
project_build/Psdk2257
# project_build/Attention_提示程序
... ...
... ... @@ -169,7 +169,10 @@
"psdk_ui_value_menu.h": "c",
"iflybak": "c",
"iflybak2": "c",
"ifybak3": "c"
"ifybak3": "c",
"jz_h150a.h": "c",
"jzsdk_framesequencequeue.h": "c",
"searchlighttemcontrol.h": "c"
},
"Codegeex.GenerationPreference": "automatic",
"C_Cpp.dimInactiveRegions": false,
... ...
# 编译链的配置
#1、编译链与设备类型的选择
set(DEVICE_NAME JZ_T40)
set(DEVICE_NAME JZ_H150A)
#上一行为禁止修改行
message("**************************JZSDK构建编译开始***************************\n")
... ... @@ -14,6 +14,7 @@ elseif("${DEVICE_NAME}" STREQUAL "JZ_H150S")
set(MAKE_COMPILER ARM_CORTEXA9_LINUX)
elseif("${DEVICE_NAME}" STREQUAL "JZ_H150T")
set(MAKE_COMPILER ARM_CORTEXA9_LINUX)
#set(MAKE_COMPILER LINARO_ARM_CORTEX_LINUX)
elseif("${DEVICE_NAME}" STREQUAL "JZ_H10")
set(MAKE_COMPILER ARM_CORTEXA9_LINUX)
elseif("${DEVICE_NAME}" STREQUAL "JZ_H10T")
... ... @@ -32,7 +33,7 @@ elseif("${DEVICE_NAME}" STREQUAL "JZ_C1")
set(MAKE_COMPILER ARM_X86_64_ARRCH64)
elseif("${DEVICE_NAME}" STREQUAL "JZ_ST")
set(MAKE_COMPILER ARM_X86_64_ARRCH64)
elseif("${DEVICE_NAME}" STREQUAL "JZ_H150G")
elseif("${DEVICE_NAME}" STREQUAL "JZ_H150A")
set(MAKE_COMPILER LINARO_ARM_CORTEX_LINUX)
elseif("${DEVICE_NAME}" STREQUAL "JZ_T40")
set(MAKE_COMPILER LINARO_ARM_CORTEX_LINUX)
... ...
... ... @@ -29,7 +29,7 @@ set(WARNLIGHT_MODULE VERSION_SWITCH_OFF)
set(MEGAPHONE_MODULE VERSION_SWITCH_OFF)
# TTS模块
set(TTS_MODULE JZ_TTS_MODULE_1)
set(TTS_MODULE VERSION_SWITCH_OFF)
##################################################
... ... @@ -125,6 +125,9 @@ elseif("${DEVICE_NAME}" STREQUAL "JZ_H1T")
# 添加AudioDeal 音频处理模块
set(AUDIODEAL_MODULE VERSION_SWITCH_ON)
# 添加TTS模块
set(TTS_MODULE JZ_TTS_MODULE_1)
# 添加Gimbal 云台处理模块
set(GIMBAL_MODULE VERSION_SWITCH_ON)
... ... @@ -305,6 +308,9 @@ elseif("${DEVICE_NAME}" STREQUAL "JZ_H150S")
# 添加喊话器模块
set(MEGAPHONE_MODULE VERSION_SWITCH_ON)
# 添加TTS模块
set(TTS_MODULE JZ_TTS_MODULE_1)
# 添加MediaProc 媒体管理模块
set(MEDIA_PROC_MODULE VERSION_SWITCH_ON)
... ... @@ -331,6 +337,9 @@ elseif("${DEVICE_NAME}" STREQUAL "JZ_H150T")
# 添加喊话器模块
set(MEGAPHONE_MODULE VERSION_SWITCH_ON)
# 添加TTS模块
set(TTS_MODULE JZ_TTS_MODULE_1)
# 添加MediaProc 媒体管理模块
set(MEDIA_PROC_MODULE VERSION_SWITCH_ON)
... ... @@ -386,7 +395,10 @@ elseif("${DEVICE_NAME}" STREQUAL "JZ_ST")
message("ST基础配置完毕\n")
elseif("${DEVICE_NAME}" STREQUAL "JZ_H150G")
elseif("${DEVICE_NAME}" STREQUAL "JZ_H150A")
# 添加WARNLIGHT 警示灯处理模块
set(WARNLIGHT_MODULE VERSION_SWITCH_ON)
# 添加AudioDeal 音频处理模块
set(AUDIODEAL_MODULE VERSION_SWITCH_ON)
... ... @@ -394,14 +406,17 @@ elseif("${DEVICE_NAME}" STREQUAL "JZ_H150G")
# 添加喊话器模块
set(MEGAPHONE_MODULE VERSION_SWITCH_ON)
# 添加TTS模块
set(TTS_MODULE JZ_TTS_MODULE_2)
# 添加FFMPEG及其附属模块
set(FFMPEG_MODULE VERSION_SWITCH_ON)
#设备独立配置源文件
file(GLOB_RECURSE DEVICE_CONFOG_SRC ${ROOT_DIRS}JZsdk_Config/DeviceSample/JZ_H150G/*.c)
file(GLOB_RECURSE DEVICE_CONFOG_SRC ${ROOT_DIRS}JZsdk_Config/DeviceSample/JZ_H150A/*.c)
list(APPEND ALL_SRC_FILES ${DEVICE_CONFOG_SRC})
message("JZ_H150G基础配置完毕\n")
message("JZ_H150A基础配置完毕\n")
elseif("${DEVICE_NAME}" STREQUAL "JZ_T40")
... ...
... ... @@ -15,6 +15,7 @@
#define APP_PSDK 0x01
#define APP_UART 0x02
#define APP_TEST 0x03
#define APP_ATTENTION 0x04
//平台选择
#define PLATFORM_H3 0x01
... ... @@ -45,7 +46,7 @@
#define JZ_H150S 0x13
#define JZ_H150T 0x15
#define JZ_H150G 0x20
#define JZ_H150A 0x20
#define JZ_H10 0x12
#define JZ_H10T 0x14
... ...
... ... @@ -141,6 +141,8 @@ typedef enum {
JZ_INSCODE_5AFRAME_GIMBAL_YAW_FINETUNING_CONTROL = 0x10000B05, //云台朝向微调
JZ_INSCODE_5AFRAME_GIMBAL_ROLL_FINETUNING_CONTROL = 0x10000B06, //云台旋转微调
JZ_INSCODE_5AFRAME_GIMBAL_PITCH_COMPENSATE = 0x10000B10, //云台俯仰补偿
JZ_INSCODE_5AFRAME_LASER_CONTROL = 0x10000C00, //激光控制
JZ_INSCODE_5AFRAME_LASER_MODE = 0x10000C01, //激光模式
... ...
... ... @@ -63,6 +63,8 @@ typedef enum JZsdk_Widget_Control
JZSDK_WIDGET_SIDE_LASER_MODE = 0x0050, //侧射激光模式
JZSDK_WIDGET_GIMBAL_SINGLE_COMPENSATION_LEFT = 0x0060, //左云台单轴补偿
JZSDK_WIDGET_GIMBAL_SINGLE_COMPENSATION_RIGHT = 0x0061, //右云台单轴补偿
}JZsdk_Widget_Control;
... ...
#include <stdio.h>
#include "JZsdk_FrameSequenceQueue.h"
T_JZsdkReturnCode JZsdk_Osal_GetFrameSequenceQueue(U8_t *frameSequence)
{
//该功能后续完善
if (*frameSequence != 0x00)
{
*frameSequence == *frameSequence;
}
else
{
*frameSequence = 0x00;
}
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
\ No newline at end of file
... ...
/**
********************************************************************
* @file JZsdk_FrameSequenceQueue.h
* JZsdk_FrameSequenceQueue.c 的头文件
*
*********************************************************************
*/
/* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/
#ifndef JZSDK_FRAMESEQUENCEQUEUE_H
#define JZSDK_FRAMESEQUENCEQUEUE_H
/* Includes ------------------------------------------------------------------*/
#include "JZsdk_Base/JZsdk_Code/JZsdk_Code.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* 常亮定义*/
/* Exported macro ------------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
T_JZsdkReturnCode JZsdk_Osal_GetFrameSequenceQueue(U8_t *frameSequence);
#ifdef __cplusplus
}
#endif
#endif
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
... ...
... ... @@ -2,6 +2,7 @@
#include "./JZsdk_Osal.h"
#include "./JZsdk_FrameSequenceQueue/JZsdk_FrameSequenceQueue.h"
static T_JZsdkOsalHandler *g_osalHandler = NULL;
... ... @@ -63,6 +64,7 @@ T_JZsdkReturnCode JZsdk_OsalInit()
.GetTimeMs = JZsdk_Osal_GetTimeMs,
.GetTimeUs = JZsdk_Osal_GetTimeUs,
.GetRandomNum = JZsdk_Osal_GetRandomNum,
.GetFrameSequenceQueueNum = JZsdk_Osal_GetFrameSequenceQueue,
};
T_JZsdkFSHandler fileSystemHandler = {
... ...
... ... @@ -70,6 +70,8 @@ typedef struct {
void *(*Malloc)(U32_t size);
void (*Free)(void *ptr);
T_JZsdkReturnCode (*GetFrameSequenceQueueNum)(U8_t *frameSequence);
} T_JZsdkOsalHandler;
... ...
... ... @@ -259,7 +259,7 @@ static void *Main_WorkModeTask(void *arg)
*
*
************************************************************************************************************************************************/
static T_JZsdkReturnCode DeviceSample_init(int mode)
T_JZsdkReturnCode DeviceSample_init(int mode)
{
//a1加载
#if DEVICE_VERSION == JZ_A1
... ... @@ -322,8 +322,8 @@ static T_JZsdkReturnCode DeviceSample_init(int mode)
#endif
//150G加载
#if DEVICE_VERSION == JZ_H150G
JZ_h150g_init(mode);
#if DEVICE_VERSION == JZ_H150A
JZ_H150A_init(mode);
#endif
//T40加载
... ...
... ... @@ -228,16 +228,16 @@ extern "C" {
#define NET_WORK_TARGET_IPADDR "192.168.5.10"
#define NET_WORK_NETMASK "255.255.255.0"
#elif DEVICE_VERSION == JZ_H150G
#elif DEVICE_VERSION == JZ_H150A
#define UART_DEV1_NUM "/dev/ttyS1"
#define UART_DEV1_BITRATE (921600)
#define UART_DEV1_NUM "/dev/ttyS2"
#define UART_DEV1_BITRATE (115200)
#define UART_DEV2_NUM NULL
#define UART_DEV2_BITRATE (0)
#define COMM_4G_UART_NUM NULL
#define COMM_4G_UART_BITRATE (0)
#define COMM_4G_UART_NUM "/dev/ttyS1"
#define COMM_4G_UART_BITRATE (115200)
#define GIMBAL_UART_NUM NULL
#define GIMBAL_UART_BITRATE (0)
... ... @@ -294,6 +294,7 @@ int Main_Device_Wheather_Use();
T_JZsdkReturnCode Main_StartupPriority(int *choose);
T_JZsdkReturnCode Main_SetDeviceName(unsigned int Port, int g_DeviceID);
int BaseConfig_GetDeviceInitFlag();
T_JZsdkReturnCode DeviceSample_init(int mode);
#ifdef __cplusplus
}
... ...
... ... @@ -19,7 +19,7 @@
#include "DeviceSample/JZ_H10_series/JZ_H10T/JZ_h10t.h"
#include "DeviceSample/JZ_H150S_H150T/JZ_h150s_h150t.h"
#include "DeviceSample/JZ_H150G/JZ_h150g.h"
#include "DeviceSample/JZ_H150A/JZ_h150a.h"
#include "DeviceSample/JZ_U3_series/JZ_U3/JZ_u3.h"
#include "DeviceSample/JZ_U3_series/JZ_U3S/JZ_u3s.h"
... ...
... ... @@ -6,28 +6,67 @@
#include "JZsdk_Hal.h"
#include "Megaphone/Megaphone.h"
#include "AudioDeal/AudioDeal.h"
#include "JZsdk_haldata_deal/JZsdk_data_transmisson.h"
#include "WarnLight/WarnLight.h"
#include "IRCUT/ircut.h"
#include "Hal_Send/HalSend.h"
/****************************
/******************
*
* h150g 初始化
*
* mode psdk为psdk模式 uart为串口模式
* 引脚初始化
*
* ****************************/
T_JZsdkReturnCode JZ_h150g_init(int mode)
* *****************/
T_JZsdkReturnCode JZ_H150A_Ircut_Init()
{
int value[5] = {0};
//引脚初始化
IrcutInfo ircut_info;
ircut_info.Amplifiter_Pin.Enable = JZ_FLAGCODE_ON;
ircut_info.Amplifiter_Pin.Port = JZ_IRC_PORT_PA;
ircut_info.Amplifiter_Pin.index = 17;
ircut_info.Amplifiter_Pin.Port = JZ_IRC_PORT_PG;
ircut_info.Amplifiter_Pin.index = 5;
ircut_info.Amplifiter_Pin.Group = 0;
ircut_info.Amplifiter_Pin.mode = JZ_IRC_PIN_MODE_OUT;
Ircut_Init(ircut_info);
}
/********************
*
*
* 基础参数设置
*
*
* ****************/
static T_JZsdkReturnCode BaseParamSet(void)
{
//设置警灯颜色
//设置警灯模式
//设置喊话器音量
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
/****************************
*
* T40 初始化
*
* mode psdk为psdk模式 uart为串口模式
*
* ****************************/
T_JZsdkReturnCode JZ_H150A_init(int mode)
{
//引脚初始化
JZ_H150A_Ircut_Init();
if (mode == APP_ATTENTION)
{
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
if (mode == APP_UART)
{
... ... @@ -46,9 +85,36 @@ T_JZsdkReturnCode JZ_h150g_init(int mode)
JZsdk_data_transmisson_Receive_Init();
}
//4G串口初始化
s_JZ_SerialPortHalRegInfo SerialInfo3 = {
.BitRate = COMM_4G_UART_BITRATE,
.ConnectType = PORT_CONNECT_TYPE_AS_MAIN,
};
JZsdk_HalPort_Init(UART_4G, (void *)&SerialInfo3);
//音频库初始化
//AudioDeal_Init();
AudioDeal_Init();
//喊话器初始化
//Megaphone_Init();
Megaphone_Init();
//警灯初始化
T_JzWarnLightInfo WarnLightInfo = {
.Attribute.Color1 = E_JZ_WARNLIGHT_COLOR_RED,
.Attribute.Color2 = E_JZ_WARNLIGHT_COLOR_BLUE,
.Attribute.mode = E_JZ_WARNLIGHT_MODE_SIMULTANEOUS_FAST_FALSHING,
.Attribute.status = JZ_FLAGCODE_OFF,
.ControlMode = JZ_MODULE_CONTROL_WAY_INDEPENDENT,
.Device = UART_4G,
.FrameSequence = 0x00,
};
WarnLight_Init(WarnLightInfo);
//基础参数设置
BaseParamSet();
JZSDK_LOG_INFO("H150A Init Success");
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
\ No newline at end of file
... ...
/**
********************************************************************
* @file JZ_h150g.h
* JZ_h150g.h的头文件
* @file JZ_H150A.h
* JZ_H150A.h的头文件
*
*********************************************************************
*/
/* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/
#ifndef JZ_H150G_H
#define JZ_H150G_H
#ifndef JZ_H150A_H
#define JZ_H150A_H
#include "JZsdk_Base/JZsdk_Code/JZsdk_Code.h"
... ... @@ -25,8 +25,7 @@ extern "C" {
/* Exported types ------------------------------------------------------------*/
T_JZsdkReturnCode JZ_h150g_init(int mode);
T_JZsdkReturnCode JZ_H150A_init(int mode);
#ifdef __cplusplus
}
... ...
... ... @@ -8,6 +8,7 @@
#include "AudioDeal/AudioDeal.h"
#include "Gimbal/Gimbal.h"
#include "JZsdk_haldata_deal/JZsdk_data_transmisson.h"
#include "DeviceInfo/DeviceInfo.h"
#include "SearchLight/SearchLight.h"
#include "WarnLight/WarnLight.h"
... ... @@ -32,7 +33,7 @@ void *JZ_T40_SubConnectTask(void *arg)
LeftGimbalConnectFlag == JZ_FLAGCODE_OFF ||
RightLightConnectFlag == JZ_FLAGCODE_OFF ||
LeftLightConnectFlag == JZ_FLAGCODE_OFF ) &&
DelayTime < 20000)
DelayTime <= 20000)
{
s_JZsdk_Hal_Info *HalInfo = JZsdk_Hal_GetHalInfo();
... ... @@ -101,6 +102,26 @@ void *JZ_T40_SubConnectTask(void *arg)
}
}
if (LeftGimbalConnectFlag != JZ_FLAGCODE_ON)
{
JZSDK_LOG_ERROR("LeftGimbalConnectFlag is OFF");
}
if (RightGimbalConnectFlag != JZ_FLAGCODE_ON)
{
JZSDK_LOG_ERROR("RightGimbalConnectFlag is OFF");
}
if (LeftLightConnectFlag != JZ_FLAGCODE_ON)
{
JZSDK_LOG_ERROR("LeftLightConnectFlag is OFF");
}
if (RightLightConnectFlag != JZ_FLAGCODE_ON)
{
JZSDK_LOG_ERROR("RightLightConnectFlag is OFF");
}
T40_SubConnectFlag = JZ_FLAGCODE_ON;
JZSDK_LOG_INFO("T40 SubDevice Connect Success");
}
... ... @@ -149,7 +170,6 @@ void *JZ_T40_CheckLightTemperatureTask(void *arg)
delayMs(100);
}
while (1)
{
//检查左灯温度
... ... @@ -205,12 +225,29 @@ static T_JZsdkReturnCode JZ_T40_BaseParamSet(void)
//设置喊话器音量
//监测飞机信号,设定为对应的功率值
E_JZ_SPECIAL_PLANE_INFO g_PlaneInfo;
JZsdk_PlaneInfo_Get(&g_PlaneInfo);
//测试部分
if (g_PlaneInfo == E_JZ_SPECIAL_PLANE_INFO_DJI_M4E)
{
//将总功率设置为无限制
HalSend_type1Send_SearchLight_SetLumenPowerLimit(UART_DEV_2, 0x00, 0x64, 0x20, 0x00);
}
else if (g_PlaneInfo == E_JZ_SPECIAL_PLANE_INFO_DJI_M4TD || g_PlaneInfo == E_JZ_SPECIAL_PLANE_INFO_DJI_M4D)
{
//将总功率设置为31%
//HalSend_type1Send_SearchLight_SetLumenPowerLimit(UART_DEV_2, 0x00, 0x1F, 0x20, 0x00);
HalSend_type1Send_SearchLight_SetLumenPowerLimit(UART_DEV_2, 0x00, 0x64, 0x20, 0x00);
}
else
{
//1、将总功率设置为无限制
HalSend_type1Send_SearchLight_SetLumenPowerLimit(UART_DEV_2, 0x00, 0x64, 0x20, 0x00);
}
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
/****************************
... ... @@ -225,6 +262,11 @@ T_JZsdkReturnCode JZ_T40_init(int mode)
//引脚初始化
JZ_T40_Ircut_Init();
if (mode == APP_ATTENTION)
{
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
if (mode == APP_UART)
{
//串口设备1初始化
... ... @@ -251,8 +293,11 @@ T_JZsdkReturnCode JZ_T40_init(int mode)
JZsdk_HalPort_Init(UART_DEV_2, (void *)&SerialInfo2);
//4G初始化
// int value[1] = {COMM_4G_UART_BITRATE};
// JZsdk_HalPort_Init(UART_4G, value);
s_JZ_SerialPortHalRegInfo SerialInfo3 = {
.BitRate = COMM_4G_UART_BITRATE,
.ConnectType = PORT_CONNECT_TYPE_AS_MAIN,
};
JZsdk_HalPort_Init(UART_4G, (void *)&SerialInfo3);
//子设备连接
JZ_T40_SubDevice_Init();
... ... @@ -267,10 +312,33 @@ T_JZsdkReturnCode JZ_T40_init(int mode)
Gimbal_Init(JZ_MODULE_CONTROL_WAY_INDEPENDENT);
//探照灯初始化
SearchLight_Init(JZ_MODULE_CONTROL_WAY_INDEPENDENT);
T_JzSearchLightInfo SearchLightInfo = {
.Attribute.Frequency = 100,
.Attribute.Mode = E_JZ_SEARCHLIGHTMODE_OFF,
.Attribute.LeftBrightness = 30,
.Attribute.RightBrightness = 30,
.Attribute.LeftTemperature = 0,
.Attribute.RightTemperature = 0,
.ControlMode = JZ_MODULE_CONTROL_WAY_INDEPENDENT,
.Device = UART_DEV_2,
.FrameSequence = 0x20,
};
SearchLight_Init(SearchLightInfo);
//警灯初始化
WarnLight_Init(JZ_MODULE_CONTROL_WAY_INDEPENDENT);
T_JzWarnLightInfo WarnLightInfo = {
.Attribute.Color1 = E_JZ_WARNLIGHT_COLOR_RED,
.Attribute.Color2 = E_JZ_WARNLIGHT_COLOR_BLUE,
.Attribute.mode = E_JZ_WARNLIGHT_MODE_SIMULTANEOUS_FAST_FALSHING,
.Attribute.status = JZ_FLAGCODE_OFF,
.ControlMode = JZ_MODULE_CONTROL_WAY_INDEPENDENT,
.Device = UART_DEV_2,
.FrameSequence = 0x20,
};
WarnLight_Init(WarnLightInfo);
//激光初始化
SideLaser_Init();
... ...
... ... @@ -7,23 +7,23 @@
#define VERSION_CHOOSE_H
#include "JZsdk_Base/JZsdk_Code/JZsdk_DeviceCode.h"
//1~10行 除了D可以修改版本选择 禁止动任何东西
#define DEVICE_VERSION JZ_T40
#define DEVICE_VERSION JZ_H150A
//禁止修改行 选择是串口程序 还是 psdk程序
#define APP_VERSION APP_PSDK
#define APP_VERSION APP_UART
//禁止修改行 板子型号
#define PLATFORM_VERSION PLATFORM_V3S
//禁止修改行 串口连接程序的软件版本号
#define MAJOR_VERSION_TEN_POSITION 0
#define MAJOR_VERSION_ONE_POSITION 1
#define MAJOR_VERSION_ONE_POSITION 0
#define MINOR_VERSION_TEN_POSITION 0
#define MINOR_VERSION_ONE_POSITION 3
#define MODIFY_VERSION_TEN_POSITION 1
#define MINOR_VERSION_ONE_POSITION 0
#define MODIFY_VERSION_TEN_POSITION 0
#define MODIFY_VERSION_ONE_POSITION 2
#define DEBUG_VERSION_TEN_POSITION 0
#define DEBUG_VERSION_ONE_POSITION 0
#define DEBUG_VERSION_TEN_POSITION 2
#define DEBUG_VERSION_ONE_POSITION 2
... ...
... ... @@ -2899,6 +2899,111 @@ static T_JZsdkReturnCode RecvDeal_Gimbal_PitchFineTuningControl(int Port, char *
}
/*********
*
* 云台俯仰补偿
*
*
**********/
static T_JZsdkReturnCode RecvDeal_Gimbal_PitchCompensate(int Port, char *getbuf)
{
T_JZsdkReturnCode ret;
JZSDK_LOG_INFO("%s,云台俯仰补偿",JZsdk_DefineCode_GetPortName(Port));
//获取帧的序列号
int FrameSequence = JZsdk_Get_FrameSequence(getbuf);
//获取模式
int mode = getbuf[9];
//通过云台控制帧 获取云台角度符号
int signal = getbuf[10];
//计算数据长度
int dataLen = JZsdk_Get_FrameLength(getbuf) - 9 - 2 - 1 -1;
//计算补偿值
int compensate = 0;
for (int i = 0; i < dataLen; i++)
{
compensate += (getbuf[11 + i] << (8 * (dataLen - i - 1)));
}
//拼接得到补偿值
if (signal == 0x00)
{
compensate = compensate;
}
else if (signal == 0xff)
{
compensate = -compensate;
}
else
{
JZSDK_LOG_INFO("云台俯仰补偿符号错误,无法正常控制");
//回复操作失败
HalSend_type1Send_Reply_Failure(Port, FrameSequence);
return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE;
}
if (mode == 0x00)
{
ret = UIcontrol_Set_GimbalPitchFineTuning(Port ,compensate);
if (ret == JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
{
// 回复操作成功
HalSend_type1Send_Reply_Success(Port, FrameSequence);
}
else
{
// 回复操作失败
HalSend_type1Send_Reply_Failure(Port, FrameSequence);
}
}
//左补偿值
else if (mode == 0x01)
{
ret = UIcontrol_Set_SingleCompensation(Port, 0, compensate);
if (ret == JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
{
// 回复操作成功
HalSend_type1Send_Reply_Success(Port, FrameSequence);
}
else
{
// 回复操作失败
HalSend_type1Send_Reply_Failure(Port, FrameSequence);
}
}
//右补偿值
else if (mode == 0x02)
{
ret = UIcontrol_Set_SingleCompensation(Port, 1, compensate);
if (ret == JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
{
// 回复操作成功
HalSend_type1Send_Reply_Success(Port, FrameSequence);
}
else
{
// 回复操作失败
HalSend_type1Send_Reply_Failure(Port, FrameSequence);
}
}
else
{
JZSDK_LOG_INFO("云台俯仰补偿模式错误,无法正常控制");
//回复操作失败
HalSend_type1Send_Reply_Failure(Port, FrameSequence);
return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE;
}
return ret;
}
/*******************************************************************************************************************************
*
* 探照灯部分
... ... @@ -3964,8 +4069,8 @@ static T_JZsdkReturnCode RecvDeal_ObtainHeartBeat(int Port, char *getbuf)
* ******************************/
static T_JZsdkReturnCode RecvDeal_ObtainTimeStamp(int Port, unsigned char *getbuf)
{
uint64_t TimeStamp = (getbuf[16] | (getbuf[15] << 8)
| (getbuf[14] << 16) | (getbuf[13] << 24)
uint64_t TimeStamp = ((uint64_t)getbuf[16] | ((uint64_t)getbuf[15] << 8)
| ((uint64_t)getbuf[14] << 16) | ((uint64_t)getbuf[13] << 24)
| ((uint64_t)getbuf[12] << 32) | ((uint64_t)getbuf[11] << 40)
| ((uint64_t)getbuf[10] << 48) | ((uint64_t)getbuf[9] << 56));
... ... @@ -4142,7 +4247,6 @@ static T_JZsdkReturnCode RecvDeal_ObtainSearchLight_Lumen(int Port, char *getbuf
static T_JZsdkReturnCode RecvDeal_ObtainSearchLight_Temperature(int Port, char *getbuf)
{
//获取帧的序列号
int FrameSequence = JZsdk_Get_FrameSequence(getbuf);
... ... @@ -4171,6 +4275,7 @@ static T_JZsdkReturnCode RecvDeal_ObtainSearchLight_Temperature(int Port, char *
UIcontrol_ObtainSearchLight_SingleTemperature(Port, FrameSequence, value);
}
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
... ... @@ -5196,6 +5301,12 @@ static T_JZsdkReturnCode RecvDeal_InstructInput(int Port, int Receive_mode, unsi
return 0;
break;
//云台俯仰补偿
case JZ_INSCODE_5AFRAME_GIMBAL_PITCH_COMPENSATE:
RecvDeal_Gimbal_PitchCompensate(Port,getbuf);
return 0;
break;
//TTS设置音色
case JZ_INSCODE_5AFRAME_TTS_SET_TONE:
RecvDeal_TTS_SetTone(Port,getbuf);
... ...
... ... @@ -20,8 +20,8 @@ extern "C" {
/* Exported constants --------------------------------------------------------*/
/* 常亮定义*/
#define SINGLE_THREAD_SEND JZSDK_SINGLE_THREAD
#define MULTI_THREAD_SEND JZSDK_MULTI_THREAD
#define SINGLE_THREAD_SEND JZSDK_SINGLE_THREAD //单线程发送
#define MULTI_THREAD_SEND JZSDK_MULTI_THREAD //线程池发送
/* Exported types ------------------------------------------------------------*/
... ...
... ... @@ -1683,7 +1683,7 @@ T_JZsdkReturnCode HalSend_type1Send_LaserMode(int Uartport, int frameSequence, i
* **************/
T_JZsdkReturnCode HalSend_type1Send_SearchLight_Temperature(int Uartport, int LeftTemperature, int RightTemperature)
{
printf("发送探照灯温度帧\n");
//printf("发送探照灯温度帧\n");
unsigned char sendbuf[256];
int send_buf_len;
... ...
... ... @@ -10,7 +10,7 @@ T_JZsdkReturnCode DebugInfo_Init()
{
//强制打开调试模式
#if 1
#if 0
JZsdk_create_file("/root/ShakedownTest");
DebugMode_Flag = JZ_FLAGCODE_ON;
... ...
... ... @@ -16,6 +16,7 @@
#include "DeviceInfo/Attribute/Attribute.h"
#include "LanguageInfo/LanguageInfo.h"
#include "DebugInfo/DebugInfo.h"
#include "PlaneInfo/PlaneInfo.h"
/* Includes ------------------------------------------------------------------*/
#ifdef __cplusplus
... ...
#include "JZsdkLib.h"
#include "PlaneInfo.h"
static E_JZ_SPECIAL_PLANE_INFO g_PlaneInfo = E_JZ_SPECIAL_PLANE_INFO_NONE;
T_JZsdkReturnCode JZsdk_PlaneInfo_Set(E_JZ_SPECIAL_PLANE_INFO ePlaneInfo)
{
JZSDK_LOG_INFO("Set PlaneInfo: %d", ePlaneInfo);
g_PlaneInfo = ePlaneInfo;
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
T_JZsdkReturnCode JZsdk_PlaneInfo_Get(E_JZ_SPECIAL_PLANE_INFO *pePlaneInfo)
{
*pePlaneInfo = g_PlaneInfo;
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
\ No newline at end of file
... ...
/**
********************************************************************
* @file PlaneInfo.h
* PlaneInfo.h的头文件
*
*********************************************************************
*/
/* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/
#ifndef PLANE_INFO_H
#define PLANE_INFO_H
/* Includes ------------------------------------------------------------------*/
#include "JZsdk_Base/JZsdk_Code/JZsdk_Code.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* 常亮定义*/
typedef enum E_JZ_SPECIAL_PLANE_INFO
{
E_JZ_SPECIAL_PLANE_INFO_NONE = 0, //无特殊信息
E_JZ_SPECIAL_PLANE_INFO_DJI_M200_V2 = 44, /*!< Aircraft type is Matrice 200 V2. */
E_JZ_SPECIAL_PLANE_INFO_DJI_M210_V2 = 45, /*!< Aircraft type is Matrice 220 V2. */
E_JZ_SPECIAL_PLANE_INFO_DJI_M210RTK_V2 = 46, /*!< Aircraft type is Matrice 210 RTK V2. */
E_JZ_SPECIAL_PLANE_INFO_DJI_M300_RTK = 60, /*!< Aircraft type is Matrice 300 RTK. */
E_JZ_SPECIAL_PLANE_INFO_DJI_M30 = 67, /*!< Aircraft type is Matrice 30. */
E_JZ_SPECIAL_PLANE_INFO_DJI_M30T = 68, /*!< Aircraft type is Matrice 30T. */
E_JZ_SPECIAL_PLANE_INFO_DJI_M3E = 77, /*!< Aircraft type is Mavic 3E. */
E_JZ_SPECIAL_PLANE_INFO_DJI_FC30 = 78, /* !<Aircraft type is FlyCart 30> */
E_JZ_SPECIAL_PLANE_INFO_DJI_M3T = 79, /*!< Aircraft type is Mavic 3T. */
E_JZ_SPECIAL_PLANE_INFO_DJI_M350_RTK = 89, /*!< Aircraft type is Matrice 350 RTK. */
E_JZ_SPECIAL_PLANE_INFO_DJI_M3D = 91, /*!< Aircraft type is Matrice 3D. */
E_JZ_SPECIAL_PLANE_INFO_DJI_M3TD = 93, /*!< Aircraft type is Matrice 3TD. */
E_JZ_SPECIAL_PLANE_INFO_DJI_M4T = 99, /*!< Aircraft type is Matrice 4T. */
E_JZ_SPECIAL_PLANE_INFO_DJI_M4E = 990, /*!< Aircraft type is Matrice 4E. */
E_JZ_SPECIAL_PLANE_INFO_DJI_M4TD = 100, /*!< Aircraft type is Matrice 4TD. */
E_JZ_SPECIAL_PLANE_INFO_DJI_M4D = 1000, /*!< Aircraft type is Matrice 4D. */
E_JZ_SPECIAL_PLANE_INFO_DJI_M400 = 103, /*!< Aircraft type is Matrice 400. */
}E_JZ_SPECIAL_PLANE_INFO;
/* Exported types ------------------------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
T_JZsdkReturnCode JZsdk_PlaneInfo_Set(E_JZ_SPECIAL_PLANE_INFO ePlaneInfo);
T_JZsdkReturnCode JZsdk_PlaneInfo_Get(E_JZ_SPECIAL_PLANE_INFO *pePlaneInfo);
#ifdef __cplusplus
}
#endif
#endif
... ...
... ... @@ -37,7 +37,7 @@ T_JZsdkReturnCode Ircut_Init(IrcutInfo ircut_info)
//初始化对应的引脚
if (DEVICE_VERSION == JZ_H1E || DEVICE_VERSION == JZ_H1T || DEVICE_VERSION == JZ_H10T ||
DEVICE_VERSION == JZ_U3 || DEVICE_VERSION == JZ_U3S || DEVICE_VERSION == JZ_U3D || DEVICE_VERSION == JZ_U30||
DEVICE_VERSION == TF_A1 || DEVICE_VERSION == JZ_T40)
DEVICE_VERSION == TF_A1 || DEVICE_VERSION == JZ_T40 || DEVICE_VERSION == JZ_H150A)
{
JZsdk_V3s_Ircut_Init(T_Ircut_info);
}
... ... @@ -116,7 +116,7 @@ T_JZsdkReturnCode Ircut_PinControl(E_JZ_IRC_PORT port, int index, int status)
if (DEVICE_VERSION == JZ_H1E || DEVICE_VERSION == JZ_H1T || DEVICE_VERSION == JZ_H10T ||
DEVICE_VERSION == JZ_U3 || DEVICE_VERSION == JZ_U3S || DEVICE_VERSION == JZ_U3D || DEVICE_VERSION == JZ_U30||
DEVICE_VERSION == TF_A1 || DEVICE_VERSION == JZ_T40)
DEVICE_VERSION == TF_A1 || DEVICE_VERSION == JZ_T40 || DEVICE_VERSION == JZ_H150A)
{
JZsdk_V3s_Gpio_SetPin(port, index, status);
}
... ...
... ... @@ -109,16 +109,26 @@ static T_JZsdkReturnCode TTS_FILE_play(struct t_Megaphone_tts_param *Megaphone_t
//开始合成音频
int loop;
int loop_interval;
int addtone = 0x01;
if (Megaphone_tts_param->tts_add == 1)
{
addtone = 0x01;
}
else if (Megaphone_tts_param->tts_add == 2)
{
addtone = 0x02;
}
do
{
//输入数据
IflyTek_2_Tts_Input(tone, argv, speed, volume);
//如果开启了追加模式
// if(tts_add_mode == JZ_FLAGCODE_ON)
// {
// //追加合成音频
// IflyTek_2_Tts_Input(tone, argv, volume);
// }
if(tts_add_mode == JZ_FLAGCODE_ON)
{
//追加合成音频
IflyTek_2_Tts_Input(addtone, argv, speed, volume);
}
Megaphone_param(JZ_FLAGCODE_GET, MEGAPHONE_LOOP, &loop);
Megaphone_param(JZ_FLAGCODE_GET, MEGAPHONE_LOOP_INTERVAL, &loop_interval);
... ...
... ... @@ -114,7 +114,6 @@ void OnOutput(AIKIT_HANDLE* handle, const AIKIT_OutputData* output)
continue;
}
if (ret != JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS && ret != JZ_ERROR_SYSTEM_MODULE_CODE_BUFFER_SIZE_NOT_ENOUGH)
{
JZSDK_LOG_ERROR("写入环形缓冲区失败: %d", ret);
... ...
... ... @@ -46,6 +46,9 @@ extern "C" {
#define MAX_VOLUME (61)
#define MAX_TTS_VOLUME (69)
// #define MAX_VOLUME (100)
// #define MAX_TTS_VOLUME (100)
#elif DEVICE_VERSION == JZ_H10
// #define MAX_VOLUME (65)
// #define MAX_TTS_VOLUME (70)
... ... @@ -107,6 +110,12 @@ extern "C" {
#define MAX_VOLUME (63)
#define MAX_TTS_VOLUME (70)
#elif DEVICE_VERSION == JZ_H150A
// #define MAX_VOLUME (80)
// #define MAX_TTS_VOLUME (75)
#define MAX_VOLUME (100)
#define MAX_TTS_VOLUME (100)
#else
#define MAX_VOLUME (75)
#define MAX_TTS_VOLUME (75)
... ...
... ... @@ -35,7 +35,10 @@ T_JZsdkReturnCode Meg_SetVolumeFun(int volume)
{
snprintf(cmdBuffer,128, "amixer set -c 0 Master %d",volume);
}
else if (DEVICE_VERSION == JZ_H10T || DEVICE_VERSION == JZ_U3 || DEVICE_VERSION == JZ_U3S || DEVICE_VERSION == JZ_U3D || DEVICE_VERSION == JZ_U30 || DEVICE_VERSION == JZ_T40)
else if (DEVICE_VERSION == JZ_H10T || DEVICE_VERSION == JZ_U3 ||
DEVICE_VERSION == JZ_U3S || DEVICE_VERSION == JZ_U3D ||
DEVICE_VERSION == JZ_U30 || DEVICE_VERSION == JZ_T40 ||
DEVICE_VERSION == JZ_H150A)
{
snprintf(cmdBuffer,128, "amixer sset -c 0 'Headphone' %d unmute",volume);
}
... ... @@ -119,7 +122,10 @@ static T_JZsdkReturnCode Megaphone_SetTTSvolume()
printf("TTS音量修改\n");
//v3s自设系统 要提高10初始音量
if (DEVICE_VERSION == JZ_H10T || DEVICE_VERSION == JZ_U3 || DEVICE_VERSION == JZ_U3S || DEVICE_VERSION == JZ_U3D || DEVICE_VERSION == JZ_U30)
if (DEVICE_VERSION == JZ_H10T || DEVICE_VERSION == JZ_U3 ||
DEVICE_VERSION == JZ_U3S || DEVICE_VERSION == JZ_U3D ||
DEVICE_VERSION == JZ_U30 || DEVICE_VERSION == JZ_T40 ||
DEVICE_VERSION == JZ_H150A)
{
if (value > 0)
{
... ... @@ -170,7 +176,10 @@ T_JZsdkReturnCode Megaphone_SetVolume(int value, int mode)//设置音é‡ï¼ŒéŸ³é‡
g_Megaphone_Volume = value;//获取当前音量
//v3s自设系统 要提高10初始音量
if (DEVICE_VERSION == JZ_H10T || DEVICE_VERSION == JZ_U3 || DEVICE_VERSION == JZ_U3S || DEVICE_VERSION == JZ_U3D || DEVICE_VERSION == JZ_U30)
if (DEVICE_VERSION == JZ_H10T || DEVICE_VERSION == JZ_U3 ||
DEVICE_VERSION == JZ_U3S || DEVICE_VERSION == JZ_U3D ||
DEVICE_VERSION == JZ_U30 || DEVICE_VERSION == JZ_T40 ||
DEVICE_VERSION == JZ_H150A)
{
if (value > 0)
{
... ...
... ... @@ -11,38 +11,20 @@
static int g_SearchLight_Subscription_Flag = JZ_FLAGCODE_OFF; //消息订阅状态 默认关闭本机的
typedef struct T_JzSearchLightInfo{
T_JzSearchLightAttribute Attribute;
JZ_MODULE_CONTROL_WAY ControlMode; //控制模式
}T_JzSearchLightInfo;
static T_JzSearchLightInfo g_SearchLight_Info;
T_JZsdkReturnCode SearchLight_Init(enum JZ_MODULE_CONTROL_WAY Mode)
T_JZsdkReturnCode SearchLight_Init(T_JzSearchLightInfo Info)
{
//温控初始化
JZsdk_SearchLightTemControl_Init();
//初始化参数属性
static T_JzSearchLightAttribute SearchLight_Attribute = {
.Frequency = 100,
.Mode = E_JZ_SEARCHLIGHTMODE_OFF,
.LeftBrightness = 30,
.RightBrightness = 30,
.LeftTemperature = 0,
.RightTemperature = 0
};
memcpy(&g_SearchLight_Info.Attribute, &SearchLight_Attribute, sizeof(T_JzSearchLightAttribute));
//创建一个每隔一段时间就去查询探照灯数据的线程
T_JZsdkOsalHandler *osal_handle = JZsdk_Platform_GetOsalHandler();
if (osal_handle == NULL)
memset(&g_SearchLight_Info, 0, sizeof(T_JzSearchLightInfo));
memcpy(&g_SearchLight_Info, &Info, sizeof(T_JzSearchLightInfo));
if (g_SearchLight_Info.ControlMode == JZ_MODULE_CONTROL_WAY_INDEPENDENT)
{
JZSDK_LOG_ERROR("osal_handle is NULL\n");
return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE;
//温控初始化
JZsdk_SearchLightTemControl_Init();
}
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
... ... @@ -73,21 +55,17 @@ T_JZsdkReturnCode SearchLight_CheckStatus_Attribute(T_JzSearchLightAttribute *p)
T_JZsdkReturnCode SearchLight_SetMode(E_JzSearchLightMode mode)
{
JZSDK_LOG_DEBUG("探照灯模式改变%d\n", mode);
#if (DEVICE_VERSION == JZ_U3 || \
DEVICE_VERSION == JZ_U3S || \
DEVICE_VERSION == JZ_U3D || \
DEVICE_VERSION == JZ_U30 || \
DEVICE_VERSION == TF_A1)
HalSend_type1Send_SearchLight_Control(UART_DEV_2, mode, 0x00);
#elif (DEVICE_VERSION == JZ_T40)
HalSend_type1Send_SearchLight_Control(UART_DEV_2, mode, 0x20);
T_JZsdkOsalHandler *osalHandle = JZsdk_Platform_GetOsalHandler();
if (osalHandle == NULL)
{
return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE;
}
#elif (DEVICE_VERSION == JZ_H1T)
HalSend_type1Send_SearchLight_Control(UART_DEV_1, mode, 0x20);
int FrameSequence = g_SearchLight_Info.FrameSequence;
osalHandle->GetFrameSequenceQueueNum(&FrameSequence);
#endif
HalSend_type1Send_SearchLight_Control(g_SearchLight_Info.Device, mode, FrameSequence);
g_SearchLight_Info.Attribute.Mode = mode;
... ... @@ -191,7 +169,7 @@ T_JZsdkReturnCode SearchLight_Obtain_Frequency(int Frequency)
//收到探照灯温度
T_JZsdkReturnCode SearchLight_Obtain_Temperature(int left, int right)
{
//JZSDK_LOG_DEBUG("%x收到探照灯温度回复%d %d",DEVICE_VERSION, left, right);
JZSDK_LOG_DEBUG("%x收到探照灯温度回复%d %d",DEVICE_VERSION, left, right);
g_SearchLight_Info.Attribute.LeftTemperature = left;
g_SearchLight_Info.Attribute.RightTemperature = right;
... ... @@ -255,7 +233,7 @@ T_JZsdkReturnCode SearchLight_Flush_SearchLightTemerature()
{
#if DEVICE_VERSION == JZ_H1T
HalSend_type1Send_CheckStatus_SearchLight_Temperture(UART_DEV_1);
HalSend_type1Send_CheckStatus_SearchLight_Temperture(UART_DEV_1, 0x00);
#endif
}
... ...
... ... @@ -26,6 +26,13 @@ typedef struct T_JzSearchLightAttribute{
int RightTemperature; //右灯光温度
}T_JzSearchLightAttribute;
typedef struct T_JzSearchLightInfo{
T_JzSearchLightAttribute Attribute;
JZ_MODULE_CONTROL_WAY ControlMode; //控制模式
JZ_DEVICE_PORT_TYPE Device; //控制的设备
int FrameSequence;//是否指定特别的序列号
}T_JzSearchLightInfo;
typedef enum E_JzSearchLightMode{
E_JZ_SEARCHLIGHTMODE_OFF = 0, //关闭
E_JZ_SEARCHLIGHTMODE_BRUST = 1, //爆闪
... ... @@ -51,6 +58,6 @@ T_JZsdkReturnCode SearchLight_Obtain_Mode(E_JzSearchLightMode mode);
T_JZsdkReturnCode JZsdk_SearchLight_SetMessageSubFlag(int InputFlag);
int JZsdk_SearchLight_GetMessageSubFlag(void);
T_JZsdkReturnCode SearchLight_Init(enum JZ_MODULE_CONTROL_WAY Mode);
T_JZsdkReturnCode SearchLight_Init(T_JzSearchLightInfo Info);
#endif
... ...
... ... @@ -425,7 +425,7 @@ T_JZsdkReturnCode JZsdk_PsdkUi_value_get(JZsdk_Widget_Control index, int *value)
if (LanguageInfo == LANGUAGE_INFO_CHINESE)
{
switch (value)
switch (*value)
{
case 0:
tone = 0x01;
... ... @@ -466,7 +466,7 @@ T_JZsdkReturnCode JZsdk_PsdkUi_value_get(JZsdk_Widget_Control index, int *value)
else
{
switch (value)
switch (*value)
{
case 0:
tone = 0x11;
... ...
... ... @@ -1004,6 +1004,36 @@ T_JZsdkReturnCode UIcontrol_Set_GimbalPitchFineTuning(int DeviceName,int value)
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
//设置pitch云台补偿值
T_JZsdkReturnCode UIcontrol_Set_SingleCompensation(int DeviceName,int direction, int value)
{
#ifdef GIMBAL_STATUS_ON
if(direction == 0)
{
T_JZsdkReturnCode ret = Gimbal_Set_SingleCompensation(JZ_SINGLE_COMPENSATION_MODE_PITCH_LEFT, value);
if (ret != JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
{
printf("%s:%s\n",UI_CONTROL_ERROR,JZsdk_GetReturnCodeMessage(ret));
return ret;
}
}
else if (direction == 1)
{
T_JZsdkReturnCode ret = Gimbal_Set_SingleCompensation(JZ_SINGLE_COMPENSATION_MODE_PITCH_RIGHT, value);
if (ret != JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
{
printf("%s:%s\n",UI_CONTROL_ERROR,JZsdk_GetReturnCodeMessage(ret));
return ret;
}
}
#endif
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
//查询云台角度
T_JZsdkReturnCode UIcontrol_CheckStatus_GimbalAngle(int *PitchValue, int *YawValue)
{
... ... @@ -1348,8 +1378,8 @@ T_JZsdkReturnCode UIcontrol_CheckStatus_SearchLightTemperture(int *ValueLeftTemp
//获取探照灯属性
T_JzSearchLightAttribute LightAttribute;
SearchLight_Get_SearchLightAttribute(&LightAttribute);
*ValueLeftTemperature = LightAttribute.LeftBrightness;
*ValueRightTemperaturen = LightAttribute.RightBrightness;
*ValueLeftTemperature = LightAttribute.LeftTemperature;
*ValueRightTemperaturen = LightAttribute.RightTemperature;
#endif
... ... @@ -1838,7 +1868,7 @@ T_JZsdkReturnCode UIcontrol_ObtainSearchLight_SingleTemperature(int DeviceName,
T_JzSearchLightAttribute Attribute;
SearchLight_Get_SearchLightAttribute(&Attribute);
if(Brocastflag == JZ_FLAGCODE_ON && FrameSequence == 0x21)
if(Brocastflag == JZ_FLAGCODE_ON)
{
//通知其他设备的ui界面变化
//如果4G模块有启动
... ... @@ -1857,12 +1887,12 @@ T_JZsdkReturnCode UIcontrol_ObtainSearchLight_SingleTemperature(int DeviceName,
//如果设备2有启动
if ( (JZsdk_HalPort_UseFlag(UART_DEV_2) == JZ_FLAGCODE_ON) && (DeviceName != UART_DEV_2) )
{
HalSend_type1Send_SearchLight_Temperature(UART_DEV_1, Attribute.LeftTemperature, Attribute.RightTemperature);
HalSend_type1Send_SearchLight_Temperature(UART_DEV_2, Attribute.LeftTemperature, Attribute.RightTemperature);
}
//如果psdk接口已经使用
if ( (JZsdk_HalPort_UseFlag(DEVICE_PSDK) == JZ_FLAGCODE_ON) && DeviceName != DEVICE_PSDK )
{
HalSend_type1Send_SearchLight_Temperature(UART_DEV_1, Attribute.LeftTemperature, Attribute.RightTemperature);
//无反应
}
}
... ...
... ... @@ -65,6 +65,8 @@ T_JZsdkReturnCode UIcontrol_Set_TTS_AppendTone(int DeviceName,int value);
T_JZsdkReturnCode UIcontrol_Set_GimbalPitchAngle(int DeviceName, int value);
T_JZsdkReturnCode UIcontrol_SetGimbalRange(int DeviceName,int value);
T_JZsdkReturnCode UIcontrol_Set_GimbalPitchFineTuning(int DeviceName,int value);
T_JZsdkReturnCode UIcontrol_Set_SingleCompensation(int DeviceName,int direction, int value);
T_JZsdkReturnCode UIcontrol_CheckStatus_GimbalPitchFineTuning(int *PitchValue, int *YawValue);
T_JZsdkReturnCode UIcontrol_Obtain_GimbalPitchFineTuninng(int DeviceName, int Pitch);
T_JZsdkReturnCode UIcontrol_Set_GimbalLinkageControl(int DeviceName, int value);
... ...
... ... @@ -152,6 +152,14 @@ static int WidgetMgMT_Control_WorkFuntion(int Inscode, int value)
JZsdk_Psdk_UI_io_SideLaserMode(JZ_FLAGCODE_ON, value);
break;
case JZSDK_WIDGET_GIMBAL_SINGLE_COMPENSATION_LEFT:
UIcontrol_Set_SingleCompensation(JZ_FLAGCODE_ON, 0, value);
break;
case JZSDK_WIDGET_GIMBAL_SINGLE_COMPENSATION_RIGHT:
UIcontrol_Set_SingleCompensation(JZ_FLAGCODE_ON, 1, value);
break;
default:
break;
}
... ...
... ... @@ -5,26 +5,18 @@
#include "WarnLight/WarnLight.h"
typedef struct T_JzWarnLightInfo{
T_JzWarnLightAttribute Attribute;
JZ_MODULE_CONTROL_WAY ControlMode; //控制模式
}T_JzWarnLightInfo;
static T_JzWarnLightInfo g_WarnLightInfo;
T_JZsdkReturnCode WarnLight_Init(enum JZ_MODULE_CONTROL_WAY Mode)
T_JZsdkReturnCode WarnLight_Init(T_JzWarnLightInfo RegInfo)
{
//初始化参数
static T_JzWarnLightAttribute Attribute = {
.Color1 = E_JZ_WARNLIGHT_COLOR_RED,
.Color2 = E_JZ_WARNLIGHT_COLOR_BLUE,
.mode = E_JZ_WARNLIGHT_MODE_ALTERATING_FAST_FALSHING,
.status = JZ_FLAGCODE_OFF,
};
memset(&g_WarnLightInfo, 0, sizeof(T_JzWarnLightInfo));
memcpy(&g_WarnLightInfo, &RegInfo, sizeof(T_JzWarnLightInfo));
memcpy(&g_WarnLightInfo.Attribute, &Attribute, sizeof(T_JzWarnLightAttribute));
//打印参数
JZSDK_LOG_INFO("WarnLightControlMode:%d",g_WarnLightInfo.ControlMode);
g_WarnLightInfo.ControlMode = Mode;
JZSDK_LOG_INFO("WarnLight Init Success");
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
... ... @@ -33,22 +25,16 @@ T_JZsdkReturnCode WarnLight_Set_StatusAndMode(int status, int mode)
{
JZSDK_LOG_DEBUG("WarnLight_Set_StatusAndMode: status = %d, mode = %d", status, mode);
#if DEVICE_VERSION == JZ_H1T
HalSend_type1Send_Set_WarningLight_Status(UART_DEV_1, 0x00, status, mode);
#elif DEVICE_VERSION == TF_A1 || \
DEVICE_VERSION == JZ_U3S || \
DEVICE_VERSION == JZ_U3D || \
DEVICE_VERSION == JZ_U30
HalSend_type1Send_Set_WarningLight_Status(UART_DEV_2, 0x00, status, mode);
#elif DEVICE_VERSION == JZ_T40
T_JZsdkOsalHandler *osalHandle = JZsdk_Platform_GetOsalHandler();
if (osalHandle == NULL)
{
return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE;
}
HalSend_type1Send_Set_WarningLight_Status(UART_DEV_2, 0x20, status, mode);
U8_t FrameSequence = g_WarnLightInfo.FrameSequence;
osalHandle->GetFrameSequenceQueueNum(&FrameSequence);
#endif
HalSend_type1Send_Set_WarningLight_Status(g_WarnLightInfo.Device, FrameSequence, status, mode);
g_WarnLightInfo.Attribute.mode = mode;
g_WarnLightInfo.Attribute.status = status;
... ... @@ -78,7 +64,7 @@ T_JZsdkReturnCode WarnLight_Flush_StatusAndMode()
if(g_WarnLightInfo.ControlMode == JZ_MODULE_CONTROL_WAY_TRANSPARENT)
{
//查询灯光属性
HalSend_type1Send_CheckStatus_WarningLightStatus(UART_DEV_1);
HalSend_type1Send_CheckStatus_WarningLightStatus(g_WarnLightInfo.Device);
}
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
... ... @@ -91,22 +77,17 @@ T_JZsdkReturnCode WarnLight_Set_Color(int Color1, int Color2)
{
JZSDK_LOG_DEBUG("设置0x%x:警灯颜色 Color1:0x%x, color:0x%x",DEVICE_VERSION, Color1, Color2);
#if DEVICE_VERSION == JZ_H1T
HalSend_type1Send_Set_WarningLight_Color(UART_DEV_1, 0x00, Color1, Color2);
#elif DEVICE_VERSION == TF_A1 || \
DEVICE_VERSION == JZ_U3S || \
DEVICE_VERSION == JZ_U3D || \
DEVICE_VERSION == JZ_U30
HalSend_type1Send_Set_WarningLight_Color(UART_DEV_2, 0x00, Color1, Color2);
#elif DEVICE_VERSION == JZ_T40
T_JZsdkOsalHandler *osalHandle = JZsdk_Platform_GetOsalHandler();
if (osalHandle == NULL)
{
return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE;
}
HalSend_type1Send_Set_WarningLight_Color(UART_DEV_2, 0x20, Color1, Color2);
U8_t FrameSequence = g_WarnLightInfo.FrameSequence;
osalHandle->GetFrameSequenceQueueNum(&FrameSequence);
#endif
//发送警灯颜色
HalSend_type1Send_Set_WarningLight_Color(g_WarnLightInfo.Device, FrameSequence, Color1, Color2);
g_WarnLightInfo.Attribute.Color1 = Color1;
g_WarnLightInfo.Attribute.Color2 = Color2;
... ... @@ -132,7 +113,7 @@ T_JZsdkReturnCode WarnLight_Flush_Color()
if(g_WarnLightInfo.ControlMode == JZ_MODULE_CONTROL_WAY_TRANSPARENT)
{
//查询灯光属性
HalSend_type1Send_CheckStatus_WarningLightColor(UART_DEV_1);
HalSend_type1Send_CheckStatus_WarningLightColor(g_WarnLightInfo.Device);
}
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
... ... @@ -146,7 +127,7 @@ T_JZsdkReturnCode WarnLight_Get_Attribute(T_JzWarnLightAttribute *Attribute)
return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE;
}
memcpy(Attribute, &g_WarnLightInfo.Attribute, sizeof(T_JzWarnLightAttribute));
memcpy(Attribute, &(g_WarnLightInfo.Attribute), sizeof(T_JzWarnLightAttribute));
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
... ...
... ... @@ -23,12 +23,20 @@ extern "C" {
/* Exported types ------------------------------------------------------------*/
typedef struct T_JzWarnLightAttribute{
int mode; //模式
int status; //状态
int Color1; //颜色1
int Color2; //颜色2
}T_JzWarnLightAttribute;
typedef struct T_JzWarnLightInfo{
T_JzWarnLightAttribute Attribute;
JZ_MODULE_CONTROL_WAY ControlMode; //控制模式
JZ_DEVICE_PORT_TYPE Device; //控制的设备
int FrameSequence;//是否指定特别的序列号
}T_JzWarnLightInfo;
typedef enum E_JzWarnLightColor{
E_JZ_WARNLIGHT_COLOR_RED = 1,
E_JZ_WARNLIGHT_COLOR_GREEN = 2,
... ... @@ -57,7 +65,7 @@ T_JZsdkReturnCode WarnLight_Flush_Color();
T_JZsdkReturnCode WarnLight_Obatin_StatusAndMode(int status, int mode);
T_JZsdkReturnCode WarnLight_Obatin_Color(int Color1, int Color2);
T_JZsdkReturnCode WarnLight_Init(enum JZ_MODULE_CONTROL_WAY Mode);
T_JZsdkReturnCode WarnLight_Init(T_JzWarnLightInfo RegInfo);
#ifdef __cplusplus
... ...
... ... @@ -25,15 +25,8 @@ T_JZsdkReturnCode Megphone_Attention()
//如果是喊话器设备
#ifdef MEGAPHONE_CONFIG_STATUS_ON
//引脚初始化
IrcutInfo ircut_info;
ircut_info.Amplifiter_Pin.Enable = JZ_FLAGCODE_ON;
ircut_info.Amplifiter_Pin.Port = JZ_IRC_PORT_PG;
ircut_info.Amplifiter_Pin.index = 5;
ircut_info.Amplifiter_Pin.Group = 0;
ircut_info.Amplifiter_Pin.mode = JZ_IRC_PIN_MODE_OUT;
Ircut_Init(ircut_info);
//设备例程初始化
DeviceSample_init(APP_ATTENTION);
//音频库初始化
AudioDeal_Init();
... ...
... ... @@ -28,32 +28,28 @@ The CXX compiler identification is GNU, found in "/mnt/hgfs/share/JZSDK_Linux/pr
Determining if the C compiler works passed with the following output:
Change Dir: /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_5dd78/fast"
make: Warning: File 'Makefile' has modification time 0.094 s in the future
/usr/bin/make -f CMakeFiles/cmTC_5dd78.dir/build.make CMakeFiles/cmTC_5dd78.dir/build
Run Build Command:"/usr/bin/make" "cmTC_96269/fast"
/usr/bin/make -f CMakeFiles/cmTC_96269.dir/build.make CMakeFiles/cmTC_96269.dir/build
make[1]: Entering directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp'
make[1]: Warning: File 'CMakeFiles/cmTC_5dd78.dir/flags.make' has modification time 0.08 s in the future
Building C object CMakeFiles/cmTC_5dd78.dir/testCCompiler.c.o
/usr/bin/cc -o CMakeFiles/cmTC_5dd78.dir/testCCompiler.c.o -c /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_5dd78
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_5dd78.dir/link.txt --verbose=1
/usr/bin/cc CMakeFiles/cmTC_5dd78.dir/testCCompiler.c.o -o cmTC_5dd78 -rdynamic
make[1]: 警告:检测到时钟错误。您的创建可能是不完整的。
Building C object CMakeFiles/cmTC_96269.dir/testCCompiler.c.o
/usr/bin/cc -o CMakeFiles/cmTC_96269.dir/testCCompiler.c.o -c /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_96269
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_96269.dir/link.txt --verbose=1
/usr/bin/cc CMakeFiles/cmTC_96269.dir/testCCompiler.c.o -o cmTC_96269 -rdynamic
make[1]: Leaving directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp'
make: 警告:检测到时钟错误。您的创建可能是不完整的。
Detecting C compiler ABI info compiled with the following output:
Change Dir: /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_a0142/fast"
/usr/bin/make -f CMakeFiles/cmTC_a0142.dir/build.make CMakeFiles/cmTC_a0142.dir/build
Run Build Command:"/usr/bin/make" "cmTC_49efd/fast"
/usr/bin/make -f CMakeFiles/cmTC_49efd.dir/build.make CMakeFiles/cmTC_49efd.dir/build
make[1]: Entering directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_a0142.dir/CMakeCCompilerABI.c.o
/usr/bin/cc -o CMakeFiles/cmTC_a0142.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.5/Modules/CMakeCCompilerABI.c
Linking C executable cmTC_a0142
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_a0142.dir/link.txt --verbose=1
/usr/bin/cc -v CMakeFiles/cmTC_a0142.dir/CMakeCCompilerABI.c.o -o cmTC_a0142 -rdynamic
Building C object CMakeFiles/cmTC_49efd.dir/CMakeCCompilerABI.c.o
/usr/bin/cc -o CMakeFiles/cmTC_49efd.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.5/Modules/CMakeCCompilerABI.c
Linking C executable cmTC_49efd
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_49efd.dir/link.txt --verbose=1
/usr/bin/cc -v CMakeFiles/cmTC_49efd.dir/CMakeCCompilerABI.c.o -o cmTC_49efd -rdynamic
Using built-in specs.
COLLECT_GCC=/usr/bin/cc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
... ... @@ -63,8 +59,8 @@ Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12)
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_a0142' '-rdynamic' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper -plugin-opt=-fresolution=/tmp/cc8mxu0M.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o cmTC_a0142 /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. CMakeFiles/cmTC_a0142.dir/CMakeCCompilerABI.c.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/5/crtend.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o
COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_49efd' '-rdynamic' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper -plugin-opt=-fresolution=/tmp/cclcS6gK.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o cmTC_49efd /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. CMakeFiles/cmTC_49efd.dir/CMakeCCompilerABI.c.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/5/crtend.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o
make[1]: Leaving directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp'
... ... @@ -72,14 +68,14 @@ Parsed C implicit link information from above output:
link line regex: [^( *|.*[/\])(ld|([^/\]+-)?ld|collect2)[^/\]*( |$)]
ignore line: [Change Dir: /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp]
ignore line: []
ignore line: [Run Build Command:"/usr/bin/make" "cmTC_a0142/fast"]
ignore line: [/usr/bin/make -f CMakeFiles/cmTC_a0142.dir/build.make CMakeFiles/cmTC_a0142.dir/build]
ignore line: [Run Build Command:"/usr/bin/make" "cmTC_49efd/fast"]
ignore line: [/usr/bin/make -f CMakeFiles/cmTC_49efd.dir/build.make CMakeFiles/cmTC_49efd.dir/build]
ignore line: [make[1]: Entering directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp']
ignore line: [Building C object CMakeFiles/cmTC_a0142.dir/CMakeCCompilerABI.c.o]
ignore line: [/usr/bin/cc -o CMakeFiles/cmTC_a0142.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.5/Modules/CMakeCCompilerABI.c]
ignore line: [Linking C executable cmTC_a0142]
ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_a0142.dir/link.txt --verbose=1]
ignore line: [/usr/bin/cc -v CMakeFiles/cmTC_a0142.dir/CMakeCCompilerABI.c.o -o cmTC_a0142 -rdynamic ]
ignore line: [Building C object CMakeFiles/cmTC_49efd.dir/CMakeCCompilerABI.c.o]
ignore line: [/usr/bin/cc -o CMakeFiles/cmTC_49efd.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.5/Modules/CMakeCCompilerABI.c]
ignore line: [Linking C executable cmTC_49efd]
ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_49efd.dir/link.txt --verbose=1]
ignore line: [/usr/bin/cc -v CMakeFiles/cmTC_49efd.dir/CMakeCCompilerABI.c.o -o cmTC_49efd -rdynamic ]
ignore line: [Using built-in specs.]
ignore line: [COLLECT_GCC=/usr/bin/cc]
ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper]
... ... @@ -89,13 +85,13 @@ Parsed C implicit link information from above output:
ignore line: [gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12) ]
ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/]
ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../:/lib/:/usr/lib/]
ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_a0142' '-rdynamic' '-mtune=generic' '-march=x86-64']
link line: [ /usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper -plugin-opt=-fresolution=/tmp/cc8mxu0M.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o cmTC_a0142 /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. CMakeFiles/cmTC_a0142.dir/CMakeCCompilerABI.c.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/5/crtend.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o]
ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_49efd' '-rdynamic' '-mtune=generic' '-march=x86-64']
link line: [ /usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper -plugin-opt=-fresolution=/tmp/cclcS6gK.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o cmTC_49efd /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. CMakeFiles/cmTC_49efd.dir/CMakeCCompilerABI.c.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/5/crtend.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o]
arg [/usr/lib/gcc/x86_64-linux-gnu/5/collect2] ==> ignore
arg [-plugin] ==> ignore
arg [/usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so] ==> ignore
arg [-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper] ==> ignore
arg [-plugin-opt=-fresolution=/tmp/cc8mxu0M.res] ==> ignore
arg [-plugin-opt=-fresolution=/tmp/cclcS6gK.res] ==> ignore
arg [-plugin-opt=-pass-through=-lgcc] ==> ignore
arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore
arg [-plugin-opt=-pass-through=-lc] ==> ignore
... ... @@ -113,7 +109,7 @@ Parsed C implicit link information from above output:
arg [/lib64/ld-linux-x86-64.so.2] ==> ignore
arg [-zrelro] ==> ignore
arg [-o] ==> ignore
arg [cmTC_a0142] ==> ignore
arg [cmTC_49efd] ==> ignore
arg [/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o] ==> ignore
arg [/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o] ==> ignore
arg [/usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o] ==> ignore
... ... @@ -125,7 +121,7 @@ Parsed C implicit link information from above output:
arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu]
arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib]
arg [-L/usr/lib/gcc/x86_64-linux-gnu/5/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/5/../../..]
arg [CMakeFiles/cmTC_a0142.dir/CMakeCCompilerABI.c.o] ==> ignore
arg [CMakeFiles/cmTC_49efd.dir/CMakeCCompilerABI.c.o] ==> ignore
arg [-lgcc] ==> lib [gcc]
arg [--as-needed] ==> ignore
arg [-lgcc_s] ==> lib [gcc_s]
... ... @@ -159,14 +155,14 @@ Parsed C implicit link information from above output:
Detecting C [-std=c11] compiler features compiled with the following output:
Change Dir: /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_225dd/fast"
/usr/bin/make -f CMakeFiles/cmTC_225dd.dir/build.make CMakeFiles/cmTC_225dd.dir/build
Run Build Command:"/usr/bin/make" "cmTC_599d5/fast"
/usr/bin/make -f CMakeFiles/cmTC_599d5.dir/build.make CMakeFiles/cmTC_599d5.dir/build
make[1]: Entering directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_225dd.dir/feature_tests.c.o
/usr/bin/cc -std=c11 -o CMakeFiles/cmTC_225dd.dir/feature_tests.c.o -c /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/feature_tests.c
Linking C executable cmTC_225dd
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_225dd.dir/link.txt --verbose=1
/usr/bin/cc CMakeFiles/cmTC_225dd.dir/feature_tests.c.o -o cmTC_225dd -rdynamic
Building C object CMakeFiles/cmTC_599d5.dir/feature_tests.c.o
/usr/bin/cc -std=c11 -o CMakeFiles/cmTC_599d5.dir/feature_tests.c.o -c /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/feature_tests.c
Linking C executable cmTC_599d5
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_599d5.dir/link.txt --verbose=1
/usr/bin/cc CMakeFiles/cmTC_599d5.dir/feature_tests.c.o -o cmTC_599d5 -rdynamic
make[1]: Leaving directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp'
... ... @@ -179,14 +175,14 @@ make[1]: Leaving directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_
Detecting C [-std=c99] compiler features compiled with the following output:
Change Dir: /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_ed5e9/fast"
/usr/bin/make -f CMakeFiles/cmTC_ed5e9.dir/build.make CMakeFiles/cmTC_ed5e9.dir/build
Run Build Command:"/usr/bin/make" "cmTC_d3a2f/fast"
/usr/bin/make -f CMakeFiles/cmTC_d3a2f.dir/build.make CMakeFiles/cmTC_d3a2f.dir/build
make[1]: Entering directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_ed5e9.dir/feature_tests.c.o
/usr/bin/cc -std=c99 -o CMakeFiles/cmTC_ed5e9.dir/feature_tests.c.o -c /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/feature_tests.c
Linking C executable cmTC_ed5e9
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_ed5e9.dir/link.txt --verbose=1
/usr/bin/cc CMakeFiles/cmTC_ed5e9.dir/feature_tests.c.o -o cmTC_ed5e9 -rdynamic
Building C object CMakeFiles/cmTC_d3a2f.dir/feature_tests.c.o
/usr/bin/cc -std=c99 -o CMakeFiles/cmTC_d3a2f.dir/feature_tests.c.o -c /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/feature_tests.c
Linking C executable cmTC_d3a2f
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_d3a2f.dir/link.txt --verbose=1
/usr/bin/cc CMakeFiles/cmTC_d3a2f.dir/feature_tests.c.o -o cmTC_d3a2f -rdynamic
make[1]: Leaving directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp'
... ... @@ -199,19 +195,15 @@ make[1]: Leaving directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_
Detecting C [-std=c90] compiler features compiled with the following output:
Change Dir: /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_157bf/fast"
make: Warning: File 'Makefile' has modification time 0.081 s in the future
/usr/bin/make -f CMakeFiles/cmTC_157bf.dir/build.make CMakeFiles/cmTC_157bf.dir/build
Run Build Command:"/usr/bin/make" "cmTC_f41ba/fast"
/usr/bin/make -f CMakeFiles/cmTC_f41ba.dir/build.make CMakeFiles/cmTC_f41ba.dir/build
make[1]: Entering directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp'
make[1]: Warning: File 'CMakeFiles/cmTC_157bf.dir/flags.make' has modification time 0.068 s in the future
Building C object CMakeFiles/cmTC_157bf.dir/feature_tests.c.o
/usr/bin/cc -std=c90 -o CMakeFiles/cmTC_157bf.dir/feature_tests.c.o -c /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/feature_tests.c
Linking C executable cmTC_157bf
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_157bf.dir/link.txt --verbose=1
/usr/bin/cc CMakeFiles/cmTC_157bf.dir/feature_tests.c.o -o cmTC_157bf -rdynamic
make[1]: 警告:检测到时钟错误。您的创建可能是不完整的。
Building C object CMakeFiles/cmTC_f41ba.dir/feature_tests.c.o
/usr/bin/cc -std=c90 -o CMakeFiles/cmTC_f41ba.dir/feature_tests.c.o -c /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/feature_tests.c
Linking C executable cmTC_f41ba
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_f41ba.dir/link.txt --verbose=1
/usr/bin/cc CMakeFiles/cmTC_f41ba.dir/feature_tests.c.o -o cmTC_f41ba -rdynamic
make[1]: Leaving directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp'
make: 警告:检测到时钟错误。您的创建可能是不完整的。
Feature record: C_FEATURE:1c_function_prototypes
... ... @@ -221,28 +213,28 @@ make: 警告:检测到时钟错误。您的创建可能是不完整的。
Determining if the CXX compiler works passed with the following output:
Change Dir: /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_11296/fast"
/usr/bin/make -f CMakeFiles/cmTC_11296.dir/build.make CMakeFiles/cmTC_11296.dir/build
Run Build Command:"/usr/bin/make" "cmTC_f41e1/fast"
/usr/bin/make -f CMakeFiles/cmTC_f41e1.dir/build.make CMakeFiles/cmTC_f41e1.dir/build
make[1]: Entering directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_11296.dir/testCXXCompiler.cxx.o
/usr/bin/c++ -o CMakeFiles/cmTC_11296.dir/testCXXCompiler.cxx.o -c /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
Linking CXX executable cmTC_11296
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_11296.dir/link.txt --verbose=1
/usr/bin/c++ CMakeFiles/cmTC_11296.dir/testCXXCompiler.cxx.o -o cmTC_11296 -rdynamic
Building CXX object CMakeFiles/cmTC_f41e1.dir/testCXXCompiler.cxx.o
/usr/bin/c++ -o CMakeFiles/cmTC_f41e1.dir/testCXXCompiler.cxx.o -c /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
Linking CXX executable cmTC_f41e1
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_f41e1.dir/link.txt --verbose=1
/usr/bin/c++ CMakeFiles/cmTC_f41e1.dir/testCXXCompiler.cxx.o -o cmTC_f41e1 -rdynamic
make[1]: Leaving directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp'
Detecting CXX compiler ABI info compiled with the following output:
Change Dir: /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_716a2/fast"
/usr/bin/make -f CMakeFiles/cmTC_716a2.dir/build.make CMakeFiles/cmTC_716a2.dir/build
Run Build Command:"/usr/bin/make" "cmTC_8f2d1/fast"
/usr/bin/make -f CMakeFiles/cmTC_8f2d1.dir/build.make CMakeFiles/cmTC_8f2d1.dir/build
make[1]: Entering directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_716a2.dir/CMakeCXXCompilerABI.cpp.o
/usr/bin/c++ -o CMakeFiles/cmTC_716a2.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.5/Modules/CMakeCXXCompilerABI.cpp
Linking CXX executable cmTC_716a2
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_716a2.dir/link.txt --verbose=1
/usr/bin/c++ -v CMakeFiles/cmTC_716a2.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_716a2 -rdynamic
Building CXX object CMakeFiles/cmTC_8f2d1.dir/CMakeCXXCompilerABI.cpp.o
/usr/bin/c++ -o CMakeFiles/cmTC_8f2d1.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.5/Modules/CMakeCXXCompilerABI.cpp
Linking CXX executable cmTC_8f2d1
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_8f2d1.dir/link.txt --verbose=1
/usr/bin/c++ -v CMakeFiles/cmTC_8f2d1.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_8f2d1 -rdynamic
Using built-in specs.
COLLECT_GCC=/usr/bin/c++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
... ... @@ -252,8 +244,8 @@ Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12)
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_716a2' '-rdynamic' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper -plugin-opt=-fresolution=/tmp/cchAFKsB.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o cmTC_716a2 /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. CMakeFiles/cmTC_716a2.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/5/crtend.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o
COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_8f2d1' '-rdynamic' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper -plugin-opt=-fresolution=/tmp/ccgdzjsR.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o cmTC_8f2d1 /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. CMakeFiles/cmTC_8f2d1.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/5/crtend.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o
make[1]: Leaving directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp'
... ... @@ -261,14 +253,14 @@ Parsed CXX implicit link information from above output:
link line regex: [^( *|.*[/\])(ld|([^/\]+-)?ld|collect2)[^/\]*( |$)]
ignore line: [Change Dir: /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp]
ignore line: []
ignore line: [Run Build Command:"/usr/bin/make" "cmTC_716a2/fast"]
ignore line: [/usr/bin/make -f CMakeFiles/cmTC_716a2.dir/build.make CMakeFiles/cmTC_716a2.dir/build]
ignore line: [Run Build Command:"/usr/bin/make" "cmTC_8f2d1/fast"]
ignore line: [/usr/bin/make -f CMakeFiles/cmTC_8f2d1.dir/build.make CMakeFiles/cmTC_8f2d1.dir/build]
ignore line: [make[1]: Entering directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp']
ignore line: [Building CXX object CMakeFiles/cmTC_716a2.dir/CMakeCXXCompilerABI.cpp.o]
ignore line: [/usr/bin/c++ -o CMakeFiles/cmTC_716a2.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.5/Modules/CMakeCXXCompilerABI.cpp]
ignore line: [Linking CXX executable cmTC_716a2]
ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_716a2.dir/link.txt --verbose=1]
ignore line: [/usr/bin/c++ -v CMakeFiles/cmTC_716a2.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_716a2 -rdynamic ]
ignore line: [Building CXX object CMakeFiles/cmTC_8f2d1.dir/CMakeCXXCompilerABI.cpp.o]
ignore line: [/usr/bin/c++ -o CMakeFiles/cmTC_8f2d1.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.5/Modules/CMakeCXXCompilerABI.cpp]
ignore line: [Linking CXX executable cmTC_8f2d1]
ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_8f2d1.dir/link.txt --verbose=1]
ignore line: [/usr/bin/c++ -v CMakeFiles/cmTC_8f2d1.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_8f2d1 -rdynamic ]
ignore line: [Using built-in specs.]
ignore line: [COLLECT_GCC=/usr/bin/c++]
ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper]
... ... @@ -278,13 +270,13 @@ Parsed CXX implicit link information from above output:
ignore line: [gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12) ]
ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/]
ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../:/lib/:/usr/lib/]
ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_716a2' '-rdynamic' '-shared-libgcc' '-mtune=generic' '-march=x86-64']
link line: [ /usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper -plugin-opt=-fresolution=/tmp/cchAFKsB.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o cmTC_716a2 /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. CMakeFiles/cmTC_716a2.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/5/crtend.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o]
ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_8f2d1' '-rdynamic' '-shared-libgcc' '-mtune=generic' '-march=x86-64']
link line: [ /usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper -plugin-opt=-fresolution=/tmp/ccgdzjsR.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o cmTC_8f2d1 /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. CMakeFiles/cmTC_8f2d1.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/5/crtend.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o]
arg [/usr/lib/gcc/x86_64-linux-gnu/5/collect2] ==> ignore
arg [-plugin] ==> ignore
arg [/usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so] ==> ignore
arg [-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper] ==> ignore
arg [-plugin-opt=-fresolution=/tmp/cchAFKsB.res] ==> ignore
arg [-plugin-opt=-fresolution=/tmp/ccgdzjsR.res] ==> ignore
arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore
arg [-plugin-opt=-pass-through=-lgcc] ==> ignore
arg [-plugin-opt=-pass-through=-lc] ==> ignore
... ... @@ -302,7 +294,7 @@ Parsed CXX implicit link information from above output:
arg [/lib64/ld-linux-x86-64.so.2] ==> ignore
arg [-zrelro] ==> ignore
arg [-o] ==> ignore
arg [cmTC_716a2] ==> ignore
arg [cmTC_8f2d1] ==> ignore
arg [/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o] ==> ignore
arg [/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o] ==> ignore
arg [/usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o] ==> ignore
... ... @@ -314,7 +306,7 @@ Parsed CXX implicit link information from above output:
arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu]
arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib]
arg [-L/usr/lib/gcc/x86_64-linux-gnu/5/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/5/../../..]
arg [CMakeFiles/cmTC_716a2.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore
arg [CMakeFiles/cmTC_8f2d1.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore
arg [-lstdc++] ==> lib [stdc++]
arg [-lm] ==> lib [m]
arg [-lgcc_s] ==> lib [gcc_s]
... ... @@ -346,14 +338,14 @@ Parsed CXX implicit link information from above output:
Detecting CXX [-std=c++14] compiler features compiled with the following output:
Change Dir: /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_27bcf/fast"
/usr/bin/make -f CMakeFiles/cmTC_27bcf.dir/build.make CMakeFiles/cmTC_27bcf.dir/build
Run Build Command:"/usr/bin/make" "cmTC_84ac0/fast"
/usr/bin/make -f CMakeFiles/cmTC_84ac0.dir/build.make CMakeFiles/cmTC_84ac0.dir/build
make[1]: Entering directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_27bcf.dir/feature_tests.cxx.o
/usr/bin/c++ -std=c++14 -o CMakeFiles/cmTC_27bcf.dir/feature_tests.cxx.o -c /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/feature_tests.cxx
Linking CXX executable cmTC_27bcf
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_27bcf.dir/link.txt --verbose=1
/usr/bin/c++ CMakeFiles/cmTC_27bcf.dir/feature_tests.cxx.o -o cmTC_27bcf -rdynamic
Building CXX object CMakeFiles/cmTC_84ac0.dir/feature_tests.cxx.o
/usr/bin/c++ -std=c++14 -o CMakeFiles/cmTC_84ac0.dir/feature_tests.cxx.o -c /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/feature_tests.cxx
Linking CXX executable cmTC_84ac0
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_84ac0.dir/link.txt --verbose=1
/usr/bin/c++ CMakeFiles/cmTC_84ac0.dir/feature_tests.cxx.o -o cmTC_84ac0 -rdynamic
make[1]: Leaving directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp'
... ... @@ -419,14 +411,14 @@ make[1]: Leaving directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_
Detecting CXX [-std=c++11] compiler features compiled with the following output:
Change Dir: /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_3096b/fast"
/usr/bin/make -f CMakeFiles/cmTC_3096b.dir/build.make CMakeFiles/cmTC_3096b.dir/build
Run Build Command:"/usr/bin/make" "cmTC_2910d/fast"
/usr/bin/make -f CMakeFiles/cmTC_2910d.dir/build.make CMakeFiles/cmTC_2910d.dir/build
make[1]: Entering directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_3096b.dir/feature_tests.cxx.o
/usr/bin/c++ -std=c++11 -o CMakeFiles/cmTC_3096b.dir/feature_tests.cxx.o -c /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/feature_tests.cxx
Linking CXX executable cmTC_3096b
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_3096b.dir/link.txt --verbose=1
/usr/bin/c++ CMakeFiles/cmTC_3096b.dir/feature_tests.cxx.o -o cmTC_3096b -rdynamic
Building CXX object CMakeFiles/cmTC_2910d.dir/feature_tests.cxx.o
/usr/bin/c++ -std=c++11 -o CMakeFiles/cmTC_2910d.dir/feature_tests.cxx.o -c /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/feature_tests.cxx
Linking CXX executable cmTC_2910d
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_2910d.dir/link.txt --verbose=1
/usr/bin/c++ CMakeFiles/cmTC_2910d.dir/feature_tests.cxx.o -o cmTC_2910d -rdynamic
make[1]: Leaving directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp'
... ... @@ -492,14 +484,14 @@ make[1]: Leaving directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_
Detecting CXX [-std=c++98] compiler features compiled with the following output:
Change Dir: /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_ef2a5/fast"
/usr/bin/make -f CMakeFiles/cmTC_ef2a5.dir/build.make CMakeFiles/cmTC_ef2a5.dir/build
Run Build Command:"/usr/bin/make" "cmTC_7bf51/fast"
/usr/bin/make -f CMakeFiles/cmTC_7bf51.dir/build.make CMakeFiles/cmTC_7bf51.dir/build
make[1]: Entering directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_ef2a5.dir/feature_tests.cxx.o
/usr/bin/c++ -std=c++98 -o CMakeFiles/cmTC_ef2a5.dir/feature_tests.cxx.o -c /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/feature_tests.cxx
Linking CXX executable cmTC_ef2a5
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_ef2a5.dir/link.txt --verbose=1
/usr/bin/c++ CMakeFiles/cmTC_ef2a5.dir/feature_tests.cxx.o -o cmTC_ef2a5 -rdynamic
Building CXX object CMakeFiles/cmTC_7bf51.dir/feature_tests.cxx.o
/usr/bin/c++ -std=c++98 -o CMakeFiles/cmTC_7bf51.dir/feature_tests.cxx.o -c /mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/feature_tests.cxx
Linking CXX executable cmTC_7bf51
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_7bf51.dir/link.txt --verbose=1
/usr/bin/c++ CMakeFiles/cmTC_7bf51.dir/feature_tests.cxx.o -o cmTC_7bf51 -rdynamic
make[1]: Leaving directory '/mnt/hgfs/share/JZSDK_Linux/project_build/Attention_提示程序/build/CMakeFiles/CMakeTmp'
... ...
... ... @@ -1546,7 +1546,7 @@ bool DjiTest_CameraIsInited(void)
//手动添加 by ookk303
// 0空闲中 1录像中 2单拍中 3连拍中 4转码中
int DJI_CamEmu_base_CameraTransLock(int flag)
T_JZsdkReturnCode DJI_CamEmu_base_CameraTransLock(int flag)
{
switch (flag)
{
... ...
... ... @@ -30,6 +30,7 @@
/* Includes ------------------------------------------------------------------*/
#include "dji_typedef.h"
#include "dji_payload_camera.h"
#include "JZsdk_Base/JZsdk_Code/JZsdk_Code.h"
#ifdef __cplusplus
extern "C" {
... ... @@ -46,7 +47,7 @@ T_DjiReturnCode DjiTest_CameraGetOpticalZoomFactor(dji_f32_t *factor);
T_DjiReturnCode DjiTest_CameraGetMode(E_DjiCameraMode *mode);
T_DjiReturnCode DjiTest_CameraGetVideoStreamType(E_DjiCameraVideoStreamType *type);
bool DjiTest_CameraIsInited(void);
int DJI_CamEmu_base_CameraTransLock(int flag);
T_JZsdkReturnCode DJI_CamEmu_base_CameraTransLock(int flag);
#ifdef __cplusplus
}
... ...
... ... @@ -259,11 +259,6 @@ T_DjiReturnCode DjiTest_WidgetStartService(void)
{
snprintf(curFileDirPath, WIDGET_DIR_PATH_LEN_MAX, "%s/en",WIDGET_FILE_DIR);
}
// else
// {
// JZSDK_LOG_ERROR("控件加载错误");
// snprintf(curFileDirPath, WIDGET_DIR_PATH_LEN_MAX, "%s/cn",WIDGET_FILE_DIR);
// }
//检查是否存在开启测试的文件
if (JZsdk_check_file_exists("/root/ShakedownTest") == JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
... ... @@ -692,36 +687,34 @@ static T_JZsdkReturnCode Megphone_Widget(unsigned int index, unsigned int value)
break;
}
#ifdef GIMBAL_STATUS_ON
case 28://设置临时参数
{
Temp_GimbalCompensation_Flag = value;
break;
}
case 29://设置云台补偿
{
if (Temp_GimbalCompensation_Flag == 0)
{
Gimbal_Set_SingleCompensation(JZ_SINGLE_COMPENSATION_MODE_PITCH_LEFT, +5);
JZSDK_WidgetMgMT_ConrtrolInputTask(JZSDK_WIDGET_GIMBAL_SINGLE_COMPENSATION_LEFT, +5);
}
else if (Temp_GimbalCompensation_Flag == 1)
{
Gimbal_Set_SingleCompensation(JZ_SINGLE_COMPENSATION_MODE_PITCH_LEFT, -5);
JZSDK_WidgetMgMT_ConrtrolInputTask(JZSDK_WIDGET_GIMBAL_SINGLE_COMPENSATION_LEFT, -5);
}
else if (Temp_GimbalCompensation_Flag == 2)
{
Gimbal_Set_SingleCompensation(JZ_SINGLE_COMPENSATION_MODE_PITCH_RIGHT, +5);
JZSDK_WidgetMgMT_ConrtrolInputTask(JZSDK_WIDGET_GIMBAL_SINGLE_COMPENSATION_RIGHT, +5);
}
else if (Temp_GimbalCompensation_Flag == 3)
{
Gimbal_Set_SingleCompensation(JZ_SINGLE_COMPENSATION_MODE_PITCH_RIGHT, -5);
JZSDK_WidgetMgMT_ConrtrolInputTask(JZSDK_WIDGET_GIMBAL_SINGLE_COMPENSATION_RIGHT, -5);
}
break;
}
#ifdef GIMBAL_STATUS_ON
case 30://设置云台补偿
{
... ...
... ... @@ -87,8 +87,9 @@ T_DjiReturnCode DjiTest_XPortStartService(void)
}
limitAngle.upperLimit = 300;
//limitAngle.lowerLimit = -1000;
limitAngle.lowerLimit = -350;
//limitAngle.lowerLimit = -1000; //原本的下限角度
//limitAngle.lowerLimit = -350;
limitAngle.lowerLimit = -900;
djiStat = DjiXPort_SetLimitAngleSync(DJI_XPORT_LIMIT_ANGLE_CATEGORY_PITCH_JOINT_ANGLE, limitAngle);
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("set pitch joint angle limit angle for XPort error: 0x%08llX.", djiStat);
... ... @@ -96,8 +97,9 @@ T_DjiReturnCode DjiTest_XPortStartService(void)
}
limitAngle.upperLimit = 300;
limitAngle.lowerLimit = -800;
//limitAngle.lowerLimit = -800; //原版
//limitAngle.lowerLimit = -300;
limitAngle.lowerLimit = -900;
USER_LOG_INFO("Set euler angle limit of pitch axis, upperLimit %d, lowerLimit %d", limitAngle.upperLimit, limitAngle.lowerLimit);
djiStat = DjiXPort_SetLimitAngleSync(DJI_XPORT_LIMIT_ANGLE_CATEGORY_PITCH_EULER_ANGLE, limitAngle);
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
... ... @@ -120,20 +122,35 @@ T_DjiReturnCode DjiTest_XPortStartService(void)
return djiStat;
}
// //航向轴关节角
// if (aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO1) {
// limitAngle.upperLimit = 300;
// //limitAngle.lowerLimit = -900;
// limitAngle.lowerLimit = -300;
// } else if (aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO2) {
// //limitAngle.upperLimit = 900;
// limitAngle.upperLimit = 300;
// limitAngle.lowerLimit = -300;
// } else if (aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO3) {
// // limitAngle.upperLimit = 900;
// // limitAngle.lowerLimit = -900;
// limitAngle.upperLimit = 300;
// limitAngle.lowerLimit = -300;
// } else {
// USER_LOG_WARN("payload mount position is unknown.");
// return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
// }
//航向轴关节角
if (aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO1) {
limitAngle.upperLimit = 300;
//limitAngle.lowerLimit = -900;
limitAngle.lowerLimit = -300;
limitAngle.lowerLimit = -900;
} else if (aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO2) {
//limitAngle.upperLimit = 900;
limitAngle.upperLimit = 300;
limitAngle.upperLimit = 900;
limitAngle.lowerLimit = -300;
} else if (aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO3) {
// limitAngle.upperLimit = 900;
// limitAngle.lowerLimit = -900;
limitAngle.upperLimit = 300;
limitAngle.lowerLimit = -300;
limitAngle.upperLimit = 900;
limitAngle.lowerLimit = -900;
} else {
USER_LOG_WARN("payload mount position is unknown.");
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
... ...
/**
********************************************************************
* @file test_xport.c
* @brief
*
* @copyright (c) 2021 DJI. All rights reserved.
*
* All information contained herein is, and remains, the property of DJI.
* The intellectual and technical concepts contained herein are proprietary
* to DJI and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of DJI.
*
* If you receive this source code without 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 <dji_gimbal.h>
#include "test_payload_xport.h"
#include "dji_logger.h"
#include "dji_platform.h"
#include "utils/util_misc.h"
#include "dji_aircraft_info.h"
#include "camera_emu/test_payload_cam_emu_base.h"
/* Private constants ---------------------------------------------------------*/
#define XPORT_TASK_FREQ (10)
#define XPORT_TASK_STACK_SIZE (2048)
/* Private types -------------------------------------------------------------*/
/* Private functions declaration ---------------------------------------------*/
static void *UserXPort_Task(void *arg);
static T_DjiReturnCode ReceiveXPortSystemState(T_DjiGimbalSystemState systemState);
static T_DjiReturnCode ReceiveXPortAttitudeInformation(T_DjiGimbalAttitudeInformation attitudeInformation);
/* Private variables ---------------------------------------------------------*/
static T_DjiTaskHandle s_userXPortThread;
static T_DjiMutexHandle s_userXPortMutex;
static T_DjiGimbalSystemState s_userXPortSystemState = {0};
static bool s_isUserXPortInited = false;
static bool s_isUserXPortSystemStateVaild = false;
/* Exported functions definition ---------------------------------------------*/
T_DjiReturnCode DjiTest_XPortStartService(void)
{
T_DjiReturnCode djiStat;
T_DjiXPortLimitAngle limitAngle = {0};
T_DjiAircraftInfoBaseInfo aircraftInfoBaseInfo = {0};
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
djiStat = DjiXPort_Init();
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("XPort init error: 0x%08llX.", djiStat);
return djiStat;
}
s_isUserXPortInited = true;
djiStat = osalHandler->MutexCreate(&s_userXPortMutex);
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("user XPort mutex create error: 0x%08llX.", djiStat);
return djiStat;
}
djiStat = DjiXPort_RegReceiveSystemStateCallback(ReceiveXPortSystemState);
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("register receive XPort system state callback function error: 0x%08llX.", djiStat);
return djiStat;
}
djiStat = DjiXPort_RegReceiveAttitudeInformationCallback(ReceiveXPortAttitudeInformation);
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("register receive XPort attitude information callback function error: 0x%08llX.",
djiStat);
return djiStat;
}
limitAngle.upperLimit = 300;
//limitAngle.lowerLimit = -1000;
limitAngle.lowerLimit = -350;
djiStat = DjiXPort_SetLimitAngleSync(DJI_XPORT_LIMIT_ANGLE_CATEGORY_PITCH_JOINT_ANGLE, limitAngle);
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("set pitch joint angle limit angle for XPort error: 0x%08llX.", djiStat);
return djiStat;
}
limitAngle.upperLimit = 300;
limitAngle.lowerLimit = -800;
//limitAngle.lowerLimit = -300;
USER_LOG_INFO("Set euler angle limit of pitch axis, upperLimit %d, lowerLimit %d", limitAngle.upperLimit, limitAngle.lowerLimit);
djiStat = DjiXPort_SetLimitAngleSync(DJI_XPORT_LIMIT_ANGLE_CATEGORY_PITCH_EULER_ANGLE, limitAngle);
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("set pitch euler angle limit angle for XPort error: 0x%08llX.", djiStat);
return djiStat;
}
limitAngle.upperLimit = 300;
limitAngle.lowerLimit = -1000;
USER_LOG_INFO("Set extended euler angle limit of pitch axis, upperLimit %d, lowerLimit %d", limitAngle.upperLimit, limitAngle.lowerLimit);
djiStat = DjiXPort_SetLimitAngleSync(DJI_XPORT_LIMIT_ANGLE_CATEGORY_PITCH_EULER_ANGLE_EXTENSION, limitAngle);
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("set pitch extension euler angle limit angle for XPort error: 0x%08llX.", djiStat);
return djiStat;
}
djiStat = DjiAircraftInfo_GetBaseInfo(&aircraftInfoBaseInfo);
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("get aircraft base information error: 0x%08llX.", djiStat);
return djiStat;
}
//航向轴关节角
if (aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO1) {
limitAngle.upperLimit = 300;
//limitAngle.lowerLimit = -900;
limitAngle.lowerLimit = -300;
} else if (aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO2) {
//limitAngle.upperLimit = 900;
limitAngle.upperLimit = 300;
limitAngle.lowerLimit = -300;
} else if (aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO3) {
// limitAngle.upperLimit = 900;
// limitAngle.lowerLimit = -900;
limitAngle.upperLimit = 300;
limitAngle.lowerLimit = -300;
} else {
USER_LOG_WARN("payload mount position is unknown.");
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
}
djiStat = DjiXPort_SetLimitAngleSync(DJI_XPORT_LIMIT_ANGLE_CATEGORY_YAW_JOINT_ANGLE, limitAngle);
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("set yaw joint angle limit angle for XPort error: 0x%08llX.", djiStat);
return djiStat;
}
djiStat = DjiXPort_SetGimbalModeSync(DJI_GIMBAL_MODE_FREE);
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("set XPort gimbal mode error: 0x%08llX.", djiStat);
return djiStat;
}
djiStat = DjiXPort_ResetSync(DJI_GIMBAL_RESET_MODE_PITCH_AND_YAW);
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("reset XPort gimbal error: 0x%08llX.", djiStat);
return djiStat;
}
if (osalHandler->TaskCreate("user_xport_task", UserXPort_Task, XPORT_TASK_STACK_SIZE, NULL, &s_userXPortThread) !=
DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("user XPort task create error.");
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
}
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
T_DjiReturnCode DjiTest_XPortDeInit(void)
{
T_DjiReturnCode djiStat;
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
djiStat = osalHandler->TaskDestroy(s_userXPortThread);
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("Destroy test xport thread error: 0x%08llX.", djiStat);
return djiStat;
}
djiStat = osalHandler->MutexDestroy(s_userXPortMutex);
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("Destroy test xport mutex error: 0x%08llX.", djiStat);
return djiStat;
}
djiStat = DjiXPort_DeInit();
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("XPort de-init error: 0x%08llX.", djiStat);
return djiStat;
}
s_isUserXPortInited = false;
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
T_DjiReturnCode DjiTest_XPortGetSystemState(T_DjiGimbalSystemState *systemState)
{
T_DjiReturnCode returnCode;
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
if (s_isUserXPortInited != true || s_isUserXPortSystemStateVaild != true) {
USER_LOG_ERROR("user XPort has not inited.");
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
}
returnCode = osalHandler->MutexLock(s_userXPortMutex);
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("user XPort mutex lock error: 0x%08llX.", returnCode);
return returnCode;
}
memcpy(systemState, &s_userXPortSystemState, sizeof(T_DjiGimbalSystemState));
returnCode = osalHandler->MutexUnlock(s_userXPortMutex);
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("user XPort mutex unlock error: 0x%08llX.", returnCode);
return returnCode;
}
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
/* Private functions definition-----------------------------------------------*/
#ifndef __CC_ARM
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-noreturn"
#pragma GCC diagnostic ignored "-Wreturn-type"
#endif
static void *UserXPort_Task(void *arg)
{
T_DjiReturnCode djiStat;
T_DjiXPortLimitAngle limitAngle = {0};
float opticalZoomFactor = 1.0f;
float digitalZoomFactor = 1.0f;
int step = 0;
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
USER_UTIL_UNUSED(arg);
while (1) {
osalHandler->TaskSleepMs(1000 / XPORT_TASK_FREQ);
step++;
if (USER_UTIL_IS_WORK_TURN(step, 1, XPORT_TASK_FREQ)) {
djiStat = DjiXPort_GetLimitAngleSync(DJI_XPORT_LIMIT_ANGLE_CATEGORY_ROLL_JOINT_ANGLE, &limitAngle);
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("get roll joint angle limit angle from XPort error: 0x%08llX.", djiStat);
continue;
}
USER_LOG_DEBUG("roll joint angle limit angle of XPort: upper limit %d, lower limit %d.",
limitAngle.upperLimit, limitAngle.lowerLimit);
djiStat = DjiXPort_GetLimitAngleSync(DJI_XPORT_LIMIT_ANGLE_CATEGORY_PITCH_JOINT_ANGLE, &limitAngle);
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("get pitch joint angle limit angle from XPort error: 0x%08llX.", djiStat);
continue;
}
USER_LOG_DEBUG("pitch joint angle limit angle of XPort: upper limit %d, lower limit %d.",
limitAngle.upperLimit, limitAngle.lowerLimit);
djiStat = DjiXPort_GetLimitAngleSync(DJI_XPORT_LIMIT_ANGLE_CATEGORY_PITCH_EULER_ANGLE, &limitAngle);
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("get pitch euler angle limit angle from XPort error: 0x%08llX.", djiStat);
continue;
}
USER_LOG_DEBUG("pitch euler angle limit angle of XPort: upper limit %d, lower limit %d.",
limitAngle.upperLimit, limitAngle.lowerLimit);
djiStat = DjiXPort_GetLimitAngleSync(DJI_XPORT_LIMIT_ANGLE_CATEGORY_PITCH_EULER_ANGLE_EXTENSION,
&limitAngle);
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("get pitch extension euler angle limit angle from XPort error: 0x%08llX.",
djiStat);
continue;
}
USER_LOG_DEBUG("pitch extension euler angle limit angle of XPort: upper limit %d, lower limit %d.",
limitAngle.upperLimit, limitAngle.lowerLimit);
djiStat = DjiXPort_GetLimitAngleSync(DJI_XPORT_LIMIT_ANGLE_CATEGORY_YAW_JOINT_ANGLE, &limitAngle);
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("get yaw joint angle limit angle from XPort error: 0x%08llX.", djiStat);
continue;
}
USER_LOG_DEBUG("yaw joint angle limit angle of XPort: upper limit %d, lower limit %d.",
limitAngle.upperLimit, limitAngle.lowerLimit);
}
if (USER_UTIL_IS_WORK_TURN(step, 10, XPORT_TASK_FREQ)) {
if (DjiTest_CameraIsInited()) {
djiStat = DjiTest_CameraGetOpticalZoomFactor(&opticalZoomFactor);
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("get camera optical zoom factor error: %d.", djiStat);
continue;
}
djiStat = DjiTest_CameraGetDigitalZoomFactor(&digitalZoomFactor);
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("get camera digital zoom factor error: %d.", djiStat);
continue;
}
djiStat = DjiXPort_SetSpeedConversionFactor(1 / (opticalZoomFactor * digitalZoomFactor));
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("set speed conversion factor error: %d.", djiStat);
continue;
}
}
}
}
}
#ifndef __CC_ARM
#pragma GCC diagnostic pop
#endif
static T_DjiReturnCode ReceiveXPortSystemState(T_DjiGimbalSystemState systemState)
{
T_DjiReturnCode returnCode;
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
returnCode = osalHandler->MutexLock(s_userXPortMutex);
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("user XPort mutex lock error: 0x%08llX.", returnCode);
return returnCode;
}
s_isUserXPortSystemStateVaild = true;
memcpy(&s_userXPortSystemState, &systemState, sizeof(T_DjiGimbalSystemState));
returnCode = osalHandler->MutexUnlock(s_userXPortMutex);
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("user XPort mutex unlock error: 0x%08llX.", returnCode);
return returnCode;
}
USER_LOG_DEBUG("receive XPort system state: mounted upward flag %d, gimbal mode %d.",
systemState.mountedUpward, systemState.gimbalMode);
USER_LOG_DEBUG("XPort fine tune: %d %d %d.", systemState.fineTuneAngle.pitch,
systemState.fineTuneAngle.roll, systemState.fineTuneAngle.yaw);
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
static T_DjiReturnCode ReceiveXPortAttitudeInformation(T_DjiGimbalAttitudeInformation attitudeInformation)
{
USER_LOG_DEBUG("receive XPort attitude information:");
USER_LOG_DEBUG("XPort attitude: pitch %d, roll %d, yaw %d.", attitudeInformation.attitude.pitch,
attitudeInformation.attitude.roll, attitudeInformation.attitude.yaw);
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/
... ... @@ -69,10 +69,12 @@ extern "C" {
#if (DEVICE_VERSION == JZ_H1T || DEVICE_VERSION == JZ_H1E || DEVICE_VERSION == JZ_U3|| DEVICE_VERSION == JZ_U3S || DEVICE_VERSION == JZ_U3D || DEVICE_VERSION == JZ_U30)
#define USER_BAUD_RATE "921600"
#elif (DEVICE_VERSION == JZ_H150S || DEVICE_VERSION == JZ_H150T || DEVICE_VERSION == JZ_H10 || DEVICE_VERSION == JZ_C1 || DEVICE_VERSION == JZ_ST)
#elif (DEVICE_VERSION == JZ_H150S || DEVICE_VERSION == JZ_H150T || DEVICE_VERSION == JZ_H10 || DEVICE_VERSION == JZ_C1 || DEVICE_VERSION == JZ_ST || DEVICE_VERSION == JZ_H150A)
#define USER_BAUD_RATE "230400"
#elif (DEVICE_VERSION == JZ_H10T)
#define USER_BAUD_RATE "115200"
#else
#define USER_BAUD_RATE "115200"
#endif
#endif
... ...
... ... @@ -45,8 +45,7 @@ extern "C" {
* */
#if (DEVICE_VERSION == JZ_H150S) || (DEVICE_VERSION == JZ_H150T) || (DEVICE_VERSION == JZ_C1) || (DEVICE_VERSION == JZ_ST)
//#define CONFIG_HARDWARE_CONNECTION DJI_USE_UART_AND_NETWORK_DEVICE
#define CONFIG_HARDWARE_CONNECTION DJI_USE_ONLY_NETWORK
#define CONFIG_HARDWARE_CONNECTION DJI_USE_UART_AND_NETWORK_DEVICE
#elif (DEVICE_VERSION == JZ_U3 && ALLWINNER_CEDAR == VERSION_SWITCH_ON)
#define CONFIG_HARDWARE_CONNECTION DJI_USE_UART_AND_NETWORK_DEVICE
// #elif (DEVICE_VERSION == JZ_H10 && SPECIAL_VERSION == SPECIAL_H10_M300)
... ...
... ... @@ -193,6 +193,9 @@ int main(int argc, char *argv[])
USER_LOG_INFO("DjiAircraftInfo_GetBaseInfo");
//设置飞机信息
JZsdk_PlaneInfo_Set((E_JZ_SPECIAL_PLANE_INFO)(aircraftInfoBaseInfo.aircraftType));
//m30和m30t有滤波锁
if (aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30 || aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30T)
{
... ... @@ -300,6 +303,14 @@ int main(int argc, char *argv[])
{
memcpy(psdk_name, "U340_OGI", sizeof("U340_OGI"));
}
else if (DEVICE_VERSION == JZ_T40)
{
memcpy(psdk_name, "JZ_T40", sizeof("JZ_T40"));
}
else if (DEVICE_VERSION == JZ_H150A)
{
memcpy(psdk_name, "JZ_H150A", sizeof("JZ_H150A"));
}
else
{
memcpy(psdk_name, "测试型号", sizeof("测试型号"));
... ... @@ -793,6 +804,13 @@ static T_DjiReturnCode DjiUser_PrepareSystemEnvironment(void)
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
}
//Attention: if you want to use camera stream view function, please uncomment it.
returnCode = DjiPlatform_RegSocketHandler(&socketHandler);
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
printf("register osal socket handler error");
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
}
#endif
returnCode = DjiPlatform_RegFileSystemHandler(&fileSystemHandler);
... ...
# Ziyan Payload SDK (PSDK)
## What is the Ziyan Payload SDK?
The ziyan Payload SDK(PSDK), is a development kit provided by ziyan to support developers to develop payload that can be mounted on ziyan aircraft. developers can obtain the information or other resource from the aircraft. According to the software logic and algorithm framework designed by the developer, users could develop payload that can be mounted on ziyan aircraft, to perform actions they need, such as Automated Flight Controller, Payload Controller, Video Image Analysis Platform, Mapping Camera, Megaphone And Searchlight, etc.
## Latest Release
The latest release version of PSDK is 1.0.0.0 This version of Payload SDK mainly first release. Please refer to the release notes for detailed changes list.
## License
Payload SDK codebase is MIT-licensed. Please refer to the LICENSE file for detailed information.
... ...
# Ziyan Payload SDK Release Log
## V1.1.1.0-20250721-Release
**[Note]**:
* Refactored the camera range finder handler and separated it into an independent interface.
* Introduced a new camera API to support the camera tracker.
* Resolved several known issues.
**[Added]**:
* Added support for the camera tracker feature. Introduced new APIs for controlling the camera tracker integrated with the payload camera, and exposed additional tracking status feedback data.
* Separated the camera range finder into a dedicated interface to improve modularity.
**[Optimized]**:
* Optimized the video streaming transmission mechanism for improved efficiency and stability.
* Enhanced core task monitoring by periodically reporting tasks with abnormal execution time, ensuring stable and reliable system behavior.
**[Fixed]**:
* Fixed an issue where the widget module ignored items with an index greater than 256.
----
## V1.1.0.0-20250620-Release
**[Note]**:
* Introduced a new self-checking mechanism.
* Fixed several known issues.
**[Added]**:
* Added support for the self-checking mechanism. Users will now be prompted to update their PSPK version in the event of communication or version mismatches.
* Added support for the I2C communication protocol.
**[Optimized]**:
* Optimized the widget configuration file loading method. UAVs can now load configuration files dynamically.
* Optimized the speaker module to improve real-time speaker and TTS (text-to-speech) transmission logic.
* Refined the core initialization logic.
**[Fixed]**:
* Fixed an issue where the widget module occasionally failed to load the configuration file, causing the Ziyan app to not display payload widget information.
* Fixed an issue where log timestamps were displayed abnormally.
---
## V1.0.0.4-20250603-Release
**[Note]**:
* Added new module.
* Fixed some known issues.
**[Added]**:
* Add support for the speaker module.
**[Optimized]**:
* Optimize the core initialization process and provide more log information to support developers in quickly identifying the cause of exceptions during the adaptation process.
**[Fixed]**:
* Fix issues that may cause abnormal program termination in specific communication scenarios.
* Fix the issue of strong coupling between the sample program and the system environment
---
## V1.0.0.3-20250429-Release
**[Note]**:
To support more camera expansion features, Add new camera API. Fixed some known issues.
**[Added]**:
* Adjust the feedback frequency of the camera status, support the remote control to refresh data at a higher frequency, and ensure real-time display.
* Add diverse debugging options
**[Fixed]**:
* Fix the dependency of the sample program and run the samples based on the computer system environment where they were compiled.
---
## V1.0.0.2-20250401-Release
**[Note]**:
To support more camera expansion features, Add new camera API. Fixed some known issues.
**[Added]**:
* Add API which used to get obtain camera calculation position.
* Add API which used to control the camera tracker integrated into the payload camera.
**[Fixed]**:
* Fix the issue that the camera status is not updated when the camera has connected.
* Fix occasional screen distortion in camera videos
---
## V1.0.0.1-20250310-Release
**[Note]**:
To support more camera expansion features, Add new camera API. Fixed some known issues.
**[Added]**:
* Add API which used to control the range finder integrated into the payload camera.
---
## V1.0.0.0-20250306-Release
**[Note]**:
This version of Payload SDK mainly first release. Please refer to the release notes for detailed changes list.
**[Added]**:
* Added support for gimbal functionality
* Added support for basic camera functionality
* Added support for widget functionality
* Added support for subscription functionality
---
... ...
... ... @@ -182,12 +182,42 @@ typedef struct {
} T_ZiyanCameraSystemState;
/**
* @brief Camera tracking target state.
*/
typedef enum {
ZIYAN_CAMERA_TRACKING_TARGET_STATUS_READY = 0,
ZIYAN_CAMERA_TRACKING_TARGET_STATUS_FAILED = 1,
ZIYAN_CAMERA_TRACKING_TARGET_STATUS_TRACKING = 2,
ZIYAN_CAMERA_TRACKING_TARGET_STATUS_LOST = 3,
} E_ZiyanCameraTrackingTargetState;
/**
* @brief Camera tracking state.
*/
typedef struct {
bool isTraking; /*!< Specifies if the camera is in tracking status. This parameter is boolean type. */
T_ZiyanCameraPointInScreen targetPoint;
T_ZiyanLocation targetLocation;
E_ZiyanCameraTrackingTargetState status; /*!< Specifies track the status of the target, #E_ZiyanCameraTrackingTargetState. */
float startX; /*!< Specifies the ratio of the x-coordinate of the starting point to the maximum horizontal pixel, This parameter is float type. */
float startY; /*!< Specifies the ratio of the y-coordinate of the starting point to the maximum vertical pixel, This parameter is float type. */
float endX; /*!< Specifies the ratio of the x-coordinate of the endpoint to the maximum horizontal pixel, This parameter is float type. */
float endY; /*!< Specifies the ratio of the y-coordinate of the endpoint to the maximum vertical pixel, This parameter is float type. */
float centerX;/*!< Specifies the x-coordinate of the center point of the tracked target, This parameter is float type. */
float centerY;/*!< Specifies the y-coordinate of the center point of the tracked target, This parameter is float type. */
double longitude; /*!< Specifies track the longitude of the center of the target object, This parameter is double type. */
double latitude; /*!< Specifies track the latitude of the center of the target object, This parameter is double type. */
double altitude; /*!< Specifies track the altitude of the center of the target object, This parameter is double type. unit: m*/
float coorN; /*!< Specifies tracking the northbound velocity of the target object center in the WGS-84 coordinate system, This parameter is float type. */
float coorE; /*!< Specifies tracking the eastward velocity of the center of the target object in the WGS-84 coordinate system, This parameter is float type. */
float coorD; /*!< Specifies tracking the radial velocity of the center of the target object in the WGS-84 coordinate system, This parameter is float type. */
float bodyX; /*!< Specifies tracking the velocity of the center of the target object in the x-axis direction of the body coordinates, This parameter is float type. */
float bodyY; /*!< Specifies tracking the velocity of the center of the target object in the y-axis direction of the body coordinates, This parameter is float type. */
float bodyZ; /*!< Specifies tracking the velocity of the center of the target object in the z-axis direction of the body coordinates, This parameter is float type. */
char targetName[17]; /*!< Specifies target recognition name for tracking, This parameter is string type. */
int confidence; /*!< Specifies confidence level of tracked targets, This parameter is int type. */
char targetType[17]; /*!< Specifies the type name of the tracked target, This parameter is string type. */
/* The following variables will be deprecated! */
bool isTraking; /*!< Deprecated! Specifies if the camera is in tracking status. This parameter is boolean type. */
T_ZiyanCameraPointInScreen targetPoint; /*!< Deprecated! */
T_ZiyanLocation targetLocation; /*!< Deprecated! */
} T_ZiyanCameraTrackState;
/**
... ... @@ -736,7 +766,7 @@ typedef struct {
/**
* @brief Prototype of handler functions for Extend function.
* @brief Prototype of handler functions for Range finder function.
* @note User can not execute blocking style operations or functions in callback function, like ziyanXPort_RotateSync()
* function, because that will block ziyan root thread, causing problems such as slow system response, payload
* disconnection or infinite loop.
... ... @@ -777,7 +807,15 @@ typedef struct {
* @return Execution result.
*/
T_ZiyanReturnCode (*GetRangeFinderLocation)(T_ZiyanLocation* location);
} T_ZiyanCameraRangeFinderHandler;
/**
* @brief Prototype of handler functions for Tracking function.
* @note User can not execute blocking style operations or functions in callback function, like ziyanXPort_RotateSync()
* function, because that will block ziyan root thread, causing problems such as slow system response, payload
* disconnection or infinite loop.
*/
typedef struct {
/**
* @brief Prototype of callback function used to track target.
* @details User can select desired target by tap screen or manual draw a bounding box, this callback function
... ... @@ -786,7 +824,16 @@ typedef struct {
* @param target_end: end point of target. Range: 0 to 1.
* @return Execution result.
*/
T_ZiyanReturnCode (*TrackTarget)(T_ZiyanCameraPointInScreen target_begin, T_ZiyanCameraPointInScreen target_end);
T_ZiyanReturnCode (*TrackTarget)(T_ZiyanCameraPointInScreen targetBegin, T_ZiyanCameraPointInScreen targetEnd);
/**
* @brief Prototype of callback function used to track target.
* @details Users can input the target recognition name, this callback function
* will be called when User select target on the application or GSDK.
* @param targetName: Target recognition name.
* @return Execution result.
*/
T_ZiyanReturnCode (*TrackTargetByName)(const char *targetName);
/**
* @brief Prototype of callback function used to stop track target.
... ... @@ -804,7 +851,7 @@ typedef struct {
*/
T_ZiyanReturnCode (*GetTrackState)(T_ZiyanCameraTrackState* state);
} T_ZiyanCameraExtendHandler;
} T_ZiyanCameraTrackingHandler;
/* Exported functions --------------------------------------------------------*/
/**
... ... @@ -878,14 +925,24 @@ T_ZiyanReturnCode ZiyanPayloadCamera_RegOpticalZoomHandler(const T_ZiyanCameraOp
T_ZiyanReturnCode ZiyanPayloadCamera_RegTapZoomHandler(const T_ZiyanCameraTapZoomHandler *cameraTapZoomHandler);
/**
* @brief Register the handler for payload camera extend function interfaces.
* @note This interface registers the camera's extend interface, which includes setting and acquiring the range finder
* @brief Register the handler for payload camera range finder function interfaces.
* @note This interface registers the camera's range finder interface, which includes setting and acquiring the range finder
* switch. Registering the load on this interface requires support for range finder. Registration of this interface
* needs to be after ZiyanPayloadCamera_Init.
* @param cameraExtendHandler: pointer to the handler for payload camera extend functions.
* @param cameraRangeFinderHandler: pointer to the handler for payload camera range finder functions.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanPayloadCamera_RegRangeFinderHandler(const T_ZiyanCameraRangeFinderHandler *cameraRangeFinderHandler);
/**
* @brief Register the handler for payload camera tracking function interfaces.
* @note This interface registers the camera's tracking interface, which includes setting and acquiring the tracking
* switch. Registering the load on this interface requires support for tracking. Registration of this interface
* needs to be after ZiyanPayloadCamera_Init.
* @param cameraTrackingHandler: pointer to the handler for payload camera tracking functions.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanPayloadCamera_RegExtendHandler(const T_ZiyanCameraExtendHandler *cameraExtendHandler);
T_ZiyanReturnCode ZiyanPayloadCamera_RegTrackingHandler(const T_ZiyanCameraTrackingHandler *cameraTrackingHandler);
/**
* @brief Set the type of camera video stream.
... ...
... ... @@ -53,6 +53,11 @@ typedef void *T_ZiyanUsbBulkHandle;
typedef void *T_ZiyanNetworkHandle;
/**
* @brief Platform handle of i2c device operation.
*/
typedef void *T_ZiyanI2cHandle;
/**
* @brief Platform handle of thread task operation.
*/
typedef void *T_ZiyanTaskHandle;
... ... @@ -195,6 +200,23 @@ typedef struct {
} T_ZiyanHalNetworkHandler;
typedef struct {
uint32_t i2cSpeed;
uint16_t devAddress;
} T_ZiyanHalI2cConfig;
typedef struct {
T_ZiyanReturnCode (*I2cInit)(T_ZiyanHalI2cConfig i2cConfig, T_ZiyanI2cHandle *i2cHandle);
T_ZiyanReturnCode (*I2cDeInit)(T_ZiyanI2cHandle *i2cHandle);
T_ZiyanReturnCode (*I2cWriteData)(T_ZiyanI2cHandle *i2cHandle, uint16_t devAddress, const uint8_t *buf,
uint32_t len, uint32_t *realLen);
T_ZiyanReturnCode (*I2cReadData)(T_ZiyanI2cHandle *i2cHandle, uint16_t devAddress, uint8_t *buf,
uint32_t len, uint32_t *realLen);
} T_ZiyanHalI2cHandler;
typedef struct {
T_ZiyanReturnCode (*TaskCreate)(const char *name, void *(*taskFunc)(void *),
uint32_t stackSize, void *arg, T_ZiyanTaskHandle *task);
... ... @@ -320,6 +342,19 @@ T_ZiyanReturnCode ZiyanPlatform_RegHalUsbBulkHandler(const T_ZiyanHalUsbBulkHand
T_ZiyanReturnCode ZiyanPlatform_RegHalNetworkHandler(const T_ZiyanHalNetworkHandler *halNetworkHandler);
/**
* @brief Register the handler for hal i2c master mode interfaces by your platform.
* @note It should be noted that the interface in hal is written and tested well. Users need to implement all the
* interfaces. Otherwise, the user interface cannot be successfully registered, and then the user interface is registered
* through the interface. If the registration fails, it needs to be based on the return code. To judge the problem. Make
* sure that the feature is available after a successful registration.
* @attention The interface needs to be called at the beginning of the application for registration, otherwise, the
* subsequent functions will not work properly.
* @param halI2cHandler: pointer to the handler for hal i2c handler interfaces by your platform.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanPlatform_RegHalI2cHandler(const T_ZiyanHalI2cHandler *halI2cHandler);
/**
* @brief Register the handler for osal interfaces by your platform.
* @note It should be noted that the interface in osal is written and tested well. Users need to implement all the
* interfaces. Otherwise, the user interface cannot be successfully registered, and then the user interface is registered
... ...
... ... @@ -34,9 +34,9 @@ extern "C" {
/* Exported constants --------------------------------------------------------*/
#define ZIYAN_SDK_VERSION_MAJOR 1 /*!< ZIYAN SDK major version num, when have incompatible API changes. Range from 0 to 99. */
#define ZIYAN_SDK_VERSION_MINOR 0 /*!< ZIYAN SDK minor version num, when add functionality in a backwards compatible manner changes. Range from 0 to 99. */
#define ZIYAN_SDK_VERSION_MODIFY 0 /*!< ZIYAN SDK modify version num, when have backwards compatible bug fixes changes. Range from 0 to 99. */
#define ZIYAN_SDK_VERSION_DEBUG 4 /*!< ZIYAN SDK version beta info, release version will be 0, when beta version release changes. Range from 0 to 255. */
#define ZIYAN_SDK_VERSION_MINOR 1 /*!< ZIYAN SDK minor version num, when add functionality in a backwards compatible manner changes. Range from 0 to 99. */
#define ZIYAN_SDK_VERSION_MODIFY 1 /*!< ZIYAN SDK modify version num, when have backwards compatible bug fixes changes. Range from 0 to 99. */
#define ZIYAN_SDK_VERSION_DEBUG 0 /*!< ZIYAN SDK version beta info, release version will be 0, when beta version release changes. Range from 0 to 255. */
#define ZIYAN_SDK_VERSION_BUILD 1 /*!< ZIYAN SDK version build info, when jenkins trigger build changes. Range from 0 to 65535. */
/* Exported types ------------------------------------------------------------*/
... ...
... ... @@ -81,7 +81,7 @@ static T_ZiyanCameraFocusHandler s_focusHandler;
static T_ZiyanCameraDigitalZoomHandler s_digitalZoomHandler;
static T_ZiyanCameraOpticalZoomHandler s_opticalZoomHandler;
static T_ZiyanCameraTapZoomHandler s_tapZoomHandler;
static T_ZiyanCameraExtendHandler s_extendHander;
static T_ZiyanCameraRangeFinderHandler s_rangeFinderHander;
static T_ZiyanTaskHandle s_userCameraThread;
... ... @@ -181,1140 +181,12 @@ static void *UserCamera_Task(void *arg);
/* Private functions definition-----------------------------------------------*/
#if 0
/**************************************************************************************************/
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#define VIDEO_STREAM_INDEX 0 // 视频流索引,假设为 0
#define BUFFER_SIZE 4096 // 每个帧的缓冲区大小
// void* push_video_stream(void* arg)
// {
// AVFormatContext *format_ctx = NULL;
// AVCodecContext *codec_ctx = NULL;
// AVCodec *codec = NULL;
// AVPacket packet;
// int video_stream_index = -1;
// const char* filename = "/home/levi/Videos/test.mp4";
// USER_UTIL_UNUSED(arg);
// // 初始化 FFmpeg 库
// av_register_all();
// avformat_network_init();
// // 打开输入文件
// if (avformat_open_input(&format_ctx, filename, NULL, NULL) < 0) {
// fprintf(stderr, "Could not open file: %s\n", filename);
// return;
// }
// // 获取文件信息
// if (avformat_find_stream_info(format_ctx, NULL) < 0) {
// fprintf(stderr, "Could not find stream information\n");
// return;
// }
// // 查找视频流
// for (int i = 0; i < format_ctx->nb_streams; i++) {
// if (format_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
// video_stream_index = i;
// break;
// }
// }
// if (video_stream_index == -1) {
// fprintf(stderr, "No video stream found in file\n");
// return;
// }
// // 获取视频流的解码器
// codec = avcodec_find_decoder(format_ctx->streams[video_stream_index]->codecpar->codec_id);
// if (!codec) {
// fprintf(stderr, "Codec not found\n");
// return;
// }
// // 创建解码器上下文
// codec_ctx = avcodec_alloc_context3(codec);
// if (!codec_ctx) {
// fprintf(stderr, "Could not allocate codec context\n");
// return;
// }
// // 初始化解码器上下文
// if (avcodec_parameters_to_context(codec_ctx, format_ctx->streams[video_stream_index]->codecpar) < 0) {
// fprintf(stderr, "Could not copy codec parameters to context\n");
// return;
// }
// // 打开解码器
// if (avcodec_open2(codec_ctx, codec, NULL) < 0) {
// fprintf(stderr, "Could not open codec\n");
// return;
// }
// // 读取视频数据包并推送每个视频帧
// av_init_packet(&packet);
// while (av_read_frame(format_ctx, &packet) >= 0) {
// if (packet.stream_index == video_stream_index) {
// // 发送每一帧数据到 ZiyanPayloadCamera_SendVideoStream
// T_ZiyanReturnCode ret = ZiyanPayloadCamera_SendVideoStream(packet.data, packet.size);
// usleep(1000 * 100);
// if (ret != 0) {
// printf("Failed to send video stream\n");
// }
// }
// // 释放数据包
// av_packet_unref(&packet);
// }
// // 释放资源
// avcodec_free_context(&codec_ctx);
// avformat_close_input(&format_ctx);
// }
#define UDP_STREAM_URL "udp://127.0.0.1:9600?pkt_size=1316"
// #define UDP_STREAM_URL "udp://192.168.3.74:9600"
// #define UDP_STREAM_URL "udp://127.0.0.1:9600"
void* push_video_stream(void* arg)
{
const char *input_file = "/home/levi/Videos/test.mp4";
AVFormatContext *ifmt_ctx = NULL, *ofmt_ctx = NULL;
AVOutputFormat *ofmt = NULL;
AVPacket pkt;
int ret, stream_index = 0;
int *stream_mapping = NULL;
int stream_mapping_size = 0;
// 初始化libavformat并注册所有的muxers, demuxers和protocols
av_register_all();
avformat_network_init();
// 打开输入文件
if ((ret = avformat_open_input(&ifmt_ctx, input_file, NULL, NULL)) < 0) {
fprintf(stderr, "Could not open input file '%s'\n", input_file);
goto end;
}
// 获取流信息
if ((ret = avformat_find_stream_info(ifmt_ctx, NULL)) < 0) {
fprintf(stderr, "Failed to retrieve input stream information\n");
goto end;
}
// 打印输入文件信息
av_dump_format(ifmt_ctx, 0, input_file, 0);
// 分配输出上下文,并显式指定输出格式为mpegts
ofmt = av_guess_format("mpegts", NULL, NULL);
if (!ofmt) {
fprintf(stderr, "Could not find MPEG-TS output format\n");
ret = AVERROR_UNKNOWN;
goto end;
}
ofmt_ctx = avformat_alloc_context();
if (!ofmt_ctx) {
fprintf(stderr, "Could not create output context\n");
ret = AVERROR_UNKNOWN;
goto end;
}
ofmt_ctx->oformat = ofmt;
// 设置输出URL
snprintf(ofmt_ctx->filename, sizeof(ofmt_ctx->filename), "%s", UDP_STREAM_URL);
// 映射输入流到输出流
stream_mapping_size = ifmt_ctx->nb_streams;
stream_mapping = av_mallocz_array(stream_mapping_size, sizeof(*stream_mapping));
if (!stream_mapping) {
ret = AVERROR(ENOMEM);
goto end;
}
for (int i = 0; i < ifmt_ctx->nb_streams; i++) {
AVStream *out_stream;
AVStream *in_stream = ifmt_ctx->streams[i];
AVCodecParameters *in_codecpar = in_stream->codecpar;
if (in_codecpar->codec_type != AVMEDIA_TYPE_VIDEO) {
stream_mapping[i] = -1;
continue;
}
stream_mapping[i] = stream_index++;
out_stream = avformat_new_stream(ofmt_ctx, NULL);
if (!out_stream) {
fprintf(stderr, "Failed allocating output stream\n");
ret = AVERROR_UNKNOWN;
goto end;
}
ret = avcodec_parameters_copy(out_stream->codecpar, in_codecpar);
if (ret < 0) {
fprintf(stderr, "Failed to copy codec parameters\n");
goto end;
}
out_stream->codecpar->codec_tag = 0;
}
// 打印输出格式信息
av_dump_format(ofmt_ctx, 0, UDP_STREAM_URL, 1);
// 打开输出URL
if (!(ofmt->flags & AVFMT_NOFILE)) {
ret = avio_open(&ofmt_ctx->pb, UDP_STREAM_URL, AVIO_FLAG_WRITE);
if (ret < 0) {
fprintf(stderr, "Could not open output URL '%s'\n", UDP_STREAM_URL);
goto end;
}
}
// 写文件头
ret = avformat_write_header(ofmt_ctx, NULL);
if (ret < 0) {
fprintf(stderr, "Error occurred when opening output URL\n");
goto end;
}
// 读取并写入数据包
while (1) {
AVStream *in_stream, *out_stream;
ret = av_read_frame(ifmt_ctx, &pkt);
if (ret < 0)
break;
in_stream = ifmt_ctx->streams[pkt.stream_index];
if (pkt.stream_index >= stream_mapping_size ||
stream_mapping[pkt.stream_index] < 0) {
av_packet_unref(&pkt);
continue;
}
pkt.stream_index = stream_mapping[pkt.stream_index];
out_stream = ofmt_ctx->streams[pkt.stream_index];
// 复制packet
pkt.pts = av_rescale_q_rnd(pkt.pts, in_stream->time_base, out_stream->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
pkt.dts = av_rescale_q_rnd(pkt.dts, in_stream->time_base, out_stream->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
pkt.duration = av_rescale_q(pkt.duration, in_stream->time_base, out_stream->time_base);
pkt.pos = -1;
// T_ZiyanReturnCode ret = ZiyanPayloadCamera_SendVideoStream(pkt.data, pkt.size);
// 写packet
ret = av_interleaved_write_frame(ofmt_ctx, &pkt);
if (ret < 0) {
fprintf(stderr, "Error muxing packet\n");
break;
}
av_packet_unref(&pkt);
usleep(1000*34);
}
// 写文件尾
av_write_trailer(ofmt_ctx);
end:
avformat_close_input(&ifmt_ctx);
if (ofmt_ctx && !(ofmt->flags & AVFMT_NOFILE))
avio_closep(&ofmt_ctx->pb);
avformat_free_context(ofmt_ctx);
av_freep(&stream_mapping);
if (ret < 0 && ret != AVERROR_EOF) {
fprintf(stderr, "Error occurred: %s\n", av_err2str(ret));
return 1;
}
return 0;
}
void* push_video_stream1(void* arg)
{
const char *input_file = "/home/levi/Videos/test.mp4";
AVFormatContext *ifmt_ctx = NULL;
AVPacket pkt;
int ret;
// 初始化libavformat并注册所有的muxers, demuxers和protocols
av_register_all();
avformat_network_init();
// 打开输入文件
if ((ret = avformat_open_input(&ifmt_ctx, input_file, NULL, NULL)) < 0) {
fprintf(stderr, "Could not open input file '%s'\n", input_file);
goto end;
}
// 获取流信息
if ((ret = avformat_find_stream_info(ifmt_ctx, NULL)) < 0) {
fprintf(stderr, "Failed to retrieve input stream information\n");
goto end;
}
// 打印输入文件信息
av_dump_format(ifmt_ctx, 0, input_file, 0);
// 查找视频流
int video_stream_index = -1;
for (int i = 0; i < ifmt_ctx->nb_streams; i++) {
if (ifmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
video_stream_index = i;
break;
}
}
if (video_stream_index == -1) {
fprintf(stderr, "No video stream found in input file\n");
ret = AVERROR_UNKNOWN;
goto end;
}
// 读取并发送H.264帧
while (1) {
ret = av_read_frame(ifmt_ctx, &pkt);
if (ret < 0)
break;
// 只处理视频流
if (pkt.stream_index == video_stream_index) {
// 调用发送函数发送H.264帧
ZiyanPayloadCamera_SendVideoStream(pkt.data, pkt.size);
}
usleep(1000*34);
av_packet_unref(&pkt);
}
end:
avformat_close_input(&ifmt_ctx);
if (ret < 0 && ret != AVERROR_EOF) {
fprintf(stderr, "Error occurred: %s\n", av_err2str(ret));
return 1;
}
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libavutil/avutil.h>
#include <libavutil/opt.h>
// #define DEST_IP "127.0.0.1"
#define DEST_IP "127.0.0.1"
#define DEST_PORT 9600
void* push_video_stream2(void* arg)
{
const char *input_file = "/home/levi/Videos/test.mp4";
AVFormatContext *format_ctx = NULL;
AVCodecContext *codec_ctx = NULL;
AVStream *video_stream = NULL;
AVPacket packet;
int ret, video_stream_index;
// 初始化 FFmpeg 库
av_register_all();
avformat_network_init();
// 打开输入文件
ret = avformat_open_input(&format_ctx, input_file, NULL, NULL);
if (ret < 0) {
fprintf(stderr, "Could not open input file '%s'\n", input_file);
return ret;
}
// 获取文件信息
ret = avformat_find_stream_info(format_ctx, NULL);
if (ret < 0) {
fprintf(stderr, "Could not find stream information\n");
return ret;
}
// 查找视频流
video_stream_index = -1;
for (int i = 0; i < format_ctx->nb_streams; i++) {
if (format_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
video_stream_index = i;
video_stream = format_ctx->streams[i];
break;
}
}
if (video_stream_index == -1) {
fprintf(stderr, "No video stream found\n");
return -1;
}
// 获取视频流的解码器
AVCodec *codec = avcodec_find_decoder(video_stream->codecpar->codec_id);
if (!codec) {
fprintf(stderr, "Codec not found\n");
return -1;
}
codec_ctx = avcodec_alloc_context3(codec);
if (!codec_ctx) {
fprintf(stderr, "Could not allocate codec context\n");
return -1;
}
ret = avcodec_parameters_to_context(codec_ctx, video_stream->codecpar);
if (ret < 0) {
fprintf(stderr, "Could not copy codec parameters\n");
return ret;
}
ret = avcodec_open2(codec_ctx, codec, NULL);
if (ret < 0) {
fprintf(stderr, "Could not open codec\n");
return ret;
}
// 设置 UDP socket
int sockfd = socket(AF_INET, SOCK_DGRAM, 0);
if (sockfd < 0) {
perror("Socket creation failed");
return -1;
}
struct sockaddr_in dest_addr;
memset(&dest_addr, 0, sizeof(dest_addr));
dest_addr.sin_family = AF_INET;
dest_addr.sin_port = htons(DEST_PORT);
ret = inet_pton(AF_INET, DEST_IP, &dest_addr.sin_addr);
if (ret <= 0) {
fprintf(stderr, "Invalid destination IP address\n");
return -1;
}
// 解码并发送数据
av_init_packet(&packet);
while (1) {
ret = av_read_frame(format_ctx, &packet);
if (ret < 0) {
break;
}
if (packet.stream_index == video_stream_index) {
// 这里发送的是解码后的裸流数据
ret = sendto(sockfd, packet.data, packet.size, 0, (struct sockaddr *)&dest_addr, sizeof(dest_addr));
if (ret < 0) {
perror("Sendto failed");
break;
}
}
usleep(1000*34);
av_packet_unref(&packet);
}
// 清理资源
close(sockfd);
avcodec_free_context(&codec_ctx);
avformat_close_input(&format_ctx);
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libavutil/avutil.h>
#include <libavutil/opt.h>
// #define DEST_IP "192.168.3.74"
// #define DEST_PORT 9600
void* push_video_stream3(void* arg)
{
const char *input_file = "/home/levi/Videos/test.mp4";
AVFormatContext *input_format_ctx = NULL, *output_format_ctx = NULL;
AVCodecContext *codec_ctx = NULL;
AVStream *video_stream = NULL;
AVPacket packet;
int ret, video_stream_index;
// 初始化 FFmpeg 库
av_register_all();
avformat_network_init();
// 打开输入 MP4 文件
ret = avformat_open_input(&input_format_ctx, input_file, NULL, NULL);
if (ret < 0) {
fprintf(stderr, "Could not open input file '%s'\n", input_file);
return ret;
}
// 获取文件流信息
ret = avformat_find_stream_info(input_format_ctx, NULL);
if (ret < 0) {
fprintf(stderr, "Could not find stream information\n");
return ret;
}
// 查找视频流
video_stream_index = -1;
for (int i = 0; i < input_format_ctx->nb_streams; i++) {
if (input_format_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
video_stream_index = i;
video_stream = input_format_ctx->streams[i];
break;
}
}
if (video_stream_index == -1) {
fprintf(stderr, "No video stream found\n");
return -1;
}
// 获取视频流的解码器
AVCodec *codec = avcodec_find_decoder(video_stream->codecpar->codec_id);
if (!codec) {
fprintf(stderr, "Codec not found\n");
return -1;
}
codec_ctx = avcodec_alloc_context3(codec);
if (!codec_ctx) {
fprintf(stderr, "Could not allocate codec context\n");
return -1;
}
ret = avcodec_parameters_to_context(codec_ctx, video_stream->codecpar);
if (ret < 0) {
fprintf(stderr, "Could not copy codec parameters\n");
return ret;
}
ret = avcodec_open2(codec_ctx, codec, NULL);
if (ret < 0) {
fprintf(stderr, "Could not open codec\n");
return ret;
}
// 创建输出格式上下文(MPEG-TS 格式)
ret = avformat_alloc_output_context2(&output_format_ctx, NULL, "mpegts", "udp://127.0.0.1:9600");
if (ret < 0 || !output_format_ctx) {
fprintf(stderr, "Could not create output context\n");
return ret;
}
// 创建输出流
AVStream *out_stream = avformat_new_stream(output_format_ctx, codec);
if (!out_stream) {
fprintf(stderr, "Could not create stream\n");
return AVERROR_UNKNOWN;
}
// 复制输入流参数到输出流
ret = avcodec_parameters_copy(out_stream->codecpar, video_stream->codecpar);
if (ret < 0) {
fprintf(stderr, "Could not copy codec parameters\n");
return ret;
}
// 打开输出文件/流
if (!(output_format_ctx->oformat->flags & AVFMT_NOFILE)) {
ret = avio_open(&output_format_ctx->pb, "udp://127.0.0.1:9600", AVIO_FLAG_WRITE);
if (ret < 0) {
fprintf(stderr, "Could not open output stream\n");
return ret;
}
}
// 写入 MPEG-TS 文件头
ret = avformat_write_header(output_format_ctx, NULL);
if (ret < 0) {
fprintf(stderr, "Error writing header to output stream\n");
return ret;
}
// 创建 UDP socket
int sockfd = socket(AF_INET, SOCK_DGRAM, 0);
if (sockfd < 0) {
perror("Socket creation failed");
return -1;
}
struct sockaddr_in dest_addr;
memset(&dest_addr, 0, sizeof(dest_addr));
dest_addr.sin_family = AF_INET;
dest_addr.sin_port = htons(DEST_PORT);
ret = inet_pton(AF_INET, DEST_IP, &dest_addr.sin_addr);
if (ret <= 0) {
fprintf(stderr, "Invalid destination IP address\n");
return -1;
}
// 解码并发送视频流
av_init_packet(&packet);
while (1) {
ret = av_read_frame(input_format_ctx, &packet);
if (ret < 0) {
break;
}
if (packet.stream_index == video_stream_index) {
// 将视频数据包发送到 UDP
// ret = sendto(sockfd, packet.data, packet.size, 0, (struct sockaddr *)&dest_addr, sizeof(dest_addr));
ZiyanPayloadCamera_SendVideoStream(packet.data, packet.size);
if (ret < 0) {
perror("Sendto failed");
break;
}
}
usleep(1000 * 34);
av_packet_unref(&packet);
}
// 写入文件尾部
av_write_trailer(output_format_ctx);
// 清理资源
close(sockfd);
avcodec_free_context(&codec_ctx);
avformat_close_input(&input_format_ctx);
avformat_free_context(output_format_ctx);
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#define TARGET_IP "127.0.0.1"
#define TARGET_PORT 9600
#define TS_PACKET_SIZE 1314
// 初始化Socket
int init_socket(const char *ip, int port) {
int sockfd = socket(AF_INET, SOCK_DGRAM, 0);
if (sockfd < 0) {
perror("Socket creation failed");
exit(EXIT_FAILURE);
}
struct sockaddr_in server_addr;
memset(&server_addr, 0, sizeof(server_addr));
server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(port);
inet_pton(AF_INET, ip, &server_addr.sin_addr);
if (connect(sockfd, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) {
perror("Socket connect failed");
close(sockfd);
exit(EXIT_FAILURE);
}
return sockfd;
}
// 推送TS包
void send_ts_packet(int sockfd, uint8_t *packet, int size) {
if (send(sockfd, packet, size, 0) < 0) {
perror("Send failed");
}
}
void* push_video_stream4(void* arg)
{
const char *input_file = "/home/levi/Videos/test.mp4";;
// 初始化FFmpeg
av_register_all();
avformat_network_init();
AVFormatContext *input_ctx = NULL;
if (avformat_open_input(&input_ctx, input_file, NULL, NULL) < 0) {
fprintf(stderr, "Could not open input file: %s\n", input_file);
return -1;
}
if (avformat_find_stream_info(input_ctx, NULL) < 0) {
fprintf(stderr, "Could not find stream information\n");
return -1;
}
// 查找视频流
int video_stream_index = -1;
for (int i = 0; i < input_ctx->nb_streams; i++) {
if (input_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
video_stream_index = i;
break;
}
}
if (video_stream_index == -1) {
fprintf(stderr, "No video stream found\n");
return -1;
}
// 初始化输出格式上下文(MPEG-TS)
AVFormatContext *output_ctx = NULL;
avformat_alloc_output_context2(&output_ctx, NULL, "mpegts", NULL);
if (!output_ctx) {
fprintf(stderr, "Could not create output context\n");
return -1;
}
// 添加视频流到输出上下文
AVStream *output_stream = avformat_new_stream(output_ctx, NULL);
if (!output_stream) {
fprintf(stderr, "Could not create output stream\n");
return -1;
}
avcodec_parameters_copy(output_stream->codecpar, input_ctx->streams[video_stream_index]->codecpar);
output_stream->codecpar->codec_tag = 0;
// 初始化Socket
int sockfd = init_socket(TARGET_IP, TARGET_PORT);
// 写入TS流到Socket
AVPacket pkt;
av_init_packet(&pkt);
pkt.data = NULL;
pkt.size = 0;
while (av_read_frame(input_ctx, &pkt) >= 0) {
if (pkt.stream_index == video_stream_index) {
// 发送TS包
uint8_t *ts_packet = pkt.data;
int ts_packet_size = pkt.size;
while (ts_packet_size > 0) {
int send_size = (ts_packet_size > TS_PACKET_SIZE) ? TS_PACKET_SIZE : ts_packet_size;
send_ts_packet(sockfd, ts_packet, send_size);
ts_packet += send_size;
ts_packet_size -= send_size;
}
}
usleep(1000 * 34);
av_packet_unref(&pkt);
}
// 清理资源
avformat_close_input(&input_ctx);
avformat_free_context(output_ctx);
close(sockfd);
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libavutil/opt.h>
#define OUTPUT_UDP "udp://127.0.0.1:9600"
#define INPUT_FILE "/home/levi/Videos/test.mp4"
void* push_video_stream5(void* arg)
{
avformat_network_init();
// 打开输入 MP4 文件
AVFormatContext *input_fmt_ctx = NULL;
if (avformat_open_input(&input_fmt_ctx, INPUT_FILE, NULL, NULL) < 0) {
fprintf(stderr, "Could not open input file '%s'\n", INPUT_FILE);
return -1;
}
if (avformat_find_stream_info(input_fmt_ctx, NULL) < 0) {
fprintf(stderr, "Could not find stream information\n");
return -1;
}
// 查找视频流
int video_stream_index = -1;
AVCodecContext *video_codec_ctx = NULL;
for (int i = 0; i < input_fmt_ctx->nb_streams; i++) {
if (input_fmt_ctx->streams[i]->codecpar->codec_id == AV_CODEC_ID_H264) {
video_stream_index = i;
video_codec_ctx = avcodec_alloc_context3(NULL);
avcodec_parameters_to_context(video_codec_ctx, input_fmt_ctx->streams[i]->codecpar);
break;
}
}
if (video_stream_index == -1) {
fprintf(stderr, "No H.264 video stream found\n");
return -1;
}
// 打开解码器
AVCodec *video_codec = avcodec_find_decoder(video_codec_ctx->codec_id);
if (avcodec_open2(video_codec_ctx, video_codec, NULL) < 0) {
fprintf(stderr, "Could not open codec\n");
return -1;
}
// 创建输出 UDP 流
AVFormatContext *output_fmt_ctx = NULL;
if (avformat_alloc_output_context2(&output_fmt_ctx, NULL, "mpegts", OUTPUT_UDP) < 0) {
fprintf(stderr, "Could not create output context\n");
return -1;
}
// 创建视频流
AVStream *out_stream = avformat_new_stream(output_fmt_ctx, video_codec);
if (!out_stream) {
fprintf(stderr, "Failed to create new stream\n");
return -1;
}
// 使用复制的参数配置输出流
if (avcodec_parameters_copy(out_stream->codecpar, input_fmt_ctx->streams[video_stream_index]->codecpar) < 0) {
fprintf(stderr, "Failed to copy codec parameters\n");
return -1;
}
// 打开输出流
if (!(output_fmt_ctx->oformat->flags & AVFMT_NOFILE)) {
if (avio_open(&output_fmt_ctx->pb, OUTPUT_UDP, AVIO_FLAG_WRITE) < 0) {
fprintf(stderr, "Could not open output file\n");
return -1;
}
}
// 写入文件头
if (avformat_write_header(output_fmt_ctx, NULL) < 0) {
fprintf(stderr, "Error occurred when opening output file\n");
return -1;
}
// 读取数据包并转发到 UDP
AVPacket packet;
while (1) {
if (av_read_frame(input_fmt_ctx, &packet) < 0) {
break; // 读取完毕
}
// 如果是视频流,直接转发
if (packet.stream_index == video_stream_index) {
// 复制数据包并推送到 UDP
if (av_interleaved_write_frame(output_fmt_ctx, &packet) < 0) {
fprintf(stderr, "Error while writing packet\n");
break;
}
usleep(1000 * 34);
}
//
// 释放包内存
av_packet_unref(&packet);
}
// 写入文件尾并关闭
av_write_trailer(output_fmt_ctx);
avcodec_free_context(&video_codec_ctx);
avformat_close_input(&input_fmt_ctx);
avformat_free_context(output_fmt_ctx);
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libavutil/opt.h>
#define MAX_PACKET_SIZE 1316 // UDP 最大数据包大小(1500字节的MTU减去头部)
#define PAYLOAD_HEADER_SIZE 4 // 假设我们需要4字节来存储包的序号或其他信息
// 发送视频流数据到UDP
int SendVideoStream(const uint8_t *data, uint16_t len, int sockfd, struct sockaddr_in *dest_addr) {
// 将数据分片并发送
int remaining = len;
int offset = 0;
while (remaining > 0) {
int size_to_send = (remaining > (MAX_PACKET_SIZE - PAYLOAD_HEADER_SIZE)) ? (MAX_PACKET_SIZE - PAYLOAD_HEADER_SIZE) : remaining;
// 为每个数据包添加头部信息(例如,偏移量)
uint8_t *packet_data = malloc(PAYLOAD_HEADER_SIZE + size_to_send);
if (!packet_data) {
perror("Failed to allocate memory for packet fragment");
return -1;
}
// 在包头附加偏移量或序号(简单示例)
*(int*)packet_data = offset; // 偏移量作为示例
memcpy(packet_data + PAYLOAD_HEADER_SIZE, data + offset, size_to_send);
// 发送数据包
ssize_t sent_len = sendto(sockfd, packet_data, PAYLOAD_HEADER_SIZE + size_to_send, 0, (struct sockaddr*)dest_addr, sizeof(*dest_addr));
if (sent_len < 0) {
perror("Failed to send UDP packet");
free(packet_data);
return -1;
}
printf("send len %d\n", sent_len);
// 更新状态
remaining -= size_to_send;
offset += size_to_send;
free(packet_data); // 释放已发送的数据包
}
return 0;
}
void* push_video_stream6(void* arg)
{
avformat_network_init();
// 打开输入 MP4 文件
AVFormatContext *input_fmt_ctx = NULL;
if (avformat_open_input(&input_fmt_ctx, INPUT_FILE, NULL, NULL) < 0) {
fprintf(stderr, "Could not open input file '%s'\n", INPUT_FILE);
return -1;
}
if (avformat_find_stream_info(input_fmt_ctx, NULL) < 0) {
fprintf(stderr, "Could not find stream information\n");
return -1;
}
// 查找视频流
int video_stream_index = -1;
AVCodecContext *video_codec_ctx = NULL;
for (int i = 0; i < input_fmt_ctx->nb_streams; i++) {
if (input_fmt_ctx->streams[i]->codecpar->codec_id == AV_CODEC_ID_H264) {
video_stream_index = i;
video_codec_ctx = avcodec_alloc_context3(NULL);
avcodec_parameters_to_context(video_codec_ctx, input_fmt_ctx->streams[i]->codecpar);
break;
}
}
if (video_stream_index == -1) {
fprintf(stderr, "No H.264 video stream found\n");
return -1;
}
// 打开解码器
AVCodec *video_codec = avcodec_find_decoder(video_codec_ctx->codec_id);
if (avcodec_open2(video_codec_ctx, video_codec, NULL) < 0) {
fprintf(stderr, "Could not open codec\n");
return -1;
}
// 创建 UDP 套接字
int sockfd;
struct sockaddr_in dest_addr;
sockfd = socket(AF_INET, SOCK_DGRAM, 0);
if (sockfd < 0) {
perror("Socket creation failed");
return -1;
}
memset(&dest_addr, 0, sizeof(dest_addr));
dest_addr.sin_family = AF_INET;
dest_addr.sin_port = htons(9600); // 目标端口
if (inet_pton(AF_INET, "127.0.0.1", &dest_addr.sin_addr) <= 0) {
perror("Invalid address");
return -1;
}
// 读取数据包并推送到 UDP
AVPacket packet;
while (1) {
if (av_read_frame(input_fmt_ctx, &packet) < 0) {
break; // 读取完毕
}
// 如果是视频流,推送到 UDP
if (packet.stream_index == video_stream_index) {
// 使用 ZiyanPayloadCamera_SendVideoStream 发送数据
if (SendVideoStream(packet.data, packet.size, sockfd, &dest_addr) < 0) {
fprintf(stderr, "Error sending packet\n");
break;
}
usleep(1000 * 33);
}
// 释放包内存
av_packet_unref(&packet);
}
// 清理
close(sockfd);
avcodec_free_context(&video_codec_ctx);
avformat_close_input(&input_fmt_ctx);
return 0;
}
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libavutil/opt.h>
#include <libavdevice/avdevice.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <netinet/in.h>
#include <arpa/inet.h> // 引入该头文件
#define STREAM_PORT 9600
#define STREAM_ADDR "127.0.0.1"
void* push_video_stream7(void* arg)
{
av_register_all();
avformat_network_init();
// Input file path
char *input_file = "/home/levi/Videos/test.mp4"; // Replace with your input file
AVFormatContext *input_format_context = NULL;
AVCodecContext *codec_context = NULL;
AVCodec *codec = NULL;
AVPacket packet;
// Open the input MP4 file
if (avformat_open_input(&input_format_context, input_file, NULL, NULL) < 0) {
fprintf(stderr, "Error opening input file\n");
return -1;
}
if (avformat_find_stream_info(input_format_context, NULL) < 0) {
fprintf(stderr, "Error finding stream info\n");
return -1;
}
// Find the video stream
int stream_index = -1;
for (int i = 0; i < input_format_context->nb_streams; i++) {
if (input_format_context->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
stream_index = i;
break;
}
}
if (stream_index == -1) {
fprintf(stderr, "No video stream found\n");
return -1;
}
AVStream *video_stream = input_format_context->streams[stream_index];
codec = avcodec_find_decoder(video_stream->codecpar->codec_id);
if (!codec) {
fprintf(stderr, "Codec not found\n");
return -1;
}
codec_context = avcodec_alloc_context3(codec);
if (!codec_context) {
fprintf(stderr, "Could not allocate codec context\n");
return -1;
}
if (avcodec_parameters_to_context(codec_context, video_stream->codecpar) < 0) {
fprintf(stderr, "Failed to copy codec parameters to context\n");
return -1;
}
if (avcodec_open2(codec_context, codec, NULL) < 0) {
fprintf(stderr, "Error opening codec\n");
return -1;
}
// UDP socket setup for RTP
int sockfd = socket(AF_INET, SOCK_DGRAM, 0);
if (sockfd < 0) {
perror("Error opening UDP socket");
return -1;
}
struct sockaddr_in dest_addr;
memset(&dest_addr, 0, sizeof(dest_addr));
dest_addr.sin_family = AF_INET;
dest_addr.sin_port = htons(STREAM_PORT);
// 使用 inet_pton 替换 inet_addr
if (inet_pton(AF_INET, STREAM_ADDR, &dest_addr.sin_addr) <= 0) {
perror("Invalid address/Address not supported");
return -1;
}
// Initialize packet structure
av_init_packet(&packet);
packet.data = NULL;
packet.size = 0;
// Start reading and sending packets
while (av_read_frame(input_format_context, &packet) >= 0) {
if (packet.stream_index == stream_index) {
// Send H.264 stream as RTP packet
if (sendto(sockfd, packet.data, packet.size, 0, (struct sockaddr *)&dest_addr, sizeof(dest_addr)) < 0) {
perror("Error sending RTP packet");
return -1;
}
}
av_packet_unref(&packet);
}
// Clean up and close the socket
close(sockfd);
avcodec_free_context(&codec_context);
avformat_close_input(&input_format_context);
return 0;
}
#ifdef FFMPEG_INSTALLED
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libavutil/opt.h>
#include <libavutil/avutil.h>
#include <libavdevice/avdevice.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
... ... @@ -1325,15 +197,17 @@ void* push_video_stream7(void* arg)
#define STREAM_PORT 9600
#define STREAM_ADDR "127.0.0.1"
#define INPUT_FILE "/home/levi/Videos/test.h264" // Replace with your actual video file path
#define INPUT_FILE2 "test.h264"
#endif
void* push_video_stream8(void* arg)
{
#if defined(FFMPEG_INSTALLED) && (LIBAVFORMAT_VERSION_MAJOR >= 57)
while(1){
// Initialize FFmpeg libraries
av_register_all();
// av_register_all();
avformat_network_init();
AVFormatContext *input_format_context = NULL;
... ... @@ -1341,121 +215,34 @@ void* push_video_stream8(void* arg)
AVCodec *codec = NULL;
AVPacket packet;
printf("input file: %s\n", INPUT_FILE);
// Open the input MP4 file
if (avformat_open_input(&input_format_context, INPUT_FILE, NULL, NULL) < 0) {
fprintf(stderr, "Error opening input file\n");
return -1;
}
// Retrieve stream information
if (avformat_find_stream_info(input_format_context, NULL) < 0) {
fprintf(stderr, "Error finding stream info\n");
return -1;
}
// Find the video stream
int video_stream_index = -1;
for (int i = 0; i < input_format_context->nb_streams; i++) {
if (input_format_context->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
video_stream_index = i;
break;
}
}
if (video_stream_index == -1) {
fprintf(stderr, "Video stream not found\n");
return -1;
}
// Find the decoder for the video stream
AVStream *video_stream = input_format_context->streams[video_stream_index];
codec = avcodec_find_decoder(video_stream->codecpar->codec_id);
if (!codec) {
fprintf(stderr, "Codec not found\n");
return -1;
}
codec_context = avcodec_alloc_context3(codec);
if (!codec_context) {
fprintf(stderr, "Could not allocate codec context\n");
return -1;
}
if (avcodec_parameters_to_context(codec_context, video_stream->codecpar) < 0) {
fprintf(stderr, "Failed to copy codec parameters to context\n");
return -1;
}
if (avcodec_open2(codec_context, codec, NULL) < 0) {
fprintf(stderr, "Error opening codec\n");
return -1;
}
// Initialize packet structure
av_init_packet(&packet);
packet.data = NULL;
packet.size = 0;
char cwd[256] = {0};
char file_path[256] = {0};
getcwd(cwd, sizeof(cwd));
sprintf(file_path, "%s/%s", cwd, INPUT_FILE2);
// Start reading frames and send packets
while (av_read_frame(input_format_context, &packet) >= 0) {
if (packet.stream_index == video_stream_index) {
// Send the H.264 encoded packet over UDP
ZiyanPayloadCamera_SendVideoStream(packet.data, packet.size);
// printf("Sent packet of size %d\n", packet.size);
usleep(1000 * 33);
}
// Free the packet after sending
av_packet_unref(&packet);
}
char input_file[256] = {0};
// Clean up and close
avcodec_free_context(&codec_context);
avformat_close_input(&input_format_context);
if (access(file_path, F_OK) == 0) {
memcpy(input_file, file_path, strlen(file_path));
USER_LOG_INFO("select: %s", file_path);
} else {
memcpy(input_file, INPUT_FILE, strlen(INPUT_FILE));
USER_LOG_INFO("select: %s", INPUT_FILE);
}
return 0;
}
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libavutil/opt.h>
#include <libavutil/avutil.h>
#include <libavdevice/avdevice.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <netinet/in.h>
#include <arpa/inet.h>
void* push_video_stream9(void* arg)
{
// Initialize FFmpeg libraries
av_register_all();
avformat_network_init();
AVFormatContext *input_format_context = NULL;
AVCodecContext *codec_context = NULL;
AVCodec *codec = NULL;
AVPacket packet;
printf("input file: %s\n", INPUT_FILE);
USER_LOG_INFO("input file: %s", input_file);
// Open the input H.264 file
if (avformat_open_input(&input_format_context, INPUT_FILE, NULL, NULL) < 0) {
// Open the input MP4 file
if (avformat_open_input(&input_format_context, input_file, NULL, NULL) < 0) {
fprintf(stderr, "Error opening input file\n");
return -1;
return NULL;
}
// Retrieve stream information
if (avformat_find_stream_info(input_format_context, NULL) < 0) {
fprintf(stderr, "Error finding stream info\n");
return -1;
return NULL;
}
// Find the video stream
... ... @@ -1469,7 +256,7 @@ void* push_video_stream9(void* arg)
if (video_stream_index == -1) {
fprintf(stderr, "Video stream not found\n");
return -1;
return NULL;
}
// Find the decoder for the video stream
... ... @@ -1477,61 +264,25 @@ void* push_video_stream9(void* arg)
codec = avcodec_find_decoder(video_stream->codecpar->codec_id);
if (!codec) {
fprintf(stderr, "Codec not found\n");
return -1;
return NULL;
}
codec_context = avcodec_alloc_context3(codec);
if (!codec_context) {
fprintf(stderr, "Could not allocate codec context\n");
return -1;
return NULL;
}
if (avcodec_parameters_to_context(codec_context, video_stream->codecpar) < 0) {
fprintf(stderr, "Failed to copy codec parameters to context\n");
return -1;
return NULL;
}
if (avcodec_open2(codec_context, codec, NULL) < 0) {
fprintf(stderr, "Error opening codec\n");
return -1;
}
// TCP socket setup
int sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0) {
perror("Error opening TCP socket");
return -1;
}
struct sockaddr_in server_addr;
memset(&server_addr, 0, sizeof(server_addr));
server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(STREAM_PORT);
server_addr.sin_addr.s_addr = INADDR_ANY;
// Bind the socket to the address and port
if (bind(sockfd, (struct sockaddr*)&server_addr, sizeof(server_addr)) < 0) {
perror("Error binding socket");
return -1;
return NULL;
}
// Listen for incoming connections
if (listen(sockfd, 1) < 0) {
perror("Error listening for connections");
return -1;
}
printf("Waiting for client connection...\n");
// Accept client connection
int client_sockfd = accept(sockfd, NULL, NULL);
if (client_sockfd < 0) {
perror("Error accepting client connection");
return -1;
}
printf("Client connected, sending video stream...\n");
// Initialize packet structure
av_init_packet(&packet);
packet.data = NULL;
... ... @@ -1540,13 +291,10 @@ void* push_video_stream9(void* arg)
// Start reading frames and send packets
while (av_read_frame(input_format_context, &packet) >= 0) {
if (packet.stream_index == video_stream_index) {
// Send the H.264 encoded packet to the client over TCP
if (send(client_sockfd, packet.data, packet.size, 0) < 0) {
perror("Error sending TCP packet");
return -1;
}
printf("Sent packet of size %d\n", packet.size);
usleep(1000 * 30); // simulate 30fps
// Send the H.264 encoded packet over UDP
ZiyanPayloadCamera_SendVideoStream(packet.data, packet.size);
// printf("Sent packet of size %d\n", packet.size);
usleep(1000 * 33);
}
// Free the packet after sending
... ... @@ -1554,184 +302,17 @@ void* push_video_stream9(void* arg)
}
// Clean up and close
close(client_sockfd);
close(sockfd);
avcodec_free_context(&codec_context);
avformat_close_input(&input_format_context);
return 0;
}
void* push_video_stream10(void* arg)
{
// Initialize FFmpeg libraries
av_register_all();
avformat_network_init();
AVFormatContext *input_format_context = NULL;
AVCodecContext *codec_context = NULL;
AVCodec *codec = NULL;
AVPacket packet;
printf("input file: %s\n", INPUT_FILE);
// Open the input H.264 file
if (avformat_open_input(&input_format_context, INPUT_FILE, NULL, NULL) < 0) {
fprintf(stderr, "Error opening input file\n");
return -1;
}
// Retrieve stream information
if (avformat_find_stream_info(input_format_context, NULL) < 0) {
fprintf(stderr, "Error finding stream info\n");
return -1;
}
// Find the video stream
int video_stream_index = -1;
for (int i = 0; i < input_format_context->nb_streams; i++) {
if (input_format_context->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
video_stream_index = i;
break;
}
}
if (video_stream_index == -1) {
fprintf(stderr, "Video stream not found\n");
return -1;
}
// Find the decoder for the video stream
AVStream *video_stream = input_format_context->streams[video_stream_index];
codec = avcodec_find_decoder(video_stream->codecpar->codec_id);
if (!codec) {
fprintf(stderr, "Codec not found\n");
return -1;
}
codec_context = avcodec_alloc_context3(codec);
if (!codec_context) {
fprintf(stderr, "Could not allocate codec context\n");
return -1;
}
if (avcodec_parameters_to_context(codec_context, video_stream->codecpar) < 0) {
fprintf(stderr, "Failed to copy codec parameters to context\n");
return -1;
}
if (avcodec_open2(codec_context, codec, NULL) < 0) {
fprintf(stderr, "Error opening codec\n");
return -1;
}
// TCP socket setup
T_ZiyanSocketHandle socket_handle = NULL;
T_ZiyanReturnCode result = ZiyanPlatform_GetSocketHandler()->Socket(ZIYAN_SOCKET_MODE_TCP, &socket_handle);
printf("Socket result: %d\n", result);
if (result != ZIYAN_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
perror("Error opening TCP socket");
return -1;
}
// Bind the socket to the address and port
if (ZiyanPlatform_GetSocketHandler()->Bind(socket_handle, "0.0.0.0", 9600) != ZIYAN_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
perror("Error binding socket");
return -1;
}
// Listen for incoming connections
if (ZiyanPlatform_GetSocketHandler()->TcpListen(socket_handle) != ZIYAN_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
perror("Error listening for connections");
return -1;
}
printf("Waiting for client connection...\n");
// Accept client connection
char accept_ip[32] = "";
uint32_t accept_port = 0;
T_ZiyanSocketHandle accept_socket_handle = NULL;
if (ZiyanPlatform_GetSocketHandler()->TcpAccept(socket_handle, accept_ip, &accept_port, &accept_socket_handle) != ZIYAN_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
perror("Error accepting client connection");
return -1;
}
printf("Client connected %s:%d, sending video stream...\n", accept_ip, accept_port);
// Initialize packet structure
av_init_packet(&packet);
packet.data = NULL;
packet.size = 0;
// Start reading frames and send packets
while (av_read_frame(input_format_context, &packet) >= 0) {
if (packet.stream_index == video_stream_index) {
// Send the H.264 encoded packet to the client over TCP
uint32_t real_len = 0;
if (ZiyanPlatform_GetSocketHandler()->TcpSendData(accept_socket_handle, packet.data, packet.size, &real_len) != ZIYAN_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
perror("Error sending TCP packet");
return -1;
}
printf("Sent packet of size %d : %d\n", packet.size, real_len);
usleep(1000 * 30); // simulate 30fps
}
// Free the packet after sending
av_packet_unref(&packet);
}
// Clean up and close
avcodec_free_context(&codec_context);
avformat_close_input(&input_format_context);
#endif
return 0;
}
#endif
/*****************************************************************************/
static T_ZiyanReturnCode GetSystemState(T_ZiyanCameraSystemState *systemState)
{
T_ZiyanReturnCode returnCode;
... ... @@ -2900,23 +1481,20 @@ T_ZiyanReturnCode ZiyanTest_CameraEmuBaseStartService(void)
}
#endif
s_extendHander.GetRangeFinderSwitch = GetRangeFinderSwitch;
s_extendHander.SetRangeFinderSwitch = SetRangeFinderSwitch;
s_extendHander.GetRangeFinderData = GetRangeFinderData;
s_extendHander.GetRangeFinderLocation = GetRangeFinderLocation;
s_rangeFinderHander.GetRangeFinderSwitch = GetRangeFinderSwitch;
s_rangeFinderHander.SetRangeFinderSwitch = SetRangeFinderSwitch;
s_rangeFinderHander.GetRangeFinderData = GetRangeFinderData;
s_rangeFinderHander.GetRangeFinderLocation = GetRangeFinderLocation;
returnCode = ZiyanPayloadCamera_RegExtendHandler(&s_extendHander);
returnCode = ZiyanPayloadCamera_RegRangeFinderHandler(&s_rangeFinderHander);
if (returnCode != ZIYAN_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("camera register extend handler error:0x%08llX", returnCode);
USER_LOG_ERROR("camera register range finder handler error:0x%08llX", returnCode);
return returnCode;
}
//修改位
// T_ZiyanTaskHandle handle_test;
// osalHandler->TaskCreate("camera_vedio_task", push_video_stream8,
// PAYLOAD_CAMERA_EMU_TASK_STACK_SIZE, NULL, &handle_test);
T_ZiyanTaskHandle handle_test;
osalHandler->TaskCreate("camera_vedio_task", push_video_stream8,
PAYLOAD_CAMERA_EMU_TASK_STACK_SIZE, NULL, &handle_test);
/* Create the camera emu taskHandle */
if (osalHandler->TaskCreate("user_camera_task", UserCamera_Task,
... ...