JZsdk_Uart_Input.c
10.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "UartConnection/UartConnection.h"
#include "Megaphone_InputAndOutput.h"
#include "BaseConfig.h"
#include "version_choose.h"
#include "JZsdk_Uart_UartDeal.h"
#include "Gimbal_InAndOut.h"
#include "Uart_Config.h"
#include "JZsdk_Uart_Send/JZsdk_Uart_Send.h"
// 记录串口是否有被使用,方便ui_contrl进行信息反馈
struct UartDev_UseFlag
{
int UartDev_DEV1 ;
int UartDev_DEV2 ;
int UartDev_4G ;
};
static struct UartDev_UseFlag UartDevUseFlag = {JZ_FLAGCODE_OFF, JZ_FLAGCODE_OFF, JZ_FLAGCODE_OFF};
/****************
*
* 回复串口是否有被调用
*
* *************/
int JZsdk_Get_UartDev_UseFlag(int UART_DEV_NAME)
{
if (UART_DEV_NAME == UART_DEV_1)
{
return UartDevUseFlag.UartDev_DEV1;
}
if (UART_DEV_NAME == UART_DEV_2)
{
return UartDevUseFlag.UartDev_DEV2;
}
if (UART_DEV_NAME == UART_4G)
{
return UartDevUseFlag.UartDev_4G;
}
}
/**************
*
* 串口部分初始化
*
* *********/
int JZsdk_Uart_Init(int UART_DEV_NAME)
{
int Uart_fd = 0;
//初始化的是一号设备
if (UART_DEV_NAME == UART_DEV_1)
{
//1、串口初始化
Uart_fd = UartConnection_UartEnabled(UART_DEV1_NUM, UART_DEV1_BITRATE);
//2、串口接收初始化
JZsdk_Uart_UartDeal_Receive(Uart_fd, UART_DEV_1);
//3、将使用标识打开
UartDevUseFlag.UartDev_DEV1 = JZ_FLAGCODE_ON;
}
//初始化的是二号设备
if (UART_DEV_NAME == UART_DEV_2)
{
//1、串口初始化
Uart_fd = UartConnection_UartEnabled(UART_DEV2_NUM, UART_DEV2_BITRATE);
//2、串口接收初始化
JZsdk_Uart_UartDeal_Receive(Uart_fd, UART_DEV_2);
//3、将使用标识打开
UartDevUseFlag.UartDev_DEV2 = JZ_FLAGCODE_ON;
}
if (UART_DEV_NAME == UART_4G)
{
//1、串口初始化
Uart_fd = UartConnection_UartEnabled(COMM_4G_UART_NUM, COMM_4G_UART_BITRATE);
//2、串口接收初始化
JZsdk_Uart_UartDeal_Receive(Uart_fd, UART_4G);
//3、将使用标识打开
UartDevUseFlag.UartDev_4G = JZ_FLAGCODE_ON;
}
printf("%x串口初始化完成\n", UART_DEV_NAME);
}
/*
*
* 发送播放结束状态帧
*
*/
int JZsdk_Uart_Reply_PlayStatus_end(int PortNum)
{
//发送播放状态结束帧
JZsdk_Uart_SendDeal_Send_PlayStatus_end(PortNum);
}
/**************
*
* 发送发送播放状态帧
*
* ***********/
int JZsdk_Uart_Send_PlayStatus(int Uartport ,int num)
{
JZsdk_Uart_SendDeal_Send_PlayStatus(Uartport, num);
}
/**************
*
* 发送音量
*
* ***********/
int JZsdk_Uart_Reply_Volume(int Uartport,int volume)
{
JZsdk_Uart_SendDeal_Reply_Volume(Uartport, volume);
}
/**************
*
* 发送音色
*
* ***********/
int JZsdk_Uart_Reply_TTS_tone(int Uartport,int tone)
{
JZsdk_Uart_SendDeal_Reply_TTS_tone(Uartport, tone);
}
/**************
*
* 发送语速
*
* ***********/
int JZsdk_Uart_Reply_TTS_speed(int Uartport,int speed)
{
JZsdk_Uart_SendDeal_Reply_TTS_speed(Uartport, speed);
}
/**************
*
* 发送循环状态
*
* ***********/
int JZsdk_Uart_Reply_AudioPlayLoopStatus(int Uartport,int speed)
{
JZsdk_Uart_SendDeal_Reply_LoopPlayStatus(Uartport, speed);
}
/**************
*
* 发送云台俯仰角度查询值
*
* ***********/
int JZsdk_Uart_Reply_GimbalPitchAngle(int Uartport,int angle)
{
JZsdk_Uart_SendDeal_Reply_GimbalPitchAngle(Uartport, angle);
}
/*************
*
* 设置云台俯仰角度
*
* **************/
int JZsdk_Uart_Send_SetGimbalPitch(int Uartport,int angle)
{
JZsdk_Uart_SendDeal_Set_GimbalPitchAngle(Uartport, angle);
}
/*************
*
* 设置云台俯仰角度微调
*
* **************/
int JZsdk_Uart_Send_SetGimbalFineTuningPitch(int Uartport,int angle)
{
JZsdk_Uart_SendDeal_Set_GimbalFineTuningPitch(Uartport, angle);
}
/*************
*
* 查询云台微调角度
*
* **************/
int JZsdk_Uart_Send_CheckStatus_GimbalFineTuningPitch(int Uartport,int FrameSequence)
{
JZsdk_Uart_SendDeal_CheckStatus_GimbalFineTuningPitch(Uartport,FrameSequence);
}
/*************
*
* 发送云台俯仰微调值
*
* **************/
int JZsdk_Uart_Send_GimbalFineTuningPitch(int Uartport,int FrameSequence, int Pitch)
{
JZsdk_Uart_SendDeal_Reply_GimbalFineTuningPitch(Uartport,FrameSequence, Pitch);
}
/*************
*
* 设置云台联动
*
* **************/
int JZsdk_Uart_Send_Set_GimbalLinkageControl(int Uartport,int FrameSequence, int value)
{
JZsdk_Uart_SendDeal_Set_GimbalLinkageControl(Uartport,FrameSequence, value);
}
/*************
*
* 查询云台联动值
*
* **************/
int JZsdk_Uart_Send_CheckStatus_GimbalLinkage(int Uartport,int FrameSequence)
{
JZsdk_Uart_SendDeal_CheckStatus_GimbalLinkage(Uartport,FrameSequence);
}
/*************
*
* 发送云台联动值
*
* **************/
int JZsdk_Uart_Send_GimbalLinkageControl(int Uartport,int FrameSequence, int value)
{
JZsdk_Uart_SendDeal_GimbalLinkageControl(Uartport,FrameSequence,value);
}
/*******************************************************************************************************************************
*
* 探照灯部分
*
* *******************************************************************************************************************************/
/*************
*
* 设置探照灯爆闪频率
*
* **************/
int JZsdk_Uart_Send_SearchLight_SetFrequency(int Uartport,int Frequency)
{
JZsdk_Uart_SendDeal_Set_SearchLightFrequency(Uartport ,Frequency);
}
/*************
*
* 探照灯控制
*
* **************/
int JZsdk_Uart_Send_SearchLight_Control(int Uartport,int mode)
{
JZsdk_Uart_SendDeal_SearchLight_Control(Uartport, mode);
}
/*************
*
* 探照灯亮度
*
* **************/
int JZsdk_Uart_Send_SearchLight_SetLumen(int Uartport, int LeftLumen, int RightLumen)
{
JZsdk_Uart_SendDeal_SearchLight_SetLumen(Uartport, LeftLumen, RightLumen);
}
/*************
*
* 查询爆闪频率
*
* **************/
int JZsdk_Uart_Send_SearchLight_CheckStatus_Frequency(int Uartport)
{
JZsdk_Uart_SendDeal_Set_SearchLight_CheckStatus_Frequency(Uartport);
}
/*************
*
* 查询探照灯亮度
*
* **************/
int JZsdk_Uart_Send_SearchLight_CheckStatus_Lumen(int Uartport)
{
JZsdk_Uart_SendDeal_Set_SearchLight_CheckStatus_Lumen(Uartport);
}
/*************
*
* 查询探照灯模式
*
* **************/
int JZsdk_Uart_Send_SearchLight_CheckStatus_Mode(int Uartport)
{
JZsdk_Uart_SendDeal_Set_SearchLight_CheckStatus_Mode(Uartport);
}
/*************
*
* 查询探照灯属性
*
* **************/
int JZsdk_Uart_Send_SearchLight_CheckStatus_LightAttribute(int Uartport)
{
JZsdk_Uart_SendDeal_CheckStatus_LightAttribute(Uartport);
}
/*************
*
* 查询探照灯温度
*
* **************/
int JZsdk_Uart_Send_SearchLight_CheckStatus_SearchLightTemperture(int Uartport)
{
JZsdk_Uart_SendDeal_CheckStatus_SearchLightTemperture(Uartport);
}
/*************
*
* 探照灯消息订阅
*
* **************/
int JZsdk_Uart_Send_MessageSubcription_Control(int Uartport,int value)
{
JZsdk_Uart_SendDeal_MessageSubcription_Control(Uartport, value);
}
/*******************************************************************************************************************************
*
* 警灯部分
*
* *******************************************************************************************************************************/
/*************
*
* 设置警灯状态
*
* **************/
int JZsdk_Uart_Send_Set_WarningLight_Status(int Uartport,int status, int mode)
{
JZsdk_Uart_SendDeal_Set_WarningLight_Status(Uartport, status, mode);
}
/*************
*
* 设置警灯颜色
*
* **************/
int JZsdk_Uart_Send_Set_WarningLight_Color(int Uartport,int color1, int color2)
{
JZsdk_Uart_SendDeal_Set_WarningLight_Color(Uartport, color1, color2);
}
/*******************************************************************************************************************************
*
* 5B类部分
*
* *******************************************************************************************************************************/
/*************
*
* 发送探照灯爆闪频率
*
* **************/
int JZsdk_Uart_Send_SearchLight_Frequency(int Uartport,int value)
{
JZsdk_Uart_SendDeal_SearchLight_Frequency(Uartport, value);
}
/*************
*
* 发送探照灯模式
*
* **************/
int JZsdk_Uart_Send_SearchLight_Mode(int Uartport,int value)
{
JZsdk_Uart_SendDeal_SearchLight_Mode(Uartport, value);
}
/*************
*
* 发送探照灯亮度
*
* **************/
int JZsdk_Uart_Send_SearchLight_Lumen(int Uartport,int LeftLumen, int RightLumen)
{
JZsdk_Uart_SendDeal_SearchLight_Lumen(Uartport, LeftLumen, RightLumen);
}
/*************
*
* 发送探照灯温度
*
* **************/
int JZsdk_Uart_Send_SearchLight_Temperature(int Uartport,int LeftTemperature, int RightTemperature)
{
JZsdk_Uart_SendDeal_SearchLight_Temperature(Uartport, LeftTemperature, RightTemperature);
}
/*******************************************************************************************************************************
*
* 警灯部分
*
* *******************************************************************************************************************************/
/*************
*
* 发送警灯状态
*
* **************/
int JZsdk_Uart_Send_WarningLight_Status(int Uartport, int status, int mode)
{
JZsdk_Uart_SendDeal_WarningLight_Status(Uartport, status, mode);
}
/*************
*
* 发送警灯颜色
*
* **************/
int JZsdk_Uart_Send_WarningLight_Color(int Uartport, int color1, int color2)
{
JZsdk_Uart_SendDeal_WarningLight_Color(Uartport, color1, color2);
}
/*************
*
* 查询警灯状态
*
* **************/
int JZsdk_Uart_Send_CheckStatus_WarningLightStatus(int Uartport)
{
JZsdk_Uart_SendDeal_CheckStatus_WarningLightStatus(Uartport);
}
/*************
*
* 查询警灯颜色
*
* **************/
int JZsdk_Uart_Send_CheckStatus_WarningLightColor(int Uartport)
{
JZsdk_Uart_SendDeal_CheckStatus_WarningLightColor(Uartport);
}