bufQueue.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. FILE NAME:bufQueue.h
  3. AUTHOR:WJL
  4. DATE:2018
  5. FUNCTION:
  6. *bufQueue.c HEAKER FILE
  7. */
  8. #ifndef _BUF_QUEUE_H_
  9. #define _BUF_QUEUE_H_
  10. //#include "talk.h" //just import GU_NAME_SIZE
  11. #define PLY_MSG_QUEUE_LEN_MAX (336*20) //最多存20包(每包200ms,共10帧数据,这里按AMR最大算)
  12. #define REC_MSG_QUEUE_LEN_MAX (320*10*6) //最多存6包(每包200ms,共10帧数据,这里每帧320字节)
  13. #define OUTER_MSG_QUEUE_LEN_MAX (41*200+64) //important 按最大200个成员队列算,取多256字节
  14. #define INNER_MSG_QUEUE_LEN_MAX (512)
  15. #define LOG_MSG_QUEUE_LEN_MAX (512)
  16. #define MSG_QUEUE_NUM_MAX 250 //按最大200个成员队列算,取多50
  17. typedef enum{
  18. Q_PRO_INIT,
  19. Q_PRO_CLEAR
  20. }QUEUE_PRODEF;
  21. typedef enum{
  22. Q_OUTER,
  23. Q_INNER,
  24. Q_LOG,
  25. Q_VOICEP,
  26. Q_VOICER,
  27. }QUEUE_DEF;
  28. #pragma pack(push)
  29. #pragma pack(1)
  30. typedef struct{
  31. unsigned char type;
  32. unsigned int MsgLen;
  33. unsigned int DataStartIndex;
  34. }SUT_MESSAGE;
  35. typedef struct{
  36. char queLocker;
  37. unsigned int MsgIn;
  38. unsigned int MsgOut;
  39. unsigned short MsgNum;
  40. SUT_MESSAGE MsgQueue[MSG_QUEUE_NUM_MAX];
  41. unsigned int DataBufferLenMax;
  42. unsigned int DataBufferLen;
  43. unsigned int DataBufferIn;
  44. unsigned int DataBufferOut;
  45. char *DataBuffer;
  46. }SUT_MSG_QUEUE;
  47. typedef enum{
  48. QSUB_VOICE_PLAY,
  49. QSUB_VOICE_RECORD,
  50. QSUB_COM_FROM_OUTTER,
  51. QSUB_COM_FROM_INNER,
  52. QSUB_COM_TO_INNER,
  53. QSUB_COM_TO_OUTTER,
  54. QSUB_COM_LOG
  55. }QSUB_DEF;
  56. #pragma pack(pop)
  57. short msgQueueAccept(unsigned char *pBuf,unsigned short BufLen, QUEUE_DEF type, unsigned char *subType);
  58. char msgQueueSet(void);
  59. void msgQueueClear(QUEUE_DEF type);
  60. unsigned short msgQueueNum(QUEUE_DEF type);
  61. char logToOutter(char *info);
  62. char msgToOutter(char *info);//msg-->queue-->cmd need to send to outter(usart)
  63. char msgSToOutter(unsigned char *info, unsigned short len);//msg-->queue-->cmd need to send to outter(usart)
  64. char msgToInner(char *info);//msg-->queue-->cmd need to send to inner(modem)
  65. char msgSToInner(unsigned char *info, unsigned short len);//msg-->queue-->cmd need to send to inner(modem)
  66. char msgToPlayer(unsigned char *info, unsigned short len);//msg-->queue-->voice to play
  67. char msgToRecord(unsigned char *info, unsigned short len);//msg-->queue-->voice that record
  68. char msgFromInner(unsigned char *info, unsigned short len);//msg-->queue-->cmd get from inner(modem)
  69. char msgFromOutter(unsigned char *info, unsigned short len);//msg-->queue-->cmd get from outter(usart)
  70. #endif