作者 ookk303

独立了tts的滤波选项

... ... @@ -119,7 +119,10 @@
"volumelimit.h": "c",
"megaphone_realtimemp2.h": "c",
"jzirc_lib.h": "c",
"hardwareinfo.h": "c"
"hardwareinfo.h": "c",
"jzsdk_attributedef.h": "c",
"msp_types.h": "c",
"attribute.h": "c"
},
"Codegeex.GenerationPreference": "automatic",
"C_Cpp.dimInactiveRegions": false
... ...
# 编译链的配置
#1、编译链与设备类型的选择
set(DEVICE_NAME JZ_U3)
set(DEVICE_NAME JZ_H1T)
#上一行为禁止修改行
message("**************************JZSDK构建编译开始***************************\n")
... ...
... ... @@ -20,9 +20,12 @@ extern "C" {
/* 常亮定义*/
#include "./JZsdk_typedef/JZsdk_typedef.h"
#include "./JZsdk_typedef/JZsdk_AttributeDef.h"
#include "./JZsdk_ReturnCode/JZsdk_ReturnCode.h"
#include "./JZsdk_Platform/JZsdk_Platform.h"
#include "./JZsdk_InsCode.h"
#include "./JZsdk_FLagCode.h"
#include "./JZsdk_WidgetCode.h"
... ...
/**
********************************************************************
* @file JZsdk_AttributeDef.h
* 用于记录属性的表
*
*********************************************************************
*/
/* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/
#ifndef JZSDK_ATTRIBUTEDEF_H
#define JZSDK_ATTRIBUTEDEF_H
/* Includes ------------------------------------------------------------------*/
#include "./JZsdk_typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* 常亮定义*/
/* Exported types ------------------------------------------------------------*/
//GPS时间
typedef U32_t T_JZsdkAttributeGpsTime;
//GPS日期
typedef U32_t T_JZsdkAttributeGpsDate;
//gps经度
typedef T_JZsdkVector3d T_JZsdkAttributeGpsPosition;
/* Exported functions --------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif
... ...
... ... @@ -60,6 +60,33 @@ typedef void *T_JZsdkFileHandle;
typedef void *T_JZsdkDirHandle;
typedef struct T_JZsdkVector3d
{
int x;
int y;
int z;
}T_JZsdkVector3d;
typedef struct T_JZsdkVector3f
{
F32_t x;
F32_t y;
F32_t z;
}T_JZsdkVector3f;
typedef struct {
int pitch; /*!< Specifies int32 value of pitch for attitude. */
int roll; /*!< Specifies int32 value of roll for attitude */
int yaw; /*!< Specifies int32 value of yaw for attitude */
} T_JZsdkAttitude3d;
typedef struct {
F32_t pitch; /*!< Specifies float value of pitch for attitude. */
F32_t roll; /*!< Specifies float value of roll for attitude */
F32_t yaw; /*!< Specifies float value of yaw for attitude */
} T_JZsdkAttitude3f;
/* Exported types ------------------------------------------------------------*/
... ...
... ... @@ -7,7 +7,7 @@
#define VERSION_CHOOSE_H
#include "JZsdk_Base/JZsdk_Code/JZsdk_DeviceCode.h"
//1~10行 除了D可以修改版本选择 禁止动任何东西
#define DEVICE_VERSION JZ_U3
#define DEVICE_VERSION JZ_H1T
//禁止修改行 选择是串口程序 还是 psdk程序
#define APP_VERSION APP_UART
... ... @@ -25,7 +25,7 @@
#define FILTERING_TYPE HIGH_PASS_FILTERING
//禁止修改行固件属地 目前 国内版/海外版
#define FIRMWARE_ORIGIN OVERSEAS_VERSION
#define FIRMWARE_ORIGIN DOMESTIC_VERSION
//禁止修改行指定特殊固件
#define SPECIAL_VERSION SPECIAL_NORMAL
... ...
... ... @@ -135,6 +135,7 @@ int HalRecv_type1_PreliminaryScreeningOfData(unsigned char *Data, int DataLen, i
{
FrameFlag = 0x00;
}
break;
}
default:
... ...
... ... @@ -38,7 +38,7 @@ static int TTS_RecvBufferLen = 0;
static T_JZsdkReturnCode HalRecv_tpye1_RecvDeal_Set_UartReceiveMode(int Port, int value);
static T_JZsdkReturnCode HalRecv_tpye1_RecvDeal_UartTransmodeDecide();
static T_JZsdkMutexHandle GetMusicList_MutexHandle = NULL;
/********************************************************************************************************
********* ********|
... ... @@ -878,6 +878,13 @@ static T_JZsdkReturnCode RecvDeal_audio_NextSong(int Port, char *getbuf)
static T_JZsdkReturnCode RecvDeal_audio_GetMusicList(int Port, char *getbuf)
{
T_JZsdkReturnCode ret;
T_JZsdkOsalHandler *OsalHandler = JZsdk_Platform_GetOsalHandler();
if (GetMusicList_MutexHandle == NULL)
{
OsalHandler->MutexCreate(&GetMusicList_MutexHandle);
}
OsalHandler->MutexLock(GetMusicList_MutexHandle);
JZSDK_LOG_INFO("%s,获取音乐列表",JZsdk_DefineCode_GetPortName(Port));
int music_sum = 0;
... ... @@ -888,7 +895,12 @@ static T_JZsdkReturnCode RecvDeal_audio_GetMusicList(int Port, char *getbuf)
#ifdef MEGAPHONE_CONFIG_STATUS_ON
//刷新歌曲列表
Megaphone_Flush_MusicList();
ret = Megaphone_Flush_MusicList();
if (ret != JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
{
HalSend_type1Send_Reply_Failure(Port, FrameSequence);
return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE;
}
//解析获取的类型
int type = getbuf[9];
... ... @@ -1009,6 +1021,8 @@ static T_JZsdkReturnCode RecvDeal_audio_GetMusicList(int Port, char *getbuf)
#endif
OsalHandler->MutexUnlock(GetMusicList_MutexHandle);
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
... ... @@ -3519,9 +3533,9 @@ static T_JZsdkReturnCode RecvDeal_ObtainTimeStamp(int Port, unsigned char *getbu
}
// 提取年、月、日
int year = tm_info->tm_year + 1900; // 注意:tm_year是从1900年开始的
int year = tm_info->tm_year + 1980; // 注意:tm_year是从1980年开始的
int month = tm_info->tm_mon + 1; // 注意:tm_mon是从0开始的(0=1月,11=12月)
int day = tm_info->tm_mday;
int day = tm_info->tm_mday + 6;
JZSDK_LOG_INFO("获得年份: %d, 月份: %d, 日期: %d", year, month, day);
... ... @@ -3534,6 +3548,9 @@ static T_JZsdkReturnCode RecvDeal_ObtainTimeStamp(int Port, unsigned char *getbu
JZSDK_LOG_ERROR("设置系统时间失败");
}
//设置gps时间
Attribute_SetGpsTime((T_JZsdkAttributeGpsTime)TimeStamp);
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
... ... @@ -3886,6 +3903,7 @@ static T_JZsdkReturnCode RecvDeal_QuerySecondaryDeviceName(int Port, char *getbu
//2、获取当前从设备名
int SecondaryName = SecondaryDeviceName;
JZSDK_LOG_INFO("当前从设备为:%d", SecondaryName);
//3、回复当前从设备名
HalSend_type1Send_Reply_SecondaryDeviceName(Port ,SecondaryName, FrameSequence);
... ...
... ... @@ -115,8 +115,11 @@ T_JZsdkReturnCode AudioDeal_ResampleRest(unsigned int in_sampleRate, AVChannelLa
*
* pcm数据接入接口
*
* Data Type = 0 为文本pcm
* Date Type = 1 为语音流pcm
*
* ************/
T_JZsdkReturnCode AudioDeal_PcmDataInput(int In_Bitrate, unsigned char *buffer, int bytesRead)
T_JZsdkReturnCode AudioDeal_PcmDataInput(int In_Bitrate, unsigned char *buffer, int bytesRead, int DataType)
{
if (AudioDeakInfo_index == NULL)
{
... ... @@ -136,7 +139,7 @@ T_JZsdkReturnCode AudioDeal_PcmDataInput(int In_Bitrate, unsigned char *buffer,
//Set_AudioDeal_ResampleAndFilterAndPlay_Flag(AudioDeakInfo_index, JZ_FLAGCODE_ON);
//默认数据pcm接入口都是 单声道,16位
PCM_PooL_Interface_PcmData(AudioDeakInfo_index, In_Bitrate, (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO, AV_SAMPLE_FMT_S16, buffer, bytesRead);
PCM_PooL_Interface_PcmData(AudioDeakInfo_index, In_Bitrate, (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO, AV_SAMPLE_FMT_S16, buffer, bytesRead, DataType);
//printf("Read %zu bytes from the PCM file.\n", bytesRead);
//标志音频库已经结束,不过alsa库内有10组缓存,该标志位结束,只能认为重采样和滤波结束
... ... @@ -145,32 +148,32 @@ T_JZsdkReturnCode AudioDeal_PcmDataInput(int In_Bitrate, unsigned char *buffer,
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
/***************************
*
* 无回复接口
*
* ************/
T_JZsdkReturnCode AudioDeal_PcmDataInput_WithoutReply(int In_Bitrate, unsigned char *buffer, int bytesRead)
{
if (AudioDeakInfo_index == NULL)
{
JZSDK_LOG_ERROR("音频处理器未注册");
return JZ_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
}
while (Audiodeal_status != JZ_FLAGCODE_ON)
{
delayMs(1);
}
//1、打开音频库的处理标志位,该标志可以重复打开,只有强制关闭音频时,需要关闭该标志
AudioDeakInfo_index->AudioDeal_ResampleAndFilter_Execute_Flag = JZ_FLAGCODE_ON;
//默认数据pcm接入口都是 单声道,16位
PCM_PooL_Interface_PcmData(AudioDeakInfo_index, In_Bitrate, (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO, AV_SAMPLE_FMT_S16, buffer, bytesRead);
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
// /***************************
// *
// * 无回复接口
// *
// * ************/
// T_JZsdkReturnCode AudioDeal_PcmDataInput_WithoutReply(int In_Bitrate, unsigned char *buffer, int bytesRead)
// {
// if (AudioDeakInfo_index == NULL)
// {
// JZSDK_LOG_ERROR("音频处理器未注册");
// return JZ_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
// }
// while (Audiodeal_status != JZ_FLAGCODE_ON)
// {
// delayMs(1);
// }
// //1、打开音频库的处理标志位,该标志可以重复打开,只有强制关闭音频时,需要关闭该标志
// AudioDeakInfo_index->AudioDeal_ResampleAndFilter_Execute_Flag = JZ_FLAGCODE_ON;
// //默认数据pcm接入口都是 单声道,16位
// PCM_PooL_Interface_PcmData(AudioDeakInfo_index, In_Bitrate, (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO, AV_SAMPLE_FMT_S16, buffer, bytesRead);
// return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
// }
... ...
... ... @@ -89,7 +89,7 @@ enum AudioDealPlayType
/* Exported functions --------------------------------------------------------*/
T_JZsdkReturnCode AudioDeal_Init();
T_JZsdkReturnCode AudioDeal_PcmDataInput(int In_Bitrate, unsigned char *buffer, int bytesRead);
T_JZsdkReturnCode AudioDeal_PcmDataInput(int In_Bitrate, unsigned char *buffer, int bytesRead, int DataType);
T_JZsdkReturnCode AudioDeal_StopDeal();
T_JZsdkReturnCode AudioDeal_FilePlayInput(unsigned char *FilePath);
... ...
... ... @@ -26,8 +26,8 @@ extern "C" {
/* Exported functions --------------------------------------------------------*/
int PCM_PooL_Interface_PcmData(struct AudioDealInfo *AD_Info,unsigned int in_sampleRate, AVChannelLayout in_ch_layout, enum AVSampleFormat in_format , unsigned char* data, int dataSize);
int PCM_PooL_Interface_PcmData_WithoutReply(struct AudioDealInfo *AD_Info,unsigned int in_sampleRate, AVChannelLayout in_ch_layout, enum AVSampleFormat in_format , unsigned char* data, int dataSize);
int PCM_PooL_Interface_PcmData(struct AudioDealInfo *AD_Info,unsigned int in_sampleRate, AVChannelLayout in_ch_layout, enum AVSampleFormat in_format , unsigned char* data, int dataSize, int dataType);
//int PCM_PooL_Interface_PcmData_WithoutReply(struct AudioDealInfo *AD_Info,unsigned int in_sampleRate, AVChannelLayout in_ch_layout, enum AVSampleFormat in_format , unsigned char* data, int dataSize);
T_JZsdkReturnCode AudioFile_Stream_Interface_PcmData(struct AudioDealInfo *AD_Info, AVFrame *frame);
T_JZsdkReturnCode mp3_Stream_Interface_Mp3Data(struct AudioDealInfo *AD_Info, unsigned int in_sampleRate, unsigned char *data, int dataSize);
T_JZsdkReturnCode File_Stream_deal_Init(enum AVCodecID id);
... ...
... ... @@ -17,7 +17,7 @@
* pcm数据池子,pcm数据的接入接口
*
* ************/
int PCM_PooL_Interface_PcmData(struct AudioDealInfo *AD_Info,unsigned int in_sampleRate, AVChannelLayout in_ch_layout, enum AVSampleFormat in_format , unsigned char* data, int dataSize)
int PCM_PooL_Interface_PcmData(struct AudioDealInfo *AD_Info,unsigned int in_sampleRate, AVChannelLayout in_ch_layout, enum AVSampleFormat in_format , unsigned char* data, int dataSize, int dataType)
{
T_JZsdkReturnCode ret;
... ... @@ -38,7 +38,14 @@ int PCM_PooL_Interface_PcmData(struct AudioDealInfo *AD_Info,unsigned int in_sam
FF_Resample_Reset(AD_Info, in_sampleRate, in_ch_layout, in_format);
//检查滤波器
if (dataType == 0x00)
{
FF_Filter_Init(AD_Info, 0x00);
}
else
{
FF_Filter_Init(AD_Info, 0x01);
}
int out_nb_samples = 0; //重采样输出的数据长度
int UnDeal_DataSize = dataSize; //未处理的数据长度
... ...
... ... @@ -152,21 +152,21 @@ typedef enum FilterList{
//普通音频滤波参数
#define FILTER_PARAM_NORMAL_AUDIO FILTER_FORMAL_3_AUDIO
//普通TTS滤波参数
#define FILTER_PARAM_NORMAL_TTS FILTER_FORMAL_3_TTS
#define FILTER_PARAM_M30_TTS FILTER_FORMAL_1_M30_TTS
//h10t的滤波器跟其他的不一样,所以单独定义
#if DEVICE_VERSION == JZ_H10T
#define FILTER_PARAM_M30_AUDIO FILTER_FORMAL_1_M30_2
#define FILTER_PARAM_M30_TTS FILTER_FORMAL_1_M30_TTS
#else
#define FILTER_PARAM_M30_AUDIO FILTER_FORMAL_1_M30_1
#define FILTER_PARAM_M30_TTS FILTER_FORMAL_1_M30_TTS
#endif
/* Exported types ------------------------------------------------------------*/
... ...
#include "JZsdkLib.h"
#include <sys/time.h> // 对于 settimeofday 可能需要这个头文件
#include <time.h>
#include "Attribute.h"
static T_JZsdkAttributeGpsTime g_GpsTime = 0;
static T_JZsdkAttributeGpsDate g_GpsDate = 0;
static T_JZsdkAttributeGpsPosition g_GpsPositino = {0};
// static int GpsYear = 0;
// static int GpsMonth = 0;
// static int GpsDay = 0;
// static int GpsHour = 0;
// static int GpsMinute = 0;
// static int GpsSecond = 0;
T_JZsdkReturnCode Attribute_Init()
{
int year = 0;
int month = 0;
int day = 0;
int hour = 0;
int minute = 0;
int second = 0;
Attribute_GetTime_ByI(&year, &month, &day, &hour, &minute, &second);
JZSDK_LOG_INFO("%d-%d-%d %d:%d:%d", year, month, day, hour, minute, second);
JZSDK_LOG_INFO("Attribute_Init_Complete");
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
// 函数:获取GPS时间
// 返回值:T_JZsdkAttributeGpsTime类型的GPS时间
T_JZsdkAttributeGpsTime Attribute_GetGpsTime()
{
// 返回全局变量g_GpsTime的值
return g_GpsTime;
}
// 设置GPS时间
T_JZsdkReturnCode Attribute_SetGpsTime(T_JZsdkAttributeGpsTime GpsTime)
{
// 将传入的参数GpsTime赋值给全局变量g_GpsTime
g_GpsTime = GpsTime;
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
/********************************
*
* 获取gps的坐标值
*
* **************************/
T_JZsdkAttributeGpsPosition Attribute_GetGpsPosition()
{
// 返回全局变量g_GpsPositino的值
return g_GpsPositino;
}
/********************************
*
* 设置gps的坐标值
*
* **************************/
T_JZsdkReturnCode Attribute_SetGpsPosition(T_JZsdkAttributeGpsPosition GpsPosition)
{
// 将传入的参数GpsPosition赋值给全局变量g_GpsPositino
g_GpsPositino = GpsPosition;
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
/***********************
*
* 设置gps的日期
*
*
* *******************/
T_JZsdkReturnCode Attribute_SetGpsDate(T_JZsdkAttributeGpsDate GpsDate)
{
// 将传入的参数GpsDate赋值给全局变量g_GpsDate
g_GpsDate = GpsDate;
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
/***********************
*
* 获取gps的日期
*
*
* *******************/
T_JZsdkAttributeGpsDate Attribute_GetGpsDate()
{
// 返回全局变量g_GpsDate的值
return g_GpsDate;
}
// 函数定义
void decimal_to_dms(float decimal_degrees, char* dms_string, char direction)
{
int degrees = (int)decimal_degrees;
float decimal_minutes = fabs(decimal_degrees - degrees) * 60;
int minutes = (int)decimal_minutes;
float seconds = (decimal_minutes - minutes) * 60;
// 格式化DMS字符串,保留两位小数
snprintf(dms_string, 50, "%d°%d'%.0f\"%c", abs(degrees), minutes, seconds, direction);
}
/************************
*
* 获取gps显示的xyz值
*
*
* ****************************/
T_JZsdkReturnCode Attribute_GetGpsXYZ_ByStr(unsigned char *latitude, unsigned char *longitude, float *z)
{
float x = g_GpsPositino.x/10000000.0;
float y = g_GpsPositino.y/10000000.0;
*z = g_GpsPositino.z/10000000.0;
char dmsX[50];
char dmsY[50];
memset(dmsX, 0, sizeof(dmsX));
memset(dmsY, 0, sizeof(dmsY));
// 调用函数将经度转换为DMS格式,并传入正确的方向字符
decimal_to_dms(x, dmsX, (g_GpsPositino.x >= 0) ? 'E' : 'W');
// 调用函数将纬度转换为DMS格式,并传入正确的方向字符
decimal_to_dms(y, dmsY, (g_GpsPositino.y >= 0) ? 'N' : 'S');
// // 打印结果
// printf("%d %f 经度: %s\n",g_GpsPositino.x, x , dmsX);
// printf("%d %f 纬度: %s\n",g_GpsPositino.y, y , dmsY);
memcpy(latitude, dmsX, strlen(dmsX));
memcpy(longitude, dmsY, strlen(dmsY));
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
/************************
*
* 获取gps显示的度分秒值
*
*
* ****************************/
T_JZsdkReturnCode Attribute_GetGpsXYZ_ByF(float *x, float *y, float *z)
{
*x = g_GpsPositino.x/10000000.0;
*y = g_GpsPositino.y/10000000.0;
*z = g_GpsPositino.z/10000000.0;
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
/************************
*
* 获取显示的时间
*
*
* ***********************/
T_JZsdkReturnCode Attribute_GetTime_ByI(int *year, int *month, int *day, int *hour, int *minute, int *second)
{
// 转换为time_t(注意:这里假设TimeStamp是以秒为单位的Unix时间戳)
// 如果TimeStamp是以毫秒为单位的,你需要将其除以1000
time_t time_t_TimeStamp = (time_t)g_GpsTime; // 注意:这里可能会有截断,如果TimeStamp非常大
// 使用localtime将time_t转换为tm结构体
struct tm *tm_info = localtime(&time_t_TimeStamp);
if (tm_info == NULL)
{
JZSDK_LOG_ERROR("时间转化失败");
return JZ_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
}
*year = tm_info->tm_year + 1900;
*month = tm_info->tm_mon + 1;
*day = tm_info->tm_mday;
*hour = tm_info->tm_hour;
*minute = tm_info->tm_min;
*second = tm_info->tm_sec;
//JZSDK_LOG_INFO("获得年份: %d, 月份: %d, 日期: %d, 小时:%d, 分:%d 秒:%d", *year, *month, *day, *hour, *minute, *second);
}
\ No newline at end of file
... ...
/**
********************************************************************
* @file Attribute.h
* Attribute.h 的头文件
*
*********************************************************************
*/
/* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/
#ifndef ATTRIBUTE_H
#define ATTRIBUTE_H
/* Includes ------------------------------------------------------------------*/
#include "JZsdk_Base/JZsdk_Code/JZsdk_Code.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* 常亮定义*/
/* Exported types ------------------------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
T_JZsdkReturnCode Attribute_SetGpsTime(T_JZsdkAttributeGpsTime GpsTime);
T_JZsdkAttributeGpsTime Attribute_GetGpsTime();
T_JZsdkReturnCode Attribute_SetGpsPosition(T_JZsdkAttributeGpsPosition GpsPosition);
T_JZsdkAttributeGpsPosition Attribute_GetGpsPosition();
T_JZsdkReturnCode Attribute_SetGpsDate(T_JZsdkAttributeGpsDate GpsDate);
T_JZsdkAttributeGpsDate Attribute_GetGpsDate();
T_JZsdkReturnCode Attribute_GetGpsXYZ_ByF(float *x, float *y, float *z);
T_JZsdkReturnCode Attribute_GetTime_ByI(int *year, int *month, int *day, int *hour, int *minute, int *second);
T_JZsdkReturnCode Attribute_GetGpsXYZ_ByStr(unsigned char *latitude, unsigned char *longitude, float *z);
#ifdef __cplusplus
}
#endif
#endif
... ...
// /**
// 方案一:调用该文件中的对外函数输入参数国家码,可能需要更改获取序列号中地区码的部分代码,等待返回值即可,返回值:0 表明国家码与地区码一致。
// 方案二:调用该文件中的对外函数输入参数国家码、序列号中的地区码,等待返回值即可。
// */
// #include "FreeRTOS.h"
// #include "task.h"
// #include "Country_Code.h"
// #include "myflash.h"
// #include "dji_logger.h"
// /*____________________________________________________ Country code array module ____________________________________________________*/
// #if 1 //国家码
// //4个有效数据
// uint16_t CN[] = { //中国
// 156, //中国大陆
// 344, //香港
// 446, //澳门
// 158, //台湾
// };
// //37个有效数据(国家码)
// uint16_t NA[] = { //美洲
// 3, //0; 国家码的百位为0~2的数据的位置<_*_*_>
// 17, //1; 国家码的百位为3~5的数据的位置<_*_*_>
// 32, //2; 国家码的百位为6~8的数据的位置<_*_*_>
// 13, //3; 国家码的百位为0~2的数据的数量<_*_*_>
// 28, //4; 安提瓜和巴布达
// 44, //5; 巴哈马
// 52, //6; 巴巴多斯
// 60, //7; 百慕大(英国)
// 84, //8; 伯利兹
// 92, //9; 英属维尔京群岛
// 124, //10; 加拿大
// 136, //11; 开曼群岛(英国)
// 188, //12; 哥斯达黎加
// 192, //13; 古巴
// 212, //14; 多米尼克
// 214, //15; 多米尼加
// 222, //16; 萨尔瓦多
// 14, //17; 国家码的百位为3~4的数据的数量<_*_*_>
// 304, //18; 格陵兰(丹麦)
// 308, //19; 格林纳达
// 312, //20; 瓜德罗普(法国)
// 320, //21; 危地马拉
// 332, //22; 海地
// 340, //23; 洪都拉斯
// 388, //24; 牙买加
// 474, //25; 马提尼克(法国)
// 484, //26; 墨西哥
// 500, //27; 蒙特塞拉特(英国)
// 530, //28; 荷属安的列斯
// 533, //29; 阿鲁巴(荷兰)
// 558, //30; 尼加拉瓜
// 591, //31; 巴拿马
// 10, //32; 国家码的百位为6~8的数据的数量<_*_*_>
// 630, //33; 波多黎各(美国)
// 659, //34; 圣基茨和尼维斯
// 660, //35; 安圭拉(英国)
// 662, //36; 圣卢西亚
// 666, //37; 圣皮埃尔和密克隆(法国)
// 670, //38; 圣文森特和格林纳丁斯
// 780, //39; 特立尼达和多巴哥
// 796, //40; 特克斯和凯科斯群岛(英国)
// 840, //41; 美国
// 850, //42; 美属维尔京群岛
// };
// //45个数据
// uint16_t EU[] = { //欧洲
// 3, //0; 国家码的百位为0~2的数据的位置<_*_*_>
// 19, //1; 国家码的百位为3~5的数据的位置<_*_*_>
// 36, //2; 国家码的百位为6~8的数据的位置<_*_*_>
// 15, //3; 国家码的百位为0~2的数据的数量<_*_*_>
// 8, //4; 阿尔巴尼亚
// 20, //5; 安道尔
// 40, //6; 奥地利
// 56, //7; 比利时
// 100, //8; 保加利亚
// 112, //9; 白俄罗斯
// 191, //10; 克罗地亚
// 203, //11; 捷克
// 208, //12; 丹麦
// 233, //13; 爱沙尼亚
// 234, //14; 法罗群岛(丹麦)
// 246, //15; 芬兰
// 250, //16; 法国
// 276, //17; 德国
// 292, //18; 直布罗陀
// 16, //19; 国家码的百位为3~5的数据的数量<_*_*_>
// 300, //20; 希腊
// 336, //21; 梵蒂冈
// 348, //22; 匈牙利
// 352, //23; 冰岛
// 372, //24; 爱尔兰
// 380, //25; 意大利
// 428, //26; 拉脱维亚
// 438, //27; 列支敦士登
// 440, //28; 立陶宛
// 442, //29; 卢森堡
// 470, //30; 马耳他
// 492, //31; 摩纳哥
// 498, //32; 摩尔多瓦
// 499, //33; 黑山
// 528, //34; 荷兰
// 578, //35; 挪威
// 14, //36; 国家码的百位为6~8的数据的数量<_*_*_>
// 616, //37; 波兰
// 620, //38; 葡萄牙
// 642, //39; 罗马尼亚
// 643, //40; 俄罗斯联邦
// 674, //41; 圣马力诺
// 688, //42; 塞尔维亚
// 703, //43; 斯洛伐克
// 705, //44; 斯洛文尼亚
// 724, //45; 西班牙
// 752, //46; 瑞典
// 756, //47; 瑞士
// 792, //48; 土耳其欧洲部分
// 804, //49; 乌克兰
// 826, //50; 英国
// };
// /*
// uint16_t AF[] = { //非洲
// };
// uint16_t OC[] = { //大洋洲
// };
// */
// #endif
// /*____________________________________________________ Country code array module ____________________________________________________*/
// //变量定义
// T_country_code_param country_code_Param[] = {
// {.name = "CN", .name_address = CN,},
// {.name = "NA", .name_address = NA,},
// {.name = "EU", .name_address = EU,},//新增区域时,在此处新增对应的区域名字符串,以及对应的国家码数组
// };
// /*____________________________________________________ Country Code func module ____________________________________________________*/
// #if 1 //国家码比对函数模块
// /**
// @brief: 传入国家码结构体,判断是否与传入的国家码一致(返回0),不一致返回1
// @Param: code 国家码参数结构体
// @Param: CountryCode 国家码
// @return:no
// */
// static uint8_t IF_Country_Code(T_country_code_param * code , uint16_t CountryCode)
// {
// uint8_t i = 0;
// uint8_t hundred = 0;//存储传进参数的百位的值
// uint8_t hundred_address = 0;//存储传进参数的百位处在第X个元素的位置
// uint8_t number = 0;
// hundred = CountryCode / 100;//取传进参数的百位在数组中的位置
// if(hundred <= 2)
// {
// hundred = 0;//存放国家码百位为0~2的数据所在位置的数组的第X个元素
// }else if(hundred >=3 && hundred <= 5)
// {
// hundred = 1;
// }else if(hundred >=6 && hundred <= 8)
// {
// hundred = 2;
// }
// hundred_address = code->name_address[hundred];//取国家码百位在X~X+2的数据的位置
// number = code->name_address[hundred_address];//取国家码百位在X~X+2的数据的数量
// for(i = 0;i<number;i++)
// {
// if(CountryCode == code->name_address[hundred_address+(1+i)])//判断这些数据是否与传进参数一致
// {
// return 0;//对比成功,数组中存在该元素
// }else
// {
// }
// }
// return 1;//对比失败,数组中未存在该元素
// }
// /**
// @brief: 输入的国家码与序列号中的地区码相同即返回0;否返回1
// @Param: CountryCode 国家码
// @Param: xarea 序列号中的国家码(地区位)
// @return:0/1 成功/失败
// */
// #if 1 //方案二
// uint8_t Country_Code_handle(uint16_t CountryCode , char * xarea)
// {
// if(strcmp(xarea,country_code_Param[0].name) == 0)//中国地区
// {
// if(CountryCode == country_code_Param[0].name_address[0]
// || CountryCode == country_code_Param[0].name_address[1]
// || CountryCode == country_code_Param[0].name_address[2]
// || CountryCode == country_code_Param[0].name_address[3])//if(CountryCode == 156 || CountryCode == 344 || CountryCode == 446 || CountryCode == 158)
// {
// return 0;//返回成功
// }else
// {
// return 1;//返回不成功
// }
// }
// else if(strcmp(xarea,country_code_Param[1].name) == 0)//美洲地区
// {
// return IF_Country_Code(&country_code_Param[1],CountryCode);
// }
// else if(strcmp(xarea,country_code_Param[2].name) == 0)//欧洲地区
// {
// return IF_Country_Code(&country_code_Param[2],CountryCode);
// }
// else
// {
// }
// return 1;//返回不成功
// }
// #else //方案一
// uint8_t Country_Code_handle(uint16_t CountryCode)
// {
// uint8_t SN_Code[SN_LEN+2] = {0}; //暂时存储序列号
// char area[3] = {0};//保存序列号中的地区码
// Read_SN_FromFlash(SN_Code,SN_LEN); //获取序列号
// SN_Code[16] = '\0';
// area[0] = SN_Code[4];
// area[1] = SN_Code[5];
// area[2] = '\0';
// if(strcmp(area,country_code_Param[0].name) == 0)//
// {
// if(CountryCode == country_code_Param[0].name_address[0]
// || CountryCode == country_code_Param[0].name_address[0]
// || CountryCode == country_code_Param[0].name_address[0]
// || CountryCode == country_code_Param[0].name_address[0])//if(CountryCode == 156 || CountryCode == 344 || CountryCode == 446 || CountryCode == 158)
// {
// return 0;//返回成功
// }else
// {
// return 1;//返回不成功
// }
// }
// else if(strcmp(area,country_code_Param[1].name) == 0)
// {
// return IF_Country_Code(&country_code_Param[1],CountryCode);
// }
// else if(strcmp(area,country_code_Param[2].name) == 0)
// {
// return IF_Country_Code(&country_code_Param[2],CountryCode);
// }
// else
// {
// }
// return 1;//返回不成功
// }
// #endif
// #endif
// /*____________________________________________________ Country Code func module ____________________________________________________*/
// /*____________________________________________________ "Country_Code_handle()" External call module ____________________________________________________*/
// #if 0 //国家码函数调用例子
// static void Country_Code_init(void)//方案二
// {
// uint8_t SN_Code[SN_LEN+2] = {0}; //暂时存储序列号
// char area[3] = {0};//保存序列号中的地区码
// uint8_t activate_flag = 0;//激活标志位,该处位局部变量真正工程中需变为全局变量或其它操作
// uint8_t Country_Code = 156;//假如从飞机获取的国家码是156,真正工程中需变为全局变量或其它操作
// Read_SN_FromFlash(SN_Code,SN_LEN); //获取序列号,需更改为工程的对应的获取序列号的函数
// SN_Code[16] = '\0';
// area[0] = SN_Code[4];
// area[1] = SN_Code[5];
// area[2] = '\0';
// activate_flag = Get_Active_State(); //获取激活状态,需更改为工程的对应的获取激活状态的函数
// if(activate_flag == 0x01)//激活后才需要判断国家码与序列号的码是否一致,app_activate_flag == 0x01
// {
// USER_LOG_INFO("SN = %s,activate = %x,CountryCode = %d,area = %s\r\n",SN_Code,activate_flag,Country_Code,area);//输出序列号,国家码,
// activate_flag = Country_Code_handle(Country_Code,area);//获取国家码比对结果。
// USER_LOG_INFO("app_country_flag = %d\r\n",activate_flag);
// if(activate_flag == 0)//国家码与序列号地区码比对一致
// {
// }else
// {
// activate_flag = 0;//非法地区,禁止使用
// }
// }
// }
// #endif
// /*____________________________________________________ "Country_Code_handle()" External call module ____________________________________________________*/
// /*____________________________________________________ Country code test module ____________________________________________________*/
// #if COUNTRY_CODE_TEST //测试国家码是否能对应查找以及对比成功
// /**
// @brief: 传入国家码结构体,判断是否与传入的国家码一致(返回0),不一致返回1
// @Param: code 国家码参数结构体
// @Param: CountryCode 国家码
// @return:no
// */
// uint8_t TEST_IF_Country_Code(T_country_code_param * code , uint16_t CountryCode)
// {
// uint8_t i = 0;
// uint8_t hundred = 0;//存储传进参数的百位的值
// uint8_t hundred_address = 0;//存储传进参数的百位处在第X个元素的位置
// uint8_t number = 0;
// uint8_t state = 1;//返回检查状态
// hundred = CountryCode / 100;//取传进参数的百位在数组中的位置
// if(hundred <= 2)
// {
// hundred = 0;//存放国家码百位为0~2的数据所在位置的数组的第X个元素
// }else if(hundred >=3 && hundred <= 5)
// {
// hundred = 1;
// }else if(hundred >=6 && hundred <= 8)
// {
// hundred = 2;
// }
// hundred_address = code->name_address[hundred];//取国家码百位在X~X+2的数据的位置
// number = code->name_address[hundred_address];//取国家码百位在X~X+2的数据的数量
// for(i = 0;i<number;i++)
// {
// if(CountryCode == code->name_address[hundred_address+(1+i)])//判断这些数据是否与传进参数一致
// {
// state = 0;
// }else
// {
// USER_LOG_INFO("CountryCode = %d\n",code->name_address[hundred_address+(1+i)]); //输出
// vTaskDelay(pdMS_TO_TICKS(2));
// }
// }
// return state;//对比成功,数组中存在该元素
// }
// /**
// @brief: 输入的国家码与序列号中的地区码相同即返回0;否返回1
// @Param: CountryCode 国家码
// @Param: xarea 序列号中的国家码(地区位)
// @return:0/1 成功/失败
// */
// uint8_t TEST_Country_Code_handle(uint16_t CountryCode , char * xarea)
// {
// USER_LOG_INFO("CountryCode = %d,%s\n",CountryCode,xarea); //输出
// if(strcmp(xarea,country_code_Param[0].name) == 0)//
// {
// if(CountryCode == 156 || CountryCode == 344 || CountryCode == 446 || CountryCode == 158)
// {
// return 0;//返回成功
// }else
// {
// return 1;//返回不成功
// }
// }
// else if(strcmp(xarea,country_code_Param[1].name) == 0)
// {
// return TEST_IF_Country_Code(&country_code_Param[1],CountryCode);
// }
// else if(strcmp(xarea,country_code_Param[2].name) == 0)
// {
// return TEST_IF_Country_Code(&country_code_Param[2],CountryCode);
// }
// else
// {
// }
// return 1;//返回不成功
// }
// /**
// @brief: 测试国家码
// @Param: no
// @return:no
// */
// void TEST_guojiama(void)
// {
// char area[5] = {0};//保存序列号中的地区码
// uint8_t state = 2;
// area[0] = 'C';
// area[1] = 'N';
// area[2] = '\0';
// state = TEST_Country_Code_handle(156,area);
// USER_LOG_INFO("%d\r\n",state);//国家码比对结果返回
// vTaskDelay(pdMS_TO_TICKS(500));
// area[0] = 'N';
// area[1] = 'A';
// area[2] = '\0';
// state = TEST_Country_Code_handle(8,area);
// USER_LOG_INFO("%d\r\n",state);
// vTaskDelay(pdMS_TO_TICKS(500));
// area[0] = 'E';
// area[1] = 'U';
// area[2] = '\0';
// state = TEST_Country_Code_handle(800,area);
// USER_LOG_INFO("%d\r\n",state);
// vTaskDelay(pdMS_TO_TICKS(500));
// }
// #endif
// /*____________________________________________________ Country code test module ____________________________________________________*/
... ...
... ... @@ -13,6 +13,7 @@
#include "DeviceInfo/DeviceMessage/DeviceMessage.h"
#include "SerialNumberProc/SerialProc.h"
#include "DeviceInfo/HardwareInfo/HardwareInfo.h"
#include "DeviceInfo/Attribute/Attribute.h"
/* Includes ------------------------------------------------------------------*/
#ifdef __cplusplus
... ...
... ... @@ -177,7 +177,6 @@ static T_JZsdkReturnCode DeviceMessage_Enter_Default(unsigned char *message)
snprintf(new_message,MESSAGE_MAX_LEN,"气体阈值\n上限:%d\n下限:%d\n",g_temp_GasValueMax , g_temp_GasValueMin);
snprintf(old_message,MESSAGE_MAX_LEN,"%s",message);
snprintf(message,MESSAGE_MAX_LEN,"%s%s",old_message,new_message);
}
else
{
... ... @@ -187,6 +186,52 @@ static T_JZsdkReturnCode DeviceMessage_Enter_Default(unsigned char *message)
snprintf(old_message,MESSAGE_MAX_LEN,"%s",message);
snprintf(message,MESSAGE_MAX_LEN,"%s%s",old_message,new_message);
}
// float gps_x;
// float gps_y;
// float gps_z;
// int gps_year;
// int gps_month;
// int gps_day;
// int gps_hour;
// int gps_minute;
// int gps_second;
// Attribute_GetGpsXYZ_ByF(&gps_x,&gps_y,&gps_z);
// Attribute_GetTime_ByI( &gps_year,&gps_month,&gps_day,&gps_hour,&gps_minute,&gps_second);
// memset(new_message,0,sizeof(new_message));
// memset(old_message,0,sizeof(old_message));
// snprintf(new_message,MESSAGE_MAX_LEN,"GPS: X:%.2f Y:%.2f Z:%.2f\n%d-%d-%d %d:%d:%d\n",gps_x,gps_y,gps_z,gps_year,gps_month,gps_day,gps_hour,gps_minute,gps_second);
// snprintf(old_message,MESSAGE_MAX_LEN,"%s",message);
// snprintf(message,MESSAGE_MAX_LEN,"%s%s",old_message,new_message);
unsigned char gps_x_str[50];
unsigned char gps_y_str[50];
float gps_z;
int gps_year;
int gps_month;
int gps_day;
int gps_hour;
int gps_minute;
int gps_second;
memset(gps_x_str,0,sizeof(gps_x_str));
memset(gps_y_str,0,sizeof(gps_y_str));
Attribute_GetGpsXYZ_ByStr(gps_x_str,gps_y_str,&gps_z);
Attribute_GetTime_ByI( &gps_year,&gps_month,&gps_day,&gps_hour,&gps_minute,&gps_second);
memset(new_message,0,sizeof(new_message));
memset(old_message,0,sizeof(old_message));
snprintf(new_message,MESSAGE_MAX_LEN,"GPS:%s %s\n%d-%d-%d %d:%d:%d\n",gps_x_str,gps_y_str,gps_year,gps_month,gps_day,gps_hour,gps_minute,gps_second);
snprintf(old_message,MESSAGE_MAX_LEN,"%s",message);
snprintf(message,MESSAGE_MAX_LEN,"%s%s",old_message,new_message);
#endif
//如果为组合版
... ...
... ... @@ -149,6 +149,9 @@ T_JZsdkReturnCode Gimbal_Set_PitchAngle(int angle)
case JZ_MODULE_CONTROL_WAY_TRANSPARENT:
{
Gimbal_PitchAngle = angle;
//将云台角度透传出去
Gimbal_DataDeal_SetRealAngle(Gimbal_PitchAngle);
}
break;
... ...
... ... @@ -76,9 +76,9 @@ T_JZsdkReturnCode IRC_LowT_CycleCalibration(U16_t *ImageData,struct IRC_param *d
if (dealInfo->LowT_flag > 9) //已经存储了9组数据
{
for (int i = 0; i < (dealInfo->Width * dealInfo->Height); i++)
for (int i = 0; i < (dealInfo->PixelNum); i++)
{
dealInfo->LowT_NineFrame_Avg[i] = (int)(dealInfo->LowT_NineFrameAdd[i] / 9);
dealInfo->LowT_NineFrame_Avg[i] = (U16_t)(dealInfo->LowT_NineFrameAdd[i] / 9);
}
dealInfo->LowT_flag = JZ_FLAGCODE_OFF; //将标志位归位
... ...
... ... @@ -111,14 +111,15 @@ static T_JZsdkReturnCode IRC_data_PreliminaryDeal(U16_t *rawData ,unsigned int *
JZsdk_CutBadPixel_U16(rawData, dealInfo->Width, dealInfo->Height, dealInfo->BadPixel, dealInfo->BadPixelNum,dealInfo->BadPixelExtern, 1);
}
// //盲点过后进行数据复查
// for (int i = 0; i < *rawSize; i++)
// {
// if (rawData[i] > dealInfo->ExpectedMax)
// {
// rawData[i] = dealInfo->ExpectedMax;
// }
// }
/****************************************盲点复查********************************************************************/
for (int i = 0; i < *rawSize; i++)
{
if (rawData[i] > dealInfo->ExpectedMax)
{
rawData[i] = dealInfo->ExpectedMax;
}
}
/*************************************两点纠正部分******************************************************************/
... ...
... ... @@ -561,9 +561,7 @@ T_JZsdkReturnCode Megaphone_PlayNextSong()
T_JZsdkReturnCode Megaphone_Flush_MusicList()
{
//1、刷新列表
AudioFile_FlushAudioList();
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
return AudioFile_FlushAudioList();
}
... ...
... ... @@ -24,6 +24,8 @@ static struct AudioMange_Node *g_AudioListtail = NULL; // 用于跟踪链表的
static int g_AudioList_Num = 0; //记录链表中一共有几首歌
static int g_AudioList_CurrentNum = 0; //记录播放当前第几首歌
static g_AudioList_flush_Flag = JZ_FLAGCODE_OFF; //刷新标志位
//文件播放线程
static void *FilePlay_data_pthread(void *arg)
{
... ... @@ -204,6 +206,13 @@ static T_JZsdkReturnCode AudioFile_FreeAudioList()
**********/
T_JZsdkReturnCode AudioFile_FlushAudioList()
{
if (g_AudioList_flush_Flag == JZ_FLAGCODE_ON)
{
return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE;
}
g_AudioList_flush_Flag = JZ_FLAGCODE_ON;
//读取audio文件夹,并将歌曲名放入音频列表
DIR *dir;
struct dirent *entry;
... ... @@ -223,6 +232,7 @@ T_JZsdkReturnCode AudioFile_FlushAudioList()
if ((dir = opendir(AUDIO_DIR)) == NULL)
{
JZSDK_LOG_ERROR("音频文件夹获取失败");
g_AudioList_flush_Flag = JZ_FLAGCODE_OFF;
return JZ_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
}
... ... @@ -272,6 +282,8 @@ T_JZsdkReturnCode AudioFile_FlushAudioList()
|| JZsdk_strings_suffix_comparison_withLen((const unsigned char *)filename, len, (const unsigned char *)".aac") == JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS
|| JZsdk_strings_suffix_comparison_withLen((const unsigned char *)filename, len, (const unsigned char *)".AAC") == JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
{
//JZSDK_LOG_INFO("读取到歌曲:%s",filename);
// 处理文件
memset(&audioInfo, 0, sizeof(audioInfo)); // 清除audioInfo结构
... ... @@ -317,6 +329,8 @@ T_JZsdkReturnCode AudioFile_FlushAudioList()
//打印一遍已加载的音乐
JZsdk_PrintfAuidoNode_AudioList(g_AudioList);
g_AudioList_flush_Flag = JZ_FLAGCODE_OFF;
JZSDK_LOG_INFO("刷新歌曲列表已完成");
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
... ...
... ... @@ -46,7 +46,7 @@ static T_JZsdkReturnCode PcmPlay_Interface(t_PcmParam *PcmParam)
nbBytes = fread(cbits, 1, 3 * 1276, Pcm_fp);
if(nbBytes > 0)
{
AudioDeal_PcmDataInput(g_opus_sampleRate, (unsigned char *)cbits, nbBytes);
AudioDeal_PcmDataInput(g_opus_sampleRate, (unsigned char *)cbits, nbBytes, 1);
}
int totalSamples = nbBytes / (2);
... ...
... ... @@ -91,7 +91,7 @@ static T_JZsdkReturnCode TTS_Synthesis(const char* src_text, const char* params)
//没将数据放入PCM通道
//printf("产生了%d 的数据\n",audio_len);
AudioDeal_PcmDataInput(16000, (unsigned char *)data, audio_len);
AudioDeal_PcmDataInput(16000, (unsigned char *)data, audio_len, 0);
}
if (synth_status == MSP_TTS_FLAG_DATA_END)
... ...
... ... @@ -35,8 +35,11 @@ extern "C" {
//新班子 116.8
//95 115.7
//90
#define MAX_VOLUME 82
#define MAX_TTS_VOLUME 92
// #define MAX_VOLUME 82
// #define MAX_TTS_VOLUME 92
#define MAX_VOLUME 100
#define MAX_TTS_VOLUME 100
#elif DEVICE_VERSION == JZ_H10
#define MAX_VOLUME (65)
#define MAX_TTS_VOLUME (70)
... ...
... ... @@ -100,7 +100,7 @@ static T_JZsdkReturnCode FixedFilePlay()
nbBytes = fread(cbits, 1, 3 * 1276, PlayFixedFile_pcm_fp);
if(nbBytes > 0)
{
AudioDeal_PcmDataInput(g_opus_sampleRate, (unsigned char *)cbits, nbBytes);
AudioDeal_PcmDataInput(g_opus_sampleRate, (unsigned char *)cbits, nbBytes, 1);
}
int totalSamples = nbBytes / (2);
... ... @@ -408,17 +408,19 @@ T_JZsdkReturnCode OpusFile_DecodeOpus(unsigned char *opusFile)
return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE;
}
unsigned char *DecodeFile = OsalHandler->Malloc(strlen(opusFile));
unsigned char *DecodeFile = OsalHandler->Malloc(strlen(opusFile) + 1);
if(DecodeFile == NULL)
{
JZSDK_LOG_ERROR("DecodeFile malloc failed");
return JZ_ERROR_SYSTEM_MODULE_CODE_MEMORY_ALLOC_FAILED;
}
memset(DecodeFile, strlen(opusFile), 0);
memset(DecodeFile, 0, strlen(opusFile) + 1);
memcpy(DecodeFile, opusFile, strlen(opusFile));
OsalHandler->TaskCreate("DecodeOpus", DecodeOpus_task, 8192, (void *)DecodeFile, &g_DecodeOpus_task);
//JZSDK_LOG_INFO("decode %s %dto %s %d\n", opusFile, strlen(opusFile), DecodeFile, strlen(DecodeFile));
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
... ... @@ -485,7 +487,7 @@ T_JZsdkReturnCode OpusFile_DecodeOpusAndSave(int SaveMode, unsigned char *InFile
return JZ_ERROR_SYSTEM_MODULE_CODE_MEMORY_ALLOC_FAILED;
}
memset(OpusDecodeFileInfo, sizeof(OpusDecodeFile), 0);
memset(OpusDecodeFileInfo, 0, sizeof(OpusDecodeFile));
OpusDecodeFileInfo->saveMode = SaveMode;
memcpy(OpusDecodeFileInfo->inputFilePath, InFile, strlen(InFile));
memcpy(OpusDecodeFileInfo->outputFilePath, OutFile, strlen(OutFile));
... ...
... ... @@ -188,7 +188,7 @@ static T_JZsdkReturnCode Opus_RealTimeVoice_PlayData(unsigned char *data,int len
pcm_bytes[2 * i + 1] = (TempPcm[i] >> 8) & 0xFF;
}
AudioDeal_PcmDataInput(RealTimeDecodeRate, pcm_bytes, frame_size*2);
AudioDeal_PcmDataInput(RealTimeDecodeRate, pcm_bytes, frame_size*2, 1);
return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
... ...
... ... @@ -42,13 +42,13 @@
#include "gimbal_emu/test_payload_gimbal_emu.h"
#include "JZsdkLib.h"
#include "DeviceInfo/Attribute/Attribute.h"
/* Private constants ---------------------------------------------------------*/
#define FC_SUBSCRIPTION_TASK_FREQ (1)
#define FC_SUBSCRIPTION_TASK_STACK_SIZE (1024)
#define HEIGHT_VOLUME_LIMIT 0 //高度限制音量开关
/* Private types -------------------------------------------------------------*/
/* Private functions declaration ---------------------------------------------*/
... ... @@ -163,23 +163,21 @@ T_DjiReturnCode DjiTest_FcSubscriptionStartService(void)
}
#if HEIGHT_VOLUME_LIMIT == 1 //如果开启相对高度音量限制功能
//m30和m30t有高度锁
if (aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30 || aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30T)
{
if (osalHandler->TaskCreate("Subscription_Height_Fusion_task", Subscription_Height_Fusion_task,
FC_SUBSCRIPTION_TASK_STACK_SIZE, NULL, &s_userFcSubscriptionThread) !=
DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("Height Fusion task create error.");
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
}
else {
USER_LOG_INFO("开启相对高度音量限制功能");
}
}
// //m30和m30t有高度锁
// if (aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30 || aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30T)
// {
// if (osalHandler->TaskCreate("Subscription_Height_Fusion_task", Subscription_Height_Fusion_task,
// FC_SUBSCRIPTION_TASK_STACK_SIZE, NULL, &s_userFcSubscriptionThread) !=
// DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
// USER_LOG_ERROR("Height Fusion task create error.");
// return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
// }
// else {
// USER_LOG_INFO("开启相对高度音量限制功能");
// }
// }
#endif
... ... @@ -381,6 +379,21 @@ static void *Subscription_GPS_DealTask(void *arg)
//USER_LOG_INFO("gps订阅");
//1s一次
T_JZsdkAttributeGpsPosition temp_GpsPosition;
temp_GpsPosition.x = gpsPosition.x;
temp_GpsPosition.y = gpsPosition.y;
temp_GpsPosition.z = gpsPosition.z;
Attribute_SetGpsPosition(temp_GpsPosition);
T_JZsdkAttributeGpsTime temp_GpsTime;
temp_GpsTime = gpsTime;
Attribute_SetGpsTime(temp_GpsTime);
T_JZsdkAttributeGpsDate temp_GpsDate;
temp_GpsDate = gpsDate;
Attribute_SetGpsDate(temp_GpsDate);
osalHandler->TaskSleepMs(1000 / FC_SUBSCRIPTION_TASK_FREQ);
}
... ...
... ... @@ -371,19 +371,6 @@ static void *DjiTest_WidgetTask(void *arg)
USER_UTIL_UNUSED(arg);
//激活功能
int a=1;
if (a == 1 && mobileAppInfo.appLanguage == DJI_MOBILE_APP_LANGUAGE_CHINESE)
{
USER_LOG_INFO("设备未激活");
}
else if (a == 1 && (mobileAppInfo.appLanguage != DJI_MOBILE_APP_LANGUAGE_CHINESE) )
{
USER_LOG_INFO("海外设备未激活");
}
while (1) {
char old_message[1024];
char new_message[1024];
... ...