You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.3 KiB
55 lines
1.3 KiB
#include "app_task_speech.h"
|
|
#define START_CODE 0x7E
|
|
#define END_CODE 0xEF
|
|
TS_TASK_SPEECH ts_speech;
|
|
|
|
void L3_task_speech_init(void)
|
|
{
|
|
U8 i;
|
|
L1_task_init(&ts_speech.task);
|
|
L3_task_s_go(ts_speech,D_task_init);
|
|
for(i=0;i<CC_SPEECH_INFO;i++)
|
|
{
|
|
ts_speech.cc_speech_info[i].mask = 0;
|
|
}
|
|
ts_speech.cc_speech_info[0].oper = SPEECH_NAME_PLAY;
|
|
ts_speech.cc_speech_info[0].mask = 0;
|
|
}
|
|
void L3_task_speech_handle(TS_tcp *s)
|
|
{
|
|
|
|
}
|
|
|
|
U8 L3_pack_speech_A3(TS_SPEECH *pspeech , U8 *tcp_buf ,U8 *buf)//tcp传来的buf
|
|
{
|
|
long name;
|
|
U8 bufsize = 9;
|
|
pspeech->start = START_CODE;
|
|
pspeech->num = 0x07;
|
|
pspeech->oper = SPEECH_NAME_PLAY;
|
|
pspeech->title = 0x43;
|
|
name = hexToDec(&tcp_buf);
|
|
tcp_buf[0] = (int)(name/100);
|
|
tcp_buf[1] = (int)((name%100)/10);
|
|
tcp_buf[2] = (int)(name%10);
|
|
Lc_hex2ascii(&tcp_buf,&pspeech->buf,3);
|
|
pspeech->crc = (pspeech->num + pspeech->oper + pspeech->buf[0] + pspeech->buf[1] + pspeech->buf[2] + pspeech->buf[3])>> 0 & 0xFF//累加和校验
|
|
pspeech->end = END_CODE;
|
|
|
|
return bufsize;
|
|
}
|
|
U8 L3_pack_ccmodbus(TS_SPEECH *pspeech , CC_SPEECH_INFO *speech_info)
|
|
{
|
|
U16 pkglen = 0;
|
|
switch(speech_info->oper)
|
|
{
|
|
case SPEECH_NAME_PLAY:
|
|
pkglen = L3_pack_ccmodbus_03(pspeech,tcp_buf,speech_info->buf);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
pccmodbus->num = pkglen;
|
|
return pkglen + 3;
|
|
}
|
|
|
|
|