/* FILE NAME:bufQueue.h AUTHOR:WJL DATE:2018 FUNCTION: *bufQueue.c HEAKER FILE */ #ifndef _BUF_QUEUE_H_ #define _BUF_QUEUE_H_ //#include "talk.h" //just import GU_NAME_SIZE #define PLY_MSG_QUEUE_LEN_MAX (336*20) //最多存20包(每包200ms,共10帧数据,这里按AMR最大算) #define REC_MSG_QUEUE_LEN_MAX (320*10*6) //最多存6包(每包200ms,共10帧数据,这里每帧320字节) #define OUTER_MSG_QUEUE_LEN_MAX (1024*8) #define INNER_MSG_QUEUE_LEN_MAX (1024) #define LOG_MSG_QUEUE_LEN_MAX (1024*3) #define MSG_QUEUE_NUM_MAX 250 //按最大200个成员队列算,取多50 typedef enum{ Q_PRO_INIT, Q_PRO_CLEAR }QUEUE_PRODEF; typedef enum{ Q_OUTER, Q_INNER, Q_LOG, Q_VOICEP, Q_VOICER, }QUEUE_DEF; #pragma pack(push) #pragma pack(1) typedef struct{ unsigned char type; unsigned int MsgLen; unsigned int DataStartIndex; }SUT_MESSAGE; typedef struct{ char queLocker; unsigned int MsgIn; unsigned int MsgOut; unsigned short MsgNum; SUT_MESSAGE MsgQueue[MSG_QUEUE_NUM_MAX]; unsigned int DataBufferLenMax; unsigned int DataBufferLen; unsigned int DataBufferIn; unsigned int DataBufferOut; char *DataBuffer; }SUT_MSG_QUEUE; typedef enum{ QSUB_VOICE_PLAY, QSUB_VOICE_RECORD, QSUB_COM_FROM_OUTTER, QSUB_COM_FROM_INNER, QSUB_COM_TO_INNER, QSUB_COM_TO_OUTTER, QSUB_COM_LOG }QSUB_DEF; #pragma pack(pop) short msgQueueAccept(unsigned char *pBuf,unsigned short BufLen, QUEUE_DEF type, unsigned char *subType); char msgQueueSet(void); void msgQueueClear(QUEUE_DEF type); unsigned short msgQueueNum(QUEUE_DEF type); char logToOutter(char *info); char msgToOutter(char *info);//msg-->queue-->cmd need to send to outter(usart) char msgSToOutter(unsigned char *info, unsigned short len);//msg-->queue-->cmd need to send to outter(usart) char msgToInner(char *info);//msg-->queue-->cmd need to send to inner(modem) char msgSToInner(unsigned char *info, unsigned short len);//msg-->queue-->cmd need to send to inner(modem) char msgToPlayer(unsigned char *info, unsigned short len);//msg-->queue-->voice to play char msgToRecord(unsigned char *info, unsigned short len);//msg-->queue-->voice that record char msgFromInner(unsigned char *info, unsigned short len);//msg-->queue-->cmd get from inner(modem) char msgFromOutter(unsigned char *info, unsigned short len);//msg-->queue-->cmd get from outter(usart) #endif