合并分支 'dev' 到 'master'
Dev 查看合并请求 !14
正在显示
57 个修改的文件
包含
2268 行增加
和
969 行删除
@@ -72,7 +72,41 @@ | @@ -72,7 +72,41 @@ | ||
72 | "rk_rga.h": "c", | 72 | "rk_rga.h": "c", |
73 | "rgautils.h": "c", | 73 | "rgautils.h": "c", |
74 | "im2d_type.h": "c", | 74 | "im2d_type.h": "c", |
75 | - "im2d.h": "c" | 75 | + "im2d.h": "c", |
76 | + "halrecv_tpye1.h": "c", | ||
77 | + "jzsdk_uart_recvdeal.h": "c", | ||
78 | + "jzsdk_framecomparsion.h": "c", | ||
79 | + "jzsdk_definingcode.h": "c", | ||
80 | + "test_data_transmission.h": "c", | ||
81 | + "halrecv_type1.h": "c", | ||
82 | + "halrecv_type1_recvdeal.h": "c", | ||
83 | + "halrecv.h": "c", | ||
84 | + "halsend_type1.h": "c", | ||
85 | + "halsend.h": "c", | ||
86 | + "warninglight_v3s_tfa1.h": "c", | ||
87 | + "gimbal.h": "c", | ||
88 | + "jzsdk_uart_uartdeal.h": "c", | ||
89 | + "powermanager_inandout.h": "c", | ||
90 | + "jzsdk_definecode.h": "c", | ||
91 | + "jzsdk_devicecode.h": "c", | ||
92 | + "opus.h": "c", | ||
93 | + "jzsdk_hal.h": "c", | ||
94 | + "commonmod.h": "c", | ||
95 | + "gimbal_specialuart.h": "c", | ||
96 | + "megaphone_opus.h": "c", | ||
97 | + "megaphone_audiofile.h": "c", | ||
98 | + "dji_typedef.h": "c", | ||
99 | + "jzsdk_flagcode.h": "c", | ||
100 | + "jzsdk_typedef.h": "c", | ||
101 | + "jzsdk_errorcode.h": "c", | ||
102 | + "jzsdk_portcode.h": "c", | ||
103 | + "jzsdk_osal.h": "c", | ||
104 | + "jzsdk_time.h": "c", | ||
105 | + "jzsdk_task.h": "c", | ||
106 | + "jzsdk_semaphore.h": "c", | ||
107 | + "jzsdk_filesystm.h": "c", | ||
108 | + "jzsdk_memoryadapter.h": "c", | ||
109 | + "jzsdk_errorcodedef.h": "c" | ||
76 | }, | 110 | }, |
77 | "Codegeex.GenerationPreference": "automatic", | 111 | "Codegeex.GenerationPreference": "automatic", |
78 | "C_Cpp.dimInactiveRegions": false | 112 | "C_Cpp.dimInactiveRegions": false |
1 | # 编译链的配置 | 1 | # 编译链的配置 |
2 | 2 | ||
3 | #1、编译链与设备类型的选择 | 3 | #1、编译链与设备类型的选择 |
4 | -set(DEVICE_NAME JZ_H10T) | 4 | +set(DEVICE_NAME JZ_H10) |
5 | #上一行为禁止修改行 | 5 | #上一行为禁止修改行 |
6 | 6 | ||
7 | message("**************************JZSDK构建编译开始***************************\n") | 7 | message("**************************JZSDK构建编译开始***************************\n") |
@@ -27,10 +27,6 @@ file(GLOB_RECURSE JZSDK_HAL_SRC ${ROOT_DIRS}JZsdk_hal/*.c) | @@ -27,10 +27,6 @@ file(GLOB_RECURSE JZSDK_HAL_SRC ${ROOT_DIRS}JZsdk_hal/*.c) | ||
27 | list(APPEND ALL_SRC_FILES ${JZSDK_HAL_SRC}) | 27 | list(APPEND ALL_SRC_FILES ${JZSDK_HAL_SRC}) |
28 | list(APPEND ALL_INC_FILES ${ROOT_DIRS}JZsdk_hal) | 28 | list(APPEND ALL_INC_FILES ${ROOT_DIRS}JZsdk_hal) |
29 | 29 | ||
30 | -file(GLOB_RECURSE JZSDK_OSAL_SRC ${ROOT_DIRS}JZsdk_osal/*.c) | ||
31 | -list(APPEND ALL_SRC_FILES ${JZSDK_OSAL_SRC}) | ||
32 | -list(APPEND ALL_INC_FILES ${ROOT_DIRS}JZsdk_osal) | ||
33 | - | ||
34 | message("\nJZSDK基础代码加载完毕\n") | 30 | message("\nJZSDK基础代码加载完毕\n") |
35 | 31 | ||
36 | #如果要加载设备信息模块,需要加载以下附属内容 | 32 | #如果要加载设备信息模块,需要加载以下附属内容 |
@@ -104,6 +100,7 @@ if(${MEDIA_PROC_MODULE} STREQUAL "VERSION_SWITCH_ON") | @@ -104,6 +100,7 @@ if(${MEDIA_PROC_MODULE} STREQUAL "VERSION_SWITCH_ON") | ||
104 | set(LIB_USB VERSION_SWITCH_ON) | 100 | set(LIB_USB VERSION_SWITCH_ON) |
105 | 101 | ||
106 | if(${IRC_MODULE} STREQUAL "VERSION_SWITCH_ON") | 102 | if(${IRC_MODULE} STREQUAL "VERSION_SWITCH_ON") |
103 | + message("加载昆腾红外相机模块") | ||
107 | set(LIB_KT_IRC VERSION_SWITCH_ON) | 104 | set(LIB_KT_IRC VERSION_SWITCH_ON) |
108 | 105 | ||
109 | endif() | 106 | endif() |
@@ -139,12 +136,12 @@ if(${MEGAPHONE_MODULE} STREQUAL "VERSION_SWITCH_ON") | @@ -139,12 +136,12 @@ if(${MEGAPHONE_MODULE} STREQUAL "VERSION_SWITCH_ON") | ||
139 | set(OPUS_MODULE VERSION_SWITCH_ON) | 136 | set(OPUS_MODULE VERSION_SWITCH_ON) |
140 | endif() | 137 | endif() |
141 | 138 | ||
142 | -#如果要加载电源管理模块,需要加载以下附属内容 | ||
143 | -if(${POWER_MANAGER_MODULE} STREQUAL "VERSION_SWITCH_ON") | 139 | +#如果要加载通用模块,需要加载以下附属内容 |
140 | +if(${COMMON_MODULE} STREQUAL "VERSION_SWITCH_ON") | ||
144 | 141 | ||
145 | - message("\n电源模块加载中") | ||
146 | - file(GLOB_RECURSE POWERMANAGER_SRC ${ROOT_DIRS}Module/PowerManager/*.c) | ||
147 | - list(APPEND ALL_SRC_FILES ${POWERMANAGER_SRC}) | 142 | + message("\n通用模块加载中") |
143 | + file(GLOB_RECURSE COMMON_MODULE_SRC ${ROOT_DIRS}Module/CommonMod/*.c) | ||
144 | + list(APPEND ALL_SRC_FILES ${COMMON_MODULE_SRC}) | ||
148 | 145 | ||
149 | endif() | 146 | endif() |
150 | 147 | ||
@@ -200,7 +197,7 @@ list(APPEND ALL_INC_FILES ${ROOT_DIRS}Module/Gimbal) | @@ -200,7 +197,7 @@ list(APPEND ALL_INC_FILES ${ROOT_DIRS}Module/Gimbal) | ||
200 | list(APPEND ALL_INC_FILES ${ROOT_DIRS}Module/Lighting) | 197 | list(APPEND ALL_INC_FILES ${ROOT_DIRS}Module/Lighting) |
201 | list(APPEND ALL_INC_FILES ${ROOT_DIRS}Module/UI_control) | 198 | list(APPEND ALL_INC_FILES ${ROOT_DIRS}Module/UI_control) |
202 | list(APPEND ALL_INC_FILES ${ROOT_DIRS}Module/Camera) | 199 | list(APPEND ALL_INC_FILES ${ROOT_DIRS}Module/Camera) |
203 | -list(APPEND ALL_INC_FILES ${ROOT_DIRS}Module/PowerManager) | 200 | +list(APPEND ALL_INC_FILES ${ROOT_DIRS}Module/COMMONManager) |
204 | list(APPEND ALL_INC_FILES ${ROOT_DIRS}Module/TestAPP) | 201 | list(APPEND ALL_INC_FILES ${ROOT_DIRS}Module/TestAPP) |
205 | list(APPEND ALL_INC_FILES ${ROOT_DIRS}Module/ImageProcessing) | 202 | list(APPEND ALL_INC_FILES ${ROOT_DIRS}Module/ImageProcessing) |
206 | list(APPEND ALL_INC_FILES ${ROOT_DIRS}Module/SerialManagement) | 203 | list(APPEND ALL_INC_FILES ${ROOT_DIRS}Module/SerialManagement) |
@@ -26,7 +26,7 @@ set(LIGHTING_MODULE VERSION_SWITCH_OFF) | @@ -26,7 +26,7 @@ set(LIGHTING_MODULE VERSION_SWITCH_OFF) | ||
26 | set(MEGAPHONE_MODULE VERSION_SWITCH_OFF) | 26 | set(MEGAPHONE_MODULE VERSION_SWITCH_OFF) |
27 | 27 | ||
28 | # 电源管理模块 | 28 | # 电源管理模块 |
29 | -set(POWER_MANAGER_MODULE VERSION_SWITCH_OFF) | 29 | +set(COMMON_MODULE VERSION_SWITCH_OFF) |
30 | 30 | ||
31 | # UI管理模块 | 31 | # UI管理模块 |
32 | set(UI_CONTROL_MODULE VERSION_SWITCH_OFF) | 32 | set(UI_CONTROL_MODULE VERSION_SWITCH_OFF) |
@@ -66,8 +66,8 @@ set(DEVICE_CONFIG_MODULE VERSION_SWITCH_ON) | @@ -66,8 +66,8 @@ set(DEVICE_CONFIG_MODULE VERSION_SWITCH_ON) | ||
66 | # 添加UI管理模块 | 66 | # 添加UI管理模块 |
67 | set(UI_CONTROL_MODULE VERSION_SWITCH_ON) | 67 | set(UI_CONTROL_MODULE VERSION_SWITCH_ON) |
68 | 68 | ||
69 | -# 添加电源管理模块 | ||
70 | -set(POWER_MANAGER_MODULE VERSION_SWITCH_ON) | 69 | +# 添加通用模块 |
70 | +set(COMMON_MODULE VERSION_SWITCH_ON) | ||
71 | 71 | ||
72 | 72 | ||
73 | message("通用库加载完成") | 73 | message("通用库加载完成") |
@@ -177,13 +177,16 @@ endif() | @@ -177,13 +177,16 @@ endif() | ||
177 | 177 | ||
178 | #kt_IRC库 | 178 | #kt_IRC库 |
179 | if(${LIB_KT_IRC} STREQUAL "VERSION_SWITCH_ON") | 179 | if(${LIB_KT_IRC} STREQUAL "VERSION_SWITCH_ON") |
180 | + | ||
181 | + add_definitions(-DMACRO_KTIRC_MODULE) | ||
182 | + | ||
180 | message("ktIRC库已加载\n") | 183 | message("ktIRC库已加载\n") |
181 | include_directories(${ROOT_DIRS}/ThirdParty/KT_IRC/include) | 184 | include_directories(${ROOT_DIRS}/ThirdParty/KT_IRC/include) |
182 | target_link_libraries( | 185 | target_link_libraries( |
183 | ${PROJECT_NAME} | 186 | ${PROJECT_NAME} |
184 | - ${ROOT_DIRS}/ThirdParty/KT_IRC/aarch64-none-linux-gnu/lib/libktlib.so | 187 | + ${ROOT_DIRS}/ThirdParty/KT_IRC/aarch64-none-linux-gnu/lib/libm330aarchx64.so |
185 | ) | 188 | ) |
186 | - add_definitions(-DMACRO_KTIRC_MODULE) | 189 | + |
187 | endif() | 190 | endif() |
188 | 191 | ||
189 | message("**************************动态库加载完毕***************************\n") | 192 | message("**************************动态库加载完毕***************************\n") |
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include "JZsdkLib.h" | 2 | #include "JZsdkLib.h" |
3 | + | ||
3 | #include "./JZsdk_TaskManagement/TaskManagement.h" | 4 | #include "./JZsdk_TaskManagement/TaskManagement.h" |
4 | 5 | ||
6 | +static T_JZsdkReturnCode JZsdk_PrepareSystemEnvironment() | ||
7 | +{ | ||
8 | + T_JZsdkReturnCode ret; | ||
9 | + | ||
10 | + ret = JZsdk_OsalInit(); | ||
11 | + if (ret != JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS) | ||
12 | + { | ||
13 | + | ||
14 | + } | ||
15 | + else | ||
16 | + { | ||
17 | + JZSDK_LOG_INFO("JZSDK_OSAL_INIT_SUCCESS"); | ||
18 | + } | ||
19 | + | ||
20 | + return ret; | ||
21 | +} | ||
22 | + | ||
23 | + | ||
5 | //初始化sdk | 24 | //初始化sdk |
6 | T_JZsdkReturnCode JZsdk_LibInit() | 25 | T_JZsdkReturnCode JZsdk_LibInit() |
7 | { | 26 | { |
27 | + //环境初始化 | ||
28 | + JZsdk_PrepareSystemEnvironment(); | ||
29 | + | ||
8 | //1、初始化log | 30 | //1、初始化log |
9 | JZsdk_LoggerInit(); | 31 | JZsdk_LoggerInit(); |
10 | 32 | ||
11 | //2、任务管理系统初始化 | 33 | //2、任务管理系统初始化 |
12 | TaskManagement_Init(); | 34 | TaskManagement_Init(); |
13 | 35 | ||
14 | - JZSDK_LOG_INFO("Lib加载已完成"); | 36 | + JZSDK_LOG_INFO("JZSDK_LIB_INIT_SUCCESS"); |
15 | } | 37 | } |
@@ -19,11 +19,8 @@ extern "C" { | @@ -19,11 +19,8 @@ extern "C" { | ||
19 | /* Exported constants --------------------------------------------------------*/ | 19 | /* Exported constants --------------------------------------------------------*/ |
20 | /* 常亮定义*/ | 20 | /* 常亮定义*/ |
21 | #include "JZsdk_Logger/JZsdk_Logger.h" | 21 | #include "JZsdk_Logger/JZsdk_Logger.h" |
22 | -#include "JZsdk_Osal/JZsdk_FileSystm.h" | ||
23 | -#include "JZsdk_Delay/JZsdk_Delay.h" | ||
24 | #include "JZsdk_Code/JZsdk_FLagCode.h" | 22 | #include "JZsdk_Code/JZsdk_FLagCode.h" |
25 | -#include "JZsdk_Osal/JZsdk_MemoryAdapter.h" | ||
26 | -#include "JZsdk_Osal/JZsdk_CheckSum/JZsdk_CheckSum.h" | 23 | +#include "JZsdk_Osal/JZsdk_Osal.h" |
27 | 24 | ||
28 | /* Exported types ------------------------------------------------------------*/ | 25 | /* Exported types ------------------------------------------------------------*/ |
29 | 26 |
@@ -19,11 +19,15 @@ extern "C" { | @@ -19,11 +19,15 @@ extern "C" { | ||
19 | /* Exported constants --------------------------------------------------------*/ | 19 | /* Exported constants --------------------------------------------------------*/ |
20 | /* 常亮定义*/ | 20 | /* 常亮定义*/ |
21 | 21 | ||
22 | +#include "./JZsdk_typedef/JZsdk_typedef.h" | ||
23 | +#include "./JZsdk_ReturnCode/JZsdk_ReturnCode.h" | ||
24 | + | ||
25 | + | ||
22 | #include "./JZsdk_InsCode.h" | 26 | #include "./JZsdk_InsCode.h" |
23 | #include "./JZsdk_FLagCode.h" | 27 | #include "./JZsdk_FLagCode.h" |
24 | -#include "./JZsdk_ReturnCode.h" | ||
25 | -#include "./JZsdk_FileType.h" | ||
26 | #include "./JZsdk_WidgetCode.h" | 28 | #include "./JZsdk_WidgetCode.h" |
29 | +#include "./JZsdk_DeviceCode.h" | ||
30 | +#include "./JZsdk_DefineCode.h" | ||
27 | 31 | ||
28 | /* Exported types ------------------------------------------------------------*/ | 32 | /* Exported types ------------------------------------------------------------*/ |
29 | 33 |
1 | +#include <stdio.h> | ||
2 | +#include "./JZsdk_DefineCode.h" | ||
3 | + | ||
4 | +unsigned char * JZsdk_DefineCode_GetPortName(int Port) | ||
5 | +{ | ||
6 | + switch (Port) | ||
7 | + { | ||
8 | + case UART_4G: | ||
9 | + return "设备4G"; | ||
10 | + break; | ||
11 | + | ||
12 | + case UART_DEV_1: | ||
13 | + return "设备UART1"; | ||
14 | + break; | ||
15 | + | ||
16 | + case UART_DEV_2: | ||
17 | + return "设备UART2"; | ||
18 | + break; | ||
19 | + | ||
20 | + case HAL_DATA_TRANSMISSION: | ||
21 | + return "HAL数据"; | ||
22 | + break; | ||
23 | + | ||
24 | + case NO_SPECIFIED: | ||
25 | + return "无指定设备"; | ||
26 | + break; | ||
27 | + | ||
28 | + default: | ||
29 | + return "无指定设备"; | ||
30 | + break; | ||
31 | + } | ||
32 | +} |
1 | +/** | ||
2 | + ******************************************************************** | ||
3 | + * @file JZsdk_DefiningCode.h | ||
4 | + * 用于记录各种定义类型的表 | ||
5 | + * | ||
6 | + ********************************************************************* | ||
7 | + */ | ||
8 | + | ||
9 | +/* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/ | ||
10 | +#ifndef JZSDK_DEFININGCODE_H | ||
11 | +#define JZSDK_DEFININGCODE_H | ||
12 | + | ||
13 | +/* Includes ------------------------------------------------------------------*/ | ||
14 | + | ||
15 | +#ifdef __cplusplus | ||
16 | +extern "C" | ||
17 | +{ | ||
18 | +#endif | ||
19 | + | ||
20 | +/* Exported constants --------------------------------------------------------*/ | ||
21 | +/* 常亮定义*/ | ||
22 | + | ||
23 | +/* Exported types ------------------------------------------------------------*/ | ||
24 | +typedef enum JZ_DEVICE_PORT_TYPE | ||
25 | +{ | ||
26 | + DEVICE_PSDK = 0x1000, // psdk功能 | ||
27 | + UART_4G = 0x1001, // 4G功能 | ||
28 | + UART_DEV_1 = 0x1002, // 1号设备功能 | ||
29 | + UART_DEV_2 = 0x1003, // 2号设备功能 | ||
30 | + UART_DEV_3 = 0x1004, // 3号设备功能 | ||
31 | + UART_DEV_4 = 0x1005, // 4号设备功能 | ||
32 | + UART_DEV_5 = 0x1006, // 5号设备功能 | ||
33 | + | ||
34 | + UART_USB_1 = 0x1100, // usb设备 | ||
35 | + UART_USB_2 = 0x1101, // usb设备 | ||
36 | + UART_USB_3 = 0x1102, // usb设备 | ||
37 | + UART_USB_4 = 0x1103, // usb设备 | ||
38 | + UART_USB_5 = 0x1104, // usb设备 | ||
39 | + | ||
40 | + HAL_DATA_TRANSMISSION = 0x1200, // hal定制的特殊数据传播 | ||
41 | + | ||
42 | + COMBINE_DEVICE = 0x1998, // 组合设备 | ||
43 | + NO_SPECIFIED = 0x1999, // 无制定设备 | ||
44 | +} JZ_DEVICE_PORT_TYPE; | ||
45 | + | ||
46 | +typedef enum JZ_MODULE_CONTROL_WAY | ||
47 | +{ | ||
48 | + JZ_MODULE_CONTROL_WAY_INDEPENDENT = 0x1000, // 独立控制 | ||
49 | + JZ_MODULE_CONTROL_WAY_TRANSPARENT = 0x1001, //透传控制 | ||
50 | +}JZ_MODULE_CONTROL_WAY; // 模块控制方式 | ||
51 | + | ||
52 | +typedef enum JZ_DATA_TRANS_TYPE | ||
53 | +{ | ||
54 | + JZ_DATA_TRANS_TYPE_REAL_TIME_MP2 = 0x1000, // 实时mp2数据传输中 | ||
55 | + JZ_DATA_TRANS_TYPE_AUDIO_FILE = 0x1001, // 音频文件传输中 | ||
56 | + JZ_DATA_TRANS_TYPE_OPUS_FILE = 0x1002, // opus文件传输中 | ||
57 | + JZ_DATA_TRANS_TYPE_REAL_TIME_OPUS = 0x1003, // 实时opus传输中 | ||
58 | + JZ_DATA_TRANS_TYPE_TTS = 0x1004, //TTS传输模式 | ||
59 | +}JZ_DATA_TRANS_TYPE; | ||
60 | + | ||
61 | +/* Exported functions --------------------------------------------------------*/ | ||
62 | +unsigned char * JZsdk_DefineCode_GetPortName(int Port); | ||
63 | + | ||
64 | +#ifdef __cplusplus | ||
65 | +} | ||
66 | +#endif | ||
67 | + | ||
68 | +#endif |
@@ -3,35 +3,29 @@ | @@ -3,35 +3,29 @@ | ||
3 | * 用来规范version_choose的参数 | 3 | * 用来规范version_choose的参数 |
4 | * | 4 | * |
5 | ***********************************************/ | 5 | ***********************************************/ |
6 | -#ifndef CONFIG_PARAMS_H | ||
7 | -#define CONFIG_PARAMS_H | 6 | +#ifndef JZSDK_DEVICE_CODE_H |
7 | +#define JZSDK_DEVICE_CODE_H | ||
8 | 8 | ||
9 | //特殊版本号 | 9 | //特殊版本号 |
10 | -#define SPECIAL_NORMAL 0x01 | ||
11 | -#define SPECIAL_DAOTONG 0x02 | 10 | +#define SPECIAL_NORMAL 0x01 //普通版本 |
11 | +#define SPECIAL_DAOTONG 0x02 //道通版本 | ||
12 | 12 | ||
13 | //软件模式 | 13 | //软件模式 |
14 | -#define APP_PSDK 0x01 //psdk设备 | ||
15 | -#define APP_UART 0x02 //串口设备 | ||
16 | -#define APP_TEST 0x03 //测试设备 | 14 | +#define APP_PSDK 0x01 |
15 | +#define APP_UART 0x02 | ||
16 | +#define APP_TEST 0x03 | ||
17 | 17 | ||
18 | //平台选择 | 18 | //平台选择 |
19 | #define PLATFORM_H3 0x01 | 19 | #define PLATFORM_H3 0x01 |
20 | #define PLATFORM_V3S 0x02 | 20 | #define PLATFORM_V3S 0x02 |
21 | 21 | ||
22 | //固件属地 | 22 | //固件属地 |
23 | -#define OVERSEAS_VERSION 0x01 //海外版 | ||
24 | -#define DOMESTIC_VERSION 0x02 //国内版 | ||
25 | - | ||
26 | -//音频滤波的方式 | ||
27 | -//目前只有和h10使用带阻滤波 | ||
28 | -#define DIRECTED_STOPBAND_FILTERING 0x10001 //带阻滤波 | ||
29 | -#define HIGH_PASS_FILTERING 0x10002 //高通滤波 | ||
30 | -#define INTERGRATED_FILTERING_1 0x10003 //综合滤波1代 | 23 | +#define OVERSEAS_VERSION 0x01 |
24 | +#define DOMESTIC_VERSION 0x02 | ||
31 | 25 | ||
32 | //加载开关 | 26 | //加载开关 |
33 | -#define VERSION_SWITCH_ON 0x0001 | ||
34 | -#define VERSION_SWITCH_OFF 0x0000 | 27 | +#define VERSION_SWITCH_ON 0x0001 //加载 |
28 | +#define VERSION_SWITCH_OFF 0x0000 //不加载 | ||
35 | 29 | ||
36 | //设备选择 | 30 | //设备选择 |
37 | #define JZ_H1E 0x0011 | 31 | #define JZ_H1E 0x0011 |
@@ -52,4 +46,18 @@ | @@ -52,4 +46,18 @@ | ||
52 | #define TF_A1 0x1010 | 46 | #define TF_A1 0x1010 |
53 | #define JZ_C1 0x1011 | 47 | #define JZ_C1 0x1011 |
54 | 48 | ||
49 | + | ||
50 | +/*********************************** | ||
51 | + * | ||
52 | + * 已退出历史舞台 | ||
53 | + * | ||
54 | + * *********************************/ | ||
55 | + | ||
56 | +// //音频滤波的方式 | ||
57 | +// //目前只有和h10使用带阻滤波 | ||
58 | +// #define DIRECTED_STOPBAND_FILTERING 0x10001 //带阻滤波 | ||
59 | +// #define HIGH_PASS_FILTERING 0x10002 //高通滤波 | ||
60 | +// #define INTERGRATED_FILTERING_1 0x10003 //综合滤波1代 | ||
61 | + | ||
62 | + | ||
55 | #endif | 63 | #endif |
1 | /** | 1 | /** |
2 | ******************************************************************** | 2 | ******************************************************************** |
3 | - * @file JZsdk_Uart_RecvDeal.h | ||
4 | - * JZsdk_Uart_RecvDeal的头文件 | 3 | + * @file JZsdk_typedef.h |
4 | + * 用于记录各类码的表 | ||
5 | * | 5 | * |
6 | ********************************************************************* | 6 | ********************************************************************* |
7 | */ | 7 | */ |
8 | 8 | ||
9 | /* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/ | 9 | /* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/ |
10 | -#ifndef JZSDK_UART_RECVDEAL_H | ||
11 | -#define JZSDK_UART_RECVDEAL_H | 10 | +#ifndef JZSDK_TYPEDEF_H |
11 | +#define JZSDK_TYPEDEF_H | ||
12 | 12 | ||
13 | /* Includes ------------------------------------------------------------------*/ | 13 | /* Includes ------------------------------------------------------------------*/ |
14 | +#include "../JZsdk_typedef/JZsdk_typedef.h" | ||
14 | 15 | ||
15 | #ifdef __cplusplus | 16 | #ifdef __cplusplus |
16 | extern "C" { | 17 | extern "C" { |
17 | #endif | 18 | #endif |
18 | 19 | ||
20 | + | ||
19 | /* Exported constants --------------------------------------------------------*/ | 21 | /* Exported constants --------------------------------------------------------*/ |
20 | /* 常亮定义*/ | 22 | /* 常亮定义*/ |
21 | 23 | ||
24 | +/* Exported macro ------------------------------------------------------------*/ | ||
25 | + | ||
26 | + | ||
22 | /* Exported types ------------------------------------------------------------*/ | 27 | /* Exported types ------------------------------------------------------------*/ |
23 | 28 | ||
29 | + | ||
24 | /* Exported functions --------------------------------------------------------*/ | 30 | /* Exported functions --------------------------------------------------------*/ |
25 | -int JZsdk_Uart_RecvDeal_CharmDeal(int Port, unsigned char *getbuf, int len); | ||
26 | 31 | ||
27 | #ifdef __cplusplus | 32 | #ifdef __cplusplus |
28 | } | 33 | } |
29 | #endif | 34 | #endif |
30 | 35 | ||
31 | #endif | 36 | #endif |
37 | + | ||
38 | + |
1 | -#include <stdint.h> | ||
2 | -#include <stdbool.h> | ||
3 | -#include <stddef.h> | ||
4 | -#include <string.h> | ||
5 | -#include <stdlib.h> | ||
6 | -#include <stdio.h> | ||
7 | -#include <string.h> | ||
8 | - | ||
9 | -#include "./JZsdk_Code.h" | ||
10 | - | ||
11 | - | 1 | +#include "./JZsdk_ReturnCode.h" |
12 | 2 | ||
13 | //获取返回码的信息 | 3 | //获取返回码的信息 |
14 | const char* JZsdk_GetReturnCodeMessage(T_JZsdkReturnCode ReturnCode) | 4 | const char* JZsdk_GetReturnCodeMessage(T_JZsdkReturnCode ReturnCode) |
1 | + | ||
2 | + | ||
1 | /** | 3 | /** |
2 | ******************************************************************** | 4 | ******************************************************************** |
3 | - * @file UartDeal_Base.h | ||
4 | - * UartDeal_Base的头文件 | 5 | + * @file JZsdk_ReturnCode.h |
6 | + * 用于记录各类码的表 | ||
5 | * | 7 | * |
6 | ********************************************************************* | 8 | ********************************************************************* |
7 | */ | 9 | */ |
8 | 10 | ||
9 | /* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/ | 11 | /* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/ |
10 | -#ifndef UARTDEAL_BASE_H | ||
11 | -#define UARTDEAL_BASE_H | 12 | +#ifndef JZSDK_RETURNCODE_H |
13 | +#define JZSDK_RETURNCODE_H | ||
12 | 14 | ||
13 | /* Includes ------------------------------------------------------------------*/ | 15 | /* Includes ------------------------------------------------------------------*/ |
16 | +#include "../JZsdk_typedef/JZsdk_typedef.h" | ||
14 | 17 | ||
15 | #ifdef __cplusplus | 18 | #ifdef __cplusplus |
16 | extern "C" { | 19 | extern "C" { |
@@ -19,11 +22,17 @@ extern "C" { | @@ -19,11 +22,17 @@ extern "C" { | ||
19 | /* Exported constants --------------------------------------------------------*/ | 22 | /* Exported constants --------------------------------------------------------*/ |
20 | /* 常亮定义*/ | 23 | /* 常亮定义*/ |
21 | 24 | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | + | ||
29 | + | ||
30 | + | ||
22 | /* Exported types ------------------------------------------------------------*/ | 31 | /* Exported types ------------------------------------------------------------*/ |
23 | 32 | ||
24 | -/* Exported functions --------------------------------------------------------*/ | ||
25 | -int UartConnection_UartEnabled(char *UartDev, int BitRate); | ||
26 | 33 | ||
34 | +/* Exported functions --------------------------------------------------------*/ | ||
35 | +const char* JZsdk_GetReturnCodeMessage(T_JZsdkReturnCode ReturnCode); | ||
27 | 36 | ||
28 | #ifdef __cplusplus | 37 | #ifdef __cplusplus |
29 | } | 38 | } |
@@ -24,7 +24,9 @@ extern "C" { | @@ -24,7 +24,9 @@ extern "C" { | ||
24 | typedef enum { | 24 | typedef enum { |
25 | JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS = 0x0000, | 25 | JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS = 0x0000, |
26 | JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE = 0x0001, | 26 | JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE = 0x0001, |
27 | + JZ_ERROR_SYSTEM_MODULE_CODE_HARDLY_FAILURE = 0x0003, //严重错误 | ||
27 | JZ_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER = 0x0002, //文件指针错误 | 28 | JZ_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER = 0x0002, //文件指针错误 |
29 | + JZ_ERROR_SYSTEM_MODULE_CODE_MEMORY_ALLOC_FAILED = 0x0004, //内存分配失败 | ||
28 | } JZ_SYSTEM_Code; | 30 | } JZ_SYSTEM_Code; |
29 | 31 | ||
30 | typedef enum { | 32 | typedef enum { |
@@ -63,6 +65,10 @@ typedef enum { | @@ -63,6 +65,10 @@ typedef enum { | ||
63 | 65 | ||
64 | } JZ_CheckCode; //检查校验码 | 66 | } JZ_CheckCode; //检查校验码 |
65 | 67 | ||
68 | +typedef enum { | ||
69 | + JZ_ERROR_SYSTEM_MODULE_CODE_NO_UPGRADE_FILE = 0x6000, //没有升级文件 | ||
70 | +}JZ_Ugrade_ErrorCode; | ||
71 | + | ||
66 | /* Exported functions --------------------------------------------------------*/ | 72 | /* Exported functions --------------------------------------------------------*/ |
67 | 73 | ||
68 | #ifdef __cplusplus | 74 | #ifdef __cplusplus |
1 | - | ||
2 | - | ||
3 | /** | 1 | /** |
4 | ******************************************************************** | 2 | ******************************************************************** |
5 | - * @file JZsdk_ReturnCode.h | 3 | + * @file JZsdk_typedef.h |
6 | * 用于记录各类码的表 | 4 | * 用于记录各类码的表 |
7 | * | 5 | * |
8 | ********************************************************************* | 6 | ********************************************************************* |
9 | */ | 7 | */ |
10 | 8 | ||
11 | /* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/ | 9 | /* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/ |
12 | -#ifndef JZSDK_RETURNCODE_H | ||
13 | -#define JZSDK_RETURNCODE_H | 10 | +#ifndef JZSDK_TYPEDEF_H |
11 | +#define JZSDK_TYPEDEF_H | ||
14 | 12 | ||
15 | /* Includes ------------------------------------------------------------------*/ | 13 | /* Includes ------------------------------------------------------------------*/ |
16 | #include <stdint.h> | 14 | #include <stdint.h> |
17 | -#include "JZsdk_ErrorCode.h" | 15 | +#include <stdbool.h> |
16 | +#include <stddef.h> | ||
17 | +#include <string.h> | ||
18 | +#include <stdlib.h> | ||
19 | +#include <stdio.h> | ||
20 | +#include <string.h> | ||
18 | 21 | ||
19 | #ifdef __cplusplus | 22 | #ifdef __cplusplus |
20 | extern "C" { | 23 | extern "C" { |
21 | #endif | 24 | #endif |
22 | 25 | ||
26 | +#include "./JZsdk_ErrorCodeDef.h" | ||
27 | +#include "./JZsdk_FileTypeDef.h" | ||
28 | + | ||
23 | /* Exported constants --------------------------------------------------------*/ | 29 | /* Exported constants --------------------------------------------------------*/ |
24 | /* 常亮定义*/ | 30 | /* 常亮定义*/ |
25 | 31 | ||
26 | 32 | ||
27 | - | ||
28 | - | ||
29 | - | ||
30 | - | ||
31 | - | ||
32 | -/* Exported types ------------------------------------------------------------*/ | 33 | +/* Exported macro ------------------------------------------------------------*/ |
33 | //重定义一个返回码 | 34 | //重定义一个返回码 |
34 | typedef uint64_t T_JZsdkReturnCode; | 35 | typedef uint64_t T_JZsdkReturnCode; |
35 | typedef uint8_t U8_t; | 36 | typedef uint8_t U8_t; |
@@ -46,11 +47,23 @@ typedef uint64_t U64_t; | @@ -46,11 +47,23 @@ typedef uint64_t U64_t; | ||
46 | typedef double F64_t; | 47 | typedef double F64_t; |
47 | typedef float F32_t; | 48 | typedef float F32_t; |
48 | 49 | ||
50 | + | ||
51 | +//线程权柄 | ||
52 | +typedef void *T_JZTaskHandle; | ||
53 | +//互斥锁权柄 | ||
54 | +typedef void *T_JZsdkMutexHandle; | ||
55 | +//信号量权柄 | ||
56 | +typedef void *T_JZsdkSemaHandle; | ||
57 | + | ||
58 | +/* Exported types ------------------------------------------------------------*/ | ||
59 | + | ||
60 | + | ||
49 | /* Exported functions --------------------------------------------------------*/ | 61 | /* Exported functions --------------------------------------------------------*/ |
50 | -const char* JZsdk_GetReturnCodeMessage(T_JZsdkReturnCode ReturnCode); | ||
51 | 62 | ||
52 | #ifdef __cplusplus | 63 | #ifdef __cplusplus |
53 | } | 64 | } |
54 | #endif | 65 | #endif |
55 | 66 | ||
56 | #endif | 67 | #endif |
68 | + | ||
69 | + |
1 | -#include <stdio.h> | ||
2 | -#include "JZsdk_Delay.h" | ||
3 | -#include <unistd.h> | ||
4 | - | ||
5 | -/* | ||
6 | -* 用于延时(粗略) | ||
7 | -* 需要优化 | ||
8 | -*/ | ||
9 | -int delayUs(unsigned long msec) | ||
10 | -{ | ||
11 | - usleep(msec); | ||
12 | -} | ||
13 | - | ||
14 | -/* | ||
15 | -* 用于延时(粗略) | ||
16 | -* 需要优化 | ||
17 | -*/ | ||
18 | -int delayMs(unsigned long msec) | ||
19 | -{ | ||
20 | - usleep(msec * 1000); | ||
21 | -} | ||
22 | - | ||
23 | -/* | ||
24 | -* 用于延时(粗略) | ||
25 | -* 需要优化 | ||
26 | -*/ | ||
27 | -int delayS(unsigned long sec) | ||
28 | -{ | ||
29 | - delayMs(sec * 1000); | ||
30 | -} |
@@ -24,28 +24,28 @@ int JZsdk_FrameComparsion(char *getdata, int len) | @@ -24,28 +24,28 @@ int JZsdk_FrameComparsion(char *getdata, int len) | ||
24 | //1、判断是否是5A帧 | 24 | //1、判断是否是5A帧 |
25 | if (getdata[0] == 0x5A && getdata[1] == 0x5A && getdata[2] == 0x77) | 25 | if (getdata[0] == 0x5A && getdata[1] == 0x5A && getdata[2] == 0x77) |
26 | { | 26 | { |
27 | - printf("JZsdk_FrameComparsion:5A帧\n"); | 27 | + //printf("JZsdk_FrameComparsion:5A帧\n"); |
28 | return JZsdk_5AFrameComparsion(getdata, len); | 28 | return JZsdk_5AFrameComparsion(getdata, len); |
29 | } | 29 | } |
30 | 30 | ||
31 | //2、判断是否是5B帧 | 31 | //2、判断是否是5B帧 |
32 | if (getdata[0] == 0x5b && getdata[1] == 0x5b && getdata[2] == 0x77) | 32 | if (getdata[0] == 0x5b && getdata[1] == 0x5b && getdata[2] == 0x77) |
33 | { | 33 | { |
34 | - printf("JZsdk_FrameComparsion:5B帧\n"); | 34 | + //printf("JZsdk_FrameComparsion:5B帧\n"); |
35 | return JZsdk_5BFrameComparsion(getdata, len); | 35 | return JZsdk_5BFrameComparsion(getdata, len); |
36 | } | 36 | } |
37 | 37 | ||
38 | //3、判断是否是6A帧 | 38 | //3、判断是否是6A帧 |
39 | if (getdata[0] == 0x6A && getdata[1] == 0x6A && getdata[2] == 0x77) | 39 | if (getdata[0] == 0x6A && getdata[1] == 0x6A && getdata[2] == 0x77) |
40 | { | 40 | { |
41 | - printf("JZsdk_FrameComparsion:6A帧\n"); | 41 | + //printf("JZsdk_FrameComparsion:6A帧\n"); |
42 | return JZsdk_6AFrameComparsion(getdata, len); | 42 | return JZsdk_6AFrameComparsion(getdata, len); |
43 | } | 43 | } |
44 | 44 | ||
45 | //4、判断是否是6B帧 | 45 | //4、判断是否是6B帧 |
46 | if (getdata[0] == 0x6b && getdata[1] == 0x6b && getdata[2] == 0x77) | 46 | if (getdata[0] == 0x6b && getdata[1] == 0x6b && getdata[2] == 0x77) |
47 | { | 47 | { |
48 | - printf("JZsdk_FrameComparsion:6B帧\n"); | 48 | + //printf("JZsdk_FrameComparsion:6B帧\n"); |
49 | return JZsdk_6BFrameComparsion(getdata, len); | 49 | return JZsdk_6BFrameComparsion(getdata, len); |
50 | } | 50 | } |
51 | 51 |
@@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
13 | #define CHECK_SUM_H | 13 | #define CHECK_SUM_H |
14 | 14 | ||
15 | /* Includes ------------------------------------------------------------------*/ | 15 | /* Includes ------------------------------------------------------------------*/ |
16 | -#include "../../JZsdk_Code/JZsdk_Code.h" | 16 | +#include "JZsdk_Base/JZsdk_Code/JZsdk_Code.h" |
17 | 17 | ||
18 | #ifdef __cplusplus | 18 | #ifdef __cplusplus |
19 | extern "C" { | 19 | extern "C" { |
@@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
13 | #define JZSDK_CHECK_SUM_H | 13 | #define JZSDK_CHECK_SUM_H |
14 | 14 | ||
15 | /* Includes ------------------------------------------------------------------*/ | 15 | /* Includes ------------------------------------------------------------------*/ |
16 | -#include "../../JZsdk_Code/JZsdk_Code.h" | 16 | +#include "JZsdk_Base/JZsdk_Code/JZsdk_Code.h" |
17 | 17 | ||
18 | #ifdef __cplusplus | 18 | #ifdef __cplusplus |
19 | extern "C" { | 19 | extern "C" { |
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | -#include "JZsdk_FileSystm.h" | 2 | +#include "./JZsdk_FileSystm.h" |
3 | #include <stdlib.h> | 3 | #include <stdlib.h> |
4 | #include <stdbool.h> | 4 | #include <stdbool.h> |
5 | #include <string.h> | 5 | #include <string.h> |
@@ -446,3 +446,16 @@ T_JZsdkReturnCode JZsdk_Fs_ReadFileSize(const unsigned char* FilePath, int *File | @@ -446,3 +446,16 @@ T_JZsdkReturnCode JZsdk_Fs_ReadFileSize(const unsigned char* FilePath, int *File | ||
446 | 446 | ||
447 | return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | 447 | return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; |
448 | } | 448 | } |
449 | + | ||
450 | + | ||
451 | +/************** | ||
452 | + * | ||
453 | + * 进行一次系统的保存 | ||
454 | + * | ||
455 | + * | ||
456 | + * *****************/ | ||
457 | +T_JZsdkReturnCode JZsdk_Sync() | ||
458 | +{ | ||
459 | + sync(); | ||
460 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
461 | +} |
@@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
11 | #define JZSDK_FILESYSTEM_H | 11 | #define JZSDK_FILESYSTEM_H |
12 | 12 | ||
13 | /* Includes ------------------------------------------------------------------*/ | 13 | /* Includes ------------------------------------------------------------------*/ |
14 | -#include "../JZsdk_Code/JZsdk_Code.h" | 14 | +#include "JZsdk_Base/JZsdk_Code/JZsdk_Code.h" |
15 | #include "./JZsdk_FS_Standards.h" | 15 | #include "./JZsdk_FS_Standards.h" |
16 | 16 | ||
17 | #ifdef __cplusplus | 17 | #ifdef __cplusplus |
@@ -39,6 +39,7 @@ T_JZsdkReturnCode JZsdk_Fs_ReadFileSize(const unsigned char* FilePath, int *File | @@ -39,6 +39,7 @@ T_JZsdkReturnCode JZsdk_Fs_ReadFileSize(const unsigned char* FilePath, int *File | ||
39 | T_JZsdkReturnCode JZsdk_copy_file_byC(const char* source_path, const char* dest_path); | 39 | T_JZsdkReturnCode JZsdk_copy_file_byC(const char* source_path, const char* dest_path); |
40 | T_JZsdkReturnCode JZsdk_RunSystemCmd_ReturnResult(char *systemCmd, unsigned int *result); | 40 | T_JZsdkReturnCode JZsdk_RunSystemCmd_ReturnResult(char *systemCmd, unsigned int *result); |
41 | T_JZsdkReturnCode JZsdk_RunSystemCmd_ReturnResult_Str(char *systemCmd, unsigned char *str); | 41 | T_JZsdkReturnCode JZsdk_RunSystemCmd_ReturnResult_Str(char *systemCmd, unsigned char *str); |
42 | +T_JZsdkReturnCode JZsdk_Sync(); | ||
42 | 43 | ||
43 | #ifdef __cplusplus | 44 | #ifdef __cplusplus |
44 | } | 45 | } |
@@ -3,9 +3,7 @@ | @@ -3,9 +3,7 @@ | ||
3 | #include <stdbool.h> | 3 | #include <stdbool.h> |
4 | #include <string.h> | 4 | #include <string.h> |
5 | 5 | ||
6 | -#include "JZsdkLib.h" | ||
7 | - | ||
8 | - | 6 | +#include "./JZsdk_MemoryAdapter.h" |
9 | 7 | ||
10 | /********************************** | 8 | /********************************** |
11 | * | 9 | * |
@@ -55,3 +53,17 @@ T_JZsdkReturnCode JZsdk_Free(void *ptr) | @@ -55,3 +53,17 @@ T_JZsdkReturnCode JZsdk_Free(void *ptr) | ||
55 | 53 | ||
56 | return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | 54 | return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; |
57 | } | 55 | } |
56 | + | ||
57 | + | ||
58 | + | ||
59 | +void *JZsdk_Osal_Malloc(U32_t size) | ||
60 | +{ | ||
61 | + return malloc(size); | ||
62 | +} | ||
63 | + | ||
64 | +void JZsdk_Osal_Free(void *ptr) | ||
65 | +{ | ||
66 | + free(ptr); | ||
67 | +} | ||
68 | + | ||
69 | + |
@@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
11 | #define JZSDK_MEMORY_ADAPTER_H | 11 | #define JZSDK_MEMORY_ADAPTER_H |
12 | 12 | ||
13 | /* Includes ------------------------------------------------------------------*/ | 13 | /* Includes ------------------------------------------------------------------*/ |
14 | -#include "../JZsdk_Code/JZsdk_Code.h" | 14 | +#include "JZsdk_Base/JZsdk_Code/JZsdk_Code.h" |
15 | 15 | ||
16 | #ifdef __cplusplus | 16 | #ifdef __cplusplus |
17 | extern "C" { | 17 | extern "C" { |
@@ -26,6 +26,8 @@ extern "C" { | @@ -26,6 +26,8 @@ extern "C" { | ||
26 | /* Exported functions --------------------------------------------------------*/ | 26 | /* Exported functions --------------------------------------------------------*/ |
27 | T_JZsdkReturnCode JZsdk_Malloc(void **ptr, unsigned int size); | 27 | T_JZsdkReturnCode JZsdk_Malloc(void **ptr, unsigned int size); |
28 | T_JZsdkReturnCode JZsdk_Free(void *ptr); | 28 | T_JZsdkReturnCode JZsdk_Free(void *ptr); |
29 | +void *JZsdk_Osal_Malloc(U32_t size); | ||
30 | +void JZsdk_Osal_Free(void *ptr); | ||
29 | 31 | ||
30 | #ifdef __cplusplus | 32 | #ifdef __cplusplus |
31 | } | 33 | } |
1 | +#include <stdio.h> | ||
2 | +#include <stdlib.h> | ||
3 | +#include <pthread.h> | ||
4 | + | ||
5 | +#include "./JZsdk_Mutex.h" | ||
6 | + | ||
7 | +/** | ||
8 | + * @brief Declare the mutex container, initialize the mutex, and | ||
9 | + * create mutex ID. | ||
10 | + * @param mutex: pointer to the created mutex ID. | ||
11 | + * @return an enum that represents a status of PSDK | ||
12 | + */ | ||
13 | +T_JZsdkReturnCode JZsdk_Osal_MutexCreate(T_JZsdkMutexHandle *mutex) | ||
14 | +{ | ||
15 | + int result; | ||
16 | + | ||
17 | + if (!mutex) | ||
18 | + { | ||
19 | + return JZ_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER; | ||
20 | + } | ||
21 | + | ||
22 | + *mutex = malloc(sizeof(pthread_mutex_t)); | ||
23 | + if (*mutex == NULL) | ||
24 | + { | ||
25 | + return JZ_ERROR_SYSTEM_MODULE_CODE_MEMORY_ALLOC_FAILED; | ||
26 | + } | ||
27 | + | ||
28 | + result = pthread_mutex_init(*mutex, NULL); | ||
29 | + if (result != 0) | ||
30 | + { | ||
31 | + return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE; | ||
32 | + } | ||
33 | + | ||
34 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
35 | +} | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | +/** | ||
40 | + * @brief Delete the created mutex. | ||
41 | + * @param mutex: pointer to the created mutex ID. | ||
42 | + * @return an enum that represents a status of PSDK | ||
43 | + */ | ||
44 | +T_JZsdkReturnCode JZsdk_Osal_MutexDestroy(T_JZsdkMutexHandle mutex) | ||
45 | +{ | ||
46 | + int result = 0; | ||
47 | + | ||
48 | + if (!mutex) | ||
49 | + { | ||
50 | + return JZ_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER; | ||
51 | + } | ||
52 | + | ||
53 | + result = pthread_mutex_destroy(mutex); | ||
54 | + if (result != 0) | ||
55 | + { | ||
56 | + return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE; | ||
57 | + } | ||
58 | + | ||
59 | + free(mutex); | ||
60 | + | ||
61 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
62 | +} | ||
63 | + | ||
64 | +/** | ||
65 | + * @brief Acquire and lock the mutex when peripheral access is required | ||
66 | + * @param mutex: pointer to the created mutex ID. | ||
67 | + * @return an enum that represents a status of PSDK | ||
68 | + */ | ||
69 | +T_JZsdkReturnCode JZsdk_Osal_MutexLock(T_JZsdkMutexHandle mutex) | ||
70 | +{ | ||
71 | + int result = 0; | ||
72 | + | ||
73 | + if (!mutex) | ||
74 | + { | ||
75 | + return JZ_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER; | ||
76 | + } | ||
77 | + | ||
78 | + result = pthread_mutex_lock(mutex); | ||
79 | + if (result != 0) | ||
80 | + { | ||
81 | + return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE; | ||
82 | + } | ||
83 | + | ||
84 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
85 | +} | ||
86 | + | ||
87 | + | ||
88 | + | ||
89 | +/** | ||
90 | + * @brief Unlock and release the mutex, when done with the peripheral access. | ||
91 | + * @param mutex: pointer to the created mutex ID. | ||
92 | + * @return an enum that represents a status of PSDK | ||
93 | + */ | ||
94 | +T_JZsdkReturnCode JZsdk_Osal_MutexUnlock(T_JZsdkMutexHandle mutex) | ||
95 | +{ | ||
96 | + int result = 0; | ||
97 | + | ||
98 | + if (!mutex) | ||
99 | + { | ||
100 | + return JZ_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER; | ||
101 | + } | ||
102 | + | ||
103 | + result = pthread_mutex_unlock(mutex); | ||
104 | + if (result != 0) | ||
105 | + { | ||
106 | + return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE; | ||
107 | + } | ||
108 | + | ||
109 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
110 | +} |
1 | /** | 1 | /** |
2 | ******************************************************************** | 2 | ******************************************************************** |
3 | - * @file JZsdk_FileSystem.h | ||
4 | - * 用于文件系统操作 | 3 | + * @file JZsdk_Mutex.h |
4 | + * JZsdk_Mutex.c 的头文件 | ||
5 | * | 5 | * |
6 | ********************************************************************* | 6 | ********************************************************************* |
7 | */ | 7 | */ |
8 | 8 | ||
9 | /* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/ | 9 | /* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/ |
10 | -#ifndef JZSDK_DELAY_H | ||
11 | -#define JZSDK_DELAY_H | 10 | +#ifndef JZSDK_MUTEX_H |
11 | +#define JZSDK_MUTEX_H | ||
12 | 12 | ||
13 | /* Includes ------------------------------------------------------------------*/ | 13 | /* Includes ------------------------------------------------------------------*/ |
14 | +#include "JZsdk_Base/JZsdk_Code/JZsdk_Code.h" | ||
14 | 15 | ||
15 | #ifdef __cplusplus | 16 | #ifdef __cplusplus |
16 | extern "C" { | 17 | extern "C" { |
@@ -19,14 +20,17 @@ extern "C" { | @@ -19,14 +20,17 @@ extern "C" { | ||
19 | /* Exported constants --------------------------------------------------------*/ | 20 | /* Exported constants --------------------------------------------------------*/ |
20 | /* 常亮定义*/ | 21 | /* 常亮定义*/ |
21 | 22 | ||
23 | +/* Exported macro ------------------------------------------------------------*/ | ||
22 | 24 | ||
23 | /* Exported types ------------------------------------------------------------*/ | 25 | /* Exported types ------------------------------------------------------------*/ |
24 | 26 | ||
25 | 27 | ||
26 | /* Exported functions --------------------------------------------------------*/ | 28 | /* Exported functions --------------------------------------------------------*/ |
27 | -int delayMs(unsigned long msec); | ||
28 | -int delayS(unsigned long sec); | ||
29 | -int delayUs(unsigned long msec); | 29 | +T_JZsdkReturnCode JZsdk_Osal_MutexCreate(T_JZsdkMutexHandle *mutex); |
30 | +T_JZsdkReturnCode JZsdk_Osal_MutexDestroy(T_JZsdkMutexHandle mutex); | ||
31 | +T_JZsdkReturnCode JZsdk_Osal_MutexLock(T_JZsdkMutexHandle mutex); | ||
32 | +T_JZsdkReturnCode JZsdk_Osal_MutexUnlock(T_JZsdkMutexHandle mutex); | ||
33 | + | ||
30 | 34 | ||
31 | #ifdef __cplusplus | 35 | #ifdef __cplusplus |
32 | } | 36 | } |
1 | +#include "../JZsdk_Code/JZsdk_Code.h" | ||
2 | +#include "./JZsdk_Osal.h" | ||
3 | + | ||
4 | + | ||
5 | + | ||
6 | + | ||
7 | +static T_JZsdkOsalHandler* g_osalHandler = NULL; | ||
8 | + | ||
9 | +static T_JZsdkReturnCode JZsdk_Platform_RegOsalHandler(const T_JZsdkOsalHandler *osalHandler) | ||
10 | +{ | ||
11 | + g_osalHandler = (T_JZsdkOsalHandler*)osalHandler; // 存储传入的 OSAL 处理器 | ||
12 | + | ||
13 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
14 | +} | ||
15 | + | ||
16 | +T_JZsdkOsalHandler *JZsdk_Platform_GetOsalHandler(void) | ||
17 | +{ | ||
18 | + return g_osalHandler; // 返回已注册的 OSAL 处理器 | ||
19 | +} | ||
20 | + | ||
21 | +T_JZsdkReturnCode JZsdk_OsalInit() | ||
22 | +{ | ||
23 | + T_JZsdkOsalHandler osalHandler = { | ||
24 | + .TaskCreate = JZsdk_Osal_TaskCreate, | ||
25 | + .TaskDestroy = JZsdk_Osal_TaskDestroy, | ||
26 | + .TaskSleepMs = delayMs, | ||
27 | + .MutexCreate= JZsdk_Osal_MutexCreate, | ||
28 | + .MutexDestroy = JZsdk_Osal_MutexDestroy, | ||
29 | + .MutexLock = JZsdk_Osal_MutexLock, | ||
30 | + .MutexUnlock = JZsdk_Osal_MutexUnlock, | ||
31 | + .SemaphoreCreate = JZsdk_Osal_SemaphoreCreate, | ||
32 | + .SemaphoreDestroy = JZsdk_Osal_SemaphoreDestroy, | ||
33 | + .SemaphoreWait = JZsdk_Osal_SemaphoreWait, | ||
34 | + .SemaphoreTimedWait = JZsdk_Osal_SemaphoreTimedWait, | ||
35 | + .SemaphorePost = JZsdk_Osal_SemaphorePost, | ||
36 | + .Malloc = JZsdk_Osal_Malloc, | ||
37 | + .Free = JZsdk_Osal_Free, | ||
38 | + .GetTimeMs = JZsdk_Osal_GetTimeMs, | ||
39 | + .GetTimeUs = JZsdk_Osal_GetTimeUs, | ||
40 | + .GetRandomNum = JZsdk_Osal_GetRandomNum, | ||
41 | + }; | ||
42 | + | ||
43 | + JZsdk_Platform_RegOsalHandler(&osalHandler); | ||
44 | + | ||
45 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
46 | +} |
1 | +/** | ||
2 | + ******************************************************************** | ||
3 | + * @file JZsdk_Osal.h | ||
4 | + * JZsdk_Osal.c 的头文件 | ||
5 | + * | ||
6 | + ********************************************************************* | ||
7 | + */ | ||
8 | + | ||
9 | +/* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/ | ||
10 | +#ifndef JZSDK_OSAL_H | ||
11 | +#define JZSDK_OSAL_H | ||
12 | + | ||
13 | +/* Includes ------------------------------------------------------------------*/ | ||
14 | +#include "../JZsdk_Code/JZsdk_Code.h" | ||
15 | + | ||
16 | +#include "./JZsdk_CheckSum/JZsdk_CheckSum.h" | ||
17 | +#include "./JZsdk_FileSystm/JZsdk_FileSystm.h" | ||
18 | +#include "./JZsdk_MemoryAdapter/JZsdk_MemoryAdapter.h" | ||
19 | +#include "./JZsdk_Mutex/JZsdk_Mutex.h" | ||
20 | +#include "./JZsdk_Semaphore/JZsdk_Semaphore.h" | ||
21 | +#include "./JZsdk_Task/JZsdk_Task.h" | ||
22 | +#include "./JZsdk_Timer/JZsdk_Timer.h" | ||
23 | + | ||
24 | +#ifdef __cplusplus | ||
25 | +extern "C" { | ||
26 | +#endif | ||
27 | + | ||
28 | +/* Exported constants --------------------------------------------------------*/ | ||
29 | +/* 常亮定义*/ | ||
30 | + | ||
31 | +/**************** | ||
32 | + * | ||
33 | + * osal权柄 | ||
34 | + * | ||
35 | + * | ||
36 | + * ******************/ | ||
37 | +typedef struct { | ||
38 | + T_JZsdkReturnCode (*TaskCreate)(const char *name, void *(*taskFunc)(void *), | ||
39 | + unsigned int stackSize, void *arg, T_JZTaskHandle *task); | ||
40 | + | ||
41 | + T_JZsdkReturnCode (*TaskDestroy)(T_JZTaskHandle task); | ||
42 | + | ||
43 | + T_JZsdkReturnCode (*TaskSleepMs)(U32_t timeMs); | ||
44 | + | ||
45 | + T_JZsdkReturnCode (*MutexCreate)(T_JZsdkMutexHandle *mutex); | ||
46 | + | ||
47 | + T_JZsdkReturnCode (*MutexDestroy)(T_JZsdkMutexHandle mutex); | ||
48 | + | ||
49 | + T_JZsdkReturnCode (*MutexLock)(T_JZsdkMutexHandle mutex); | ||
50 | + | ||
51 | + T_JZsdkReturnCode (*MutexUnlock)(T_JZsdkMutexHandle mutex); | ||
52 | + | ||
53 | + T_JZsdkReturnCode (*SemaphoreCreate)(U32_t initValue, T_JZsdkSemaHandle *semaphore); | ||
54 | + | ||
55 | + T_JZsdkReturnCode (*SemaphoreDestroy)(T_JZsdkSemaHandle semaphore); | ||
56 | + | ||
57 | + T_JZsdkReturnCode (*SemaphoreWait)(T_JZsdkSemaHandle semaphore); | ||
58 | + | ||
59 | + T_JZsdkReturnCode (*SemaphoreTimedWait)(T_JZsdkSemaHandle semaphore, U32_t waitTimeMs); | ||
60 | + | ||
61 | + T_JZsdkReturnCode (*SemaphorePost)(T_JZsdkSemaHandle semaphore); | ||
62 | + | ||
63 | + T_JZsdkReturnCode (*GetTimeMs)(U32_t *ms); | ||
64 | + | ||
65 | + T_JZsdkReturnCode (*GetTimeUs)(U64_t *us); | ||
66 | + | ||
67 | + T_JZsdkReturnCode (*GetRandomNum)(U16_t *randomNum); | ||
68 | + | ||
69 | + void *(*Malloc)(U32_t size); | ||
70 | + | ||
71 | + void (*Free)(void *ptr); | ||
72 | +} T_JZsdkOsalHandler; | ||
73 | + | ||
74 | + | ||
75 | + | ||
76 | +/* Exported macro ------------------------------------------------------------*/ | ||
77 | + | ||
78 | + | ||
79 | +/* Exported types ------------------------------------------------------------*/ | ||
80 | + | ||
81 | + | ||
82 | +/* Exported functions --------------------------------------------------------*/ | ||
83 | +T_JZsdkReturnCode JZsdk_OsalInit(); | ||
84 | +T_JZsdkOsalHandler *JZsdk_Platform_GetOsalHandler(void); | ||
85 | + | ||
86 | + | ||
87 | +#ifdef __cplusplus | ||
88 | +} | ||
89 | +#endif | ||
90 | + | ||
91 | +#endif | ||
92 | +/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/ |
1 | +#include <stdio.h> | ||
2 | +#include <stdlib.h> | ||
3 | +#include <pthread.h> | ||
4 | +#include <semaphore.h> | ||
5 | +#include <sys/time.h> | ||
6 | + | ||
7 | +#include "./JZsdk_Semaphore.h" | ||
8 | + | ||
9 | +/** | ||
10 | + * @brief Declare the semaphore container, initialize the semaphore, and | ||
11 | + * create semaphore ID. | ||
12 | + * @param semaphore: pointer to the created semaphore ID. | ||
13 | + * @param initValue: initial value of semaphore. | ||
14 | + * @return an enum that represents a status of PSDK | ||
15 | + */ | ||
16 | +T_JZsdkReturnCode JZsdk_Osal_SemaphoreCreate(U32_t initValue, T_JZsdkSemaHandle *semaphore) | ||
17 | +{ | ||
18 | + int result; | ||
19 | + | ||
20 | + *semaphore = malloc(sizeof(sem_t)); | ||
21 | + if (*semaphore == NULL) | ||
22 | + { | ||
23 | + return JZ_ERROR_SYSTEM_MODULE_CODE_MEMORY_ALLOC_FAILED; | ||
24 | + } | ||
25 | + | ||
26 | + result = sem_init(*semaphore, 0, (unsigned int) initValue); | ||
27 | + if (result != 0) | ||
28 | + { | ||
29 | + return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE; | ||
30 | + } | ||
31 | + | ||
32 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
33 | +} | ||
34 | + | ||
35 | + | ||
36 | +/** | ||
37 | + * @brief Delete the created semaphore. | ||
38 | + * @param semaphore: pointer to the created semaphore ID. | ||
39 | + * @return an enum that represents a status of PSDK | ||
40 | + */ | ||
41 | +T_JZsdkReturnCode JZsdk_Osal_SemaphoreDestroy(T_JZsdkSemaHandle semaphore) | ||
42 | +{ | ||
43 | + int result; | ||
44 | + | ||
45 | + result = sem_destroy((sem_t *) semaphore); | ||
46 | + if (result != 0) | ||
47 | + { | ||
48 | + return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE; | ||
49 | + } | ||
50 | + | ||
51 | + free(semaphore); | ||
52 | + | ||
53 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
54 | +} | ||
55 | + | ||
56 | + | ||
57 | +/** | ||
58 | + * @brief Wait the semaphore until token becomes available. | ||
59 | + * @param semaphore: pointer to the created semaphore ID. | ||
60 | + * @return an enum that represents a status of PSDK | ||
61 | + */ | ||
62 | +T_JZsdkReturnCode JZsdk_Osal_SemaphoreWait(T_JZsdkSemaHandle semaphore) | ||
63 | +{ | ||
64 | + int result; | ||
65 | + | ||
66 | + result = sem_wait(semaphore); | ||
67 | + if (result != 0) | ||
68 | + { | ||
69 | + return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE; | ||
70 | + } | ||
71 | + | ||
72 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
73 | +} | ||
74 | + | ||
75 | + | ||
76 | +/** | ||
77 | + * @brief Wait the semaphore until token becomes available. | ||
78 | + * @param semaphore: pointer to the created semaphore ID. | ||
79 | + * @param waitTime: timeout value of waiting semaphore, unit: millisecond. | ||
80 | + * @return an enum that represents a status of PSDK | ||
81 | + */ | ||
82 | +T_JZsdkReturnCode JZsdk_Osal_SemaphoreTimedWait(T_JZsdkSemaHandle semaphore, U32_t waitTime) | ||
83 | +{ | ||
84 | + int result; | ||
85 | + struct timespec semaphoreWaitTime; | ||
86 | + struct timeval systemTime; | ||
87 | + | ||
88 | + gettimeofday(&systemTime, NULL); | ||
89 | + | ||
90 | + systemTime.tv_usec += waitTime * 1000; | ||
91 | + if (systemTime.tv_usec >= 1000000) | ||
92 | + { | ||
93 | + systemTime.tv_sec += systemTime.tv_usec / 1000000; | ||
94 | + systemTime.tv_usec %= 1000000; | ||
95 | + } | ||
96 | + | ||
97 | + semaphoreWaitTime.tv_sec = systemTime.tv_sec; | ||
98 | + semaphoreWaitTime.tv_nsec = systemTime.tv_usec * 1000; | ||
99 | + | ||
100 | + result = sem_timedwait(semaphore, &semaphoreWaitTime); | ||
101 | + if (result != 0) | ||
102 | + { | ||
103 | + return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE; | ||
104 | + } | ||
105 | + | ||
106 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
107 | +} | ||
108 | + | ||
109 | + | ||
110 | + | ||
111 | +/** | ||
112 | + * @brief Release the semaphore token. | ||
113 | + * @param semaphore: pointer to the created semaphore ID. | ||
114 | + * @return an enum that represents a status of PSDK | ||
115 | + */ | ||
116 | +T_JZsdkReturnCode JZsdk_Osal_SemaphorePost(T_JZsdkSemaHandle semaphore) | ||
117 | +{ | ||
118 | + int result; | ||
119 | + | ||
120 | + result = sem_post(semaphore); | ||
121 | + if (result != 0) | ||
122 | + { | ||
123 | + return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE; | ||
124 | + } | ||
125 | + | ||
126 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
127 | +} |
1 | +/** | ||
2 | + ******************************************************************** | ||
3 | + * @file JZsdk_Semaphore.h | ||
4 | + * JZsdk_Semaphore.c 的头文件 | ||
5 | + * | ||
6 | + ********************************************************************* | ||
7 | + */ | ||
8 | + | ||
9 | +/* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/ | ||
10 | +#ifndef JZSDK_SEMAPHORE_H | ||
11 | +#define JZSDK_SEMAPHORE_H | ||
12 | + | ||
13 | +/* Includes ------------------------------------------------------------------*/ | ||
14 | +#include "JZsdk_Base/JZsdk_Code/JZsdk_Code.h" | ||
15 | + | ||
16 | +#ifdef __cplusplus | ||
17 | +extern "C" { | ||
18 | +#endif | ||
19 | + | ||
20 | +/* Exported constants --------------------------------------------------------*/ | ||
21 | +/* 常亮定义*/ | ||
22 | + | ||
23 | +/* Exported macro ------------------------------------------------------------*/ | ||
24 | + | ||
25 | +/* Exported types ------------------------------------------------------------*/ | ||
26 | + | ||
27 | + | ||
28 | +/* Exported functions --------------------------------------------------------*/ | ||
29 | +T_JZsdkReturnCode JZsdk_Osal_SemaphoreCreate(U32_t initValue, T_JZsdkSemaHandle *semaphore); | ||
30 | +T_JZsdkReturnCode JZsdk_Osal_SemaphoreDestroy(T_JZsdkSemaHandle semaphore); | ||
31 | +T_JZsdkReturnCode JZsdk_Osal_SemaphoreWait(T_JZsdkSemaHandle semaphore); | ||
32 | +T_JZsdkReturnCode JZsdk_Osal_SemaphoreTimedWait(T_JZsdkSemaHandle semaphore, U32_t waitTime); | ||
33 | +T_JZsdkReturnCode JZsdk_Osal_SemaphorePost(T_JZsdkSemaHandle semaphore); | ||
34 | + | ||
35 | + | ||
36 | +#ifdef __cplusplus | ||
37 | +} | ||
38 | +#endif | ||
39 | + | ||
40 | +#endif | ||
41 | +/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/ |
1 | +#include <stdio.h> | ||
2 | +#include <stdlib.h> | ||
3 | +#include <pthread.h> | ||
4 | + | ||
5 | +#include "./JZsdk_Task.h" | ||
6 | + | ||
7 | +T_JZsdkReturnCode JZsdk_Osal_TaskCreate(const char *name, void *(*taskFunc)(void *), unsigned int stackSize, void *arg, | ||
8 | + T_JZTaskHandle *task) | ||
9 | +{ | ||
10 | + int result; | ||
11 | + char nameDealed[16] = {0}; | ||
12 | + | ||
13 | + //为任务句柄分配内存空间,大小为sizeof(pthread_t)。如果内存分配失败,则返回一个错误代码 | ||
14 | + *task = malloc(sizeof(pthread_t)); | ||
15 | + if (*task == NULL) { | ||
16 | + return JZ_ERROR_SYSTEM_MODULE_CODE_MEMORY_ALLOC_FAILED; | ||
17 | + } | ||
18 | + | ||
19 | + //使用pthread_create函数创建一个新的线程,传递给它任务函数指针taskFunc和参数arg。如果创建线程失败,则返回一个错误代码 | ||
20 | + result = pthread_create(*task, NULL, taskFunc, arg); | ||
21 | + if (result != 0) { | ||
22 | + return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE; | ||
23 | + } | ||
24 | + | ||
25 | + | ||
26 | + //如果任务名称name不为空,则将其拷贝到nameDealed字符数组中(最多拷贝sizeof(nameDealed) - 1个字符)。 | ||
27 | + if (name != NULL) | ||
28 | + strncpy(nameDealed, name, sizeof(nameDealed) - 1); | ||
29 | + | ||
30 | + //使用pthread_setname_np函数将任务线程的名称设置为nameDealed。如果设置线程名称失败,则返回一个错误代码 | ||
31 | + result = pthread_setname_np(*(pthread_t *) *task, nameDealed); | ||
32 | + if (result != 0) { | ||
33 | + return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE; | ||
34 | + } | ||
35 | + | ||
36 | +/*int pthread_setcanceltype(int type, int *oldtype); | ||
37 | +``` | ||
38 | + | ||
39 | +- `type`参数指定了取消类型,可以是以下两个值之一: | ||
40 | + - `PTHREAD_CANCEL_DEFERRED`:线程将在下一个取消点取消。取消点是指线程可以响应取消请求的一些特定操作点,例如函数调用、线程等待等。线程将继续运行,直到到达取消点后才会被取消。 | ||
41 | + - `PTHREAD_CANCEL_ASYNCHRONOUS`:线程立即取消,不论是否在取消点。线程将立即终止执行,不会进行清理操作。这种取消类型可能导致资源泄漏和数据不一致,因此需要谨慎使用。 | ||
42 | +- `oldtype`参数是一个可选的输出参数,用于获取之前的取消类型。 | ||
43 | + | ||
44 | +*/ | ||
45 | + pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); | ||
46 | +/* | ||
47 | +- `state`参数指定了取消状态,可以是以下两个值之一: | ||
48 | + - `PTHREAD_CANCEL_ENABLE`:线程可以接收取消请求。 | ||
49 | + - `PTHREAD_CANCEL_DISABLE`:线程忽略取消请求。 | ||
50 | +- `oldstate`参数是一个可选的输出参数,用于获取之前的取消状态。 | ||
51 | + | ||
52 | +通过调用`pthread_setcancelstate`函数,您可以选择线程的取消状态。默认情况下,线程的取消状态是`PTHREAD_CANCEL_ENABLE`。*/ | ||
53 | + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); | ||
54 | + | ||
55 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
56 | + | ||
57 | +} | ||
58 | + | ||
59 | + | ||
60 | +T_JZsdkReturnCode JZsdk_Osal_TaskDestroy(T_JZTaskHandle task) | ||
61 | +{ | ||
62 | + pthread_cancel(*(pthread_t *) task); | ||
63 | + free(task); | ||
64 | + | ||
65 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
66 | +} |
1 | +/** | ||
2 | + ******************************************************************** | ||
3 | + * @file JZsdk_Task.h | ||
4 | + * JZsdk_Task.c 的头文件 | ||
5 | + * | ||
6 | + ********************************************************************* | ||
7 | + */ | ||
8 | + | ||
9 | +/* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/ | ||
10 | +#ifndef JZSDK_TASK_H | ||
11 | +#define JZSDK_TASK_H | ||
12 | + | ||
13 | +/* Includes ------------------------------------------------------------------*/ | ||
14 | +#include "JZsdk_Base/JZsdk_Code/JZsdk_Code.h" | ||
15 | + | ||
16 | +#ifdef __cplusplus | ||
17 | +extern "C" { | ||
18 | +#endif | ||
19 | + | ||
20 | +/* Exported constants --------------------------------------------------------*/ | ||
21 | +/* 常亮定义*/ | ||
22 | + | ||
23 | +/* Exported macro ------------------------------------------------------------*/ | ||
24 | + | ||
25 | +/* Exported types ------------------------------------------------------------*/ | ||
26 | + | ||
27 | + | ||
28 | +/* Exported functions --------------------------------------------------------*/ | ||
29 | +T_JZsdkReturnCode JZsdk_Osal_TaskCreate(const char *name, void *(*taskFunc)(void *), unsigned int stackSize, void *arg, | ||
30 | + T_JZTaskHandle *task); | ||
31 | + | ||
32 | +T_JZsdkReturnCode JZsdk_Osal_TaskDestroy(T_JZTaskHandle task); | ||
33 | + | ||
34 | +#ifdef __cplusplus | ||
35 | +} | ||
36 | +#endif | ||
37 | + | ||
38 | +#endif | ||
39 | +/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/ |
1 | +#include <sys/time.h> // 为了使用 gettimeofday 函数 | ||
2 | +#include <time.h> // 为了使用 time 函数 | ||
3 | + | ||
4 | +#include "./JZsdk_TimeR.h" | ||
5 | + | ||
6 | +static U32_t s_localTimeMsOffset = 0; | ||
7 | +static U64_t s_localTimeUsOffset = 0; | ||
8 | + | ||
9 | + | ||
10 | +/** | ||
11 | + * @brief Get the system time for ms. | ||
12 | + * @return an uint32 that the time of system, uint:ms | ||
13 | + */ | ||
14 | +T_JZsdkReturnCode JZsdk_Osal_GetTimeMs(U32_t *ms) | ||
15 | +{ | ||
16 | + struct timeval time; | ||
17 | + | ||
18 | + gettimeofday(&time, NULL); | ||
19 | + *ms = (time.tv_sec * 1000 + time.tv_usec / 1000); | ||
20 | + | ||
21 | + if (s_localTimeMsOffset == 0) | ||
22 | + { | ||
23 | + s_localTimeMsOffset = *ms; | ||
24 | + } else { | ||
25 | + *ms = *ms - s_localTimeMsOffset; | ||
26 | + } | ||
27 | + | ||
28 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
29 | +} | ||
30 | + | ||
31 | +T_JZsdkReturnCode JZsdk_Osal_GetTimeUs(U64_t *us) | ||
32 | +{ | ||
33 | + struct timeval time; | ||
34 | + | ||
35 | + gettimeofday(&time, NULL); | ||
36 | + *us = (time.tv_sec * 1000000 + time.tv_usec); | ||
37 | + | ||
38 | + if (s_localTimeUsOffset == 0) { | ||
39 | + s_localTimeUsOffset = *us; | ||
40 | + } else { | ||
41 | + *us = *us - s_localTimeMsOffset; | ||
42 | + } | ||
43 | + | ||
44 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
45 | +} | ||
46 | + | ||
47 | +T_JZsdkReturnCode JZsdk_Osal_GetRandomNum(U16_t *randomNum) | ||
48 | +{ | ||
49 | + srand(time(NULL)); | ||
50 | + *randomNum = random() % 65535; | ||
51 | + | ||
52 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
53 | +} | ||
54 | + | ||
55 | + | ||
56 | +/* | ||
57 | +* 用于延时(粗略) | ||
58 | +* 需要优化 | ||
59 | +*/ | ||
60 | +T_JZsdkReturnCode delayUs(U32_t msec) | ||
61 | +{ | ||
62 | + usleep(msec); | ||
63 | + | ||
64 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
65 | +} | ||
66 | + | ||
67 | +/* | ||
68 | +* 用于延时(粗略) | ||
69 | +* 需要优化 | ||
70 | +*/ | ||
71 | +T_JZsdkReturnCode delayMs(U32_t msec) | ||
72 | +{ | ||
73 | + usleep(msec * 1000); | ||
74 | + | ||
75 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
76 | +} | ||
77 | + | ||
78 | +/* | ||
79 | +* 用于延时(粗略) | ||
80 | +* 需要优化 | ||
81 | +*/ | ||
82 | +T_JZsdkReturnCode delayS(U32_t sec) | ||
83 | +{ | ||
84 | + delayMs(sec * 1000); | ||
85 | + | ||
86 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
87 | +} |
1 | +/** | ||
2 | + ******************************************************************** | ||
3 | + * @file JZsdk_Timer.h | ||
4 | + * JZsdk_Timer.c 的头文件 | ||
5 | + * | ||
6 | + ********************************************************************* | ||
7 | + */ | ||
8 | + | ||
9 | +/* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/ | ||
10 | +#ifndef JZSDK_TIMER_H | ||
11 | +#define JZSDK_TIMER_H | ||
12 | + | ||
13 | +/* Includes ------------------------------------------------------------------*/ | ||
14 | +#include "JZsdk_Base/JZsdk_Code/JZsdk_Code.h" | ||
15 | + | ||
16 | +#ifdef __cplusplus | ||
17 | +extern "C" { | ||
18 | +#endif | ||
19 | + | ||
20 | +/* Exported constants --------------------------------------------------------*/ | ||
21 | +/* 常亮定义*/ | ||
22 | + | ||
23 | +/* Exported macro ------------------------------------------------------------*/ | ||
24 | + | ||
25 | +/* Exported types ------------------------------------------------------------*/ | ||
26 | + | ||
27 | + | ||
28 | +/* Exported functions --------------------------------------------------------*/ | ||
29 | +T_JZsdkReturnCode JZsdk_Osal_GetTimeMs(U32_t *ms); | ||
30 | +T_JZsdkReturnCode JZsdk_Osal_GetTimeUs(U64_t *us); | ||
31 | +T_JZsdkReturnCode JZsdk_Osal_GetRandomNum(U16_t *randomNum); | ||
32 | +T_JZsdkReturnCode delayUs(U32_t msec); | ||
33 | +T_JZsdkReturnCode delayMs(U32_t msec); | ||
34 | +T_JZsdkReturnCode delayS(U32_t sec); | ||
35 | + | ||
36 | + | ||
37 | +#ifdef __cplusplus | ||
38 | +} | ||
39 | +#endif | ||
40 | + | ||
41 | +#endif | ||
42 | +/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/ |
@@ -22,7 +22,7 @@ typedef struct { | @@ -22,7 +22,7 @@ typedef struct { | ||
22 | pthread_cond_t condition; // 条件变量 | 22 | pthread_cond_t condition; // 条件变量 |
23 | } t_ThreadPool; | 23 | } t_ThreadPool; |
24 | 24 | ||
25 | -t_ThreadPool TaskPool[THREAD_POOL_SIZE]; //任务池子 | 25 | +static t_ThreadPool TaskPool[THREAD_POOL_SIZE]; //任务池子 |
26 | 26 | ||
27 | static void* TaskManagement_ThreadFunction(void* arg); | 27 | static void* TaskManagement_ThreadFunction(void* arg); |
28 | 28 |
@@ -5,33 +5,37 @@ | @@ -5,33 +5,37 @@ | ||
5 | 5 | ||
6 | #include "JZsdkLib.h" | 6 | #include "JZsdkLib.h" |
7 | 7 | ||
8 | -#include "version_choose.h" | 8 | +#include "Hal_Send/HalSend.h" |
9 | + | ||
10 | +#include "BaseConfig.h" | ||
11 | + | ||
9 | #include "ircut.h" | 12 | #include "ircut.h" |
10 | -#include "Megaphone/Megaphone.h" | ||
11 | #include "Gimbal/Gimbal.h" | 13 | #include "Gimbal/Gimbal.h" |
12 | 14 | ||
13 | -#include "JZsdk_uart/JZsdk_Uart_Input.h" | ||
14 | -#include "BaseConfig.h" | ||
15 | #include "Psdk_UI_io.h" | 15 | #include "Psdk_UI_io.h" |
16 | 16 | ||
17 | - | ||
18 | #include "Lighting_InAndOut.h" | 17 | #include "Lighting_InAndOut.h" |
19 | #include "JZsdk_network/JZsdk_network.h" | 18 | #include "JZsdk_network/JZsdk_network.h" |
20 | 19 | ||
21 | -#include "JZsdk_TaskManagement/TaskManagement.h" | ||
22 | #include "JZsdk_haldata_deal/JZsdk_data_transmisson.h" | 20 | #include "JZsdk_haldata_deal/JZsdk_data_transmisson.h" |
23 | #include "MediaProc/MediaProc.h" | 21 | #include "MediaProc/MediaProc.h" |
24 | #include "UI_control/WidegMgmt/JZsdk_Widget.h" | 22 | #include "UI_control/WidegMgmt/JZsdk_Widget.h" |
25 | #include "DeviceConfig/DeviceConfig.h" | 23 | #include "DeviceConfig/DeviceConfig.h" |
26 | 24 | ||
25 | +#include "JZsdk_Hal.h" | ||
26 | + | ||
27 | #if APP_VERSION == APP_PSDK | 27 | #if APP_VERSION == APP_PSDK |
28 | + | ||
28 | #include "fc_subscription/test_fc_subscription.h" | 29 | #include "fc_subscription/test_fc_subscription.h" |
30 | + | ||
29 | #endif | 31 | #endif |
32 | + | ||
30 | #include "DeviceInfo/DeviceInfo.h" | 33 | #include "DeviceInfo/DeviceInfo.h" |
31 | 34 | ||
32 | -#if MEGAPHONE_CONFIG_STATUS == VERSION_SWITCH_ON | 35 | +#ifdef MEGAPHONE_CONFIG_STATUS_ON |
33 | #include "AudioDeal/AudioDeal.h" | 36 | #include "AudioDeal/AudioDeal.h" |
34 | #include "Megaphone/Megaphone.h" | 37 | #include "Megaphone/Megaphone.h" |
38 | + extern int MegaphoneStatusFlag; | ||
35 | #endif | 39 | #endif |
36 | 40 | ||
37 | #ifdef SIDE_LASER_STATUS_ON | 41 | #ifdef SIDE_LASER_STATUS_ON |
@@ -42,7 +46,7 @@ static int Main_WorkMode(); | @@ -42,7 +46,7 @@ static int Main_WorkMode(); | ||
42 | static void *Main_WorkModeTask(void *arg); | 46 | static void *Main_WorkModeTask(void *arg); |
43 | static int WorkMode = JZ_FLAGCODE_OFF; | 47 | static int WorkMode = JZ_FLAGCODE_OFF; |
44 | 48 | ||
45 | -extern int MegaphoneStatusFlag; | 49 | + |
46 | static int g_All_filter_Mode = JZ_FLAGCODE_OFF; //用于m30的滤波开关 | 50 | static int g_All_filter_Mode = JZ_FLAGCODE_OFF; //用于m30的滤波开关 |
47 | static int StartupPriorityNum = JZ_FLAGCODE_OFF; //优先启动项值 | 51 | static int StartupPriorityNum = JZ_FLAGCODE_OFF; //优先启动项值 |
48 | 52 | ||
@@ -58,7 +62,7 @@ T_JZsdkReturnCode Main_M30_all_filter_mode(int *mode) | @@ -58,7 +62,7 @@ T_JZsdkReturnCode Main_M30_all_filter_mode(int *mode) | ||
58 | { | 62 | { |
59 | 63 | ||
60 | //喊话器功能被打开时 | 64 | //喊话器功能被打开时 |
61 | -#if MEGAPHONE_CONFIG_STATUS == VERSION_SWITCH_ON | 65 | +#ifdef MEGAPHONE_CONFIG_STATUS_ON |
62 | if (*mode == JZ_FLAGCODE_GET) | 66 | if (*mode == JZ_FLAGCODE_GET) |
63 | { | 67 | { |
64 | *mode = g_All_filter_Mode; | 68 | *mode = g_All_filter_Mode; |
@@ -149,7 +153,7 @@ T_JZsdkReturnCode Main_APP_Psdk() | @@ -149,7 +153,7 @@ T_JZsdkReturnCode Main_APP_Psdk() | ||
149 | JZsdk_data_transmisson_Receive_Init(); | 153 | JZsdk_data_transmisson_Receive_Init(); |
150 | 154 | ||
151 | //喊话器功能被打开时 | 155 | //喊话器功能被打开时 |
152 | -#if MEGAPHONE_CONFIG_STATUS == VERSION_SWITCH_ON | 156 | +#ifdef MEGAPHONE_CONFIG_STATUS_ON |
153 | 157 | ||
154 | //音频库初始化 | 158 | //音频库初始化 |
155 | AudioDeal_Init(); | 159 | AudioDeal_Init(); |
@@ -159,16 +163,16 @@ T_JZsdkReturnCode Main_APP_Psdk() | @@ -159,16 +163,16 @@ T_JZsdkReturnCode Main_APP_Psdk() | ||
159 | if (DEVICE_VERSION == TF_A1) | 163 | if (DEVICE_VERSION == TF_A1) |
160 | { | 164 | { |
161 | //串口设备1初始化 | 165 | //串口设备1初始化 |
162 | - //JZsdk_Uart_Init(UART_DEV_1); | 166 | + //JZsdk_HalPort_Init_WithDefault(UART_DEV_1); |
163 | 167 | ||
164 | //串口设备2初始化 | 168 | //串口设备2初始化 |
165 | - JZsdk_Uart_Init(UART_DEV_2); | 169 | + JZsdk_HalPort_Init_WithDefault(UART_DEV_2); |
166 | 170 | ||
167 | //喊话器初始化 | 171 | //喊话器初始化 |
168 | Megaphone_Init(); | 172 | Megaphone_Init(); |
169 | 173 | ||
170 | //云台初始化 | 174 | //云台初始化 |
171 | - Gimbal_Init(); | 175 | + Gimbal_Init(JZ_MODULE_CONTROL_WAY_INDEPENDENT); |
172 | 176 | ||
173 | //灯类初始化 | 177 | //灯类初始化 |
174 | Lighting_Init(); | 178 | Lighting_Init(); |
@@ -176,49 +180,49 @@ T_JZsdkReturnCode Main_APP_Psdk() | @@ -176,49 +180,49 @@ T_JZsdkReturnCode Main_APP_Psdk() | ||
176 | delayMs(1000); | 180 | delayMs(1000); |
177 | 181 | ||
178 | //消息订阅初始化 | 182 | //消息订阅初始化 |
179 | - JZsdk_Uart_Send_MessageSubcription_Control(UART_DEV_2, JZ_FLAGCODE_ON); | 183 | + HalSend_type1Send_MessageSubcription_Control(UART_DEV_2, JZ_FLAGCODE_ON); |
180 | } | 184 | } |
181 | 185 | ||
182 | else if (DEVICE_VERSION == JZ_H1E) | 186 | else if (DEVICE_VERSION == JZ_H1E) |
183 | { | 187 | { |
184 | //串口设备1初始化 | 188 | //串口设备1初始化 |
185 | - //JZsdk_Uart_Init(UART_DEV_1); | 189 | + //JZsdk_HalPort_Init_WithDefault(UART_DEV_1); |
186 | 190 | ||
187 | //喊话器初始化 | 191 | //喊话器初始化 |
188 | - Megaphone_Init(); | 192 | + Megaphone_Init(JZ_MODULE_CONTROL_WAY_INDEPENDENT); |
189 | } | 193 | } |
190 | 194 | ||
191 | else if (DEVICE_VERSION == JZ_H1T) | 195 | else if (DEVICE_VERSION == JZ_H1T) |
192 | { | 196 | { |
193 | //串口设备1初始化 | 197 | //串口设备1初始化 |
194 | - //JZsdk_Uart_Init(UART_DEV_1); | 198 | + //JZsdk_HalPort_Init_WithDefault(UART_DEV_1); |
195 | 199 | ||
196 | //4g设备初始化 | 200 | //4g设备初始化 |
197 | - JZsdk_Uart_Init(UART_4G); | 201 | + JZsdk_HalPort_Init_WithDefault(UART_4G); |
198 | 202 | ||
199 | //喊话器初始化 | 203 | //喊话器初始化 |
200 | Megaphone_Init(); | 204 | Megaphone_Init(); |
201 | 205 | ||
202 | //云台初始化 | 206 | //云台初始化 |
203 | - Gimbal_Init(); | 207 | + Gimbal_Init(JZ_MODULE_CONTROL_WAY_TRANSPARENT); |
204 | } | 208 | } |
205 | 209 | ||
206 | else if (DEVICE_VERSION == JZ_H150S || DEVICE_VERSION == JZ_H150T) | 210 | else if (DEVICE_VERSION == JZ_H150S || DEVICE_VERSION == JZ_H150T) |
207 | { | 211 | { |
208 | //串口设备1初始化 | 212 | //串口设备1初始化 |
209 | - // JZsdk_Uart_Init(UART_DEV_1); | 213 | + // JZsdk_HalPort_Init_WithDefault(UART_DEV_1); |
210 | 214 | ||
211 | if (DEVICE_VERSION == JZ_H150T) | 215 | if (DEVICE_VERSION == JZ_H150T) |
212 | { | 216 | { |
213 | //4g设备初始化 | 217 | //4g设备初始化 |
214 | - JZsdk_Uart_Init(UART_4G); | 218 | + JZsdk_HalPort_Init_WithDefault(UART_4G); |
215 | } | 219 | } |
216 | 220 | ||
217 | //喊话器初始化 | 221 | //喊话器初始化 |
218 | Megaphone_Init(); | 222 | Megaphone_Init(); |
219 | 223 | ||
220 | //云台初始化 | 224 | //云台初始化 |
221 | - Gimbal_Init(); | 225 | + Gimbal_Init(JZ_MODULE_CONTROL_WAY_INDEPENDENT); |
222 | 226 | ||
223 | //相机初始化 | 227 | //相机初始化 |
224 | MediaProc_Init(); | 228 | MediaProc_Init(); |
@@ -227,43 +231,43 @@ T_JZsdkReturnCode Main_APP_Psdk() | @@ -227,43 +231,43 @@ T_JZsdkReturnCode Main_APP_Psdk() | ||
227 | else if (DEVICE_VERSION == JZ_H10) | 231 | else if (DEVICE_VERSION == JZ_H10) |
228 | { | 232 | { |
229 | //串口设备1初始化 | 233 | //串口设备1初始化 |
230 | - // JZsdk_Uart_Init(UART_DEV_1); | 234 | + // JZsdk_HalPort_Init_WithDefault(UART_DEV_1); |
231 | 235 | ||
232 | //喊话器初始化 | 236 | //喊话器初始化 |
233 | Megaphone_Init(); | 237 | Megaphone_Init(); |
234 | 238 | ||
235 | //云台初始化 | 239 | //云台初始化 |
236 | - Gimbal_Init(); | 240 | + Gimbal_Init(JZ_MODULE_CONTROL_WAY_INDEPENDENT); |
237 | } | 241 | } |
238 | 242 | ||
239 | else if (DEVICE_VERSION == JZ_H10T) | 243 | else if (DEVICE_VERSION == JZ_H10T) |
240 | { | 244 | { |
241 | //串口设备1初始化 | 245 | //串口设备1初始化 |
242 | - //JZsdk_Uart_Init(UART_DEV_1); | 246 | + //JZsdk_HalPort_Init_WithDefault(UART_DEV_1); |
243 | 247 | ||
244 | //4g设备初始化 | 248 | //4g设备初始化 |
245 | - JZsdk_Uart_Init(UART_4G); | 249 | + JZsdk_HalPort_Init_WithDefault(UART_4G); |
246 | 250 | ||
247 | //喊话器初始化 | 251 | //喊话器初始化 |
248 | Megaphone_Init(); | 252 | Megaphone_Init(); |
249 | 253 | ||
250 | //云台初始化 | 254 | //云台初始化 |
251 | - Gimbal_Init(); | 255 | + Gimbal_Init(JZ_MODULE_CONTROL_WAY_INDEPENDENT); |
252 | } | 256 | } |
253 | 257 | ||
254 | else if (DEVICE_VERSION == JZ_U3) | 258 | else if (DEVICE_VERSION == JZ_U3) |
255 | { | 259 | { |
256 | //串口设备1初始化 | 260 | //串口设备1初始化 |
257 | - //JZsdk_Uart_Init(UART_DEV_1); | 261 | + //JZsdk_HalPort_Init_WithDefault(UART_DEV_1); |
258 | 262 | ||
259 | //串口设备2初始化 | 263 | //串口设备2初始化 |
260 | - JZsdk_Uart_Init(UART_DEV_2); | 264 | + JZsdk_HalPort_Init_WithDefault(UART_DEV_2); |
261 | 265 | ||
262 | //喊话器初始化 | 266 | //喊话器初始化 |
263 | Megaphone_Init(); | 267 | Megaphone_Init(); |
264 | 268 | ||
265 | //云台初始化 | 269 | //云台初始化 |
266 | - Gimbal_Init(); | 270 | + Gimbal_Init(JZ_MODULE_CONTROL_WAY_INDEPENDENT); |
267 | 271 | ||
268 | //灯类初始化 | 272 | //灯类初始化 |
269 | Lighting_Init(); | 273 | Lighting_Init(); |
@@ -271,22 +275,22 @@ T_JZsdkReturnCode Main_APP_Psdk() | @@ -271,22 +275,22 @@ T_JZsdkReturnCode Main_APP_Psdk() | ||
271 | delayMs(1000); | 275 | delayMs(1000); |
272 | 276 | ||
273 | //消息订阅初始化 | 277 | //消息订阅初始化 |
274 | - JZsdk_Uart_Send_MessageSubcription_Control(UART_DEV_2, JZ_FLAGCODE_ON); | 278 | + HalSend_type1Send_MessageSubcription_Control(UART_DEV_2, JZ_FLAGCODE_ON); |
275 | } | 279 | } |
276 | 280 | ||
277 | else if (DEVICE_VERSION == JZ_U3S) | 281 | else if (DEVICE_VERSION == JZ_U3S) |
278 | { | 282 | { |
279 | //串口设备1初始化 | 283 | //串口设备1初始化 |
280 | - //JZsdk_Uart_Init(UART_DEV_1); | 284 | + //JZsdk_HalPort_Init_WithDefault(UART_DEV_1); |
281 | 285 | ||
282 | //串口设备2初始化 | 286 | //串口设备2初始化 |
283 | - JZsdk_Uart_Init(UART_DEV_2); | 287 | + JZsdk_HalPort_Init_WithDefault(UART_DEV_2); |
284 | 288 | ||
285 | //喊话器初始化 | 289 | //喊话器初始化 |
286 | Megaphone_Init(); | 290 | Megaphone_Init(); |
287 | 291 | ||
288 | //云台初始化 | 292 | //云台初始化 |
289 | - Gimbal_Init(); | 293 | + Gimbal_Init(JZ_MODULE_CONTROL_WAY_INDEPENDENT); |
290 | 294 | ||
291 | //灯类初始化 | 295 | //灯类初始化 |
292 | Lighting_Init(); | 296 | Lighting_Init(); |
@@ -297,22 +301,22 @@ T_JZsdkReturnCode Main_APP_Psdk() | @@ -297,22 +301,22 @@ T_JZsdkReturnCode Main_APP_Psdk() | ||
297 | delayMs(1000); | 301 | delayMs(1000); |
298 | 302 | ||
299 | //消息订阅初始化 | 303 | //消息订阅初始化 |
300 | - JZsdk_Uart_Send_MessageSubcription_Control(UART_DEV_2, JZ_FLAGCODE_ON); | 304 | + HalSend_type1Send_MessageSubcription_Control(UART_DEV_2, JZ_FLAGCODE_ON); |
301 | } | 305 | } |
302 | 306 | ||
303 | else if (DEVICE_VERSION == JZ_U3D) | 307 | else if (DEVICE_VERSION == JZ_U3D) |
304 | { | 308 | { |
305 | //串口设备1初始化 | 309 | //串口设备1初始化 |
306 | - //JZsdk_Uart_Init(UART_DEV_1); | 310 | + //JZsdk_HalPort_Init_WithDefault(UART_DEV_1); |
307 | 311 | ||
308 | //串口设备2初始化 | 312 | //串口设备2初始化 |
309 | - JZsdk_Uart_Init(UART_DEV_2); | 313 | + JZsdk_HalPort_Init_WithDefault(UART_DEV_2); |
310 | 314 | ||
311 | //喊话器初始化 | 315 | //喊话器初始化 |
312 | Megaphone_Init(); | 316 | Megaphone_Init(); |
313 | 317 | ||
314 | //云台初始化 | 318 | //云台初始化 |
315 | - Gimbal_Init(); | 319 | + Gimbal_Init(JZ_MODULE_CONTROL_WAY_INDEPENDENT); |
316 | 320 | ||
317 | //灯类初始化 | 321 | //灯类初始化 |
318 | Lighting_Init(); | 322 | Lighting_Init(); |
@@ -320,22 +324,22 @@ T_JZsdkReturnCode Main_APP_Psdk() | @@ -320,22 +324,22 @@ T_JZsdkReturnCode Main_APP_Psdk() | ||
320 | delayMs(1000); | 324 | delayMs(1000); |
321 | 325 | ||
322 | //消息订阅初始化 | 326 | //消息订阅初始化 |
323 | - JZsdk_Uart_Send_MessageSubcription_Control(UART_DEV_2, JZ_FLAGCODE_ON); | 327 | + HalSend_type1Send_MessageSubcription_Control(UART_DEV_2, JZ_FLAGCODE_ON); |
324 | } | 328 | } |
325 | 329 | ||
326 | else if (DEVICE_VERSION == JZ_U30) | 330 | else if (DEVICE_VERSION == JZ_U30) |
327 | { | 331 | { |
328 | //串口设备1初始化 | 332 | //串口设备1初始化 |
329 | - //JZsdk_Uart_Init(UART_DEV_1); | 333 | + //JZsdk_HalPort_Init_WithDefault(UART_DEV_1); |
330 | 334 | ||
331 | //串口设备2初始化 | 335 | //串口设备2初始化 |
332 | - JZsdk_Uart_Init(UART_DEV_2); | 336 | + JZsdk_HalPort_Init_WithDefault(UART_DEV_2); |
333 | 337 | ||
334 | //喊话器初始化 | 338 | //喊话器初始化 |
335 | Megaphone_Init(); | 339 | Megaphone_Init(); |
336 | 340 | ||
337 | //云台初始化 | 341 | //云台初始化 |
338 | - Gimbal_Init(); | 342 | + Gimbal_Init(JZ_MODULE_CONTROL_WAY_INDEPENDENT); |
339 | 343 | ||
340 | //灯类初始化 | 344 | //灯类初始化 |
341 | Lighting_Init(); | 345 | Lighting_Init(); |
@@ -343,7 +347,7 @@ T_JZsdkReturnCode Main_APP_Psdk() | @@ -343,7 +347,7 @@ T_JZsdkReturnCode Main_APP_Psdk() | ||
343 | delayMs(1000); | 347 | delayMs(1000); |
344 | 348 | ||
345 | //消息订阅初始化 | 349 | //消息订阅初始化 |
346 | - JZsdk_Uart_Send_MessageSubcription_Control(UART_DEV_2, JZ_FLAGCODE_ON); | 350 | + HalSend_type1Send_MessageSubcription_Control(UART_DEV_2, JZ_FLAGCODE_ON); |
347 | } | 351 | } |
348 | 352 | ||
349 | else if (DEVICE_VERSION == JZ_C1) | 353 | else if (DEVICE_VERSION == JZ_C1) |
@@ -382,7 +386,7 @@ int Main_APP_Uart() | @@ -382,7 +386,7 @@ int Main_APP_Uart() | ||
382 | Main_WorkMode(); | 386 | Main_WorkMode(); |
383 | 387 | ||
384 | //喊话器功能被打开时 | 388 | //喊话器功能被打开时 |
385 | -#if MEGAPHONE_CONFIG_STATUS == VERSION_SWITCH_ON | 389 | +#ifdef MEGAPHONE_CONFIG_STATUS_ON |
386 | //音频库初始化 | 390 | //音频库初始化 |
387 | AudioDeal_Init(); | 391 | AudioDeal_Init(); |
388 | #endif | 392 | #endif |
@@ -390,7 +394,7 @@ int Main_APP_Uart() | @@ -390,7 +394,7 @@ int Main_APP_Uart() | ||
390 | if (DEVICE_VERSION == JZ_H1E) | 394 | if (DEVICE_VERSION == JZ_H1E) |
391 | { | 395 | { |
392 | //串口设备1初始化 | 396 | //串口设备1初始化 |
393 | - JZsdk_Uart_Init(UART_DEV_1); | 397 | + JZsdk_HalPort_Init_WithDefault(UART_DEV_1); |
394 | 398 | ||
395 | //喊话器初始化 | 399 | //喊话器初始化 |
396 | Megaphone_Init(); | 400 | Megaphone_Init(); |
@@ -399,16 +403,16 @@ int Main_APP_Uart() | @@ -399,16 +403,16 @@ int Main_APP_Uart() | ||
399 | if (DEVICE_VERSION == JZ_H1T) | 403 | if (DEVICE_VERSION == JZ_H1T) |
400 | { | 404 | { |
401 | //串口设备1初始化 | 405 | //串口设备1初始化 |
402 | - JZsdk_Uart_Init(UART_DEV_1); | 406 | + JZsdk_HalPort_Init_WithDefault(UART_DEV_1); |
403 | 407 | ||
404 | //4g设备初始化 | 408 | //4g设备初始化 |
405 | - JZsdk_Uart_Init(UART_4G); | 409 | + JZsdk_HalPort_Init_WithDefault(UART_4G); |
406 | 410 | ||
407 | //喊话器初始化 | 411 | //喊话器初始化 |
408 | Megaphone_Init(); | 412 | Megaphone_Init(); |
409 | 413 | ||
410 | //云台初始化 | 414 | //云台初始化 |
411 | - Gimbal_Init(); | 415 | + Gimbal_Init(JZ_MODULE_CONTROL_WAY_TRANSPARENT); |
412 | 416 | ||
413 | // //测试增加选项 | 417 | // //测试增加选项 |
414 | // //开启循环 | 418 | // //开启循环 |
@@ -421,7 +425,7 @@ int Main_APP_Uart() | @@ -421,7 +425,7 @@ int Main_APP_Uart() | ||
421 | if (DEVICE_VERSION == JZ_H150S || DEVICE_VERSION == JZ_H150T) | 425 | if (DEVICE_VERSION == JZ_H150S || DEVICE_VERSION == JZ_H150T) |
422 | { | 426 | { |
423 | //串口设备1初始化 | 427 | //串口设备1初始化 |
424 | - JZsdk_Uart_Init(UART_DEV_1); | 428 | + JZsdk_HalPort_Init_WithDefault(UART_DEV_1); |
425 | 429 | ||
426 | //网口初始化 | 430 | //网口初始化 |
427 | JZsdk_NetWork_Init(); | 431 | JZsdk_NetWork_Init(); |
@@ -429,11 +433,11 @@ int Main_APP_Uart() | @@ -429,11 +433,11 @@ int Main_APP_Uart() | ||
429 | if (DEVICE_VERSION == JZ_H150T) | 433 | if (DEVICE_VERSION == JZ_H150T) |
430 | { | 434 | { |
431 | //4g设备初始化 | 435 | //4g设备初始化 |
432 | - JZsdk_Uart_Init(UART_4G); | 436 | + JZsdk_HalPort_Init_WithDefault(UART_4G); |
433 | } | 437 | } |
434 | 438 | ||
435 | //云台初始化 | 439 | //云台初始化 |
436 | - Gimbal_Init(); | 440 | + Gimbal_Init(JZ_MODULE_CONTROL_WAY_INDEPENDENT); |
437 | 441 | ||
438 | //相机初始化 | 442 | //相机初始化 |
439 | MediaProc_Init(); | 443 | MediaProc_Init(); |
@@ -445,7 +449,7 @@ int Main_APP_Uart() | @@ -445,7 +449,7 @@ int Main_APP_Uart() | ||
445 | if (DEVICE_VERSION == JZ_H10) | 449 | if (DEVICE_VERSION == JZ_H10) |
446 | { | 450 | { |
447 | //串口设备1初始化 | 451 | //串口设备1初始化 |
448 | - JZsdk_Uart_Init(UART_DEV_1); | 452 | + JZsdk_HalPort_Init_WithDefault(UART_DEV_1); |
449 | 453 | ||
450 | //H10和10t固定打开滤波 | 454 | //H10和10t固定打开滤波 |
451 | int filter_mode = JZ_FLAGCODE_ON; | 455 | int filter_mode = JZ_FLAGCODE_ON; |
@@ -455,16 +459,16 @@ int Main_APP_Uart() | @@ -455,16 +459,16 @@ int Main_APP_Uart() | ||
455 | Megaphone_Init(); | 459 | Megaphone_Init(); |
456 | 460 | ||
457 | //云台初始化 | 461 | //云台初始化 |
458 | - Gimbal_Init(); | 462 | + Gimbal_Init(JZ_MODULE_CONTROL_WAY_INDEPENDENT); |
459 | } | 463 | } |
460 | 464 | ||
461 | if (DEVICE_VERSION == JZ_H10T) | 465 | if (DEVICE_VERSION == JZ_H10T) |
462 | { | 466 | { |
463 | //串口设备1初始化 | 467 | //串口设备1初始化 |
464 | - JZsdk_Uart_Init(UART_DEV_1); | 468 | + JZsdk_HalPort_Init_WithDefault(UART_DEV_1); |
465 | 469 | ||
466 | //4g设备初始化 | 470 | //4g设备初始化 |
467 | - JZsdk_Uart_Init(UART_4G); | 471 | + JZsdk_HalPort_Init_WithDefault(UART_4G); |
468 | 472 | ||
469 | //H10和10t固定打开滤波 | 473 | //H10和10t固定打开滤波 |
470 | int filter_mode = JZ_FLAGCODE_ON; | 474 | int filter_mode = JZ_FLAGCODE_ON; |
@@ -474,22 +478,22 @@ int Main_APP_Uart() | @@ -474,22 +478,22 @@ int Main_APP_Uart() | ||
474 | Megaphone_Init(); | 478 | Megaphone_Init(); |
475 | 479 | ||
476 | //云台初始化 | 480 | //云台初始化 |
477 | - Gimbal_Init(); | 481 | + Gimbal_Init(JZ_MODULE_CONTROL_WAY_INDEPENDENT); |
478 | } | 482 | } |
479 | 483 | ||
480 | if (DEVICE_VERSION == JZ_U3) | 484 | if (DEVICE_VERSION == JZ_U3) |
481 | { | 485 | { |
482 | //串口设备1初始化 | 486 | //串口设备1初始化 |
483 | - JZsdk_Uart_Init(UART_DEV_1); | 487 | + JZsdk_HalPort_Init_WithDefault(UART_DEV_1); |
484 | 488 | ||
485 | //串口设备2初始化 | 489 | //串口设备2初始化 |
486 | - JZsdk_Uart_Init(UART_DEV_2); | 490 | + JZsdk_HalPort_Init_WithDefault(UART_DEV_2); |
487 | 491 | ||
488 | //喊话器初始化 | 492 | //喊话器初始化 |
489 | Megaphone_Init(); | 493 | Megaphone_Init(); |
490 | 494 | ||
491 | //云台初始化 | 495 | //云台初始化 |
492 | - Gimbal_Init(); | 496 | + Gimbal_Init(JZ_MODULE_CONTROL_WAY_INDEPENDENT); |
493 | 497 | ||
494 | //灯类初始化 | 498 | //灯类初始化 |
495 | Lighting_Init(); | 499 | Lighting_Init(); |
@@ -497,7 +501,7 @@ int Main_APP_Uart() | @@ -497,7 +501,7 @@ int Main_APP_Uart() | ||
497 | delayMs(1000); | 501 | delayMs(1000); |
498 | 502 | ||
499 | //消息订阅初始化 | 503 | //消息订阅初始化 |
500 | - JZsdk_Uart_Send_MessageSubcription_Control(UART_DEV_2, JZ_FLAGCODE_ON); | 504 | + HalSend_type1Send_MessageSubcription_Control(UART_DEV_2, JZ_FLAGCODE_ON); |
501 | 505 | ||
502 | // //测试需要开启亮度 | 506 | // //测试需要开启亮度 |
503 | // JZsdk_Uart_SearchLight_Control(UART_DEV_1, 1); | 507 | // JZsdk_Uart_SearchLight_Control(UART_DEV_1, 1); |
@@ -508,16 +512,16 @@ int Main_APP_Uart() | @@ -508,16 +512,16 @@ int Main_APP_Uart() | ||
508 | else if (DEVICE_VERSION == JZ_U3S) | 512 | else if (DEVICE_VERSION == JZ_U3S) |
509 | { | 513 | { |
510 | //串口设备1初始化 | 514 | //串口设备1初始化 |
511 | - JZsdk_Uart_Init(UART_DEV_1); | 515 | + JZsdk_HalPort_Init_WithDefault(UART_DEV_1); |
512 | 516 | ||
513 | //串口设备2初始化 | 517 | //串口设备2初始化 |
514 | - JZsdk_Uart_Init(UART_DEV_2); | 518 | + JZsdk_HalPort_Init_WithDefault(UART_DEV_2); |
515 | 519 | ||
516 | //喊话器初始化 | 520 | //喊话器初始化 |
517 | Megaphone_Init(); | 521 | Megaphone_Init(); |
518 | 522 | ||
519 | //云台初始化 | 523 | //云台初始化 |
520 | - Gimbal_Init(); | 524 | + Gimbal_Init(JZ_MODULE_CONTROL_WAY_INDEPENDENT); |
521 | 525 | ||
522 | //灯类初始化 | 526 | //灯类初始化 |
523 | Lighting_Init(); | 527 | Lighting_Init(); |
@@ -528,22 +532,22 @@ int Main_APP_Uart() | @@ -528,22 +532,22 @@ int Main_APP_Uart() | ||
528 | delayMs(1000); | 532 | delayMs(1000); |
529 | 533 | ||
530 | //消息订阅初始化 | 534 | //消息订阅初始化 |
531 | - JZsdk_Uart_Send_MessageSubcription_Control(UART_DEV_2, JZ_FLAGCODE_ON); | 535 | + HalSend_type1Send_MessageSubcription_Control(UART_DEV_2, JZ_FLAGCODE_ON); |
532 | } | 536 | } |
533 | 537 | ||
534 | else if (DEVICE_VERSION == JZ_U3D) | 538 | else if (DEVICE_VERSION == JZ_U3D) |
535 | { | 539 | { |
536 | //串口设备1初始化 | 540 | //串口设备1初始化 |
537 | - JZsdk_Uart_Init(UART_DEV_1); | 541 | + JZsdk_HalPort_Init_WithDefault(UART_DEV_1); |
538 | 542 | ||
539 | //串口设备2初始化 | 543 | //串口设备2初始化 |
540 | - JZsdk_Uart_Init(UART_DEV_2); | 544 | + JZsdk_HalPort_Init_WithDefault(UART_DEV_2); |
541 | 545 | ||
542 | //喊话器初始化 | 546 | //喊话器初始化 |
543 | Megaphone_Init(); | 547 | Megaphone_Init(); |
544 | 548 | ||
545 | //云台初始化 | 549 | //云台初始化 |
546 | - Gimbal_Init(); | 550 | + Gimbal_Init(JZ_MODULE_CONTROL_WAY_INDEPENDENT); |
547 | 551 | ||
548 | //灯类初始化 | 552 | //灯类初始化 |
549 | Lighting_Init(); | 553 | Lighting_Init(); |
@@ -551,7 +555,7 @@ int Main_APP_Uart() | @@ -551,7 +555,7 @@ int Main_APP_Uart() | ||
551 | delayMs(1000); | 555 | delayMs(1000); |
552 | 556 | ||
553 | //消息订阅初始化 | 557 | //消息订阅初始化 |
554 | - JZsdk_Uart_Send_MessageSubcription_Control(UART_DEV_2, JZ_FLAGCODE_ON); | 558 | + HalSend_type1Send_MessageSubcription_Control(UART_DEV_2, JZ_FLAGCODE_ON); |
555 | 559 | ||
556 | // delayS(3); | 560 | // delayS(3); |
557 | 561 | ||
@@ -566,16 +570,16 @@ int Main_APP_Uart() | @@ -566,16 +570,16 @@ int Main_APP_Uart() | ||
566 | else if (DEVICE_VERSION == JZ_U30) | 570 | else if (DEVICE_VERSION == JZ_U30) |
567 | { | 571 | { |
568 | //串口设备1初始化 | 572 | //串口设备1初始化 |
569 | - JZsdk_Uart_Init(UART_DEV_1); | 573 | + JZsdk_HalPort_Init_WithDefault(UART_DEV_1); |
570 | 574 | ||
571 | //串口设备2初始化 | 575 | //串口设备2初始化 |
572 | - JZsdk_Uart_Init(UART_DEV_2); | 576 | + JZsdk_HalPort_Init_WithDefault(UART_DEV_2); |
573 | 577 | ||
574 | //喊话器初始化 | 578 | //喊话器初始化 |
575 | Megaphone_Init(); | 579 | Megaphone_Init(); |
576 | 580 | ||
577 | //云台初始化 | 581 | //云台初始化 |
578 | - Gimbal_Init(); | 582 | + Gimbal_Init(JZ_MODULE_CONTROL_WAY_INDEPENDENT); |
579 | 583 | ||
580 | //灯类初始化 | 584 | //灯类初始化 |
581 | Lighting_Init(); | 585 | Lighting_Init(); |
@@ -583,25 +587,25 @@ int Main_APP_Uart() | @@ -583,25 +587,25 @@ int Main_APP_Uart() | ||
583 | delayMs(1000); | 587 | delayMs(1000); |
584 | 588 | ||
585 | //消息订阅初始化 | 589 | //消息订阅初始化 |
586 | - JZsdk_Uart_Send_MessageSubcription_Control(UART_DEV_2, JZ_FLAGCODE_ON); | 590 | + HalSend_type1Send_MessageSubcription_Control(UART_DEV_2, JZ_FLAGCODE_ON); |
587 | } | 591 | } |
588 | 592 | ||
589 | if (DEVICE_VERSION == TF_A1) | 593 | if (DEVICE_VERSION == TF_A1) |
590 | { | 594 | { |
591 | //串口设备1初始化 | 595 | //串口设备1初始化 |
592 | - JZsdk_Uart_Init(UART_DEV_1); | 596 | + JZsdk_HalPort_Init_WithDefault(UART_DEV_1); |
593 | 597 | ||
594 | //串口设备2初始化 | 598 | //串口设备2初始化 |
595 | - JZsdk_Uart_Init(UART_DEV_2); | 599 | + JZsdk_HalPort_Init_WithDefault(UART_DEV_2); |
596 | 600 | ||
597 | //喊话器初始化 | 601 | //喊话器初始化 |
598 | Megaphone_Init(); | 602 | Megaphone_Init(); |
599 | 603 | ||
600 | //云台初始化 | 604 | //云台初始化 |
601 | - Gimbal_Init(); | 605 | + Gimbal_Init(JZ_MODULE_CONTROL_WAY_INDEPENDENT); |
602 | 606 | ||
603 | //消息订阅初始化 | 607 | //消息订阅初始化 |
604 | - JZsdk_Uart_Send_MessageSubcription_Control(UART_DEV_2, JZ_FLAGCODE_ON); | 608 | + HalSend_type1Send_MessageSubcription_Control(UART_DEV_2, JZ_FLAGCODE_ON); |
605 | } | 609 | } |
606 | 610 | ||
607 | } | 611 | } |
@@ -609,7 +613,7 @@ int Main_APP_Uart() | @@ -609,7 +613,7 @@ int Main_APP_Uart() | ||
609 | int Main_TestAPP() | 613 | int Main_TestAPP() |
610 | { | 614 | { |
611 | //串口设备1初始化 | 615 | //串口设备1初始化 |
612 | - JZsdk_Uart_Init(UART_DEV_1); | 616 | + JZsdk_HalPort_Init_WithDefault(UART_DEV_1); |
613 | } | 617 | } |
614 | 618 | ||
615 | //JZ_FLAGCODE_GET为返回工作值,其他值为设置 | 619 | //JZ_FLAGCODE_GET为返回工作值,其他值为设置 |
@@ -728,12 +732,13 @@ static void *Main_WorkModeTask(void *arg) | @@ -728,12 +732,13 @@ static void *Main_WorkModeTask(void *arg) | ||
728 | delayMs(1000);//延迟一秒钟 | 732 | delayMs(1000);//延迟一秒钟 |
729 | printf("计数%d\n",i); | 733 | printf("计数%d\n",i); |
730 | 734 | ||
735 | +#ifdef MEGAPHONE_CONFIG_STATUS_ON | ||
731 | if (start_voice_flag == JZ_FLAGCODE_OFF && MegaphoneStatusFlag == JZ_FLAGCODE_ON) | 736 | if (start_voice_flag == JZ_FLAGCODE_OFF && MegaphoneStatusFlag == JZ_FLAGCODE_ON) |
732 | { | 737 | { |
733 | start_voice_flag = JZ_FLAGCODE_ON; | 738 | start_voice_flag = JZ_FLAGCODE_ON; |
734 | Start_voice(); | 739 | Start_voice(); |
735 | } | 740 | } |
736 | - | 741 | +#endif |
737 | if (WorkMode == JZ_FLAGCODE_ON) | 742 | if (WorkMode == JZ_FLAGCODE_ON) |
738 | { | 743 | { |
739 | printf("串口连接成功,进入串口模式\n"); | 744 | printf("串口连接成功,进入串口模式\n"); |
@@ -752,7 +757,7 @@ static void *Main_WorkModeTask(void *arg) | @@ -752,7 +757,7 @@ static void *Main_WorkModeTask(void *arg) | ||
752 | JZSDK_LOG_INFO("选择开始psdk播报"); | 757 | JZSDK_LOG_INFO("选择开始psdk播报"); |
753 | #endif | 758 | #endif |
754 | 759 | ||
755 | -#if MEGAPHONE_CONFIG_STATUS == VERSION_SWITCH_ON | 760 | +#ifdef MEGAPHONE_CONFIG_STATUS_ON |
756 | while (1) | 761 | while (1) |
757 | { | 762 | { |
758 | if (start_voice_flag == JZ_FLAGCODE_OFF && MegaphoneStatusFlag == JZ_FLAGCODE_ON) | 763 | if (start_voice_flag == JZ_FLAGCODE_OFF && MegaphoneStatusFlag == JZ_FLAGCODE_ON) |
@@ -14,6 +14,7 @@ | @@ -14,6 +14,7 @@ | ||
14 | #include "version_choose.h" | 14 | #include "version_choose.h" |
15 | #include "JZsdkLib.h" | 15 | #include "JZsdkLib.h" |
16 | #include "./ParamterParsing.h" | 16 | #include "./ParamterParsing.h" |
17 | +#include "JZsdk_Base/JZsdk_Code/JZsdk_DeviceCode.h" | ||
17 | 18 | ||
18 | #ifdef __cplusplus | 19 | #ifdef __cplusplus |
19 | extern "C" { | 20 | extern "C" { |
@@ -21,25 +22,6 @@ extern "C" { | @@ -21,25 +22,6 @@ extern "C" { | ||
21 | 22 | ||
22 | /* Exported constants --------------------------------------------------------*/ | 23 | /* Exported constants --------------------------------------------------------*/ |
23 | /* 常亮定义*/ | 24 | /* 常亮定义*/ |
24 | -#define DEVICE_PSDK 0x1000 //psdk功能 | ||
25 | -#define UART_4G 0x1001 //4G功能 | ||
26 | -#define UART_DEV_1 0x1002 //1号设备功能 | ||
27 | -#define UART_DEV_2 0x1003 //2号设备功能 | ||
28 | -#define UART_DEV_3 0x1004 //3号设备功能 | ||
29 | -#define UART_DEV_4 0x1005 //4号设备功能 | ||
30 | -#define UART_DEV_5 0x1006 //5号设备功能 | ||
31 | - | ||
32 | -#define UART_USB_1 0x1100 //usb设备 | ||
33 | -#define UART_USB_2 0x1101 //usb设备 | ||
34 | -#define UART_USB_3 0x1102 //usb设备 | ||
35 | -#define UART_USB_4 0x1103 //usb设备 | ||
36 | -#define UART_USB_5 0x1104 //usb设备 | ||
37 | - | ||
38 | -#define HAL_DATA_TRANSMISSION 0x1200 //hal定制的特殊数据传播 | ||
39 | - | ||
40 | - | ||
41 | -#define COMBINE_DEVICE 0x1998 //组合设备 | ||
42 | -#define NO_SPECIFIED 0x1999 //无制定设备 | ||
43 | 25 | ||
44 | //展架通讯串口 | 26 | //展架通讯串口 |
45 | #if DEVICE_VERSION == JZ_H150S || DEVICE_VERSION == JZ_H150T | 27 | #if DEVICE_VERSION == JZ_H150S || DEVICE_VERSION == JZ_H150T |
@@ -5,21 +5,21 @@ | @@ -5,21 +5,21 @@ | ||
5 | ***********************************************/ | 5 | ***********************************************/ |
6 | #ifndef VERSION_CHOOSE_H | 6 | #ifndef VERSION_CHOOSE_H |
7 | #define VERSION_CHOOSE_H | 7 | #define VERSION_CHOOSE_H |
8 | -#include "./ConfigParams.h" | 8 | +#include "JZsdk_Base/JZsdk_Code/JZsdk_DeviceCode.h" |
9 | //1~10行 除了D可以修改版本选择 禁止动任何东西 | 9 | //1~10行 除了D可以修改版本选择 禁止动任何东西 |
10 | -#define DEVICE_VERSION JZ_H10T | 10 | +#define DEVICE_VERSION JZ_H10 |
11 | 11 | ||
12 | //禁止修改行 选择是串口程序 还是 psdk程序 | 12 | //禁止修改行 选择是串口程序 还是 psdk程序 |
13 | -#define APP_VERSION APP_PSDK | 13 | +#define APP_VERSION APP_UART |
14 | 14 | ||
15 | //禁止修改行 板子型号 | 15 | //禁止修改行 板子型号 |
16 | #define PLATFORM_VERSION PLATFORM_V3S | 16 | #define PLATFORM_VERSION PLATFORM_V3S |
17 | 17 | ||
18 | //禁止修改行 串口连接程序的软件版本号 | 18 | //禁止修改行 串口连接程序的软件版本号 |
19 | -#define MAJOR_VERSION 0x01 | ||
20 | -#define MINOR_VERSION 0x03 | ||
21 | -#define MODIFY_VERSION 0x09 | ||
22 | -#define DEBUG_VERSION 0x03 | 19 | +#define MAJOR_VERSION 0x00 |
20 | +#define MINOR_VERSION 0x00 | ||
21 | +#define MODIFY_VERSION 0x02 | ||
22 | +#define DEBUG_VERSION 0x12 | ||
23 | 23 | ||
24 | //禁止修改行 滤波方式 | 24 | //禁止修改行 滤波方式 |
25 | #define FILTERING_TYPE HIGH_PASS_FILTERING | 25 | #define FILTERING_TYPE HIGH_PASS_FILTERING |
@@ -40,37 +40,27 @@ | @@ -40,37 +40,27 @@ | ||
40 | #ifdef COMPILE_MODE_MODULE | 40 | #ifdef COMPILE_MODE_MODULE |
41 | //是否开启喊话器功能 | 41 | //是否开启喊话器功能 |
42 | #ifdef MACRO_MEGAPHONE_MODULE | 42 | #ifdef MACRO_MEGAPHONE_MODULE |
43 | - #define MEGAPHONE_CONFIG_STATUS VERSION_SWITCH_ON | ||
44 | - #else | ||
45 | - #define MEGAPHONE_CONFIG_STATUS VERSION_SWITCH_OFF | 43 | + #define MEGAPHONE_CONFIG_STATUS_ON |
46 | #endif | 44 | #endif |
47 | 45 | ||
48 | //是否开启媒体功能 | 46 | //是否开启媒体功能 |
49 | #ifdef MACRO_MEDIA_PROC_MODULE | 47 | #ifdef MACRO_MEDIA_PROC_MODULE |
50 | - #define MEDIA_PROC_CONFIG_STATUS VERSION_SWITCH_ON | ||
51 | #define MEDIA_PROC_CONFIG_STATUS_ON | 48 | #define MEDIA_PROC_CONFIG_STATUS_ON |
52 | - #else | ||
53 | - #define MEDIA_PROC_CONFIG_STATUS VERSION_SWITCH_OFF | ||
54 | #endif | 49 | #endif |
55 | 50 | ||
56 | //是否开启红外相机功能 | 51 | //是否开启红外相机功能 |
57 | #ifdef MACRO_IRC_MODULE | 52 | #ifdef MACRO_IRC_MODULE |
58 | - #define IRC_CONFIG_STATUS VERSION_SWITCH_ON | ||
59 | #define IRC_CONFIG_STATUS_ON | 53 | #define IRC_CONFIG_STATUS_ON |
60 | - #else | ||
61 | - #define IRC_CONFIG_STATUS VERSION_SWITCH_OFF | ||
62 | #endif | 54 | #endif |
63 | 55 | ||
64 | //是否加载ktirclib | 56 | //是否加载ktirclib |
65 | - #ifdef DMACRO_KTIRC_MODULE | 57 | + #ifdef MACRO_KTIRC_MODULE |
66 | #define KTIRC_LIB_STATUS_ON | 58 | #define KTIRC_LIB_STATUS_ON |
67 | #endif | 59 | #endif |
68 | 60 | ||
69 | //是否加载usb模块 | 61 | //是否加载usb模块 |
70 | #ifdef MACRO_USB_MODULE | 62 | #ifdef MACRO_USB_MODULE |
71 | - #define USB_CONFIG_STATUS VERSION_SWITCH_ON | ||
72 | - #else | ||
73 | - #define USB_CONFIG_STATUS VERSION_SWITCH_OFF | 63 | + #define USB_CONFIG_STATUS_ON |
74 | #endif | 64 | #endif |
75 | 65 | ||
76 | //是否加载RTK_MPP模块 | 66 | //是否加载RTK_MPP模块 |
@@ -100,17 +90,16 @@ | @@ -100,17 +90,16 @@ | ||
100 | 90 | ||
101 | #else //这里用于方便调试使用,不是实际加载的模组 | 91 | #else //这里用于方便调试使用,不是实际加载的模组 |
102 | //是否开启喊话器功能 | 92 | //是否开启喊话器功能 |
103 | - #define MEGAPHONE_CONFIG_STATUS VERSION_SWITCH_ON | 93 | + #define MEGAPHONE_CONFIG_STATUS_ON |
104 | 94 | ||
105 | //是否开启媒体管理功能 | 95 | //是否开启媒体管理功能 |
106 | - #define MEDIA_PROC_CONFIG_STATUS VERSION_SWITCH_ON | ||
107 | #define MEDIA_PROC_CONFIG_STATUS_ON | 96 | #define MEDIA_PROC_CONFIG_STATUS_ON |
108 | 97 | ||
109 | //是否开启红外相机功能 | 98 | //是否开启红外相机功能 |
110 | - #define IRC_CONFIG_STATUS VERSION_SWITCH_ON | 99 | + #define IRC_CONFIG_STATUS_ON |
111 | 100 | ||
112 | //是否加载usb模块 | 101 | //是否加载usb模块 |
113 | - #define USB_CONFIG_STATUS VERSION_SWITCH_ON | 102 | + #define USB_CONFIG_STATUS_ON |
114 | 103 | ||
115 | //是否加载RTK_MPP模块 | 104 | //是否加载RTK_MPP模块 |
116 | #define RTK_MPP_STATUS_ON | 105 | #define RTK_MPP_STATUS_ON |
1 | /** | 1 | /** |
2 | ******************************************************************** | 2 | ******************************************************************** |
3 | - * @file Uart_Config.h | ||
4 | - * Uart_Config的头文件 | ||
5 | - * 用于管理串口的基本信息 | 3 | + * @file HalRecv.h |
4 | + * HalRecv.c的头文件 | ||
5 | + * | ||
6 | ********************************************************************* | 6 | ********************************************************************* |
7 | */ | 7 | */ |
8 | 8 | ||
9 | /* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/ | 9 | /* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/ |
10 | -#ifndef UART_CONFIG_H | ||
11 | -#define UART_CONFIG_H | 10 | +#ifndef HALRECV_H |
11 | +#define HALRECV_H | ||
12 | 12 | ||
13 | /* Includes ------------------------------------------------------------------*/ | 13 | /* Includes ------------------------------------------------------------------*/ |
14 | -#include "BaseConfig.h" | ||
15 | 14 | ||
16 | #ifdef __cplusplus | 15 | #ifdef __cplusplus |
17 | extern "C" { | 16 | extern "C" { |
@@ -19,11 +18,15 @@ extern "C" { | @@ -19,11 +18,15 @@ extern "C" { | ||
19 | 18 | ||
20 | /* Exported constants --------------------------------------------------------*/ | 19 | /* Exported constants --------------------------------------------------------*/ |
21 | /* 常亮定义*/ | 20 | /* 常亮定义*/ |
21 | +#include "JZsdk_Base/JZsdk_Code/JZsdk_Code.h" | ||
22 | +#include "Hal_Recv/HalRecv_type1/HalRecv_type1.h" | ||
22 | 23 | ||
23 | /* Exported types ------------------------------------------------------------*/ | 24 | /* Exported types ------------------------------------------------------------*/ |
24 | 25 | ||
25 | /* Exported functions --------------------------------------------------------*/ | 26 | /* Exported functions --------------------------------------------------------*/ |
26 | 27 | ||
28 | + | ||
29 | + | ||
27 | #ifdef __cplusplus | 30 | #ifdef __cplusplus |
28 | } | 31 | } |
29 | #endif | 32 | #endif |
1 | +/********************************* | ||
2 | + * | ||
3 | + * 极至接收数据处理 | ||
4 | + * 数据类型1 | ||
5 | + * 用于串口协议,大疆多通道接收协议 | ||
6 | + * | ||
7 | + * ****************************************/ | ||
8 | + | ||
9 | +#include <stdio.h> | ||
10 | +#include "JZsdkLib.h" | ||
11 | +#include "BaseConfig.h" | ||
12 | +#include "Hal_Recv/HalRecv_type1/HalRecv_type1.h" | ||
13 | +#include "Hal_Recv/HalRecv_type1/HalRecv_type1_RecvDeal.h" | ||
14 | + | ||
15 | +/*************** | ||
16 | + * | ||
17 | + * | ||
18 | + * 极至串口协议的数据初步筛选 | ||
19 | + * 用于清空无效数据 | ||
20 | + * 以及将有效数据提取出来,放置到后续处理函数中 | ||
21 | + * 输入要 处理的原始数据data 以及 数据长度DataLen 还有输入的接口 | ||
22 | + * 返回值:未处理的长度数据 | ||
23 | + * | ||
24 | + * 该协议的帧排序为 | ||
25 | + * | ||
26 | + * 帧头三位 0x5A 0x5A 0x77 | 组成了实际的帧头 | ||
27 | + * 帧长度两位 0x00 0x00 | | ||
28 | + * | ||
29 | + * 应答位一位 0x00 | 组成了识别顺序的部分 | ||
30 | + * 帧序列一位 0x00 | | ||
31 | + * | ||
32 | + * 一级功能码一位 0x00 | 组成了数据功能识别的部分 | ||
33 | + * 二级功能码一位 0x00 | | ||
34 | + * | ||
35 | + * 数据位 不定 | 用于描述该帧的实际内容 | ||
36 | + * | ||
37 | + * 帧尾两位 0x00 0x23 | 祖册了实际的帧尾 | ||
38 | + * | ||
39 | + * ********************/ | ||
40 | +int HalRecv_type1_PreliminaryScreeningOfData(unsigned char *Data, unsigned int DataLen, int Port) | ||
41 | +{ | ||
42 | + int ResidualLength = 0; // 剩余数据长度 | ||
43 | + | ||
44 | + //串口打印 | ||
45 | + switch (Port) | ||
46 | + { | ||
47 | + case UART_DEV_1: | ||
48 | + //JZSDK_LOG_INFO("串口-设备1号,接受到数据+未处理数据的长度len: %d", DataLen); | ||
49 | + break; | ||
50 | + | ||
51 | + case UART_DEV_2: | ||
52 | + //JZSDK_LOG_INFO("串口-设备2号,接受到数据+未处理数据的长度len: %d", DataLen); | ||
53 | + break; | ||
54 | + | ||
55 | + case UART_4G: | ||
56 | + //JZSDK_LOG_INFO("串口-4G模块,接受到数据+未处理数据的长度len: %d", DataLen); | ||
57 | + break; | ||
58 | + | ||
59 | + case HAL_DATA_TRANSMISSION: | ||
60 | + //JZSDK_LOG_INFO("hal-数据传输,接受到数据+未处理数据的长度len: %d", DataLen); | ||
61 | + break; | ||
62 | + | ||
63 | + /********** 未报备的接口 ************/ | ||
64 | + default: | ||
65 | + ResidualLength = 0; | ||
66 | + return ResidualLength; | ||
67 | + break; | ||
68 | + } | ||
69 | + | ||
70 | + //确保有数据传输进来 | ||
71 | + if (DataLen <= 0) | ||
72 | + { | ||
73 | + ResidualLength = 0; | ||
74 | + return ResidualLength; | ||
75 | + } | ||
76 | + | ||
77 | + int HaveReadLen = 0; // 已读长度 | ||
78 | + int HaveDealLen = 0; // 已处理长度 | ||
79 | + int FrameFlag = 0x00; // 帧标志 | ||
80 | + int FrameLen = 0; | ||
81 | + | ||
82 | + //将数据提取出来 | ||
83 | + //为什么是减3呢,因为帧头为3位 | ||
84 | + for (HaveReadLen = 0; HaveReadLen <= (DataLen - 3); ) | ||
85 | + { | ||
86 | + //查找是否存在帧头 | ||
87 | + switch (Data[HaveReadLen]) | ||
88 | + { | ||
89 | + case 0x5A: | ||
90 | + { | ||
91 | + if (Data[HaveReadLen + 1] == 0x5A && Data[HaveReadLen + 2] == 0x77) | ||
92 | + { | ||
93 | + FrameFlag = 0x5A; | ||
94 | + } | ||
95 | + else | ||
96 | + { | ||
97 | + FrameFlag = 0x00; | ||
98 | + } | ||
99 | + break; | ||
100 | + } | ||
101 | + | ||
102 | + case 0x5B: | ||
103 | + { | ||
104 | + if (Data[HaveReadLen + 1] == 0x5B && Data[HaveReadLen + 2] == 0x77) | ||
105 | + { | ||
106 | + FrameFlag = 0x5B; | ||
107 | + } | ||
108 | + else | ||
109 | + { | ||
110 | + FrameFlag = 0x00; | ||
111 | + } | ||
112 | + break; | ||
113 | + } | ||
114 | + | ||
115 | + case 0x6A: | ||
116 | + { | ||
117 | + if (Data[HaveReadLen + 1] == 0x6A && Data[HaveReadLen + 2] == 0x77) | ||
118 | + { | ||
119 | + FrameFlag = 0x6A; | ||
120 | + } | ||
121 | + else | ||
122 | + { | ||
123 | + FrameFlag = 0x00; | ||
124 | + } | ||
125 | + break; | ||
126 | + } | ||
127 | + | ||
128 | + case 0x6B: | ||
129 | + { | ||
130 | + if (Data[HaveReadLen + 1] == 0x6B && Data[HaveReadLen + 2] == 0x77) | ||
131 | + { | ||
132 | + FrameFlag = 0x6B; | ||
133 | + } | ||
134 | + else | ||
135 | + { | ||
136 | + FrameFlag = 0x00; | ||
137 | + } | ||
138 | + } | ||
139 | + | ||
140 | + default: | ||
141 | + FrameFlag = 0x00; | ||
142 | + break; | ||
143 | + } | ||
144 | + | ||
145 | + //没有检测到帧头,向后继续查找 | ||
146 | + if (FrameFlag == 0x00) | ||
147 | + { | ||
148 | + HaveReadLen++; | ||
149 | + continue; | ||
150 | + } | ||
151 | + | ||
152 | + //如果有帧头 | ||
153 | + //判断前面有没有多余的数据残留,并将其移除 | ||
154 | + if (HaveReadLen > HaveDealLen) | ||
155 | + { | ||
156 | + //JZSDK_LOG_INFO("残余处理%d",(HaveReadLen - HaveDealLen)); | ||
157 | + HaveDealLen = HaveReadLen; | ||
158 | + } | ||
159 | + | ||
160 | + //检查此时的剩余长度是否足够容纳帧长度位 | ||
161 | + if ((DataLen - HaveReadLen) < 5) | ||
162 | + { | ||
163 | + //如果已经容纳不下长度位了,则返回内容 | ||
164 | + ResidualLength = (DataLen - HaveReadLen); | ||
165 | + return ResidualLength; | ||
166 | + } | ||
167 | + | ||
168 | + //此时有足够的长度位置,可以计算长度,检查帧长度是否超出数据剩余的内容 | ||
169 | + FrameLen = (((int)Data[HaveReadLen+3]) << 8) + (int)Data[HaveReadLen+4]; | ||
170 | + if (FrameLen > (DataLen - HaveReadLen)) | ||
171 | + { | ||
172 | + //JZSDK_LOG_DEBUG("当前帧长度位长度%d 超出剩余帧长度%d ",FrameLen,(DataLen - HaveReadLen)); | ||
173 | + // 直接跳出for循环 | ||
174 | + break; | ||
175 | + } | ||
176 | + | ||
177 | + //检查帧长度是否为0,避免卡死接收串口 | ||
178 | + if (FrameLen == 0) | ||
179 | + { | ||
180 | + JZSDK_LOG_ERROR("严重错误,接收到的帧出现长度为空"); | ||
181 | + //直接清空接收的数组 | ||
182 | + return 0; | ||
183 | + } | ||
184 | + | ||
185 | + //以上检查都没问题,则正常输出帧 | ||
186 | + //JZSDK_LOG_INFO("正常输出帧%d",FrameLen); | ||
187 | + HalRecv_type1_FrameDeal(Port, &Data[HaveReadLen], FrameLen); | ||
188 | + | ||
189 | + HaveReadLen = HaveReadLen + FrameLen; | ||
190 | + HaveDealLen = HaveReadLen; | ||
191 | + | ||
192 | + //JZSDK_LOG_INFO("Prot:%x f_len%d h_r%d [h_r]:%x get%d",Port,FrameLen ,HaveReadLen, Data[HaveReadLen-1], DataLen); | ||
193 | + | ||
194 | + FrameLen = 0; | ||
195 | + FrameFlag = 0; | ||
196 | + } | ||
197 | + | ||
198 | + // 如果没有数据残留了,可以直接退出了 | ||
199 | + if (HaveDealLen >= DataLen) | ||
200 | + { | ||
201 | + //printf("HaveReadLen:%d HaveDealLen%d DataLen:%d\n",HaveReadLen,HaveDealLen,DataLen); | ||
202 | + ResidualLength = 0; | ||
203 | + return ResidualLength; | ||
204 | + } | ||
205 | + | ||
206 | + // 到达这里时 | ||
207 | + // 完整的帧 已处理 | ||
208 | + // 有帧头且长度为4的帧则已返回 | ||
209 | + // 没有剩余数据则已返回 | ||
210 | + | ||
211 | + // 剩下的是 | ||
212 | + // 1、剩余长度为所有0~3的帧 | ||
213 | + // 2、切帧的帧(即带帧头 长度大于4 小于帧长度的帧) | ||
214 | + // 3、以及无实际意义数据 | ||
215 | + | ||
216 | + // 如果有帧头与长度位判定, 说明是切帧的帧,判断长度是否合理,如果合理返回帧长度给接收线程 | ||
217 | + if (FrameFlag != 0) //bu | ||
218 | + { | ||
219 | + // 1、判断帧的长度会不会不合理,帧的长度最大为文件名帧,其长度为9+2+1024 | ||
220 | + if (FrameLen > (9 + 2 + 1024)) | ||
221 | + { | ||
222 | + JZSDK_LOG_ERROR("串口严重错误,接收到的帧长度位长度%d 超出最大长度%d ",FrameLen,(9 + 2 + 1024)); | ||
223 | + // 将其移除数据 | ||
224 | + HaveDealLen = HaveReadLen; | ||
225 | + ResidualLength = 0; | ||
226 | + return ResidualLength; | ||
227 | + } | ||
228 | + | ||
229 | + //printf("切帧返回%d\n",(DataLen - HaveDealLen)); | ||
230 | + | ||
231 | + // 2、如果合理,则返回剩余长度 | ||
232 | + ResidualLength = (DataLen - HaveDealLen); | ||
233 | + return ResidualLength; | ||
234 | + } | ||
235 | + | ||
236 | + //接下来判断1类型 | ||
237 | + | ||
238 | + //检查最后3位 | ||
239 | + for (; HaveReadLen < DataLen - 2; HaveReadLen++) | ||
240 | + { | ||
241 | + if ((Data[HaveReadLen] == 0x5A && Data[HaveReadLen + 1] == 0x5A && Data[HaveReadLen + 2] == 0x77) || | ||
242 | + (Data[HaveReadLen] == 0x5B && Data[HaveReadLen + 1] == 0x5B && Data[HaveReadLen + 2] == 0x77) || | ||
243 | + (Data[HaveReadLen] == 0x6A && Data[HaveReadLen + 1] == 0x6A && Data[HaveReadLen + 2] == 0x77) || | ||
244 | + (Data[HaveReadLen] == 0x6B && Data[HaveReadLen + 1] == 0x6B && Data[HaveReadLen + 2] == 0x77)) | ||
245 | + { | ||
246 | + //如果最后三位前还有数据,将其清空 | ||
247 | + if ((HaveReadLen - HaveDealLen) > 0) | ||
248 | + { | ||
249 | + HaveDealLen = HaveReadLen; | ||
250 | + } | ||
251 | + | ||
252 | + printf("检查最后3 4位%d\n",(DataLen - HaveDealLen)); | ||
253 | + | ||
254 | + ResidualLength = (DataLen - HaveDealLen); | ||
255 | + return ResidualLength; | ||
256 | + } | ||
257 | + } | ||
258 | + | ||
259 | + //检查最后两位 | ||
260 | + for (; HaveReadLen < DataLen - 1; HaveReadLen++) | ||
261 | + { | ||
262 | + if ((Data[HaveReadLen] == 0x5A && Data[HaveReadLen + 1] == 0x5A) || | ||
263 | + (Data[HaveReadLen] == 0x5B && Data[HaveReadLen + 1] == 0x5B) || | ||
264 | + (Data[HaveReadLen] == 0x6A && Data[HaveReadLen + 1] == 0x6A) || | ||
265 | + (Data[HaveReadLen] == 0x6B && Data[HaveReadLen + 1] == 0x6B)) | ||
266 | + { | ||
267 | + if ((HaveReadLen - HaveDealLen) > 0) | ||
268 | + { | ||
269 | + HaveDealLen = HaveReadLen; | ||
270 | + } | ||
271 | + | ||
272 | + printf("检查最后两位%d\n",(DataLen - HaveDealLen)); | ||
273 | + | ||
274 | + ResidualLength = (DataLen - HaveDealLen); | ||
275 | + return ResidualLength; | ||
276 | + } | ||
277 | + } | ||
278 | + | ||
279 | + //检查最后一位 | ||
280 | + for (; HaveReadLen < DataLen - 0; HaveReadLen++) | ||
281 | + { | ||
282 | + if (Data[HaveReadLen] == 0x5A || | ||
283 | + Data[HaveReadLen] == 0x5B || | ||
284 | + Data[HaveReadLen] == 0x6A || | ||
285 | + Data[HaveReadLen] == 0x6B) | ||
286 | + { | ||
287 | + if ((HaveReadLen - HaveDealLen) > 0) | ||
288 | + { | ||
289 | + HaveDealLen = HaveReadLen; | ||
290 | + } | ||
291 | + | ||
292 | + printf("检查最后一位%d\n",(DataLen - HaveDealLen)); | ||
293 | + | ||
294 | + ResidualLength = (DataLen - HaveDealLen); | ||
295 | + return ResidualLength; | ||
296 | + } | ||
297 | + } | ||
298 | + | ||
299 | + //都检查完了,还是没有帧头在里面,清空所有数据 | ||
300 | + ResidualLength = 0; | ||
301 | + return ResidualLength; | ||
302 | +} |
1 | +/** | ||
2 | + ******************************************************************** | ||
3 | + * @file HalRecv_tpye1.h | ||
4 | + * HalRecv_tpye1.h的头文件 | ||
5 | + * | ||
6 | + ********************************************************************* | ||
7 | + */ | ||
8 | + | ||
9 | +/* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/ | ||
10 | +#ifndef HALRECV_TPYE1_H | ||
11 | +#define HALRECV_TPYE1_H | ||
12 | + | ||
13 | +/* Includes ------------------------------------------------------------------*/ | ||
14 | + | ||
15 | +#ifdef __cplusplus | ||
16 | +extern "C" { | ||
17 | +#endif | ||
18 | + | ||
19 | +/* Exported constants --------------------------------------------------------*/ | ||
20 | +/* 常亮定义*/ | ||
21 | + | ||
22 | +/* Exported types ------------------------------------------------------------*/ | ||
23 | + | ||
24 | +/* Exported functions --------------------------------------------------------*/ | ||
25 | + | ||
26 | +int HalRecv_type1_PreliminaryScreeningOfData(unsigned char *Data, unsigned int DataLen, int Port); | ||
27 | + | ||
28 | + | ||
29 | +#ifdef __cplusplus | ||
30 | +} | ||
31 | +#endif | ||
32 | + | ||
33 | +#endif |
此 diff 太大无法显示。
1 | +/** | ||
2 | + ******************************************************************** | ||
3 | + * @file HalRecv_type1_RecvDeal.h | ||
4 | + * HalRecv_type1_RecvDeal | ||
5 | + * | ||
6 | + ********************************************************************* | ||
7 | + */ | ||
8 | + | ||
9 | +/* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/ | ||
10 | +#ifndef HALRECV_TYPE1_RECVDEAL_H | ||
11 | +#define HALRECV_TYPE1_RECVDEAL_H | ||
12 | + | ||
13 | +/* Includes ------------------------------------------------------------------*/ | ||
14 | + | ||
15 | +#ifdef __cplusplus | ||
16 | +extern "C" { | ||
17 | +#endif | ||
18 | + | ||
19 | +/* Exported constants --------------------------------------------------------*/ | ||
20 | +/* 常亮定义*/ | ||
21 | +#include "JZsdk_Base/JZsdk_Code/JZsdk_Code.h" | ||
22 | + | ||
23 | +/* Exported types ------------------------------------------------------------*/ | ||
24 | + | ||
25 | +/* Exported functions --------------------------------------------------------*/ | ||
26 | +T_JZsdkReturnCode HalRecv_type1_FrameDeal(int Port, unsigned char *getbuf, int len); | ||
27 | + | ||
28 | +#ifdef __cplusplus | ||
29 | +} | ||
30 | +#endif | ||
31 | + | ||
32 | +#endif |
JZsdk_hal/Hal_Send/HalSend.c
0 → 100644
1 | +#include <stdio.h> | ||
2 | +#include "JZsdkLib.h" | ||
3 | + | ||
4 | +#include "JZsdk_uart/JZsdk_Uart_UartDeal.h" | ||
5 | + | ||
6 | + | ||
7 | +#define SINGLE_THREAD_SEND 0 | ||
8 | +#define MULTI_THREAD_SEND 1 | ||
9 | + | ||
10 | +/***************************** | ||
11 | + * | ||
12 | + * hal层发送接口 | ||
13 | + * | ||
14 | + * Port:发送的端口名 | ||
15 | + * Data:发送的数据 | ||
16 | + * DataLen:发送的数据长度 | ||
17 | + * SendType:发送类型 | ||
18 | + * 0:单线程发送 | ||
19 | + * 1:多线程发送 | ||
20 | + * | ||
21 | + * 成功返回 jz sdk 成功码 | ||
22 | + * *************************/ | ||
23 | +T_JZsdkReturnCode HalSend_SendData(unsigned int Port, unsigned char *Data, unsigned int DataLen, unsigned int SendType) | ||
24 | +{ | ||
25 | + T_JZsdkReturnCode ret = JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
26 | + | ||
27 | + //判断端口 | ||
28 | + switch (Port) | ||
29 | + { | ||
30 | + case UART_4G: | ||
31 | + case UART_DEV_1: | ||
32 | + case UART_DEV_2: | ||
33 | + case UART_DEV_3: | ||
34 | + case UART_DEV_4: | ||
35 | + case UART_DEV_5: | ||
36 | + if (SendType == SINGLE_THREAD_SEND) | ||
37 | + { | ||
38 | + JZsdk_Uart_UartSend(Port, Data, DataLen); | ||
39 | + } | ||
40 | + else if (SendType == MULTI_THREAD_SEND) | ||
41 | + { | ||
42 | + JZsdk_Uart_UartSend_NotTask(Port, Data, DataLen); | ||
43 | + } | ||
44 | + break; | ||
45 | + | ||
46 | + case HAL_DATA_TRANSMISSION: | ||
47 | + JZSDK_LOG_DEBUG("暂无该通道"); | ||
48 | + break; | ||
49 | + | ||
50 | + default: | ||
51 | + break; | ||
52 | + } | ||
53 | + | ||
54 | + | ||
55 | + return ret; | ||
56 | +} |
JZsdk_hal/Hal_Send/HalSend.h
0 → 100644
1 | +/** | ||
2 | + ******************************************************************** | ||
3 | + * @file HalRecv.h | ||
4 | + * HalRecv.c的头文件 | ||
5 | + * | ||
6 | + ********************************************************************* | ||
7 | + */ | ||
8 | + | ||
9 | +/* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/ | ||
10 | +#ifndef HALRECV_H | ||
11 | +#define HALRECV_H | ||
12 | + | ||
13 | +/* Includes ------------------------------------------------------------------*/ | ||
14 | +#include "JZsdk_Base/JZsdk_Code/JZsdk_Code.h" | ||
15 | +#include "Hal_Send/HalSend_type1/HalSend_type1.h" | ||
16 | + | ||
17 | +#ifdef __cplusplus | ||
18 | +extern "C" { | ||
19 | +#endif | ||
20 | + | ||
21 | +/* Exported constants --------------------------------------------------------*/ | ||
22 | +/* 常亮定义*/ | ||
23 | + | ||
24 | + | ||
25 | +/* Exported types ------------------------------------------------------------*/ | ||
26 | + | ||
27 | +/* Exported functions --------------------------------------------------------*/ | ||
28 | +T_JZsdkReturnCode HalSend_SendData(unsigned int Port, unsigned char *Data, unsigned int DataLen, unsigned int SendType); | ||
29 | + | ||
30 | + | ||
31 | + | ||
32 | +#ifdef __cplusplus | ||
33 | +} | ||
34 | +#endif | ||
35 | + | ||
36 | +#endif |
@@ -2,16 +2,16 @@ | @@ -2,16 +2,16 @@ | ||
2 | #include <string.h> | 2 | #include <string.h> |
3 | #include <stdlib.h> | 3 | #include <stdlib.h> |
4 | 4 | ||
5 | -#include "../JZsdk_Uart_UartDeal.h" | ||
6 | -#include "../Uart_Config.h" | ||
7 | -#include "./JZsdk_Uart_Send.h" | ||
8 | -#include "JZsdk_TaskManagement/TaskManagement.h" | ||
9 | -#include "JZsdk_Base/JZsdk_Code/JZsdk_Code.h" | ||
10 | #include "JZsdk_Base/JZsdk_FrameComparsion/JZsdk_FrameComparsion.h" | 5 | #include "JZsdk_Base/JZsdk_FrameComparsion/JZsdk_FrameComparsion.h" |
6 | +#include "JZsdkLib.h" | ||
7 | + | ||
8 | +#include "JZsdk_TaskManagement/TaskManagement.h" | ||
11 | 9 | ||
12 | 10 | ||
11 | +#include "Hal_Send/HalSend.h" | ||
12 | + | ||
13 | //发送主动连接帧 | 13 | //发送主动连接帧 |
14 | -int JZsdk_Uart_SendDeal_ConnectFrame(int PortNum) | 14 | +T_JZsdkReturnCode HalSend_type1Send_ConnectFrame(int PortNum) |
15 | { | 15 | { |
16 | unsigned char sendbuf[256]; | 16 | unsigned char sendbuf[256]; |
17 | int send_buf_len; | 17 | int send_buf_len; |
@@ -20,11 +20,13 @@ int JZsdk_Uart_SendDeal_ConnectFrame(int PortNum) | @@ -20,11 +20,13 @@ int JZsdk_Uart_SendDeal_ConnectFrame(int PortNum) | ||
20 | JZsdk_GetFrameTemplate(JZ_INSCODE_5AFRAME_ASKFORCONNECT , sendbuf, &send_buf_len); | 20 | JZsdk_GetFrameTemplate(JZ_INSCODE_5AFRAME_ASKFORCONNECT , sendbuf, &send_buf_len); |
21 | 21 | ||
22 | //2、发送帧 | 22 | //2、发送帧 |
23 | - JZsdk_Uart_UartSend(PortNum ,sendbuf, send_buf_len); | 23 | + HalSend_SendData(PortNum ,sendbuf, send_buf_len, 1); |
24 | + | ||
25 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
24 | } | 26 | } |
25 | 27 | ||
26 | //回复连接帧 | 28 | //回复连接帧 |
27 | -int JZsdk_Uart_SendDeal_Send_Connect(int Uartport , int FrameSequence,int Version_flag) | 29 | +T_JZsdkReturnCode HalSend_type1Send_Send_Connect(int Uartport , int FrameSequence,int Version_flag) |
28 | { | 30 | { |
29 | unsigned char sendbuf[256]; | 31 | unsigned char sendbuf[256]; |
30 | int send_buf_len; | 32 | int send_buf_len; |
@@ -39,11 +41,13 @@ int JZsdk_Uart_SendDeal_Send_Connect(int Uartport , int FrameSequence,int Versio | @@ -39,11 +41,13 @@ int JZsdk_Uart_SendDeal_Send_Connect(int Uartport , int FrameSequence,int Versio | ||
39 | sendbuf[6] = FrameSequence; //帧序列 | 41 | sendbuf[6] = FrameSequence; //帧序列 |
40 | 42 | ||
41 | //3、发送帧 | 43 | //3、发送帧 |
42 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 44 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
45 | + | ||
46 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
43 | } | 47 | } |
44 | 48 | ||
45 | //回复心跳帧 | 49 | //回复心跳帧 |
46 | -int JZsdk_Uart_SendDeal_Send_HeartBeatStatus(int Uartport , int FrameSequence,int HeartBeatStatus) | 50 | +T_JZsdkReturnCode HalSend_type1Send_Send_HeartBeatStatus(int Uartport , int FrameSequence,int HeartBeatStatus) |
47 | { | 51 | { |
48 | unsigned char sendbuf[256]; | 52 | unsigned char sendbuf[256]; |
49 | int send_buf_len; | 53 | int send_buf_len; |
@@ -58,11 +62,13 @@ int JZsdk_Uart_SendDeal_Send_HeartBeatStatus(int Uartport , int FrameSequence,in | @@ -58,11 +62,13 @@ int JZsdk_Uart_SendDeal_Send_HeartBeatStatus(int Uartport , int FrameSequence,in | ||
58 | sendbuf[6] = FrameSequence; //帧序列 | 62 | sendbuf[6] = FrameSequence; //帧序列 |
59 | 63 | ||
60 | //3、发送帧 | 64 | //3、发送帧 |
61 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 65 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
66 | + | ||
67 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
62 | } | 68 | } |
63 | 69 | ||
64 | //设置电源状态 | 70 | //设置电源状态 |
65 | -T_JZsdkReturnCode JZsdk_Uart_SendDeal_PowerStatus(int Uartport, int FrameSequence, int status) | 71 | +T_JZsdkReturnCode HalSend_type1Send_Set_PowerStatus(int Uartport, int FrameSequence, int status) |
66 | { | 72 | { |
67 | printf("发送电源状态\n"); | 73 | printf("发送电源状态\n"); |
68 | 74 | ||
@@ -76,11 +82,13 @@ T_JZsdkReturnCode JZsdk_Uart_SendDeal_PowerStatus(int Uartport, int FrameSequenc | @@ -76,11 +82,13 @@ T_JZsdkReturnCode JZsdk_Uart_SendDeal_PowerStatus(int Uartport, int FrameSequenc | ||
76 | sendbuf[6] = FrameSequence; //帧序列 | 82 | sendbuf[6] = FrameSequence; //帧序列 |
77 | 83 | ||
78 | //2、发送帧 | 84 | //2、发送帧 |
79 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 85 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
86 | + | ||
87 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
80 | } | 88 | } |
81 | 89 | ||
82 | -//发送心跳帧 | ||
83 | -T_JZsdkReturnCode JZsdk_Uart_SendDeal_Ask_HeartBeatStatus(int Uartport , int FrameSequence,int HeartBeatStatus) | 90 | +//请求心跳帧 |
91 | +T_JZsdkReturnCode HalSend_type1Send_Ask_HeartBeatStatus(int Uartport , int FrameSequence,int HeartBeatStatus) | ||
84 | { | 92 | { |
85 | printf("发送请求心跳帧\n"); | 93 | printf("发送请求心跳帧\n"); |
86 | 94 | ||
@@ -94,11 +102,13 @@ T_JZsdkReturnCode JZsdk_Uart_SendDeal_Ask_HeartBeatStatus(int Uartport , int Fra | @@ -94,11 +102,13 @@ T_JZsdkReturnCode JZsdk_Uart_SendDeal_Ask_HeartBeatStatus(int Uartport , int Fra | ||
94 | sendbuf[6] = FrameSequence; //帧序列 | 102 | sendbuf[6] = FrameSequence; //帧序列 |
95 | 103 | ||
96 | //2、发送帧 | 104 | //2、发送帧 |
97 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 105 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
106 | + | ||
107 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
98 | } | 108 | } |
99 | 109 | ||
100 | //发送请求时间戳帧 | 110 | //发送请求时间戳帧 |
101 | -T_JZsdkReturnCode JZsdk_Uart_SendDeal_Ask_TimeStamp(int Uartport , int FrameSequence) | 111 | +T_JZsdkReturnCode HalSend_type1Send_Ask_TimeStamp(int Uartport , int FrameSequence) |
102 | { | 112 | { |
103 | printf("发送请求时间戳帧\n"); | 113 | printf("发送请求时间戳帧\n"); |
104 | 114 | ||
@@ -111,11 +121,13 @@ T_JZsdkReturnCode JZsdk_Uart_SendDeal_Ask_TimeStamp(int Uartport , int FrameSequ | @@ -111,11 +121,13 @@ T_JZsdkReturnCode JZsdk_Uart_SendDeal_Ask_TimeStamp(int Uartport , int FrameSequ | ||
111 | sendbuf[6] = FrameSequence; //帧序列 | 121 | sendbuf[6] = FrameSequence; //帧序列 |
112 | 122 | ||
113 | //2、发送帧 | 123 | //2、发送帧 |
114 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 124 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
125 | + | ||
126 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
115 | } | 127 | } |
116 | 128 | ||
117 | //发送版本号 | 129 | //发送版本号 |
118 | -T_JZsdkReturnCode JZsdk_Uart_SendDeal_SendAllVersion(int Uartport, int FrameSequence, int DeviceID, int MajorVersion, int MinorVersion, int ModifyVersion, int DebugVersion) | 130 | +T_JZsdkReturnCode HalSend_type1Send_SendAllVersion(int Uartport, int FrameSequence, int DeviceID, int MajorVersion, int MinorVersion, int ModifyVersion, int DebugVersion) |
119 | { | 131 | { |
120 | printf("发送所有版本号\n"); | 132 | printf("发送所有版本号\n"); |
121 | 133 | ||
@@ -133,11 +145,13 @@ T_JZsdkReturnCode JZsdk_Uart_SendDeal_SendAllVersion(int Uartport, int FrameSequ | @@ -133,11 +145,13 @@ T_JZsdkReturnCode JZsdk_Uart_SendDeal_SendAllVersion(int Uartport, int FrameSequ | ||
133 | sendbuf[13] = DebugVersion; | 145 | sendbuf[13] = DebugVersion; |
134 | 146 | ||
135 | //2、发送帧 | 147 | //2、发送帧 |
136 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 148 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
149 | + | ||
150 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
137 | } | 151 | } |
138 | 152 | ||
139 | //发送序列号 | 153 | //发送序列号 |
140 | -T_JZsdkReturnCode JZsdk_Uart_SendDeal_SendAllSerialNumber(int Uartport, int FrameSequence, int DeviceID, unsigned char *SerialNumber, int SerialNumberLen) | 154 | +T_JZsdkReturnCode HalSend_type1Send_SendAllSerialNumber(int Uartport, int FrameSequence, int DeviceID, unsigned char *SerialNumber, int SerialNumberLen) |
141 | { | 155 | { |
142 | printf("发送所有序列号\n"); | 156 | printf("发送所有序列号\n"); |
143 | 157 | ||
@@ -158,11 +172,13 @@ T_JZsdkReturnCode JZsdk_Uart_SendDeal_SendAllSerialNumber(int Uartport, int Fram | @@ -158,11 +172,13 @@ T_JZsdkReturnCode JZsdk_Uart_SendDeal_SendAllSerialNumber(int Uartport, int Fram | ||
158 | sendbuf[4] = (send_buf_len & 0xff); | 172 | sendbuf[4] = (send_buf_len & 0xff); |
159 | 173 | ||
160 | //2、发送帧 | 174 | //2、发送帧 |
161 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 175 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
176 | + | ||
177 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
162 | } | 178 | } |
163 | 179 | ||
164 | //发送成功帧 | 180 | //发送成功帧 |
165 | -int JZsdk_Uart_SendDeal_Reply_Sucesss(int Uartport ,int FrameSequence) | 181 | +T_JZsdkReturnCode HalSend_type1Send_Reply_Success(int Uartport ,int FrameSequence) |
166 | { | 182 | { |
167 | unsigned char sendbuf[256]; | 183 | unsigned char sendbuf[256]; |
168 | int send_buf_len; | 184 | int send_buf_len; |
@@ -174,11 +190,13 @@ int JZsdk_Uart_SendDeal_Reply_Sucesss(int Uartport ,int FrameSequence) | @@ -174,11 +190,13 @@ int JZsdk_Uart_SendDeal_Reply_Sucesss(int Uartport ,int FrameSequence) | ||
174 | sendbuf[6] = FrameSequence; //帧序列 | 190 | sendbuf[6] = FrameSequence; //帧序列 |
175 | 191 | ||
176 | //3、发送帧 | 192 | //3、发送帧 |
177 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 193 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
194 | + | ||
195 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
178 | } | 196 | } |
179 | 197 | ||
180 | //发送失败帧 | 198 | //发送失败帧 |
181 | -int JZsdk_Uart_SendDeal_Reply_Failure(int Uartport ,int FrameSequence) | 199 | +T_JZsdkReturnCode HalSend_type1Send_Reply_Failure(int Uartport ,int FrameSequence) |
182 | { | 200 | { |
183 | unsigned char sendbuf[256]; | 201 | unsigned char sendbuf[256]; |
184 | int send_buf_len; | 202 | int send_buf_len; |
@@ -190,11 +208,11 @@ int JZsdk_Uart_SendDeal_Reply_Failure(int Uartport ,int FrameSequence) | @@ -190,11 +208,11 @@ int JZsdk_Uart_SendDeal_Reply_Failure(int Uartport ,int FrameSequence) | ||
190 | sendbuf[6] = FrameSequence; //帧序列 | 208 | sendbuf[6] = FrameSequence; //帧序列 |
191 | 209 | ||
192 | //3、发送帧 | 210 | //3、发送帧 |
193 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 211 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
194 | } | 212 | } |
195 | 213 | ||
196 | //发送校验失败帧 | 214 | //发送校验失败帧 |
197 | -T_JZsdkReturnCode JZsdk_Uart_SendDeal_Reply_CheckError(int Uartport ,int FrameSequence) | 215 | +T_JZsdkReturnCode HalSend_type1Send_Reply_CheckError(int Uartport ,int FrameSequence) |
198 | { | 216 | { |
199 | unsigned char sendbuf[256]; | 217 | unsigned char sendbuf[256]; |
200 | int send_buf_len; | 218 | int send_buf_len; |
@@ -206,11 +224,11 @@ T_JZsdkReturnCode JZsdk_Uart_SendDeal_Reply_CheckError(int Uartport ,int FrameSe | @@ -206,11 +224,11 @@ T_JZsdkReturnCode JZsdk_Uart_SendDeal_Reply_CheckError(int Uartport ,int FrameSe | ||
206 | sendbuf[6] = FrameSequence; //帧序列 | 224 | sendbuf[6] = FrameSequence; //帧序列 |
207 | 225 | ||
208 | //3、发送帧 | 226 | //3、发送帧 |
209 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 227 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
210 | } | 228 | } |
211 | 229 | ||
212 | //发送解码失败帧 | 230 | //发送解码失败帧 |
213 | -T_JZsdkReturnCode JZsdk_Uart_SendDeal_Reply_DecodeError(int Uartport ,int FrameSequence) | 231 | +T_JZsdkReturnCode HalSend_type1Send_Reply_DecodeError(int Uartport ,int FrameSequence) |
214 | { | 232 | { |
215 | unsigned char sendbuf[256]; | 233 | unsigned char sendbuf[256]; |
216 | int send_buf_len; | 234 | int send_buf_len; |
@@ -222,11 +240,11 @@ T_JZsdkReturnCode JZsdk_Uart_SendDeal_Reply_DecodeError(int Uartport ,int FrameS | @@ -222,11 +240,11 @@ T_JZsdkReturnCode JZsdk_Uart_SendDeal_Reply_DecodeError(int Uartport ,int FrameS | ||
222 | sendbuf[6] = FrameSequence; //帧序列 | 240 | sendbuf[6] = FrameSequence; //帧序列 |
223 | 241 | ||
224 | //3、发送帧 | 242 | //3、发送帧 |
225 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 243 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
226 | } | 244 | } |
227 | 245 | ||
228 | //发送当前从设备名 | 246 | //发送当前从设备名 |
229 | -int JZsdk_Uart_SendDeal_Reply_SecondaryDeviceName(int Uartport , int device_name, int FrameSequence) | 247 | +T_JZsdkReturnCode HalSend_type1Send_Reply_SecondaryDeviceName(int Uartport , int device_name, int FrameSequence) |
230 | { | 248 | { |
231 | unsigned char sendbuf[256]; | 249 | unsigned char sendbuf[256]; |
232 | int send_buf_len; | 250 | int send_buf_len; |
@@ -239,12 +257,12 @@ int JZsdk_Uart_SendDeal_Reply_SecondaryDeviceName(int Uartport , int device_name | @@ -239,12 +257,12 @@ int JZsdk_Uart_SendDeal_Reply_SecondaryDeviceName(int Uartport , int device_name | ||
239 | sendbuf[10] = device_name; | 257 | sendbuf[10] = device_name; |
240 | 258 | ||
241 | //3、发送帧 | 259 | //3、发送帧 |
242 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 260 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
243 | } | 261 | } |
244 | 262 | ||
245 | 263 | ||
246 | //查询当前从设备名 | 264 | //查询当前从设备名 |
247 | -int JZsdk_Uart_SendDeal_QuerySecondaryDeviceName(int Uartport ,int FrameSequence) | 265 | +T_JZsdkReturnCode HalSend_type1Send_QuerySecondaryDeviceName(int Uartport ,int FrameSequence) |
248 | { | 266 | { |
249 | unsigned char sendbuf[256]; | 267 | unsigned char sendbuf[256]; |
250 | int send_buf_len; | 268 | int send_buf_len; |
@@ -256,11 +274,11 @@ int JZsdk_Uart_SendDeal_QuerySecondaryDeviceName(int Uartport ,int FrameSequence | @@ -256,11 +274,11 @@ int JZsdk_Uart_SendDeal_QuerySecondaryDeviceName(int Uartport ,int FrameSequence | ||
256 | sendbuf[6] = FrameSequence; //帧序列 | 274 | sendbuf[6] = FrameSequence; //帧序列 |
257 | 275 | ||
258 | //3、发送帧 | 276 | //3、发送帧 |
259 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 277 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
260 | } | 278 | } |
261 | 279 | ||
262 | //发送当前设备序列号 | 280 | //发送当前设备序列号 |
263 | -int JZsdk_Uart_SendDeal_SerialNumber(int UartPort, int FrameSequence, char *SerialNumber, int SerialNumberLenth) | 281 | +T_JZsdkReturnCode HalSend_type1Send_SerialNumber(int UartPort, int FrameSequence, char *SerialNumber, int SerialNumberLenth) |
264 | { | 282 | { |
265 | unsigned char sendbuf[256]; | 283 | unsigned char sendbuf[256]; |
266 | int send_buf_len; | 284 | int send_buf_len; |
@@ -283,7 +301,7 @@ int JZsdk_Uart_SendDeal_SerialNumber(int UartPort, int FrameSequence, char *Seri | @@ -283,7 +301,7 @@ int JZsdk_Uart_SendDeal_SerialNumber(int UartPort, int FrameSequence, char *Seri | ||
283 | sendbuf[4] = send_buf_len; | 301 | sendbuf[4] = send_buf_len; |
284 | 302 | ||
285 | //3、发送帧 | 303 | //3、发送帧 |
286 | - JZsdk_Uart_UartSend(UartPort ,sendbuf, send_buf_len); | 304 | + HalSend_SendData(UartPort ,sendbuf, send_buf_len, 1); |
287 | } | 305 | } |
288 | 306 | ||
289 | /********* | 307 | /********* |
@@ -292,7 +310,7 @@ int JZsdk_Uart_SendDeal_SerialNumber(int UartPort, int FrameSequence, char *Seri | @@ -292,7 +310,7 @@ int JZsdk_Uart_SendDeal_SerialNumber(int UartPort, int FrameSequence, char *Seri | ||
292 | * | 310 | * |
293 | * | 311 | * |
294 | * *******/ | 312 | * *******/ |
295 | -T_JZsdkReturnCode JZsdk_Uart_SendDeal_DeviceMessage(int UartPort, int FrameSequence, unsigned char *message, unsigned int messageLen) | 313 | +T_JZsdkReturnCode HalSend_type1Send_DeviceMessage(int UartPort, int FrameSequence, unsigned char *message, unsigned int messageLen) |
296 | { | 314 | { |
297 | unsigned char sendbuf[300]; | 315 | unsigned char sendbuf[300]; |
298 | memset(sendbuf,0,sizeof(sendbuf)); | 316 | memset(sendbuf,0,sizeof(sendbuf)); |
@@ -308,7 +326,7 @@ T_JZsdkReturnCode JZsdk_Uart_SendDeal_DeviceMessage(int UartPort, int FrameSeque | @@ -308,7 +326,7 @@ T_JZsdkReturnCode JZsdk_Uart_SendDeal_DeviceMessage(int UartPort, int FrameSeque | ||
308 | sendbuf[9+messageLen + 1] = 0x23; | 326 | sendbuf[9+messageLen + 1] = 0x23; |
309 | 327 | ||
310 | //3、发送帧 | 328 | //3、发送帧 |
311 | - JZsdk_Uart_UartSend(UartPort ,sendbuf, send_buf_len); | 329 | + HalSend_SendData(UartPort ,sendbuf, send_buf_len, 1); |
312 | } | 330 | } |
313 | 331 | ||
314 | 332 | ||
@@ -317,7 +335,7 @@ struct JZsdk_MusicListSentStruct | @@ -317,7 +335,7 @@ struct JZsdk_MusicListSentStruct | ||
317 | int UartPort; | 335 | int UartPort; |
318 | int FrameSequence; | 336 | int FrameSequence; |
319 | int music_sum; | 337 | int music_sum; |
320 | - char **MusicName; | 338 | + unsigned char **MusicName; |
321 | int *MusicNameLength; | 339 | int *MusicNameLength; |
322 | }; | 340 | }; |
323 | 341 | ||
@@ -326,7 +344,7 @@ struct JZsdk_MusicListSentStruct | @@ -326,7 +344,7 @@ struct JZsdk_MusicListSentStruct | ||
326 | * 歌曲列表发送任务函数 | 344 | * 歌曲列表发送任务函数 |
327 | * | 345 | * |
328 | * ***********/ | 346 | * ***********/ |
329 | -static void JZsdk_Uart_SentDeal_Reply_Musiclist_Task(void *data) | 347 | +static void HalSend_type1Send_Reply_Musiclist_Task(void *data) |
330 | { | 348 | { |
331 | struct JZsdk_MusicListSentStruct *taskData = (struct JZsdk_MusicListSentStruct *)data; | 349 | struct JZsdk_MusicListSentStruct *taskData = (struct JZsdk_MusicListSentStruct *)data; |
332 | unsigned char sendbuf[256]; | 350 | unsigned char sendbuf[256]; |
@@ -340,7 +358,7 @@ static void JZsdk_Uart_SentDeal_Reply_Musiclist_Task(void *data) | @@ -340,7 +358,7 @@ static void JZsdk_Uart_SentDeal_Reply_Musiclist_Task(void *data) | ||
340 | sendbuf[6] = taskData->FrameSequence; //帧序列 | 358 | sendbuf[6] = taskData->FrameSequence; //帧序列 |
341 | //发送帧 | 359 | //发送帧 |
342 | printf("发送操作成功帧\n"); | 360 | printf("发送操作成功帧\n"); |
343 | - JZsdk_Uart_UartSend_NotTask(taskData->UartPort ,sendbuf, send_buf_len); | 361 | + HalSend_SendData(taskData->UartPort ,sendbuf, send_buf_len, 0); |
344 | 362 | ||
345 | //2、发送开始帧 | 363 | //2、发送开始帧 |
346 | //获取帧样板 | 364 | //获取帧样板 |
@@ -351,7 +369,7 @@ static void JZsdk_Uart_SentDeal_Reply_Musiclist_Task(void *data) | @@ -351,7 +369,7 @@ static void JZsdk_Uart_SentDeal_Reply_Musiclist_Task(void *data) | ||
351 | sendbuf[9] = taskData->music_sum; | 369 | sendbuf[9] = taskData->music_sum; |
352 | //发送帧 | 370 | //发送帧 |
353 | printf("发送歌曲开始列表帧\n"); | 371 | printf("发送歌曲开始列表帧\n"); |
354 | - JZsdk_Uart_UartSend_NotTask(taskData->UartPort ,sendbuf, send_buf_len); | 372 | + HalSend_SendData(taskData->UartPort ,sendbuf, send_buf_len, 0); |
355 | 373 | ||
356 | //3、逐一调用发送函数将歌曲名发出 | 374 | //3、逐一调用发送函数将歌曲名发出 |
357 | for (int i = 0; i < (taskData->music_sum) ; i++) | 375 | for (int i = 0; i < (taskData->music_sum) ; i++) |
@@ -368,7 +386,7 @@ static void JZsdk_Uart_SentDeal_Reply_Musiclist_Task(void *data) | @@ -368,7 +386,7 @@ static void JZsdk_Uart_SentDeal_Reply_Musiclist_Task(void *data) | ||
368 | sendbuf[3] = (send_buf_len >> 8); | 386 | sendbuf[3] = (send_buf_len >> 8); |
369 | sendbuf[4] = (send_buf_len & 0xff); | 387 | sendbuf[4] = (send_buf_len & 0xff); |
370 | sendbuf[6] = taskData->FrameSequence; //帧序列 | 388 | sendbuf[6] = taskData->FrameSequence; //帧序列 |
371 | - JZsdk_Uart_UartSend_NotTask(taskData->UartPort ,sendbuf, send_buf_len); | 389 | + HalSend_SendData(taskData->UartPort ,sendbuf, send_buf_len, 0); |
372 | } | 390 | } |
373 | 391 | ||
374 | //4、发送结束帧 | 392 | //4、发送结束帧 |
@@ -380,7 +398,7 @@ static void JZsdk_Uart_SentDeal_Reply_Musiclist_Task(void *data) | @@ -380,7 +398,7 @@ static void JZsdk_Uart_SentDeal_Reply_Musiclist_Task(void *data) | ||
380 | sendbuf[9] = 0x00; | 398 | sendbuf[9] = 0x00; |
381 | //发送帧 | 399 | //发送帧 |
382 | printf("发送歌曲结束列表"); | 400 | printf("发送歌曲结束列表"); |
383 | - JZsdk_Uart_UartSend_NotTask(taskData->UartPort ,sendbuf, send_buf_len); | 401 | + HalSend_SendData(taskData->UartPort ,sendbuf, send_buf_len, 0); |
384 | 402 | ||
385 | //5、释放内存 | 403 | //5、释放内存 |
386 | for (int i = 0; i < taskData->music_sum; i++) | 404 | for (int i = 0; i < taskData->music_sum; i++) |
@@ -398,7 +416,7 @@ static void JZsdk_Uart_SentDeal_Reply_Musiclist_Task(void *data) | @@ -398,7 +416,7 @@ static void JZsdk_Uart_SentDeal_Reply_Musiclist_Task(void *data) | ||
398 | } | 416 | } |
399 | 417 | ||
400 | //发送歌曲列表Ⅰ型 | 418 | //发送歌曲列表Ⅰ型 |
401 | -T_JZsdkReturnCode JZsdk_Uart_SentDeal_Reply_Musiclist(int UartPort ,int FrameSequence, int music_sum ,char **MusicName ,int *MusicNameLength) | 419 | +T_JZsdkReturnCode HalSend_type1Send_Reply_Musiclist(int UartPort ,int FrameSequence, int music_sum ,unsigned char **MusicName ,int *MusicNameLength) |
402 | { | 420 | { |
403 | struct JZsdk_MusicListSentStruct *musicList = (struct JZsdk_MusicListSentStruct *)malloc(sizeof(struct JZsdk_MusicListSentStruct)); | 421 | struct JZsdk_MusicListSentStruct *musicList = (struct JZsdk_MusicListSentStruct *)malloc(sizeof(struct JZsdk_MusicListSentStruct)); |
404 | if (musicList == NULL) | 422 | if (musicList == NULL) |
@@ -412,7 +430,7 @@ T_JZsdkReturnCode JZsdk_Uart_SentDeal_Reply_Musiclist(int UartPort ,int FrameSeq | @@ -412,7 +430,7 @@ T_JZsdkReturnCode JZsdk_Uart_SentDeal_Reply_Musiclist(int UartPort ,int FrameSeq | ||
412 | musicList->MusicName = MusicName; | 430 | musicList->MusicName = MusicName; |
413 | musicList->MusicNameLength = MusicNameLength; | 431 | musicList->MusicNameLength = MusicNameLength; |
414 | 432 | ||
415 | - T_JZsdkReturnCode ret = TaskManagement_SubmitTask(JZsdk_Uart_SentDeal_Reply_Musiclist_Task, (void *)musicList); | 433 | + T_JZsdkReturnCode ret = TaskManagement_SubmitTask(HalSend_type1Send_Reply_Musiclist_Task, (void *)musicList); |
416 | if (ret == JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE) | 434 | if (ret == JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE) |
417 | { | 435 | { |
418 | free(musicList); | 436 | free(musicList); |
@@ -424,7 +442,7 @@ T_JZsdkReturnCode JZsdk_Uart_SentDeal_Reply_Musiclist(int UartPort ,int FrameSeq | @@ -424,7 +442,7 @@ T_JZsdkReturnCode JZsdk_Uart_SentDeal_Reply_Musiclist(int UartPort ,int FrameSeq | ||
424 | } | 442 | } |
425 | 443 | ||
426 | //发送歌曲列表开始帧 | 444 | //发送歌曲列表开始帧 |
427 | -T_JZsdkReturnCode JZsdk_Uart_SendDeal_Send_AudioList_Start(int Uartport, int FrameSequence, int music_sum) | 445 | +T_JZsdkReturnCode HalSend_type1Send_Send_AudioList_Start(int Uartport, int FrameSequence, int music_sum) |
428 | { | 446 | { |
429 | printf("发送歌曲开始列表帧\n"); | 447 | printf("发送歌曲开始列表帧\n"); |
430 | 448 | ||
@@ -439,13 +457,13 @@ T_JZsdkReturnCode JZsdk_Uart_SendDeal_Send_AudioList_Start(int Uartport, int Fra | @@ -439,13 +457,13 @@ T_JZsdkReturnCode JZsdk_Uart_SendDeal_Send_AudioList_Start(int Uartport, int Fra | ||
439 | sendbuf[9] = music_sum; | 457 | sendbuf[9] = music_sum; |
440 | 458 | ||
441 | //发送帧 | 459 | //发送帧 |
442 | - JZsdk_Uart_UartSend_NotTask(Uartport ,sendbuf, send_buf_len); | 460 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 0); |
443 | 461 | ||
444 | return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | 462 | return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; |
445 | } | 463 | } |
446 | 464 | ||
447 | //发送歌曲列表结束帧 | 465 | //发送歌曲列表结束帧 |
448 | -T_JZsdkReturnCode JZsdk_Uart_SendDeal_Send_AudioList_Stop(int Uartport, int FrameSequence) | 466 | +T_JZsdkReturnCode HalSend_type1Send_Send_AudioList_Stop(int Uartport, int FrameSequence) |
449 | { | 467 | { |
450 | printf("发送歌曲结束列表帧\n"); | 468 | printf("发送歌曲结束列表帧\n"); |
451 | 469 | ||
@@ -458,11 +476,11 @@ T_JZsdkReturnCode JZsdk_Uart_SendDeal_Send_AudioList_Stop(int Uartport, int Fram | @@ -458,11 +476,11 @@ T_JZsdkReturnCode JZsdk_Uart_SendDeal_Send_AudioList_Stop(int Uartport, int Fram | ||
458 | //写入数据 | 476 | //写入数据 |
459 | sendbuf[6] = FrameSequence; //帧序列 | 477 | sendbuf[6] = FrameSequence; //帧序列 |
460 | 478 | ||
461 | - JZsdk_Uart_UartSend_NotTask(Uartport ,sendbuf, send_buf_len); | 479 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 0); |
462 | } | 480 | } |
463 | 481 | ||
464 | //发送歌曲列表Ⅱ型 | 482 | //发送歌曲列表Ⅱ型 |
465 | -T_JZsdkReturnCode JZsdk_Uart_SendDeal_Send_AudioList_2(int Uartport, int FrameSequence, unsigned char *name, unsigned int namelen, unsigned int Filesize, unsigned int Time) | 483 | +T_JZsdkReturnCode HalSend_type1Send_Send_AudioList_2(int Uartport, int FrameSequence, unsigned char *name, unsigned int namelen, unsigned int Filesize, unsigned int Time) |
466 | { | 484 | { |
467 | printf("发送歌曲列表Ⅱ型 %s %d %d %d\n",name, namelen, Filesize, Time); | 485 | printf("发送歌曲列表Ⅱ型 %s %d %d %d\n",name, namelen, Filesize, Time); |
468 | unsigned char sendbuf[400]; | 486 | unsigned char sendbuf[400]; |
@@ -496,14 +514,14 @@ T_JZsdkReturnCode JZsdk_Uart_SendDeal_Send_AudioList_2(int Uartport, int FrameSe | @@ -496,14 +514,14 @@ T_JZsdkReturnCode JZsdk_Uart_SendDeal_Send_AudioList_2(int Uartport, int FrameSe | ||
496 | sendbuf[send_buf_len-1] = 0x23; | 514 | sendbuf[send_buf_len-1] = 0x23; |
497 | 515 | ||
498 | //3、发送帧 | 516 | //3、发送帧 |
499 | - JZsdk_Uart_UartSend_NotTask(Uartport ,sendbuf, send_buf_len); | 517 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 0); |
500 | 518 | ||
501 | return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | 519 | return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; |
502 | } | 520 | } |
503 | 521 | ||
504 | 522 | ||
505 | //发送音频详细信息帧 | 523 | //发送音频详细信息帧 |
506 | -T_JZsdkReturnCode JZsdk_Uart_SendDeal_Send_AudioDetailMessage(int Uartport, int FrameSequence, unsigned char type ,unsigned char *data, unsigned int datalen) | 524 | +T_JZsdkReturnCode HalSend_type1Send_Send_AudioDetailMessage(int Uartport, int FrameSequence, unsigned char type ,unsigned char *data, unsigned int datalen) |
507 | { | 525 | { |
508 | printf("发送音频详细信息帧\n"); | 526 | printf("发送音频详细信息帧\n"); |
509 | unsigned char sendbuf[256]; | 527 | unsigned char sendbuf[256]; |
@@ -524,13 +542,13 @@ T_JZsdkReturnCode JZsdk_Uart_SendDeal_Send_AudioDetailMessage(int Uartport, int | @@ -524,13 +542,13 @@ T_JZsdkReturnCode JZsdk_Uart_SendDeal_Send_AudioDetailMessage(int Uartport, int | ||
524 | sendbuf[send_buf_len-1] = 0x23; | 542 | sendbuf[send_buf_len-1] = 0x23; |
525 | 543 | ||
526 | //3、发送帧 | 544 | //3、发送帧 |
527 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 545 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
528 | 546 | ||
529 | return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | 547 | return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; |
530 | } | 548 | } |
531 | 549 | ||
532 | //发送播放状态结束帧 | 550 | //发送播放状态结束帧 |
533 | -int JZsdk_Uart_SendDeal_Send_PlayStatus_end(int Uartport) | 551 | +T_JZsdkReturnCode HalSend_type1Send_Send_PlayStatus_end(int Uartport) |
534 | { | 552 | { |
535 | printf("发送播放状态结束帧\n"); | 553 | printf("发送播放状态结束帧\n"); |
536 | unsigned char sendbuf[256]; | 554 | unsigned char sendbuf[256]; |
@@ -542,11 +560,11 @@ int JZsdk_Uart_SendDeal_Send_PlayStatus_end(int Uartport) | @@ -542,11 +560,11 @@ int JZsdk_Uart_SendDeal_Send_PlayStatus_end(int Uartport) | ||
542 | //2、写入数据 | 560 | //2、写入数据 |
543 | 561 | ||
544 | //3、发送帧 | 562 | //3、发送帧 |
545 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 563 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
546 | } | 564 | } |
547 | 565 | ||
548 | //发送播放状态帧 | 566 | //发送播放状态帧 |
549 | -int JZsdk_Uart_SendDeal_Send_PlayStatus(int Uartport ,int num) | 567 | +T_JZsdkReturnCode HalSend_type1Send_Send_PlayStatus(int Uartport ,int num) |
550 | { | 568 | { |
551 | printf("向"); | 569 | printf("向"); |
552 | switch (Uartport) | 570 | switch (Uartport) |
@@ -575,11 +593,11 @@ int JZsdk_Uart_SendDeal_Send_PlayStatus(int Uartport ,int num) | @@ -575,11 +593,11 @@ int JZsdk_Uart_SendDeal_Send_PlayStatus(int Uartport ,int num) | ||
575 | sendbuf[9] = (char)num; | 593 | sendbuf[9] = (char)num; |
576 | 594 | ||
577 | //3、发送帧 | 595 | //3、发送帧 |
578 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 596 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
579 | } | 597 | } |
580 | 598 | ||
581 | //回复当前播放的歌曲名字 | 599 | //回复当前播放的歌曲名字 |
582 | -int JZsdk_Uart_SendDeal_Reply_MusicName(int Uartport ,char *music_name, int music_name_len) | 600 | +T_JZsdkReturnCode HalSend_type1Send_Reply_MusicName(int Uartport ,char *music_name, int music_name_len) |
583 | { | 601 | { |
584 | printf("发送当前歌曲名字帧"); | 602 | printf("发送当前歌曲名字帧"); |
585 | unsigned char sendbuf[256]; | 603 | unsigned char sendbuf[256]; |
@@ -599,13 +617,13 @@ int JZsdk_Uart_SendDeal_Reply_MusicName(int Uartport ,char *music_name, int musi | @@ -599,13 +617,13 @@ int JZsdk_Uart_SendDeal_Reply_MusicName(int Uartport ,char *music_name, int musi | ||
599 | sendbuf[4] = len & 0xff; | 617 | sendbuf[4] = len & 0xff; |
600 | 618 | ||
601 | //3、发送帧 | 619 | //3、发送帧 |
602 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, len); | 620 | + HalSend_SendData(Uartport ,sendbuf, len, 1); |
603 | } | 621 | } |
604 | 622 | ||
605 | //回复当前音量 | 623 | //回复当前音量 |
606 | -int JZsdk_Uart_SendDeal_Reply_Volume(int Uartport ,int num) | 624 | +T_JZsdkReturnCode HalSend_type1Send_Reply_Volume(int Uartport ,int num) |
607 | { | 625 | { |
608 | - printf("发送播放状态帧\n"); | 626 | + printf("发送当前音量帧\n"); |
609 | unsigned char sendbuf[256]; | 627 | unsigned char sendbuf[256]; |
610 | int send_buf_len; | 628 | int send_buf_len; |
611 | 629 | ||
@@ -616,14 +634,14 @@ int JZsdk_Uart_SendDeal_Reply_Volume(int Uartport ,int num) | @@ -616,14 +634,14 @@ int JZsdk_Uart_SendDeal_Reply_Volume(int Uartport ,int num) | ||
616 | sendbuf[9] = (char)num; | 634 | sendbuf[9] = (char)num; |
617 | 635 | ||
618 | //3、发送帧 | 636 | //3、发送帧 |
619 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 637 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
620 | 638 | ||
621 | } | 639 | } |
622 | 640 | ||
623 | 641 | ||
624 | 642 | ||
625 | //回复软件版本号 | 643 | //回复软件版本号 |
626 | -int JZsdk_Uart_SendDeal_Reply_SoftVersion(int Uartport ,char majorVersion, char minorVersion, char modifyVersion, char debugVersion) | 644 | +T_JZsdkReturnCode HalSend_type1Send_Reply_SoftVersion(int Uartport ,char majorVersion, char minorVersion, char modifyVersion, char debugVersion) |
627 | { | 645 | { |
628 | printf("发送软件版本号帧\n"); | 646 | printf("发送软件版本号帧\n"); |
629 | unsigned char sendbuf[256]; | 647 | unsigned char sendbuf[256]; |
@@ -639,11 +657,11 @@ int JZsdk_Uart_SendDeal_Reply_SoftVersion(int Uartport ,char majorVersion, char | @@ -639,11 +657,11 @@ int JZsdk_Uart_SendDeal_Reply_SoftVersion(int Uartport ,char majorVersion, char | ||
639 | sendbuf[12] = debugVersion; | 657 | sendbuf[12] = debugVersion; |
640 | 658 | ||
641 | //3、发送帧 | 659 | //3、发送帧 |
642 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 660 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
643 | } | 661 | } |
644 | 662 | ||
645 | //发送循环状态 | 663 | //发送循环状态 |
646 | -int JZsdk_Uart_SendDeal_Reply_LoopPlayStatus(int Uartport ,int status) | 664 | +T_JZsdkReturnCode HalSend_type1Send_Reply_LoopPlayStatus(int Uartport ,int status) |
647 | { | 665 | { |
648 | printf("发送循环状态帧\n"); | 666 | printf("发送循环状态帧\n"); |
649 | 667 | ||
@@ -657,12 +675,12 @@ int JZsdk_Uart_SendDeal_Reply_LoopPlayStatus(int Uartport ,int status) | @@ -657,12 +675,12 @@ int JZsdk_Uart_SendDeal_Reply_LoopPlayStatus(int Uartport ,int status) | ||
657 | sendbuf[9] = status; | 675 | sendbuf[9] = status; |
658 | 676 | ||
659 | //3、发送帧 | 677 | //3、发送帧 |
660 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 678 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
661 | 679 | ||
662 | } | 680 | } |
663 | 681 | ||
664 | //发送音色 | 682 | //发送音色 |
665 | -int JZsdk_Uart_SendDeal_Reply_TTS_tone(int Uartport ,int tone) | 683 | +T_JZsdkReturnCode HalSend_type1Send_Reply_TTS_tone(int Uartport ,int tone) |
666 | { | 684 | { |
667 | printf("发送音色帧\n"); | 685 | printf("发送音色帧\n"); |
668 | 686 | ||
@@ -676,11 +694,11 @@ int JZsdk_Uart_SendDeal_Reply_TTS_tone(int Uartport ,int tone) | @@ -676,11 +694,11 @@ int JZsdk_Uart_SendDeal_Reply_TTS_tone(int Uartport ,int tone) | ||
676 | sendbuf[9] = tone; | 694 | sendbuf[9] = tone; |
677 | 695 | ||
678 | //3、发送帧 | 696 | //3、发送帧 |
679 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 697 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
680 | } | 698 | } |
681 | 699 | ||
682 | //发送语速 | 700 | //发送语速 |
683 | -int JZsdk_Uart_SendDeal_Reply_TTS_speed(int Uartport ,int speed) | 701 | +T_JZsdkReturnCode HalSend_type1Send_Reply_TTS_speed(int Uartport ,int speed) |
684 | { | 702 | { |
685 | printf("发送音色帧\n"); | 703 | printf("发送音色帧\n"); |
686 | 704 | ||
@@ -694,7 +712,7 @@ int JZsdk_Uart_SendDeal_Reply_TTS_speed(int Uartport ,int speed) | @@ -694,7 +712,7 @@ int JZsdk_Uart_SendDeal_Reply_TTS_speed(int Uartport ,int speed) | ||
694 | sendbuf[9] = speed; | 712 | sendbuf[9] = speed; |
695 | 713 | ||
696 | //3、发送帧 | 714 | //3、发送帧 |
697 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 715 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
698 | } | 716 | } |
699 | 717 | ||
700 | /************* | 718 | /************* |
@@ -702,7 +720,7 @@ int JZsdk_Uart_SendDeal_Reply_TTS_speed(int Uartport ,int speed) | @@ -702,7 +720,7 @@ int JZsdk_Uart_SendDeal_Reply_TTS_speed(int Uartport ,int speed) | ||
702 | * 发送opus解码状态 | 720 | * 发送opus解码状态 |
703 | * | 721 | * |
704 | * **************/ | 722 | * **************/ |
705 | -int JZsdk_Uart_SendDeal_OpusDecodeStatus(int Uartport,int value) | 723 | +T_JZsdkReturnCode HalSend_type1Send_OpusDecodeStatus(int Uartport,int value) |
706 | { | 724 | { |
707 | printf("发送opus解码状态帧\n"); | 725 | printf("发送opus解码状态帧\n"); |
708 | 726 | ||
@@ -716,7 +734,7 @@ int JZsdk_Uart_SendDeal_OpusDecodeStatus(int Uartport,int value) | @@ -716,7 +734,7 @@ int JZsdk_Uart_SendDeal_OpusDecodeStatus(int Uartport,int value) | ||
716 | sendbuf[9] = value; | 734 | sendbuf[9] = value; |
717 | 735 | ||
718 | //3、发送帧 | 736 | //3、发送帧 |
719 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 737 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
720 | } | 738 | } |
721 | 739 | ||
722 | /**************************************************************************************************************************************************** | 740 | /**************************************************************************************************************************************************** |
@@ -725,10 +743,10 @@ int JZsdk_Uart_SendDeal_OpusDecodeStatus(int Uartport,int value) | @@ -725,10 +743,10 @@ int JZsdk_Uart_SendDeal_OpusDecodeStatus(int Uartport,int value) | ||
725 | * | 743 | * |
726 | ****************************************************************************************************************************************************/ | 744 | ****************************************************************************************************************************************************/ |
727 | 745 | ||
728 | -//回复当前云台角度 | ||
729 | -int JZsdk_Uart_SendDeal_Reply_GimbalPitchAngle(int Uartport ,int angle) | 746 | +//回复当前俯仰云台角度 |
747 | +T_JZsdkReturnCode HalSend_type1Send_Reply_GimbalPitchAngle(int Uartport ,int angle) | ||
730 | { | 748 | { |
731 | - printf("发送当前云台角度帧\n"); | 749 | + printf("发送当前俯仰云台角度帧\n"); |
732 | unsigned char sendbuf[256]; | 750 | unsigned char sendbuf[256]; |
733 | int send_buf_len; | 751 | int send_buf_len; |
734 | 752 | ||
@@ -748,11 +766,11 @@ int JZsdk_Uart_SendDeal_Reply_GimbalPitchAngle(int Uartport ,int angle) | @@ -748,11 +766,11 @@ int JZsdk_Uart_SendDeal_Reply_GimbalPitchAngle(int Uartport ,int angle) | ||
748 | sendbuf[11] = (char)(angle & 255); | 766 | sendbuf[11] = (char)(angle & 255); |
749 | 767 | ||
750 | //3、发送帧 | 768 | //3、发送帧 |
751 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 769 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
752 | } | 770 | } |
753 | 771 | ||
754 | //设置当前云台角度 | 772 | //设置当前云台角度 |
755 | -int JZsdk_Uart_SendDeal_Set_GimbalPitchAngle(int Uartport ,int angle) | 773 | +T_JZsdkReturnCode HalSend_type1Send_Set_GimbalPitchAngle(int Uartport ,int angle) |
756 | { | 774 | { |
757 | //printf("发送设置云台角度帧 %d\n",angle); //该打印可能会造成卡顿 | 775 | //printf("发送设置云台角度帧 %d\n",angle); //该打印可能会造成卡顿 |
758 | unsigned char sendbuf[256]; | 776 | unsigned char sendbuf[256]; |
@@ -776,11 +794,11 @@ int JZsdk_Uart_SendDeal_Set_GimbalPitchAngle(int Uartport ,int angle) | @@ -776,11 +794,11 @@ int JZsdk_Uart_SendDeal_Set_GimbalPitchAngle(int Uartport ,int angle) | ||
776 | sendbuf[11] = (angle & 0xff); | 794 | sendbuf[11] = (angle & 0xff); |
777 | 795 | ||
778 | //3、发送帧 | 796 | //3、发送帧 |
779 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 797 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
780 | } | 798 | } |
781 | 799 | ||
782 | //查询云台角度 | 800 | //查询云台角度 |
783 | -int JZsdk_Uart_SendDeal_CheckStatus_GimbalAngle(int Uartport ,int FrameSequence) | 801 | +T_JZsdkReturnCode HalSend_type1Send_CheckStatus_GimbalAngle(int Uartport ,int FrameSequence) |
784 | { | 802 | { |
785 | printf("发送查询云台角度帧\n"); | 803 | printf("发送查询云台角度帧\n"); |
786 | unsigned char sendbuf[256]; | 804 | unsigned char sendbuf[256]; |
@@ -793,11 +811,11 @@ int JZsdk_Uart_SendDeal_CheckStatus_GimbalAngle(int Uartport ,int FrameSequence) | @@ -793,11 +811,11 @@ int JZsdk_Uart_SendDeal_CheckStatus_GimbalAngle(int Uartport ,int FrameSequence) | ||
793 | sendbuf[6] = FrameSequence; | 811 | sendbuf[6] = FrameSequence; |
794 | 812 | ||
795 | //3、发送帧 | 813 | //3、发送帧 |
796 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 814 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
797 | } | 815 | } |
798 | 816 | ||
799 | //微调云台pitch | 817 | //微调云台pitch |
800 | -int JZsdk_Uart_SendDeal_Set_GimbalFineTuningPitch(int Uartport, int PitchFineTuning) | 818 | +T_JZsdkReturnCode HalSend_type1Send_Set_GimbalFineTuningPitch(int Uartport, int PitchFineTuning) |
801 | { | 819 | { |
802 | printf("发送微调云台pitch帧\n"); | 820 | printf("发送微调云台pitch帧\n"); |
803 | unsigned char sendbuf[256]; | 821 | unsigned char sendbuf[256]; |
@@ -821,11 +839,11 @@ int JZsdk_Uart_SendDeal_Set_GimbalFineTuningPitch(int Uartport, int PitchFineTun | @@ -821,11 +839,11 @@ int JZsdk_Uart_SendDeal_Set_GimbalFineTuningPitch(int Uartport, int PitchFineTun | ||
821 | sendbuf[11] = (PitchFineTuning & 0xff); | 839 | sendbuf[11] = (PitchFineTuning & 0xff); |
822 | 840 | ||
823 | //3、发送帧 | 841 | //3、发送帧 |
824 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 842 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
825 | } | 843 | } |
826 | 844 | ||
827 | //查询云台角度微调值 | 845 | //查询云台角度微调值 |
828 | -int JZsdk_Uart_SendDeal_CheckStatus_GimbalFineTuningPitch(int Uartport, int FrameSequence) | 846 | +T_JZsdkReturnCode HalSend_type1Send_CheckStatus_GimbalFineTuningPitch(int Uartport, int FrameSequence) |
829 | { | 847 | { |
830 | printf("发送查询云台角度微调值帧\n"); | 848 | printf("发送查询云台角度微调值帧\n"); |
831 | unsigned char sendbuf[256]; | 849 | unsigned char sendbuf[256]; |
@@ -838,11 +856,11 @@ int JZsdk_Uart_SendDeal_CheckStatus_GimbalFineTuningPitch(int Uartport, int Fram | @@ -838,11 +856,11 @@ int JZsdk_Uart_SendDeal_CheckStatus_GimbalFineTuningPitch(int Uartport, int Fram | ||
838 | sendbuf[6] = FrameSequence; //帧序列 | 856 | sendbuf[6] = FrameSequence; //帧序列 |
839 | 857 | ||
840 | //3、发送帧 | 858 | //3、发送帧 |
841 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 859 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
842 | } | 860 | } |
843 | 861 | ||
844 | //回复云台pitch微调值 | 862 | //回复云台pitch微调值 |
845 | -int JZsdk_Uart_SendDeal_Reply_GimbalFineTuningPitch(int Uartport, int FrameSequence, int FineTunigPitch) | 863 | +T_JZsdkReturnCode HalSend_type1Send_Reply_GimbalFineTuningPitch(int Uartport, int FrameSequence, int FineTunigPitch) |
846 | { | 864 | { |
847 | printf("发送云台pitch微调值\n"); | 865 | printf("发送云台pitch微调值\n"); |
848 | unsigned char sendbuf[256]; | 866 | unsigned char sendbuf[256]; |
@@ -866,11 +884,11 @@ int JZsdk_Uart_SendDeal_Reply_GimbalFineTuningPitch(int Uartport, int FrameSeque | @@ -866,11 +884,11 @@ int JZsdk_Uart_SendDeal_Reply_GimbalFineTuningPitch(int Uartport, int FrameSeque | ||
866 | sendbuf[11] = (FineTunigPitch & 0xff); | 884 | sendbuf[11] = (FineTunigPitch & 0xff); |
867 | 885 | ||
868 | //3、发送帧 | 886 | //3、发送帧 |
869 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 887 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
870 | } | 888 | } |
871 | 889 | ||
872 | //设置云台联动 | 890 | //设置云台联动 |
873 | -int JZsdk_Uart_SendDeal_Set_GimbalLinkageControl(int Uartport,int FrameSequence, int value) | 891 | +T_JZsdkReturnCode HalSend_type1Send_Set_GimbalLinkageControl(int Uartport,int FrameSequence, int value) |
874 | { | 892 | { |
875 | printf("发送设置云台联动帧\n"); | 893 | printf("发送设置云台联动帧\n"); |
876 | unsigned char sendbuf[256]; | 894 | unsigned char sendbuf[256]; |
@@ -884,11 +902,11 @@ int JZsdk_Uart_SendDeal_Set_GimbalLinkageControl(int Uartport,int FrameSequence, | @@ -884,11 +902,11 @@ int JZsdk_Uart_SendDeal_Set_GimbalLinkageControl(int Uartport,int FrameSequence, | ||
884 | sendbuf[10] = value; | 902 | sendbuf[10] = value; |
885 | 903 | ||
886 | //3、发送帧 | 904 | //3、发送帧 |
887 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 905 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
888 | } | 906 | } |
889 | 907 | ||
890 | //查询云台联动值 | 908 | //查询云台联动值 |
891 | -int JZsdk_Uart_SendDeal_CheckStatus_GimbalLinkage(int Uartport,int FrameSequence) | 909 | +T_JZsdkReturnCode HalSend_type1Send_CheckStatus_GimbalLinkage(int Uartport,int FrameSequence) |
892 | { | 910 | { |
893 | printf("发送查询云台联动值帧\n"); | 911 | printf("发送查询云台联动值帧\n"); |
894 | unsigned char sendbuf[256]; | 912 | unsigned char sendbuf[256]; |
@@ -901,11 +919,11 @@ int JZsdk_Uart_SendDeal_CheckStatus_GimbalLinkage(int Uartport,int FrameSequence | @@ -901,11 +919,11 @@ int JZsdk_Uart_SendDeal_CheckStatus_GimbalLinkage(int Uartport,int FrameSequence | ||
901 | sendbuf[6] = FrameSequence; //帧序列 | 919 | sendbuf[6] = FrameSequence; //帧序列 |
902 | 920 | ||
903 | //3、发送帧 | 921 | //3、发送帧 |
904 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 922 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
905 | } | 923 | } |
906 | 924 | ||
907 | //发送云台联动值 | 925 | //发送云台联动值 |
908 | -int JZsdk_Uart_SendDeal_GimbalLinkageControl(int Uartport,int FrameSequence,int value) | 926 | +T_JZsdkReturnCode HalSend_type1Send_GimbalLinkageControl(int Uartport,int FrameSequence,int value) |
909 | { | 927 | { |
910 | printf("发送云台联动值帧\n"); | 928 | printf("发送云台联动值帧\n"); |
911 | unsigned char sendbuf[256]; | 929 | unsigned char sendbuf[256]; |
@@ -919,11 +937,11 @@ int JZsdk_Uart_SendDeal_GimbalLinkageControl(int Uartport,int FrameSequence,int | @@ -919,11 +937,11 @@ int JZsdk_Uart_SendDeal_GimbalLinkageControl(int Uartport,int FrameSequence,int | ||
919 | sendbuf[10] = value; | 937 | sendbuf[10] = value; |
920 | 938 | ||
921 | //3、发送帧 | 939 | //3、发送帧 |
922 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 940 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
923 | } | 941 | } |
924 | 942 | ||
925 | //发送云台最大最小值帧 | 943 | //发送云台最大最小值帧 |
926 | -int JZsdk_Uart_SendDeal_SetGimbalRange(int Uartport,int FrameSequence,int value) | 944 | +T_JZsdkReturnCode HalSend_type1Send_SetGimbalRange(int Uartport,int FrameSequence,int value) |
927 | { | 945 | { |
928 | printf("发送云台最大最小值帧\n"); | 946 | printf("发送云台最大最小值帧\n"); |
929 | unsigned char sendbuf[256]; | 947 | unsigned char sendbuf[256]; |
@@ -937,7 +955,7 @@ int JZsdk_Uart_SendDeal_SetGimbalRange(int Uartport,int FrameSequence,int value) | @@ -937,7 +955,7 @@ int JZsdk_Uart_SendDeal_SetGimbalRange(int Uartport,int FrameSequence,int value) | ||
937 | sendbuf[10] = value; | 955 | sendbuf[10] = value; |
938 | 956 | ||
939 | //3、发送帧 | 957 | //3、发送帧 |
940 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 958 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
941 | } | 959 | } |
942 | 960 | ||
943 | /**************************************************************************************************************************************************** | 961 | /**************************************************************************************************************************************************** |
@@ -947,7 +965,7 @@ int JZsdk_Uart_SendDeal_SetGimbalRange(int Uartport,int FrameSequence,int value) | @@ -947,7 +965,7 @@ int JZsdk_Uart_SendDeal_SetGimbalRange(int Uartport,int FrameSequence,int value) | ||
947 | ****************************************************************************************************************************************************/ | 965 | ****************************************************************************************************************************************************/ |
948 | 966 | ||
949 | //发送设置探照灯爆闪频率 | 967 | //发送设置探照灯爆闪频率 |
950 | -int JZsdk_Uart_SendDeal_Set_SearchLightFrequency(int Uartport ,int Frequency) | 968 | +T_JZsdkReturnCode HalSend_type1Send_Set_SearchLightFrequency(int Uartport ,int Frequency) |
951 | { | 969 | { |
952 | printf("发送设置爆闪频率帧\n"); | 970 | printf("发送设置爆闪频率帧\n"); |
953 | 971 | ||
@@ -961,11 +979,11 @@ int JZsdk_Uart_SendDeal_Set_SearchLightFrequency(int Uartport ,int Frequency) | @@ -961,11 +979,11 @@ int JZsdk_Uart_SendDeal_Set_SearchLightFrequency(int Uartport ,int Frequency) | ||
961 | sendbuf[10] = Frequency; | 979 | sendbuf[10] = Frequency; |
962 | 980 | ||
963 | //3、发送帧 | 981 | //3、发送帧 |
964 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 982 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
965 | } | 983 | } |
966 | 984 | ||
967 | //设置探照灯控制 | 985 | //设置探照灯控制 |
968 | -int JZsdk_Uart_SendDeal_SearchLight_Control(int Uartport,int mode) | 986 | +T_JZsdkReturnCode HalSend_type1Send_SearchLight_Control(int Uartport,int mode) |
969 | { | 987 | { |
970 | printf("发送探照灯控制\n"); | 988 | printf("发送探照灯控制\n"); |
971 | 989 | ||
@@ -979,11 +997,11 @@ int JZsdk_Uart_SendDeal_SearchLight_Control(int Uartport,int mode) | @@ -979,11 +997,11 @@ int JZsdk_Uart_SendDeal_SearchLight_Control(int Uartport,int mode) | ||
979 | sendbuf[10] = mode; | 997 | sendbuf[10] = mode; |
980 | 998 | ||
981 | //3、发送帧 | 999 | //3、发送帧 |
982 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 1000 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
983 | } | 1001 | } |
984 | 1002 | ||
985 | //设置探照灯亮度 | 1003 | //设置探照灯亮度 |
986 | -int JZsdk_Uart_SendDeal_SearchLight_SetLumen(int Uartport, int LeftLumen, int RightLumen) | 1004 | +T_JZsdkReturnCode HalSend_type1Send_SearchLight_SetLumen(int Uartport, int LeftLumen, int RightLumen) |
987 | { | 1005 | { |
988 | printf("发送设置探照灯亮度\n"); | 1006 | printf("发送设置探照灯亮度\n"); |
989 | 1007 | ||
@@ -998,13 +1016,13 @@ int JZsdk_Uart_SendDeal_SearchLight_SetLumen(int Uartport, int LeftLumen, int | @@ -998,13 +1016,13 @@ int JZsdk_Uart_SendDeal_SearchLight_SetLumen(int Uartport, int LeftLumen, int | ||
998 | sendbuf[10] = RightLumen; | 1016 | sendbuf[10] = RightLumen; |
999 | 1017 | ||
1000 | //3、发送帧 | 1018 | //3、发送帧 |
1001 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 1019 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
1002 | } | 1020 | } |
1003 | 1021 | ||
1004 | //发送 | 1022 | //发送 |
1005 | 1023 | ||
1006 | //查询探照灯频率 | 1024 | //查询探照灯频率 |
1007 | -int JZsdk_Uart_SendDeal_Set_SearchLight_CheckStatus_Frequency(int Uartport) | 1025 | +T_JZsdkReturnCode HalSend_type1Send_CheckStatus_SearchLight_Frequency(int Uartport) |
1008 | { | 1026 | { |
1009 | printf("发送查询探照灯频率帧\n"); | 1027 | printf("发送查询探照灯频率帧\n"); |
1010 | 1028 | ||
@@ -1015,11 +1033,11 @@ int JZsdk_Uart_SendDeal_Set_SearchLight_CheckStatus_Frequency(int Uartport) | @@ -1015,11 +1033,11 @@ int JZsdk_Uart_SendDeal_Set_SearchLight_CheckStatus_Frequency(int Uartport) | ||
1015 | JZsdk_GetFrameTemplate(JZ_INSCODE_5AFRAME_CHECKSTATUS_SEARCHLIGHT_FREQUENCY, sendbuf, &send_buf_len); | 1033 | JZsdk_GetFrameTemplate(JZ_INSCODE_5AFRAME_CHECKSTATUS_SEARCHLIGHT_FREQUENCY, sendbuf, &send_buf_len); |
1016 | 1034 | ||
1017 | //2、发送帧 | 1035 | //2、发送帧 |
1018 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 1036 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
1019 | } | 1037 | } |
1020 | 1038 | ||
1021 | //查询探照灯亮度 | 1039 | //查询探照灯亮度 |
1022 | -int JZsdk_Uart_SendDeal_Set_SearchLight_CheckStatus_Lumen(int Uartport) | 1040 | +T_JZsdkReturnCode HalSend_type1Send_CheckStatus_SearchLight_Lumen(int Uartport) |
1023 | { | 1041 | { |
1024 | printf("发送查询探照灯亮度帧\n"); | 1042 | printf("发送查询探照灯亮度帧\n"); |
1025 | 1043 | ||
@@ -1030,11 +1048,11 @@ int JZsdk_Uart_SendDeal_Set_SearchLight_CheckStatus_Lumen(int Uartport) | @@ -1030,11 +1048,11 @@ int JZsdk_Uart_SendDeal_Set_SearchLight_CheckStatus_Lumen(int Uartport) | ||
1030 | JZsdk_GetFrameTemplate(JZ_INSCODE_5AFRAME_CHECKSTATUS_SEARCHLIGHT_LUMEN, sendbuf, &send_buf_len); | 1048 | JZsdk_GetFrameTemplate(JZ_INSCODE_5AFRAME_CHECKSTATUS_SEARCHLIGHT_LUMEN, sendbuf, &send_buf_len); |
1031 | 1049 | ||
1032 | //2、发送帧 | 1050 | //2、发送帧 |
1033 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 1051 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
1034 | } | 1052 | } |
1035 | 1053 | ||
1036 | //查询探照灯模式 | 1054 | //查询探照灯模式 |
1037 | -int JZsdk_Uart_SendDeal_Set_SearchLight_CheckStatus_Mode(int Uartport) | 1055 | +T_JZsdkReturnCode HalSend_type1Send_CheckStatus_SearchLight_Mode(int Uartport) |
1038 | { | 1056 | { |
1039 | printf("发送查询探照灯模式帧\n"); | 1057 | printf("发送查询探照灯模式帧\n"); |
1040 | 1058 | ||
@@ -1045,11 +1063,11 @@ int JZsdk_Uart_SendDeal_Set_SearchLight_CheckStatus_Mode(int Uartport) | @@ -1045,11 +1063,11 @@ int JZsdk_Uart_SendDeal_Set_SearchLight_CheckStatus_Mode(int Uartport) | ||
1045 | JZsdk_GetFrameTemplate(JZ_INSCODE_5AFRAME_CHECKSTATUS_SEARCHLIGHT_MODE, sendbuf, &send_buf_len); | 1063 | JZsdk_GetFrameTemplate(JZ_INSCODE_5AFRAME_CHECKSTATUS_SEARCHLIGHT_MODE, sendbuf, &send_buf_len); |
1046 | 1064 | ||
1047 | //2、发送帧 | 1065 | //2、发送帧 |
1048 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 1066 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
1049 | } | 1067 | } |
1050 | 1068 | ||
1051 | //查询探照灯属性 | 1069 | //查询探照灯属性 |
1052 | -int JZsdk_Uart_SendDeal_CheckStatus_LightAttribute(int Uartport) | 1070 | +T_JZsdkReturnCode HalSend_type1Send_CheckStatus_SearchLight_Attribute(int Uartport) |
1053 | { | 1071 | { |
1054 | printf("发送查询探照灯属性帧\n"); | 1072 | printf("发送查询探照灯属性帧\n"); |
1055 | 1073 | ||
@@ -1060,11 +1078,11 @@ int JZsdk_Uart_SendDeal_CheckStatus_LightAttribute(int Uartport) | @@ -1060,11 +1078,11 @@ int JZsdk_Uart_SendDeal_CheckStatus_LightAttribute(int Uartport) | ||
1060 | JZsdk_GetFrameTemplate(JZ_INSCODE_5AFRAME_CHECKSTATUS_SEARCHLIGHT_LIGHTATTRIBUTE, sendbuf, &send_buf_len); | 1078 | JZsdk_GetFrameTemplate(JZ_INSCODE_5AFRAME_CHECKSTATUS_SEARCHLIGHT_LIGHTATTRIBUTE, sendbuf, &send_buf_len); |
1061 | 1079 | ||
1062 | //2、发送帧 | 1080 | //2、发送帧 |
1063 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 1081 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
1064 | } | 1082 | } |
1065 | 1083 | ||
1066 | //查询探照灯温度 | 1084 | //查询探照灯温度 |
1067 | -int JZsdk_Uart_SendDeal_CheckStatus_SearchLightTemperture(int Uartport) | 1085 | +T_JZsdkReturnCode HalSend_type1Send_CheckStatus_SearchLight_Temperture(int Uartport) |
1068 | { | 1086 | { |
1069 | printf("发送查询探照灯温度\n"); | 1087 | printf("发送查询探照灯温度\n"); |
1070 | 1088 | ||
@@ -1075,11 +1093,11 @@ int JZsdk_Uart_SendDeal_CheckStatus_SearchLightTemperture(int Uartport) | @@ -1075,11 +1093,11 @@ int JZsdk_Uart_SendDeal_CheckStatus_SearchLightTemperture(int Uartport) | ||
1075 | JZsdk_GetFrameTemplate(JZ_INSCODE_5AFRAME_CHECKSTATUS_SEARCHLIGHT_TEMPERATURE, sendbuf, &send_buf_len); | 1093 | JZsdk_GetFrameTemplate(JZ_INSCODE_5AFRAME_CHECKSTATUS_SEARCHLIGHT_TEMPERATURE, sendbuf, &send_buf_len); |
1076 | 1094 | ||
1077 | //2、发送帧 | 1095 | //2、发送帧 |
1078 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 1096 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
1079 | } | 1097 | } |
1080 | 1098 | ||
1081 | //开启消息订阅 | 1099 | //开启消息订阅 |
1082 | -int JZsdk_Uart_SendDeal_MessageSubcription_Control(int Uartport, int value) | 1100 | +T_JZsdkReturnCode HalSend_type1Send_MessageSubcription_Control(int Uartport, int value) |
1083 | { | 1101 | { |
1084 | printf("发送开启消息订阅%d\n",value); | 1102 | printf("发送开启消息订阅%d\n",value); |
1085 | 1103 | ||
@@ -1093,7 +1111,7 @@ int JZsdk_Uart_SendDeal_MessageSubcription_Control(int Uartport, int value) | @@ -1093,7 +1111,7 @@ int JZsdk_Uart_SendDeal_MessageSubcription_Control(int Uartport, int value) | ||
1093 | sendbuf[10] = value; | 1111 | sendbuf[10] = value; |
1094 | 1112 | ||
1095 | //3、发送帧 | 1113 | //3、发送帧 |
1096 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 1114 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
1097 | } | 1115 | } |
1098 | 1116 | ||
1099 | /**************************************************************************************************************************************************** | 1117 | /**************************************************************************************************************************************************** |
@@ -1106,7 +1124,7 @@ int JZsdk_Uart_SendDeal_MessageSubcription_Control(int Uartport, int value) | @@ -1106,7 +1124,7 @@ int JZsdk_Uart_SendDeal_MessageSubcription_Control(int Uartport, int value) | ||
1106 | * 设置警灯状态 | 1124 | * 设置警灯状态 |
1107 | * | 1125 | * |
1108 | * **************/ | 1126 | * **************/ |
1109 | -int JZsdk_Uart_SendDeal_Set_WarningLight_Status(int Uartport,int status, int mode) | 1127 | +T_JZsdkReturnCode HalSend_type1Send_Set_WarningLight_Status(int Uartport,int status, int mode) |
1110 | { | 1128 | { |
1111 | printf("发送设置警灯状态\n"); | 1129 | printf("发送设置警灯状态\n"); |
1112 | 1130 | ||
@@ -1121,7 +1139,7 @@ int JZsdk_Uart_SendDeal_Set_WarningLight_Status(int Uartport,int status, int mod | @@ -1121,7 +1139,7 @@ int JZsdk_Uart_SendDeal_Set_WarningLight_Status(int Uartport,int status, int mod | ||
1121 | sendbuf[10] = mode; | 1139 | sendbuf[10] = mode; |
1122 | 1140 | ||
1123 | //3、发送帧 | 1141 | //3、发送帧 |
1124 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 1142 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
1125 | } | 1143 | } |
1126 | 1144 | ||
1127 | /************* | 1145 | /************* |
@@ -1129,7 +1147,7 @@ int JZsdk_Uart_SendDeal_Set_WarningLight_Status(int Uartport,int status, int mod | @@ -1129,7 +1147,7 @@ int JZsdk_Uart_SendDeal_Set_WarningLight_Status(int Uartport,int status, int mod | ||
1129 | * 设置警灯颜色 | 1147 | * 设置警灯颜色 |
1130 | * | 1148 | * |
1131 | * **************/ | 1149 | * **************/ |
1132 | -int JZsdk_Uart_SendDeal_Set_WarningLight_Color(int Uartport,int color1, int color2) | 1150 | +T_JZsdkReturnCode HalSend_type1Send_Set_WarningLight_Color(int Uartport,int color1, int color2) |
1133 | { | 1151 | { |
1134 | printf("发送设置警灯颜色\n"); | 1152 | printf("发送设置警灯颜色\n"); |
1135 | 1153 | ||
@@ -1144,11 +1162,11 @@ int JZsdk_Uart_SendDeal_Set_WarningLight_Color(int Uartport,int color1, int colo | @@ -1144,11 +1162,11 @@ int JZsdk_Uart_SendDeal_Set_WarningLight_Color(int Uartport,int color1, int colo | ||
1144 | sendbuf[10] = color2; | 1162 | sendbuf[10] = color2; |
1145 | 1163 | ||
1146 | //3、发送帧 | 1164 | //3、发送帧 |
1147 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 1165 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
1148 | } | 1166 | } |
1149 | 1167 | ||
1150 | //查询警灯状态 | 1168 | //查询警灯状态 |
1151 | -int JZsdk_Uart_SendDeal_CheckStatus_WarningLightStatus(int Uartport) | 1169 | +T_JZsdkReturnCode HalSend_type1Send_CheckStatus_WarningLightStatus(int Uartport) |
1152 | { | 1170 | { |
1153 | printf("发送查询警灯状态\n"); | 1171 | printf("发送查询警灯状态\n"); |
1154 | 1172 | ||
@@ -1159,11 +1177,11 @@ int JZsdk_Uart_SendDeal_CheckStatus_WarningLightStatus(int Uartport) | @@ -1159,11 +1177,11 @@ int JZsdk_Uart_SendDeal_CheckStatus_WarningLightStatus(int Uartport) | ||
1159 | JZsdk_GetFrameTemplate(JZ_INSCODE_5AFRAME_CHECKSTATUS_WARNINGLIGHT_STATUS, sendbuf, &send_buf_len); | 1177 | JZsdk_GetFrameTemplate(JZ_INSCODE_5AFRAME_CHECKSTATUS_WARNINGLIGHT_STATUS, sendbuf, &send_buf_len); |
1160 | 1178 | ||
1161 | //2、发送帧 | 1179 | //2、发送帧 |
1162 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 1180 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
1163 | } | 1181 | } |
1164 | 1182 | ||
1165 | //查询警灯颜色 | 1183 | //查询警灯颜色 |
1166 | -int JZsdk_Uart_SendDeal_CheckStatus_WarningLightColor(int Uartport) | 1184 | +T_JZsdkReturnCode HalSend_type1Send_CheckStatus_WarningLightColor(int Uartport) |
1167 | { | 1185 | { |
1168 | printf("发送查询警灯颜色\n"); | 1186 | printf("发送查询警灯颜色\n"); |
1169 | 1187 | ||
@@ -1174,7 +1192,7 @@ int JZsdk_Uart_SendDeal_CheckStatus_WarningLightColor(int Uartport) | @@ -1174,7 +1192,7 @@ int JZsdk_Uart_SendDeal_CheckStatus_WarningLightColor(int Uartport) | ||
1174 | JZsdk_GetFrameTemplate(JZ_INSCODE_5AFRAME_CHECKSTATUS_WARNINGLIGHT_COLOR, sendbuf, &send_buf_len); | 1192 | JZsdk_GetFrameTemplate(JZ_INSCODE_5AFRAME_CHECKSTATUS_WARNINGLIGHT_COLOR, sendbuf, &send_buf_len); |
1175 | 1193 | ||
1176 | //2、发送帧 | 1194 | //2、发送帧 |
1177 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 1195 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
1178 | } | 1196 | } |
1179 | 1197 | ||
1180 | /**************************************************************************************************************************************************** | 1198 | /**************************************************************************************************************************************************** |
@@ -1188,7 +1206,7 @@ int JZsdk_Uart_SendDeal_CheckStatus_WarningLightColor(int Uartport) | @@ -1188,7 +1206,7 @@ int JZsdk_Uart_SendDeal_CheckStatus_WarningLightColor(int Uartport) | ||
1188 | * 发送探照灯爆闪频率 | 1206 | * 发送探照灯爆闪频率 |
1189 | * | 1207 | * |
1190 | * **************/ | 1208 | * **************/ |
1191 | -int JZsdk_Uart_SendDeal_SearchLight_Frequency(int Uartport, int Frequency) | 1209 | +T_JZsdkReturnCode HalSend_type1Send_SearchLight_Frequency(int Uartport, int Frequency) |
1192 | { | 1210 | { |
1193 | printf("发送灯光频率帧\n"); | 1211 | printf("发送灯光频率帧\n"); |
1194 | 1212 | ||
@@ -1202,7 +1220,7 @@ int JZsdk_Uart_SendDeal_SearchLight_Frequency(int Uartport, int Frequency) | @@ -1202,7 +1220,7 @@ int JZsdk_Uart_SendDeal_SearchLight_Frequency(int Uartport, int Frequency) | ||
1202 | sendbuf[10] = Frequency; | 1220 | sendbuf[10] = Frequency; |
1203 | 1221 | ||
1204 | //3、发送帧 | 1222 | //3、发送帧 |
1205 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 1223 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
1206 | } | 1224 | } |
1207 | 1225 | ||
1208 | /************* | 1226 | /************* |
@@ -1210,7 +1228,7 @@ int JZsdk_Uart_SendDeal_SearchLight_Frequency(int Uartport, int Frequency) | @@ -1210,7 +1228,7 @@ int JZsdk_Uart_SendDeal_SearchLight_Frequency(int Uartport, int Frequency) | ||
1210 | * 发送探照灯模式 | 1228 | * 发送探照灯模式 |
1211 | * | 1229 | * |
1212 | * **************/ | 1230 | * **************/ |
1213 | -int JZsdk_Uart_SendDeal_SearchLight_Mode(int Uartport, int mode) | 1231 | +T_JZsdkReturnCode HalSend_type1Send_SearchLight_Mode(int Uartport, int mode) |
1214 | { | 1232 | { |
1215 | printf("发送探照灯模式帧\n"); | 1233 | printf("发送探照灯模式帧\n"); |
1216 | 1234 | ||
@@ -1224,7 +1242,7 @@ int JZsdk_Uart_SendDeal_SearchLight_Mode(int Uartport, int mode) | @@ -1224,7 +1242,7 @@ int JZsdk_Uart_SendDeal_SearchLight_Mode(int Uartport, int mode) | ||
1224 | sendbuf[10] = mode; | 1242 | sendbuf[10] = mode; |
1225 | 1243 | ||
1226 | //3、发送帧 | 1244 | //3、发送帧 |
1227 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 1245 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
1228 | } | 1246 | } |
1229 | 1247 | ||
1230 | /************* | 1248 | /************* |
@@ -1232,7 +1250,7 @@ int JZsdk_Uart_SendDeal_SearchLight_Mode(int Uartport, int mode) | @@ -1232,7 +1250,7 @@ int JZsdk_Uart_SendDeal_SearchLight_Mode(int Uartport, int mode) | ||
1232 | * 发送探照灯亮度 | 1250 | * 发送探照灯亮度 |
1233 | * | 1251 | * |
1234 | * **************/ | 1252 | * **************/ |
1235 | -int JZsdk_Uart_SendDeal_SearchLight_Lumen(int Uartport,int LeftLumen, int RightLumen) | 1253 | +T_JZsdkReturnCode HalSend_type1Send_SearchLight_Lumen(int Uartport,int LeftLumen, int RightLumen) |
1236 | { | 1254 | { |
1237 | printf("发送探照灯亮度帧\n"); | 1255 | printf("发送探照灯亮度帧\n"); |
1238 | 1256 | ||
@@ -1247,7 +1265,7 @@ int JZsdk_Uart_SendDeal_SearchLight_Lumen(int Uartport,int LeftLumen, int RightL | @@ -1247,7 +1265,7 @@ int JZsdk_Uart_SendDeal_SearchLight_Lumen(int Uartport,int LeftLumen, int RightL | ||
1247 | sendbuf[10] = RightLumen; | 1265 | sendbuf[10] = RightLumen; |
1248 | 1266 | ||
1249 | //3、发送帧 | 1267 | //3、发送帧 |
1250 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 1268 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
1251 | } | 1269 | } |
1252 | 1270 | ||
1253 | /************* | 1271 | /************* |
@@ -1255,7 +1273,7 @@ int JZsdk_Uart_SendDeal_SearchLight_Lumen(int Uartport,int LeftLumen, int RightL | @@ -1255,7 +1273,7 @@ int JZsdk_Uart_SendDeal_SearchLight_Lumen(int Uartport,int LeftLumen, int RightL | ||
1255 | * 发送探照灯温度 | 1273 | * 发送探照灯温度 |
1256 | * | 1274 | * |
1257 | * **************/ | 1275 | * **************/ |
1258 | -int JZsdk_Uart_SendDeal_SearchLight_Temperature(int Uartport, int LeftTemperature, int RightTemperature) | 1276 | +T_JZsdkReturnCode HalSend_type1Send_SearchLight_Temperature(int Uartport, int LeftTemperature, int RightTemperature) |
1259 | { | 1277 | { |
1260 | printf("发送探照灯温度帧\n"); | 1278 | printf("发送探照灯温度帧\n"); |
1261 | 1279 | ||
@@ -1270,7 +1288,7 @@ int JZsdk_Uart_SendDeal_SearchLight_Temperature(int Uartport, int LeftTemperatur | @@ -1270,7 +1288,7 @@ int JZsdk_Uart_SendDeal_SearchLight_Temperature(int Uartport, int LeftTemperatur | ||
1270 | sendbuf[10] = RightTemperature; | 1288 | sendbuf[10] = RightTemperature; |
1271 | 1289 | ||
1272 | //3、发送帧 | 1290 | //3、发送帧 |
1273 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 1291 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
1274 | } | 1292 | } |
1275 | 1293 | ||
1276 | 1294 | ||
@@ -1279,7 +1297,7 @@ int JZsdk_Uart_SendDeal_SearchLight_Temperature(int Uartport, int LeftTemperatur | @@ -1279,7 +1297,7 @@ int JZsdk_Uart_SendDeal_SearchLight_Temperature(int Uartport, int LeftTemperatur | ||
1279 | * 发送警灯状态 | 1297 | * 发送警灯状态 |
1280 | * | 1298 | * |
1281 | * **************/ | 1299 | * **************/ |
1282 | -int JZsdk_Uart_SendDeal_WarningLight_Status(int Uartport, int status, int mode) | 1300 | +T_JZsdkReturnCode HalSend_type1Send_WarningLight_Status(int Uartport, int status, int mode) |
1283 | { | 1301 | { |
1284 | printf("发送警灯状态帧\n"); | 1302 | printf("发送警灯状态帧\n"); |
1285 | 1303 | ||
@@ -1294,14 +1312,14 @@ int JZsdk_Uart_SendDeal_WarningLight_Status(int Uartport, int status, int mode) | @@ -1294,14 +1312,14 @@ int JZsdk_Uart_SendDeal_WarningLight_Status(int Uartport, int status, int mode) | ||
1294 | sendbuf[10] = mode; | 1312 | sendbuf[10] = mode; |
1295 | 1313 | ||
1296 | //3、发送帧 | 1314 | //3、发送帧 |
1297 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); } | 1315 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1);} |
1298 | 1316 | ||
1299 | /************* | 1317 | /************* |
1300 | * | 1318 | * |
1301 | * 发送警灯颜色 | 1319 | * 发送警灯颜色 |
1302 | * | 1320 | * |
1303 | * **************/ | 1321 | * **************/ |
1304 | -int JZsdk_Uart_SendDeal_WarningLight_Color(int Uartport, int color1, int color2) | 1322 | +T_JZsdkReturnCode HalSend_type1Send_WarningLight_Color(int Uartport, int color1, int color2) |
1305 | { | 1323 | { |
1306 | printf("发送警灯颜色帧\n"); | 1324 | printf("发送警灯颜色帧\n"); |
1307 | 1325 | ||
@@ -1316,7 +1334,7 @@ int JZsdk_Uart_SendDeal_WarningLight_Color(int Uartport, int color1, int color2) | @@ -1316,7 +1334,7 @@ int JZsdk_Uart_SendDeal_WarningLight_Color(int Uartport, int color1, int color2) | ||
1316 | sendbuf[10] = color2; | 1334 | sendbuf[10] = color2; |
1317 | 1335 | ||
1318 | //3、发送帧 | 1336 | //3、发送帧 |
1319 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 1337 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
1320 | } | 1338 | } |
1321 | 1339 | ||
1322 | /************* | 1340 | /************* |
@@ -1324,7 +1342,7 @@ int JZsdk_Uart_SendDeal_WarningLight_Color(int Uartport, int color1, int color2) | @@ -1324,7 +1342,7 @@ int JZsdk_Uart_SendDeal_WarningLight_Color(int Uartport, int color1, int color2) | ||
1324 | * 发送对外电源状态 | 1342 | * 发送对外电源状态 |
1325 | * | 1343 | * |
1326 | * **************/ | 1344 | * **************/ |
1327 | -int JZsdk_Uart_SendDeal_OutputPowerStatus(int Uartport, int FrameSequence, int status) | 1345 | +T_JZsdkReturnCode HalSend_type1Send_OutputPowerStatus(int Uartport, int FrameSequence, int status) |
1328 | { | 1346 | { |
1329 | printf("发送对外电源状态帧\n"); | 1347 | printf("发送对外电源状态帧\n"); |
1330 | 1348 | ||
@@ -1338,7 +1356,7 @@ int JZsdk_Uart_SendDeal_OutputPowerStatus(int Uartport, int FrameSequence, int s | @@ -1338,7 +1356,7 @@ int JZsdk_Uart_SendDeal_OutputPowerStatus(int Uartport, int FrameSequence, int s | ||
1338 | sendbuf[9] = status; | 1356 | sendbuf[9] = status; |
1339 | 1357 | ||
1340 | //3、发送帧 | 1358 | //3、发送帧 |
1341 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 1359 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
1342 | } | 1360 | } |
1343 | 1361 | ||
1344 | /**************************************************************************************************************************************************** | 1362 | /**************************************************************************************************************************************************** |
@@ -1347,7 +1365,7 @@ int JZsdk_Uart_SendDeal_OutputPowerStatus(int Uartport, int FrameSequence, int s | @@ -1347,7 +1365,7 @@ int JZsdk_Uart_SendDeal_OutputPowerStatus(int Uartport, int FrameSequence, int s | ||
1347 | * | 1365 | * |
1348 | ****************************************************************************************************************************************************/ | 1366 | ****************************************************************************************************************************************************/ |
1349 | //发送特殊参数 | 1367 | //发送特殊参数 |
1350 | -int JZsdk_Uart_Reply_CheckSpecialParameters(int Uartport,int FrameSequence,int type, int value) | 1368 | +T_JZsdkReturnCode HalSend_type1Send_Reply_CheckSpecialParameters(int Uartport,int FrameSequence,int type, int value) |
1351 | { | 1369 | { |
1352 | printf("发送特殊参数帧\n"); | 1370 | printf("发送特殊参数帧\n"); |
1353 | unsigned char sendbuf[256]; | 1371 | unsigned char sendbuf[256]; |
@@ -1362,5 +1380,5 @@ int JZsdk_Uart_Reply_CheckSpecialParameters(int Uartport,int FrameSequence,int t | @@ -1362,5 +1380,5 @@ int JZsdk_Uart_Reply_CheckSpecialParameters(int Uartport,int FrameSequence,int t | ||
1362 | sendbuf[10] = value; | 1380 | sendbuf[10] = value; |
1363 | 1381 | ||
1364 | //3、发送帧 | 1382 | //3、发送帧 |
1365 | - JZsdk_Uart_UartSend(Uartport ,sendbuf, send_buf_len); | 1383 | + HalSend_SendData(Uartport ,sendbuf, send_buf_len, 1); |
1366 | } | 1384 | } |
1 | +/** | ||
2 | + ******************************************************************** | ||
3 | + * @file JZsdk_Uart_SendDeal.h | ||
4 | + * | ||
5 | + * | ||
6 | + ********************************************************************* | ||
7 | + */ | ||
8 | + | ||
9 | +/* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/ | ||
10 | +#ifndef JZSDK_IART_SENDDEAL_H | ||
11 | +#define JZSDK_IART_SENDDEAL_H | ||
12 | + | ||
13 | +/* Includes ------------------------------------------------------------------*/ | ||
14 | +#include "JZsdk_Base/JZsdk_Code/JZsdk_Code.h" | ||
15 | + | ||
16 | +#ifdef __cplusplus | ||
17 | +extern "C" { | ||
18 | +#endif | ||
19 | + | ||
20 | +/* Exported constants --------------------------------------------------------*/ | ||
21 | +/* 常亮定义*/ | ||
22 | + | ||
23 | + | ||
24 | +/* Exported types ------------------------------------------------------------*/ | ||
25 | +T_JZsdkReturnCode HalSend_type1Send_Reply_Success(int Uartport ,int FrameSequence); | ||
26 | +T_JZsdkReturnCode HalSend_type1Send_Send_Connect(int Uartport , int FrameSequence,int Version_flag); | ||
27 | +T_JZsdkReturnCode HalSend_type1Send_ConnectFrame(int PortNum); | ||
28 | +T_JZsdkReturnCode HalSend_type1Send_Send_HeartBeatStatus(int Uartport , int FrameSequence,int HeartBeatStatus); | ||
29 | + | ||
30 | +T_JZsdkReturnCode HalSend_type1Send_Set_PowerStatus(int Uartport, int FrameSequence, int status); | ||
31 | +T_JZsdkReturnCode HalSend_type1Send_Ask_HeartBeatStatus(int Uartport , int FrameSequence,int HeartBeatStatus); | ||
32 | +T_JZsdkReturnCode HalSend_type1Send_Ask_TimeStamp(int Uartport , int FrameSequence); | ||
33 | +T_JZsdkReturnCode HalSend_type1Send_SendAllVersion(int Uartport, int FrameSequence, int DeviceID, int MajorVersion, int MinorVersion, int ModifyVersion, int DebugVersion); | ||
34 | +T_JZsdkReturnCode HalSend_type1Send_SendAllSerialNumber(int Uartport, int FrameSequence, int DeviceID, unsigned char *SerialNumber, int SerialNumberLen); | ||
35 | +T_JZsdkReturnCode HalSend_type1Send_DeviceMessage(int UartPort, int FrameSequence, unsigned char *message, unsigned int messageLen); | ||
36 | + | ||
37 | +T_JZsdkReturnCode HalSend_type1Send_Reply_SecondaryDeviceName(int Uartport , int device_name, int FrameSequence); | ||
38 | +T_JZsdkReturnCode HalSend_type1Send_QuerySecondaryDeviceName(int Uartport ,int FrameSequence); | ||
39 | + | ||
40 | + | ||
41 | + | ||
42 | +T_JZsdkReturnCode HalSend_type1Send_Reply_Sucesss(int Uartport ,int FrameSequence); | ||
43 | +T_JZsdkReturnCode HalSend_type1Send_Reply_CheckError(int Uartport ,int FrameSequence); | ||
44 | +T_JZsdkReturnCode HalSend_type1Send_Reply_DecodeError(int Uartport ,int FrameSequence); | ||
45 | + | ||
46 | + | ||
47 | + | ||
48 | +T_JZsdkReturnCode HalSend_type1Send_Reply_Failure(int Uartport ,int FrameSequence); | ||
49 | +T_JZsdkReturnCode HalSend_type1Send_Reply_Musiclist(int UartPort ,int FrameSequence, int music_sum ,unsigned char **MusicName ,int *MusicNameLength); | ||
50 | +T_JZsdkReturnCode HalSend_type1Send_Send_AudioList_2(int Uartport, int FrameSequence, unsigned char *name, unsigned int namelen, unsigned int Filesize, unsigned int Time); | ||
51 | +T_JZsdkReturnCode HalSend_type1Send_Send_AudioDetailMessage(int Uartport,int FrameSequence, unsigned char type ,unsigned char *data, unsigned int datalen); | ||
52 | +T_JZsdkReturnCode HalSend_type1Send_Send_AudioList_Start(int Uartport, int FrameSequence, int music_sum); | ||
53 | +T_JZsdkReturnCode HalSend_type1Send_Send_AudioList_Stop(int Uartport, int FrameSequence); | ||
54 | + | ||
55 | + | ||
56 | + | ||
57 | +T_JZsdkReturnCode HalSend_type1Send_Send_PlayStatus_end(int Uartport); | ||
58 | +T_JZsdkReturnCode HalSend_type1Send_Send_PlayStatus(int Uartport ,int num); | ||
59 | +T_JZsdkReturnCode HalSend_type1Send_Reply_MusicName(int Uartport ,char *music_name, int music_name_len); | ||
60 | +T_JZsdkReturnCode HalSend_type1Send_Reply_Volume(int Uartport ,int num); | ||
61 | +T_JZsdkReturnCode HalSend_type1Send_OpusDecodeStatus(int Uartport,int value); | ||
62 | + | ||
63 | +T_JZsdkReturnCode HalSend_type1Send_Reply_GimbalPitchAngle(int Uartport ,int angle); | ||
64 | +T_JZsdkReturnCode HalSend_type1Send_Set_GimbalPitchAngle(int Uartport ,int angle); | ||
65 | +T_JZsdkReturnCode HalSend_type1Send_Reply_GimbalFineTuningPitch(int Uartport, int FrameSequence, int FineTunigPitch); | ||
66 | +T_JZsdkReturnCode HalSend_type1Send_Set_GimbalFineTuningPitch(int Uartport, int PitchFineTuning); | ||
67 | +T_JZsdkReturnCode HalSend_type1Send_CheckStatus_GimbalFineTuningPitch(int Uartport, int FrameSequence); | ||
68 | +T_JZsdkReturnCode HalSend_type1Send_Set_GimbalLinkageControl(int Uartport,int FrameSequence, int value); | ||
69 | +T_JZsdkReturnCode HalSend_type1Send_CheckStatus_GimbalLinkage(int Uartport,int FrameSequence); | ||
70 | +T_JZsdkReturnCode HalSend_type1Send_GimbalLinkageControl(int Uartport,int FrameSequence,int value); | ||
71 | +T_JZsdkReturnCode HalSend_type1Send_CheckStatus_GimbalAngle(int Uartport ,int FrameSequence); | ||
72 | +T_JZsdkReturnCode HalSend_type1Send_SetGimbalRange(int Uartport,int FrameSequence,int value); | ||
73 | + | ||
74 | + | ||
75 | +T_JZsdkReturnCode HalSend_type1Send_Reply_SoftVersion(int Uartport ,char majorVersion, char minorVersion, char modifyVersion, char debugVersion); | ||
76 | +T_JZsdkReturnCode HalSend_type1Send_Reply_LoopPlayStatus(int Uartport ,int status); | ||
77 | +T_JZsdkReturnCode HalSend_type1Send_Reply_TTS_tone(int Uartport ,int tone); | ||
78 | +T_JZsdkReturnCode HalSend_type1Send_Reply_TTS_speed(int Uartport ,int speed); | ||
79 | + | ||
80 | +T_JZsdkReturnCode HalSend_type1Send_Set_SearchLightFrequency(int Uartport ,int Frequency); | ||
81 | +T_JZsdkReturnCode HalSend_type1Send_SearchLight_Control(int Uartport,int mode); | ||
82 | +T_JZsdkReturnCode HalSend_type1Send_SearchLight_SetLumen(int Uartport, int LeftLumen, int RightLumen); | ||
83 | +T_JZsdkReturnCode HalSend_type1Send_MessageSubcription_Control(int Uartport, int value); | ||
84 | + | ||
85 | +T_JZsdkReturnCode HalSend_type1Send_Set_WarningLight_Status(int Uartport,int status, int mode); | ||
86 | +T_JZsdkReturnCode HalSend_type1Send_Set_WarningLight_Color(int Uartport,int color1, int color2); | ||
87 | + | ||
88 | +T_JZsdkReturnCode HalSend_type1Send_SerialNumber(int UartPort, int FrameSequence, char *SerialNumber, int SerialNumberLenth); | ||
89 | +T_JZsdkReturnCode HalSend_type1Send_Reply_CheckSpecialParameters(int Uartport,int FrameSequence,int type, int value); | ||
90 | + | ||
91 | + | ||
92 | + | ||
93 | + | ||
94 | + | ||
95 | + | ||
96 | +T_JZsdkReturnCode HalSend_type1Send_SearchLight_Frequency(int Uartport, int Frequency); | ||
97 | +T_JZsdkReturnCode HalSend_type1Send_SearchLight_Mode(int Uartport, int mode); | ||
98 | +T_JZsdkReturnCode HalSend_type1Send_SearchLight_Lumen(int Uartport,int LeftLumen, int RightLumen); | ||
99 | +T_JZsdkReturnCode HalSend_type1Send_SearchLight_Temperature(int Uartport, int LeftTemperature, int RightTemperature); | ||
100 | + | ||
101 | + | ||
102 | +//查询探照灯频率 | ||
103 | +T_JZsdkReturnCode HalSend_type1Send_CheckStatus_SearchLight_Frequency(int Uartport); | ||
104 | +T_JZsdkReturnCode HalSend_type1Send_CheckStatus_SearchLight_Lumen(int Uartport); | ||
105 | +T_JZsdkReturnCode HalSend_type1Send_CheckStatus_SearchLight_Mode(int Uartport); | ||
106 | +T_JZsdkReturnCode HalSend_type1Send_CheckStatus_SearchLight_Attribute(int Uartport); | ||
107 | +T_JZsdkReturnCode HalSend_type1Send_CheckStatus_SearchLight_Temperture(int Uartport); | ||
108 | + | ||
109 | + | ||
110 | +T_JZsdkReturnCode HalSend_type1Send_WarningLight_Status(int Uartport, int status, int mode); | ||
111 | +T_JZsdkReturnCode HalSend_type1Send_WarningLight_Color(int Uartport, int color1, int color2); | ||
112 | +T_JZsdkReturnCode HalSend_type1Send_CheckStatus_WarningLightStatus(int Uartport); | ||
113 | +T_JZsdkReturnCode HalSend_type1Send_CheckStatus_WarningLightColor(int Uartport); | ||
114 | + | ||
115 | +T_JZsdkReturnCode HalSend_type1Send_OutputPowerStatus(int Uartport, int FrameSequence, int status); | ||
116 | + | ||
117 | + | ||
118 | +/* Exported functions --------------------------------------------------------*/ | ||
119 | + | ||
120 | +#ifdef __cplusplus | ||
121 | +} | ||
122 | +#endif | ||
123 | + | ||
124 | +#endif |
JZsdk_hal/JZsdk_Hal.c
0 → 100644
1 | +#include <stdio.h> | ||
2 | + | ||
3 | +#include "JZsdkLib.h" | ||
4 | +#include "Hal_Recv/HalRecv.h" | ||
5 | +#include "Hal_Send/HalSend.h" | ||
6 | +#include "JZsdk_Hal.h" | ||
7 | +#include "BaseConfig.h" | ||
8 | + | ||
9 | +#include "JZsdk_uart/JZsdk_Uart.h" | ||
10 | + | ||
11 | +/****************** | ||
12 | + * | ||
13 | + * 用来记录端口使用情况的结构体 | ||
14 | + * JZ_FLAGCODE_OFF 关闭 | ||
15 | + * JZ_FLAGCODE_ON 开启 | ||
16 | + * ********************/ | ||
17 | +typedef struct s_JZsdk_Hal_PortUseFlag | ||
18 | +{ | ||
19 | + int UartDev_DEV1 ; | ||
20 | + int UartDev_DEV2 ; | ||
21 | + int UartDev_DEV3 ; | ||
22 | + int UartDev_DEV4 ; | ||
23 | + int UartDev_4G ; | ||
24 | + int Data_Dransmisson; | ||
25 | +}s_JZsdk_Hal_PortUseFlag; | ||
26 | + | ||
27 | +static s_JZsdk_Hal_PortUseFlag g_PortUseFlag = {JZ_FLAGCODE_OFF}; | ||
28 | + | ||
29 | +/************** | ||
30 | + * | ||
31 | + * jzsdk hal的端口使用标志位 | ||
32 | + * | ||
33 | + * | ||
34 | + * *********************/ | ||
35 | +int JZsdk_HalPort_UseFlag(int PortName) | ||
36 | +{ | ||
37 | + if (PortName == UART_DEV_1) | ||
38 | + { | ||
39 | + return g_PortUseFlag.UartDev_DEV1; | ||
40 | + } | ||
41 | + else if (PortName == UART_DEV_2) | ||
42 | + { | ||
43 | + return g_PortUseFlag.UartDev_DEV2; | ||
44 | + } | ||
45 | + else if (PortName == UART_DEV_3) | ||
46 | + { | ||
47 | + return g_PortUseFlag.UartDev_DEV3; | ||
48 | + } | ||
49 | + else if (PortName == UART_DEV_4) | ||
50 | + { | ||
51 | + return g_PortUseFlag.UartDev_DEV4; | ||
52 | + } | ||
53 | + else if (PortName == UART_4G) | ||
54 | + { | ||
55 | + return g_PortUseFlag.UartDev_4G; | ||
56 | + } | ||
57 | + else if (PortName == HAL_DATA_TRANSMISSION) | ||
58 | + { | ||
59 | + return g_PortUseFlag.Data_Dransmisson; | ||
60 | + } | ||
61 | +} | ||
62 | + | ||
63 | +T_JZsdkReturnCode JZsdk_HalPort_SetUseFlag(int PortName,int UseFlag) | ||
64 | +{ | ||
65 | + if (PortName == UART_DEV_1) | ||
66 | + { | ||
67 | + g_PortUseFlag.UartDev_DEV1 = UseFlag; | ||
68 | + } | ||
69 | + else if (PortName == UART_DEV_2) | ||
70 | + { | ||
71 | + g_PortUseFlag.UartDev_DEV2 = UseFlag; | ||
72 | + } | ||
73 | + else if (PortName == UART_DEV_3) | ||
74 | + { | ||
75 | + g_PortUseFlag.UartDev_DEV3 = UseFlag; | ||
76 | + } | ||
77 | + else if (PortName == UART_DEV_4) | ||
78 | + { | ||
79 | + g_PortUseFlag.UartDev_DEV4 = UseFlag; | ||
80 | + } | ||
81 | + else if (PortName == UART_4G) | ||
82 | + { | ||
83 | + g_PortUseFlag.UartDev_4G = UseFlag; | ||
84 | + } | ||
85 | + else if (PortName == HAL_DATA_TRANSMISSION) | ||
86 | + { | ||
87 | + g_PortUseFlag.Data_Dransmisson = UseFlag; | ||
88 | + } | ||
89 | + else | ||
90 | + { | ||
91 | + return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE; | ||
92 | + } | ||
93 | + | ||
94 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
95 | +} | ||
96 | + | ||
97 | +/********************** | ||
98 | + * | ||
99 | + * hal端口 重初始化函数 | ||
100 | + * | ||
101 | + * | ||
102 | + * ******************/ | ||
103 | +T_JZsdkReturnCode JZsdk_HalPort_ReInit(int PortName, int Value[]) | ||
104 | +{ | ||
105 | + switch (PortName) | ||
106 | + { | ||
107 | + case UART_DEV_1: | ||
108 | + JZsdk_Uart_ReInit(PortName, Value[0]); | ||
109 | + break; | ||
110 | + | ||
111 | + case UART_DEV_2: | ||
112 | + JZsdk_Uart_ReInit(PortName, Value[0]); | ||
113 | + break; | ||
114 | + | ||
115 | + case UART_DEV_3: | ||
116 | + JZsdk_Uart_ReInit(PortName, Value[0]); | ||
117 | + break; | ||
118 | + | ||
119 | + case UART_DEV_4: | ||
120 | + JZsdk_Uart_ReInit(PortName, Value[0]); | ||
121 | + break; | ||
122 | + | ||
123 | + case UART_4G: | ||
124 | + JZsdk_Uart_ReInit(PortName, Value[0]); | ||
125 | + break; | ||
126 | + | ||
127 | + default: | ||
128 | + break; | ||
129 | + } | ||
130 | +} | ||
131 | + | ||
132 | +/********************** | ||
133 | + * | ||
134 | + * hal端口 使用默认参数初始化函数 | ||
135 | + * | ||
136 | + * ******************/ | ||
137 | +T_JZsdkReturnCode JZsdk_HalPort_Init_WithDefault(int PortName) | ||
138 | +{ | ||
139 | + int value[5] = {0, 0, 0, 0, 0}; | ||
140 | + | ||
141 | + if (PortName == UART_DEV_1) | ||
142 | + { | ||
143 | + value[0] = UART_DEV1_BITRATE; | ||
144 | + } | ||
145 | + else if (PortName == UART_DEV_2) | ||
146 | + { | ||
147 | + value[0] = UART_DEV2_BITRATE; | ||
148 | + } | ||
149 | + else if (PortName == UART_4G) | ||
150 | + { | ||
151 | + value[0] = COMM_4G_UART_BITRATE; | ||
152 | + } | ||
153 | + | ||
154 | + return JZsdk_HalPort_ReInit(PortName, value); | ||
155 | +} |
JZsdk_hal/JZsdk_Hal.h
0 → 100644
1 | +/** | ||
2 | + ******************************************************************** | ||
3 | + * @file JZsdk_Hal.h | ||
4 | + * JZsdk_Hal.c 的头文件 | ||
5 | + * @version V0.1.0 | ||
6 | + * @date | ||
7 | + * @brief This is the JZsdk_Hal.h file | ||
8 | + * | ||
9 | + * @attention | ||
10 | + * | ||
11 | + * | ||
12 | + ********************************************************************* | ||
13 | + | ||
14 | +/* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/ | ||
15 | +#ifndef JZSDK_HAL_H | ||
16 | +#define JZSDK_HAL_H | ||
17 | + | ||
18 | +/* Includes ------------------------------------------------------------------*/ | ||
19 | + | ||
20 | +#ifdef __cplusplus | ||
21 | +extern "C" { | ||
22 | +#endif | ||
23 | + | ||
24 | + | ||
25 | +/* Exported constants --------------------------------------------------------*/ | ||
26 | +/* 常亮定义*/ | ||
27 | + | ||
28 | +/* Exported types ------------------------------------------------------------*/ | ||
29 | + | ||
30 | +/* Exported functions --------------------------------------------------------*/ | ||
31 | +int JZsdk_HalPort_UseFlag(int PortName); | ||
32 | +T_JZsdkReturnCode JZsdk_HalPort_SetUseFlag(int PortName,int UseFlag); | ||
33 | +T_JZsdkReturnCode JZsdk_HalPort_ReInit(int PortName, int Value[]); | ||
34 | +T_JZsdkReturnCode JZsdk_HalPort_Init_WithDefault(int PortName); | ||
35 | + | ||
36 | + | ||
37 | +#ifdef __cplusplus | ||
38 | +} | ||
39 | +#endif | ||
40 | + | ||
41 | +#endif |
@@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
8 | #include "JZsdk_Base/JZsdk_FrameComparsion/JZsdk_FrameComparsion.h" | 8 | #include "JZsdk_Base/JZsdk_FrameComparsion/JZsdk_FrameComparsion.h" |
9 | #include "JZsdk_uart/JZsdk_Uart_UartDeal.h" | 9 | #include "JZsdk_uart/JZsdk_Uart_UartDeal.h" |
10 | #include "BaseConfig.h" | 10 | #include "BaseConfig.h" |
11 | +#include "Hal_Recv/HalRecv.h" | ||
11 | 12 | ||
12 | typedef struct | 13 | typedef struct |
13 | { | 14 | { |
@@ -365,7 +366,7 @@ static void *JZsdk_hal_data_deal(void *arg) | @@ -365,7 +366,7 @@ static void *JZsdk_hal_data_deal(void *arg) | ||
365 | } | 366 | } |
366 | 367 | ||
367 | // 处理数据 | 368 | // 处理数据 |
368 | - ResidualLength = UartDeal_Recv_interface(1,HAL_DATA_TRANSMISSION, args->Message, args->MessageLength); | 369 | + ResidualLength = HalRecv_type1_PreliminaryScreeningOfData(args->Message, args->MessageLength, HAL_DATA_TRANSMISSION); |
369 | //如果还有剩余的长度 | 370 | //如果还有剩余的长度 |
370 | if (ResidualLength != 0) | 371 | if (ResidualLength != 0) |
371 | { | 372 | { |
JZsdk_hal/JZsdk_uart/JZsdk_Uart.c
0 → 100644
1 | +#include <stdio.h> | ||
2 | +#include <string.h> | ||
3 | +#include <stdlib.h> | ||
4 | + | ||
5 | +#include <fcntl.h> | ||
6 | +#include <unistd.h> | ||
7 | +#include <termios.h> | ||
8 | +#include <sys/time.h> | ||
9 | + | ||
10 | + | ||
11 | +#include "BaseConfig.h" | ||
12 | + | ||
13 | +#include "JZsdk_uart/JZsdk_Uart_UartDeal.h" | ||
14 | +#include "JZsdk_Hal.h" | ||
15 | + | ||
16 | +/******************** | ||
17 | + * | ||
18 | + * | ||
19 | + * 串口使能 | ||
20 | + 使能一个串口 返回设备号 | ||
21 | + 变量1 串口设备名 | ||
22 | + 变量2 比特率 | ||
23 | + 返回 int 设备号 | ||
24 | + 例子: UartDeal_Base_CreateReceive("/dev/ttyS2", 115200) | ||
25 | + * | ||
26 | + * | ||
27 | + * **************************/ | ||
28 | +T_JZsdkReturnCode JZsdk_Uart_UartEnabled(unsigned char *UartDev, unsigned int BitRate, int *UartFd) | ||
29 | +{ | ||
30 | + if (UartFd == NULL) | ||
31 | + { | ||
32 | + JZSDK_LOG_ERROR("UartFd 为空"); | ||
33 | + return JZ_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER; | ||
34 | + } | ||
35 | + | ||
36 | + //1、串口初始化 | ||
37 | + //(*UartFd) = open(UartDev, O_RDWR); | ||
38 | + (*UartFd) = open(UartDev, O_RDWR | O_NOCTTY | O_NDELAY); | ||
39 | + if ((*UartFd) < 0) | ||
40 | + { | ||
41 | + JZSDK_LOG_ERROR("打开串口 %s 失败", UartDev); | ||
42 | + return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE; | ||
43 | + } | ||
44 | + else | ||
45 | + { | ||
46 | + JZSDK_LOG_INFO("打开串口 %s 成功", UartDev); | ||
47 | + } | ||
48 | + | ||
49 | + //2、获取终端信息 | ||
50 | + struct termios options; | ||
51 | + if(tcgetattr((*UartFd),&options)!= 0) //获取终端信息 | ||
52 | + { | ||
53 | + JZSDK_LOG_ERROR("获取终端信息失败!\n"); | ||
54 | + return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE; | ||
55 | + } | ||
56 | + | ||
57 | + //3、设置比特率 | ||
58 | + switch (BitRate) | ||
59 | + { | ||
60 | + case 115200: | ||
61 | + cfsetispeed(&options, B115200); | ||
62 | + cfsetospeed(&options, B115200); | ||
63 | + break; | ||
64 | + case 230400: | ||
65 | + cfsetispeed(&options, B230400); | ||
66 | + cfsetospeed(&options, B230400); | ||
67 | + break; | ||
68 | + case 460800: | ||
69 | + cfsetispeed(&options, B460800); | ||
70 | + cfsetospeed(&options, B460800); | ||
71 | + break; | ||
72 | + case 921600: | ||
73 | + cfsetispeed(&options, B921600); | ||
74 | + cfsetospeed(&options, B921600); | ||
75 | + break; | ||
76 | + case 1000000: | ||
77 | + cfsetispeed(&options, B1000000); | ||
78 | + cfsetospeed(&options, B1000000); | ||
79 | + break; | ||
80 | + default: | ||
81 | + return JZ_ERROR_SYSTEM_MODULE_CODE_FAILURE; | ||
82 | + break; | ||
83 | + } | ||
84 | + | ||
85 | + options.c_cflag |= (unsigned) CLOCAL; | ||
86 | + options.c_cflag |= (unsigned) CREAD; | ||
87 | + options.c_cflag &= ~(unsigned) CRTSCTS; | ||
88 | + options.c_cflag &= ~(unsigned) CSIZE; | ||
89 | + options.c_cflag |= (unsigned) CS8; | ||
90 | + options.c_cflag &= ~(unsigned) PARENB; | ||
91 | + options.c_iflag &= ~(unsigned) INPCK; | ||
92 | + options.c_cflag &= ~(unsigned) CSTOPB; | ||
93 | + options.c_oflag &= ~(unsigned) OPOST; | ||
94 | + options.c_lflag &= ~((unsigned) ICANON | (unsigned) ECHO | (unsigned) ECHOE | (unsigned) ISIG); | ||
95 | + options.c_iflag &= ~((unsigned) BRKINT | (unsigned) ICRNL | (unsigned) INPCK | (unsigned) ISTRIP | (unsigned) IXON); | ||
96 | + options.c_cc[VTIME] = 0; | ||
97 | + options.c_cc[VMIN] = 0; | ||
98 | + | ||
99 | + tcflush((*UartFd),TCIOFLUSH); //刷清输入、输出队列 | ||
100 | + tcsetattr((*UartFd),TCSAFLUSH,&options); //串口设置使能 | ||
101 | + | ||
102 | + JZSDK_LOG_INFO("使能串口 波特率%d成功",BitRate); | ||
103 | + | ||
104 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
105 | +} | ||
106 | + | ||
107 | + | ||
108 | + | ||
109 | + | ||
110 | + | ||
111 | +/**************** | ||
112 | + * | ||
113 | + * | ||
114 | + * | ||
115 | + * 串口重初始化 | ||
116 | + * | ||
117 | + * | ||
118 | + * | ||
119 | + * | ||
120 | + * ************************/ | ||
121 | +T_JZsdkReturnCode JZsdk_Uart_ReInit(int UART_DEV_NAME, int BitRate) | ||
122 | +{ | ||
123 | + T_JZsdkReturnCode ret = JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
124 | + int UartFd = 0; | ||
125 | + | ||
126 | + JZSDK_LOG_INFO("初始化串口 0x%x", UART_DEV_NAME); | ||
127 | + | ||
128 | + //初始化的是一号设备 | ||
129 | + if (UART_DEV_NAME == UART_DEV_1) | ||
130 | + { | ||
131 | + //1、检查串口是否已经初始化 | ||
132 | + if(JZsdk_HalPort_UseFlag(UART_DEV_1) == JZ_FLAGCODE_ON) | ||
133 | + { | ||
134 | + //先注释掉原来的串口 | ||
135 | + JZsdk_HalPort_SetUseFlag(UART_DEV_1, JZ_FLAGCODE_OFF); | ||
136 | + | ||
137 | + //然后关闭串口 注:该函数有延时 | ||
138 | + JZsdk_Uart_CloseUartThead(UART_DEV_1); | ||
139 | + } | ||
140 | + | ||
141 | + //2、串口初始化 | ||
142 | + ret = JZsdk_Uart_UartEnabled(UART_DEV1_NUM, BitRate, &UartFd); | ||
143 | + if (ret != JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS) | ||
144 | + { | ||
145 | + return ret; | ||
146 | + } | ||
147 | + | ||
148 | + //3、串口接收初始化 | ||
149 | + JZsdk_Uart_UartDeal_Receive(UartFd, UART_DEV_1); | ||
150 | + | ||
151 | + //4、将串口的标志位打开 | ||
152 | + JZsdk_HalPort_SetUseFlag(UART_DEV_1, JZ_FLAGCODE_ON); | ||
153 | + } | ||
154 | + | ||
155 | + //初始化的是二号设备 | ||
156 | + if (UART_DEV_NAME == UART_DEV_2) | ||
157 | + { | ||
158 | + //1、检查串口是否已经初始化 | ||
159 | + if(JZsdk_HalPort_UseFlag(UART_DEV_2) == JZ_FLAGCODE_ON) | ||
160 | + { | ||
161 | + //先注释掉原来的串口 | ||
162 | + JZsdk_HalPort_SetUseFlag(UART_DEV_2, JZ_FLAGCODE_OFF); | ||
163 | + | ||
164 | + //然后关闭串口 注:该函数有延时 | ||
165 | + JZsdk_Uart_CloseUartThead(UART_DEV_2); | ||
166 | + } | ||
167 | + | ||
168 | + //2、串口初始化 | ||
169 | + ret = JZsdk_Uart_UartEnabled(UART_DEV2_NUM, BitRate, &UartFd); | ||
170 | + if (ret != JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS) | ||
171 | + { | ||
172 | + return ret; | ||
173 | + } | ||
174 | + | ||
175 | + //3、串口接收初始化 | ||
176 | + JZsdk_Uart_UartDeal_Receive(UartFd, UART_DEV_2); | ||
177 | + | ||
178 | + //4、将串口的标志位打开 | ||
179 | + JZsdk_HalPort_SetUseFlag(UART_DEV_2, JZ_FLAGCODE_ON); | ||
180 | + } | ||
181 | + | ||
182 | + //初始化的是4g设备 | ||
183 | + if (UART_DEV_NAME == UART_4G) | ||
184 | + { | ||
185 | + //1、检查串口是否已经初始化 | ||
186 | + if(JZsdk_HalPort_UseFlag(UART_4G) == JZ_FLAGCODE_ON) | ||
187 | + { | ||
188 | + //先注释掉原来的串口 | ||
189 | + JZsdk_HalPort_SetUseFlag(UART_4G, JZ_FLAGCODE_OFF); | ||
190 | + | ||
191 | + //然后关闭串口 注:该函数有延时 | ||
192 | + JZsdk_Uart_CloseUartThead(UART_4G); | ||
193 | + } | ||
194 | + | ||
195 | + //2、串口初始化 | ||
196 | + ret = JZsdk_Uart_UartEnabled(COMM_4G_UART_NUM, BitRate, &UartFd); | ||
197 | + if (ret != JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS) | ||
198 | + { | ||
199 | + return ret; | ||
200 | + } | ||
201 | + | ||
202 | + //3、串口接收初始化 | ||
203 | + JZsdk_Uart_UartDeal_Receive(UartFd, UART_4G); | ||
204 | + | ||
205 | + //4、将串口的标志位打开 | ||
206 | + JZsdk_HalPort_SetUseFlag(UART_4G, JZ_FLAGCODE_ON); | ||
207 | + } | ||
208 | + | ||
209 | + return JZ_ERROR_SYSTEM_MODULE_CODE_SUCCESS; | ||
210 | +} |
JZsdk_hal/JZsdk_uart/JZsdk_Uart.h
0 → 100644
1 | +/** | ||
2 | + ******************************************************************** | ||
3 | + * @file JZsdk_Uart.h | ||
4 | + * JZsdk_Uart.c 的头文件 | ||
5 | + * | ||
6 | + ********************************************************************* | ||
7 | + */ | ||
8 | + | ||
9 | +/* Define to prevent recursive inclusion 避免重定义 -------------------------------------*/ | ||
10 | +#ifndef JZSDK_UART_H | ||
11 | +#define JZSDK_UART_H | ||
12 | + | ||
13 | +/* Includes ------------------------------------------------------------------*/ | ||
14 | +#include "JZsdk_Base/JZsdk_Code/JZsdk_Code.h" | ||
15 | + | ||
16 | +#ifdef __cplusplus | ||
17 | +extern "C" { | ||
18 | +#endif | ||
19 | + | ||
20 | + | ||
21 | +/* Exported constants --------------------------------------------------------*/ | ||
22 | +/* 常亮定义*/ | ||
23 | + | ||
24 | +/* Exported types ------------------------------------------------------------*/ | ||
25 | + | ||
26 | +/* Exported functions --------------------------------------------------------*/ | ||
27 | +T_JZsdkReturnCode JZsdk_Uart_ReInit(int UART_DEV_NAME, int BitRate); | ||
28 | +T_JZsdkReturnCode JZsdk_Uart_UartEnabled(unsigned char *UartDev, unsigned int BitRate, int *UartFd); | ||
29 | + | ||
30 | +#ifdef __cplusplus | ||
31 | +} | ||
32 | +#endif | ||
33 | + | ||
34 | +#endif |
JZsdk_hal/JZsdk_uart/JZsdk_Uart_Input.c
已删除
100644 → 0
1 | -#include <stdio.h> | ||
2 | -#include <string.h> | ||
3 | -#include <stdlib.h> | ||
4 | - | ||
5 | -#include "JZsdk_uart/UartConnection/UartConnection.h" | ||
6 | -#include "Megaphone/Megaphone.h" | ||
7 | -#include "BaseConfig.h" | ||
8 | -#include "version_choose.h" | ||
9 | - | ||
10 | -#include "JZsdk_uart/JZsdk_Uart_Input.h" | ||
11 | -#include "JZsdk_uart/JZsdk_Uart_UartDeal.h" | ||
12 | -#include "JZsdk_uart/Uart_Config.h" | ||
13 | -#include "JZsdk_uart/JZsdk_Uart_Send/JZsdk_Uart_Send.h" | ||
14 | -#include "Gimbal/Gimbal.h" | ||
15 | - | ||
16 | -// 记录串口是否有被使用,方便ui_contrl进行信息反馈 | ||
17 | -struct UartDev_UseFlag | ||
18 | -{ | ||
19 | - int UartDev_DEV1 ; | ||
20 | - int UartDev_DEV2 ; | ||
21 | - int UartDev_4G ; | ||
22 | -}; | ||
23 | -static struct UartDev_UseFlag UartDevUseFlag = {JZ_FLAGCODE_OFF, JZ_FLAGCODE_OFF, JZ_FLAGCODE_OFF}; | ||
24 | - | ||
25 | - | ||
26 | -/**************** | ||
27 | - * | ||
28 | - * 回复串口是否有被调用 | ||
29 | - * | ||
30 | - * *************/ | ||
31 | -int JZsdk_Get_UartDev_UseFlag(int UART_DEV_NAME) | ||
32 | -{ | ||
33 | - if (UART_DEV_NAME == UART_DEV_1) | ||
34 | - { | ||
35 | - return UartDevUseFlag.UartDev_DEV1; | ||
36 | - } | ||
37 | - else if (UART_DEV_NAME == UART_DEV_2) | ||
38 | - { | ||
39 | - return UartDevUseFlag.UartDev_DEV2; | ||
40 | - } | ||
41 | - else if (UART_DEV_NAME == UART_4G) | ||
42 | - { | ||
43 | - return UartDevUseFlag.UartDev_4G; | ||
44 | - } | ||
45 | -} | ||
46 | - | ||
47 | -/************** | ||
48 | - * | ||
49 | - * 串口部分初始化 | ||
50 | - * | ||
51 | - * *********/ | ||
52 | -int JZsdk_Uart_Init(int UART_DEV_NAME) | ||
53 | -{ | ||
54 | - | ||
55 | - //初始化的是一号设备 | ||
56 | - if (UART_DEV_NAME == UART_DEV_1) | ||
57 | - { | ||
58 | - JZsdk_Uart_SecondInit(UART_DEV_1,UART_DEV1_BITRATE); | ||
59 | - } | ||
60 | - | ||
61 | - //初始化的是二号设备 | ||
62 | - else if (UART_DEV_NAME == UART_DEV_2) | ||
63 | - { | ||
64 | - JZsdk_Uart_SecondInit(UART_DEV_2, UART_DEV2_BITRATE); | ||
65 | - } | ||
66 | - | ||
67 | - else if (UART_DEV_NAME == UART_4G) | ||
68 | - { | ||
69 | - JZsdk_Uart_SecondInit(UART_4G, COMM_4G_UART_BITRATE); | ||
70 | - } | ||
71 | - | ||
72 | - printf("%x串口初始化完成\n", UART_DEV_NAME); | ||
73 | -} | ||
74 | - | ||
75 | -/************** | ||
76 | - * | ||
77 | - * 串口部分修改波特率 | ||
78 | - * | ||
79 | - * *********/ | ||
80 | -int JZsdk_Uart_BitRateChange(int UART_DEV_NAME, int BitRate) | ||
81 | -{ | ||
82 | - //1、释放掉原串口 | ||
83 | - if (UART_DEV_NAME == UART_DEV_1) | ||
84 | - { | ||
85 | - //将使用标识关闭 | ||
86 | - UartDevUseFlag.UartDev_DEV1 = JZ_FLAGCODE_OFF; | ||
87 | - | ||
88 | - //等候关闭接收线程 | ||
89 | - JZsdk_Uart_CloseUartThead(UART_DEV_NAME, BitRate); | ||
90 | - } | ||
91 | - | ||
92 | - //1、释放掉原串口 | ||
93 | - else if (UART_DEV_NAME == UART_DEV_2) | ||
94 | - { | ||
95 | - //将使用标识关闭 | ||
96 | - UartDevUseFlag.UartDev_DEV2 = JZ_FLAGCODE_OFF; | ||
97 | - | ||
98 | - //等候关闭接收线程 | ||
99 | - JZsdk_Uart_CloseUartThead(UART_DEV_NAME, BitRate); | ||
100 | - } | ||
101 | - | ||
102 | - //1、释放掉原串口 | ||
103 | - else if (UART_DEV_NAME == UART_4G) | ||
104 | - { | ||
105 | - //将使用标识关闭 | ||
106 | - UartDevUseFlag.UartDev_4G = JZ_FLAGCODE_OFF; | ||
107 | - | ||
108 | - //等候关闭接收线程 | ||
109 | - JZsdk_Uart_CloseUartThead(UART_DEV_NAME, BitRate); | ||
110 | - } | ||
111 | -} | ||
112 | - | ||
113 | -/************** | ||
114 | - * | ||
115 | - * 串口部分串口再注册 | ||
116 | - * | ||
117 | - * *********/ | ||
118 | -int JZsdk_Uart_SecondInit(int UART_DEV_NAME, int BitRate) | ||
119 | -{ | ||
120 | - int Uart_fd = 0; | ||
121 | - | ||
122 | - printf("初始化串口%x\n",UART_DEV_NAME); | ||
123 | - | ||
124 | - //初始化的是一号设备 | ||
125 | - if (UART_DEV_NAME == UART_DEV_1) | ||
126 | - { | ||
127 | - //1、串口初始化 | ||
128 | - Uart_fd = UartConnection_UartEnabled(UART_DEV1_NUM, BitRate); | ||
129 | - | ||
130 | - //2、串口接收初始化 | ||
131 | - JZsdk_Uart_UartDeal_Receive(Uart_fd, UART_DEV_1); | ||
132 | - | ||
133 | - //3、将使用标识打开 | ||
134 | - UartDevUseFlag.UartDev_DEV1 = JZ_FLAGCODE_ON; | ||
135 | - } | ||
136 | - | ||
137 | - else if (UART_DEV_NAME == UART_DEV_2) | ||
138 | - { | ||
139 | - //1、串口初始化 | ||
140 | - Uart_fd = UartConnection_UartEnabled(UART_DEV2_NUM, BitRate); | ||
141 | - | ||
142 | - //2、串口接收初始化 | ||
143 | - JZsdk_Uart_UartDeal_Receive(Uart_fd, UART_DEV_2); | ||
144 | - | ||
145 | - //3、将使用标识打开 | ||
146 | - UartDevUseFlag.UartDev_DEV2 = JZ_FLAGCODE_ON; | ||
147 | - } | ||
148 | - | ||
149 | - else if (UART_DEV_NAME == UART_4G) | ||
150 | - { | ||
151 | - //1、串口初始化 | ||
152 | - Uart_fd = UartConnection_UartEnabled(COMM_4G_UART_NUM, BitRate); | ||
153 | - | ||
154 | - //2、串口接收初始化 | ||
155 | - JZsdk_Uart_UartDeal_Receive(Uart_fd, UART_4G); | ||
156 | - | ||
157 | - //3、将使用标识打开 | ||
158 | - UartDevUseFlag.UartDev_4G = JZ_FLAGCODE_ON; | ||
159 | - } | ||
160 | -} | ||
161 | - | ||
162 | -/******************************* | ||
163 | - * | ||
164 | - * 自由帧发送 | ||
165 | - * | ||
166 | - * ******************/ | ||
167 | -int JZsdk_Uart_Send_CustomOrder(int UartPort, char *frame, int frame_len) | ||
168 | -{ | ||
169 | - JZsdk_Uart_UartSend(UartPort, frame, frame_len); | ||
170 | -} | ||
171 | - | ||
172 | -/***************** | ||
173 | - * | ||
174 | - * 发送主动连接帧 | ||
175 | - * | ||
176 | - * ******************/ | ||
177 | -int JZsdk_Uart_Send_ConnectFrame(int PortNum) | ||
178 | -{ | ||
179 | - JZsdk_Uart_SendDeal_ConnectFrame(PortNum); | ||
180 | -} | ||
181 | - | ||
182 | -/* | ||
183 | -* | ||
184 | -* 发送播放结束状态帧 | ||
185 | -* | ||
186 | -*/ | ||
187 | -int JZsdk_Uart_Reply_PlayStatus_end(int PortNum) | ||
188 | -{ | ||
189 | - //发送播放状态结束帧 | ||
190 | - JZsdk_Uart_SendDeal_Send_PlayStatus_end(PortNum); | ||
191 | -} | ||
192 | - | ||
193 | -/************** | ||
194 | - * | ||
195 | - * 发送发送播放状态帧 | ||
196 | - * | ||
197 | - * ***********/ | ||
198 | -int JZsdk_Uart_Send_PlayStatus(int Uartport ,int num) | ||
199 | -{ | ||
200 | - JZsdk_Uart_SendDeal_Send_PlayStatus(Uartport, num); | ||
201 | -} | ||
202 | - | ||
203 | -/************** | ||
204 | - * | ||
205 | - * 发送音量 | ||
206 | - * | ||
207 | - * ***********/ | ||
208 | -int JZsdk_Uart_Reply_Volume(int Uartport,int volume) | ||
209 | -{ | ||
210 | - JZsdk_Uart_SendDeal_Reply_Volume(Uartport, volume); | ||
211 | -} | ||
212 | - | ||
213 | -/************** | ||
214 | - * | ||
215 | - * 发送音色 | ||
216 | - * | ||
217 | - * ***********/ | ||
218 | -int JZsdk_Uart_Reply_TTS_tone(int Uartport,int tone) | ||
219 | -{ | ||
220 | - JZsdk_Uart_SendDeal_Reply_TTS_tone(Uartport, tone); | ||
221 | -} | ||
222 | - | ||
223 | -/************** | ||
224 | - * | ||
225 | - * 发送语速 | ||
226 | - * | ||
227 | - * ***********/ | ||
228 | -int JZsdk_Uart_Reply_TTS_speed(int Uartport,int speed) | ||
229 | -{ | ||
230 | - JZsdk_Uart_SendDeal_Reply_TTS_speed(Uartport, speed); | ||
231 | -} | ||
232 | - | ||
233 | -/************** | ||
234 | - * | ||
235 | - * 发送循环状态 | ||
236 | - * | ||
237 | - * ***********/ | ||
238 | -int JZsdk_Uart_Reply_AudioPlayLoopStatus(int Uartport,int speed) | ||
239 | -{ | ||
240 | - JZsdk_Uart_SendDeal_Reply_LoopPlayStatus(Uartport, speed); | ||
241 | -} | ||
242 | - | ||
243 | - | ||
244 | -/************** | ||
245 | - * | ||
246 | - * 发送云台俯仰角度查询值 | ||
247 | - * | ||
248 | - * ***********/ | ||
249 | -int JZsdk_Uart_Reply_GimbalPitchAngle(int Uartport,int angle) | ||
250 | -{ | ||
251 | - JZsdk_Uart_SendDeal_Reply_GimbalPitchAngle(Uartport, angle); | ||
252 | -} | ||
253 | - | ||
254 | -/************* | ||
255 | - * | ||
256 | - * 设置云台俯仰角度 | ||
257 | - * | ||
258 | - * **************/ | ||
259 | -int JZsdk_Uart_Send_SetGimbalPitch(int Uartport,int angle) | ||
260 | -{ | ||
261 | - JZsdk_Uart_SendDeal_Set_GimbalPitchAngle(Uartport, angle); | ||
262 | -} | ||
263 | - | ||
264 | -/************* | ||
265 | - * | ||
266 | - * 查询云台角度 | ||
267 | - * | ||
268 | - * **************/ | ||
269 | -int JZsdk_Uart_Send_CheckStatus_GimbalAngle(int Uartport ,int FrameSequence) | ||
270 | -{ | ||
271 | - JZsdk_Uart_SendDeal_CheckStatus_GimbalAngle(Uartport, FrameSequence); | ||
272 | -} | ||
273 | - | ||
274 | -/************* | ||
275 | - * | ||
276 | - * 设置云台俯仰角度微调 | ||
277 | - * | ||
278 | - * **************/ | ||
279 | -int JZsdk_Uart_Send_SetGimbalFineTuningPitch(int Uartport,int angle) | ||
280 | -{ | ||
281 | - JZsdk_Uart_SendDeal_Set_GimbalFineTuningPitch(Uartport, angle); | ||
282 | -} | ||
283 | - | ||
284 | -/************* | ||
285 | - * | ||
286 | - * 查询云台微调角度 | ||
287 | - * | ||
288 | - * **************/ | ||
289 | -int JZsdk_Uart_Send_CheckStatus_GimbalFineTuningPitch(int Uartport,int FrameSequence) | ||
290 | -{ | ||
291 | - JZsdk_Uart_SendDeal_CheckStatus_GimbalFineTuningPitch(Uartport,FrameSequence); | ||
292 | -} | ||
293 | - | ||
294 | -/************* | ||
295 | - * | ||
296 | - * 发送云台俯仰微调值 | ||
297 | - * | ||
298 | - * **************/ | ||
299 | -int JZsdk_Uart_Send_GimbalFineTuningPitch(int Uartport,int FrameSequence, int Pitch) | ||
300 | -{ | ||
301 | - JZsdk_Uart_SendDeal_Reply_GimbalFineTuningPitch(Uartport,FrameSequence, Pitch); | ||
302 | -} | ||
303 | - | ||
304 | -/************* | ||
305 | - * | ||
306 | - * 设置云台联动 | ||
307 | - * | ||
308 | - * **************/ | ||
309 | -int JZsdk_Uart_Send_Set_GimbalLinkageControl(int Uartport,int FrameSequence, int value) | ||
310 | -{ | ||
311 | - JZsdk_Uart_SendDeal_Set_GimbalLinkageControl(Uartport,FrameSequence, value); | ||
312 | -} | ||
313 | - | ||
314 | -/************* | ||
315 | - * | ||
316 | - * 查询云台联动值 | ||
317 | - * | ||
318 | - * **************/ | ||
319 | -int JZsdk_Uart_Send_CheckStatus_GimbalLinkage(int Uartport,int FrameSequence) | ||
320 | -{ | ||
321 | - JZsdk_Uart_SendDeal_CheckStatus_GimbalLinkage(Uartport,FrameSequence); | ||
322 | -} | ||
323 | - | ||
324 | -/************* | ||
325 | - * | ||
326 | - * 发送云台联动值 | ||
327 | - * | ||
328 | - * **************/ | ||
329 | -int JZsdk_Uart_Send_GimbalLinkageControl(int Uartport,int FrameSequence, int value) | ||
330 | -{ | ||
331 | - JZsdk_Uart_SendDeal_GimbalLinkageControl(Uartport,FrameSequence,value); | ||
332 | -} | ||
333 | - | ||
334 | -/************* | ||
335 | - * | ||
336 | - * 设置云台最大最小值 | ||
337 | - * | ||
338 | - * **************/ | ||
339 | -int JZsdk_Uart_Send_SetGimbalRange(int Uartport,int FrameSequence, int value) | ||
340 | -{ | ||
341 | - JZsdk_Uart_SendDeal_SetGimbalRange(Uartport,FrameSequence,value); | ||
342 | -} | ||
343 | - | ||
344 | -/******************************************************************************************************************************* | ||
345 | - * | ||
346 | - * 探照灯部分 | ||
347 | - * | ||
348 | - * *******************************************************************************************************************************/ | ||
349 | - | ||
350 | -/************* | ||
351 | - * | ||
352 | - * 设置探照灯爆闪频率 | ||
353 | - * | ||
354 | - * **************/ | ||
355 | -int JZsdk_Uart_Send_SearchLight_SetFrequency(int Uartport,int Frequency) | ||
356 | -{ | ||
357 | - JZsdk_Uart_SendDeal_Set_SearchLightFrequency(Uartport ,Frequency); | ||
358 | -} | ||
359 | - | ||
360 | -/************* | ||
361 | - * | ||
362 | - * 探照灯控制 | ||
363 | - * | ||
364 | - * **************/ | ||
365 | -int JZsdk_Uart_Send_SearchLight_Control(int Uartport,int mode) | ||
366 | -{ | ||
367 | - JZsdk_Uart_SendDeal_SearchLight_Control(Uartport, mode); | ||
368 | -} | ||
369 | - | ||
370 | -/************* | ||
371 | - * | ||
372 | - * 探照灯亮度 | ||
373 | - * | ||
374 | - * **************/ | ||
375 | -int JZsdk_Uart_Send_SearchLight_SetLumen(int Uartport, int LeftLumen, int RightLumen) | ||
376 | -{ | ||
377 | - JZsdk_Uart_SendDeal_SearchLight_SetLumen(Uartport, LeftLumen, RightLumen); | ||
378 | -} | ||
379 | - | ||
380 | -/************* | ||
381 | - * | ||
382 | - * 查询爆闪频率 | ||
383 | - * | ||
384 | - * **************/ | ||
385 | -int JZsdk_Uart_Send_SearchLight_CheckStatus_Frequency(int Uartport) | ||
386 | -{ | ||
387 | - JZsdk_Uart_SendDeal_Set_SearchLight_CheckStatus_Frequency(Uartport); | ||
388 | -} | ||
389 | - | ||
390 | -/************* | ||
391 | - * | ||
392 | - * 查询探照灯亮度 | ||
393 | - * | ||
394 | - * **************/ | ||
395 | -int JZsdk_Uart_Send_SearchLight_CheckStatus_Lumen(int Uartport) | ||
396 | -{ | ||
397 | - JZsdk_Uart_SendDeal_Set_SearchLight_CheckStatus_Lumen(Uartport); | ||
398 | -} | ||
399 | - | ||
400 | -/************* | ||
401 | - * | ||
402 | - * 查询探照灯模式 | ||
403 | - * | ||
404 | - * **************/ | ||
405 | -int JZsdk_Uart_Send_SearchLight_CheckStatus_Mode(int Uartport) | ||
406 | -{ | ||
407 | - JZsdk_Uart_SendDeal_Set_SearchLight_CheckStatus_Mode(Uartport); | ||
408 | -} | ||
409 | - | ||
410 | -/************* | ||
411 | - * | ||
412 | - * 查询探照灯属性 | ||
413 | - * | ||
414 | - * **************/ | ||
415 | -int JZsdk_Uart_Send_SearchLight_CheckStatus_LightAttribute(int Uartport) | ||
416 | -{ | ||
417 | - JZsdk_Uart_SendDeal_CheckStatus_LightAttribute(Uartport); | ||
418 | -} | ||
419 | - | ||
420 | -/************* | ||
421 | - * | ||
422 | - * 查询探照灯温度 | ||
423 | - * | ||
424 | - * **************/ | ||
425 | -int JZsdk_Uart_Send_SearchLight_CheckStatus_SearchLightTemperture(int Uartport) | ||
426 | -{ | ||
427 | - JZsdk_Uart_SendDeal_CheckStatus_SearchLightTemperture(Uartport); | ||
428 | -} | ||
429 | - | ||
430 | - | ||
431 | -/************* | ||
432 | - * | ||
433 | - * 探照灯消息订阅 | ||
434 | - * | ||
435 | - * **************/ | ||
436 | -int JZsdk_Uart_Send_MessageSubcription_Control(int Uartport,int value) | ||
437 | -{ | ||
438 | - JZsdk_Uart_SendDeal_MessageSubcription_Control(Uartport, value); | ||
439 | -} | ||
440 | -/******************************************************************************************************************************* | ||
441 | - * | ||
442 | - * 警灯部分 | ||
443 | - * | ||
444 | - * *******************************************************************************************************************************/ | ||
445 | - | ||
446 | -/************* | ||
447 | - * | ||
448 | - * 设置警灯状态 | ||
449 | - * | ||
450 | - * **************/ | ||
451 | -int JZsdk_Uart_Send_Set_WarningLight_Status(int Uartport,int status, int mode) | ||
452 | -{ | ||
453 | - JZsdk_Uart_SendDeal_Set_WarningLight_Status(Uartport, status, mode); | ||
454 | -} | ||
455 | -/************* | ||
456 | - * | ||
457 | - * 设置警灯颜色 | ||
458 | - * | ||
459 | - * **************/ | ||
460 | -int JZsdk_Uart_Send_Set_WarningLight_Color(int Uartport,int color1, int color2) | ||
461 | -{ | ||
462 | - JZsdk_Uart_SendDeal_Set_WarningLight_Color(Uartport, color1, color2); | ||
463 | -} | ||
464 | - | ||
465 | -/******************************************************************************************************************************* | ||
466 | - * | ||
467 | - * 5B类部分 | ||
468 | - * | ||
469 | - * *******************************************************************************************************************************/ | ||
470 | -/************* | ||
471 | - * | ||
472 | - * 发送opus解码状态 | ||
473 | - * | ||
474 | - * **************/ | ||
475 | -int JZsdk_Uart_Send_OpusDecodeStatus(int Uartport,int value) | ||
476 | -{ | ||
477 | - JZsdk_Uart_SendDeal_OpusDecodeStatus(Uartport, value); | ||
478 | -} | ||
479 | - | ||
480 | - | ||
481 | -/************* | ||
482 | - * | ||
483 | - * 发送探照灯爆闪频率 | ||
484 | - * | ||
485 | - * **************/ | ||
486 | -int JZsdk_Uart_Send_SearchLight_Frequency(int Uartport,int value) | ||
487 | -{ | ||
488 | - JZsdk_Uart_SendDeal_SearchLight_Frequency(Uartport, value); | ||
489 | -} | ||
490 | - | ||
491 | -/************* | ||
492 | - * | ||
493 | - * 发送探照灯模式 | ||
494 | - * | ||
495 | - * **************/ | ||
496 | -int JZsdk_Uart_Send_SearchLight_Mode(int Uartport,int value) | ||
497 | -{ | ||
498 | - JZsdk_Uart_SendDeal_SearchLight_Mode(Uartport, value); | ||
499 | -} | ||
500 | - | ||
501 | -/************* | ||
502 | - * | ||
503 | - * 发送探照灯亮度 | ||
504 | - * | ||
505 | - * **************/ | ||
506 | -int JZsdk_Uart_Send_SearchLight_Lumen(int Uartport,int LeftLumen, int RightLumen) | ||
507 | -{ | ||
508 | - JZsdk_Uart_SendDeal_SearchLight_Lumen(Uartport, LeftLumen, RightLumen); | ||
509 | -} | ||
510 | - | ||
511 | -/************* | ||
512 | - * | ||
513 | - * 发送探照灯温度 | ||
514 | - * | ||
515 | - * **************/ | ||
516 | -int JZsdk_Uart_Send_SearchLight_Temperature(int Uartport,int LeftTemperature, int RightTemperature) | ||
517 | -{ | ||
518 | - JZsdk_Uart_SendDeal_SearchLight_Temperature(Uartport, LeftTemperature, RightTemperature); | ||
519 | -} | ||
520 | - | ||
521 | - | ||
522 | -/************* | ||
523 | - * | ||
524 | - * 发送对外供电电源的状态 | ||
525 | - * | ||
526 | - * **************/ | ||
527 | -int JZsdk_Uart_Send_OutputPowerStatus(int Uartport, int FrameSequence, int status) | ||
528 | -{ | ||
529 | - JZsdk_Uart_SendDeal_OutputPowerStatus(Uartport, FrameSequence, status); | ||
530 | -} | ||
531 | - | ||
532 | -/******************************************************************************************************************************* | ||
533 | - * | ||
534 | - * 警灯部分 | ||
535 | - * | ||
536 | - * *******************************************************************************************************************************/ | ||
537 | -/************* | ||
538 | - * | ||
539 | - * 发送警灯状态 | ||
540 | - * | ||
541 | - * **************/ | ||
542 | -int JZsdk_Uart_Send_WarningLight_Status(int Uartport, int status, int mode) | ||
543 | -{ | ||
544 | - JZsdk_Uart_SendDeal_WarningLight_Status(Uartport, status, mode); | ||
545 | -} | ||
546 | - | ||
547 | -/************* | ||
548 | - * | ||
549 | - * 发送警灯颜色 | ||
550 | - * | ||
551 | - * **************/ | ||
552 | -int JZsdk_Uart_Send_WarningLight_Color(int Uartport, int color1, int color2) | ||
553 | -{ | ||
554 | - JZsdk_Uart_SendDeal_WarningLight_Color(Uartport, color1, color2); | ||
555 | -} | ||
556 | - | ||
557 | - | ||
558 | -/************* | ||
559 | - * | ||
560 | - * 查询警灯状态 | ||
561 | - * | ||
562 | - * **************/ | ||
563 | -int JZsdk_Uart_Send_CheckStatus_WarningLightStatus(int Uartport) | ||
564 | -{ | ||
565 | - JZsdk_Uart_SendDeal_CheckStatus_WarningLightStatus(Uartport); | ||
566 | -} | ||
567 | - | ||
568 | - | ||
569 | -/************* | ||
570 | - * | ||
571 | - * 查询警灯颜色 | ||
572 | - * | ||
573 | - * **************/ | ||
574 | -int JZsdk_Uart_Send_CheckStatus_WarningLightColor(int Uartport) | ||
575 | -{ | ||
576 | - JZsdk_Uart_SendDeal_CheckStatus_WarningLightColor(Uartport); | ||
577 | -} |
-
请 注册 或 登录 后发表评论