proBuBiao.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. #ifndef __BU_BIAO_H_
  2. #define __BU_BIAO_H_
  3. typedef unsigned char BYTE;
  4. typedef unsigned short WORD;
  5. typedef unsigned long DWORD;
  6. typedef unsigned int BOOL;
  7. #define TSGPS_PACK_HEAD 0x7e
  8. #define TSGPS_PACK_END 0x7e
  9. /***终端通用应答***/
  10. #define TS_TERMINAL_UNIVERSAL_ANSWER 0x0001
  11. //平台通用应答
  12. #define TS_PLATFORM_UNIVERSAL_ANSWER 0x8001
  13. //终端心跳
  14. #define TS_TERMINAL_HEARTBEAT 0x0002
  15. //分包
  16. #define TS_SUBCONTRACTPACKET 0x8003
  17. //终端注册
  18. #define TS_TERMINAL_REGISTRATION 0X0100
  19. //终端注册应答
  20. #define TS_TERMINAL_REGISTRATION_REPLY 0X8100
  21. //终端鉴权
  22. #define TS_TERMINAL_AUTHENTICATION 0x0102
  23. //位置信息汇报
  24. #define TS_LOCATION_INFORMATION_REPORTING 0x0200
  25. //文本信息下发
  26. #define TS_TEXT_INFORMATION_ISSUED 0x8300
  27. //设置终端参数
  28. #define TS_SETTING_TERMINAL_PARAMETERS 0x8103
  29. #if 0
  30. //设置终端参数
  31. #define TS_SETTING_TERMINAL_PARAMETERS 0x8103
  32. //查询终端参数
  33. #define TS_QUERY_TERMINAL_PARAMETERS 0x8104
  34. //查询终端参数应答
  35. #define TS_QUERY_PARAMETER_RESPONSE_TERMINAL 0x0104
  36. //终端控制
  37. #define TS_TERMINAL_CONTROL 0x8105
  38. //终端注销
  39. #define TS_TERMINAL_CANCELLATION 0x0003
  40. //位置信息查询
  41. #define TS_LOCATION_INFORMATION_INQUIRY 0x8201
  42. //位置信息查询应答
  43. #define TS_LOCATION_INFORMATION_INQUIRY_RESPONSE 0x0201
  44. //临时位置跟踪控制
  45. #define TS_PROVISIONAL_INFORMATION_TRACKING_CONTROL 0x8202
  46. //事件设置
  47. #define TS_EVENT_SETTINGS 0x8301
  48. //事件报告
  49. #define TS_EVENT_REPORT 0x0301
  50. //提问下发
  51. #define TS_QUESTION_ISSUED 0x8302
  52. //提问应答
  53. #define TS_QUESTION_ANSWER 0x0302
  54. //信息点播菜单设置
  55. #define TS_INFORMATION_ON_DEMAND_MENU_SETTINGS 0x8303
  56. //信息点播/取消
  57. #define TS_INFORMATION_ON_DEMAND_CANCELLATIONS 0x0303
  58. //信息服务
  59. #define TS_INFORMATION_SERVICES 0x8304
  60. //电话回拨
  61. #define TS_CALL_BACK 0x8400
  62. //设置电话本
  63. #define TS_SET_THE_PHONE_BOOK 0x8401
  64. //车辆控制
  65. #define TS_THE_VEHICLE_CONTROL 0x8500
  66. //车辆控制应答
  67. #define TS_VEHICLE_CONTROL_RESPONSES 0x0500
  68. //设置圆形区域
  69. #define TS_SET_CIRCULAR_AREA 0x8600
  70. //删除圆形区域
  71. #define TS_REMOVE_CIRCULAR_AREA 0x8601
  72. //设置矩形区域
  73. #define TS_SETTING_RECTANGULAR_AREA 0x8602
  74. //删除矩形区域
  75. #define TS_DELETE_RECTANGULAR_AREA 0x8603
  76. //设置多边形区域
  77. #define TS_SET_POLYGON_AREA 0x8604
  78. //删除多边形区域
  79. #define TS_DELETE_POLYGON_AREA 0x8605
  80. //设置线路
  81. #define TS_SET_LINE 0x8606
  82. //删除线路
  83. #define TS_DELETE_SET_LINE 0x8607
  84. //行驶记录数据采集命令
  85. #define TS_WITH_RECORD_DATA_COLLECTION 0x8700
  86. //行驶记录数据上传
  87. #define TS_WITH_RECORDING_DATA_UPLOAD 0x0700
  88. //行驶记录参数下传
  89. #define TS_WITH_RECORDING_DATA_DOWNLINK 0x8101
  90. //电子运单上报
  91. #define TS_ELECTRONIC_WAYBILL_REPORTED 0x0701
  92. //驾驶员身份信息采集上报
  93. #define TS_DRIVER_IDENTITY_DATA_COLLECTION 0x0702
  94. //多媒体事件信息上传
  95. #define TS_MULTIMEDIA_EVENT_UPLOAD 0x0800
  96. //多媒体数据上传
  97. #define TS_MULTIMEDIA_DATA_UPLOAD 0x0801
  98. //多媒体数据上传应答
  99. #define TS_MULTIMEDIA_DATA_UPLOAD_REPLY 0x8800
  100. //摄像头立即拍摄命令
  101. #define TS_CAMERA_IMMEDIATELY_SHOOTING_COMMAND 0x8801
  102. //存储多媒体数据检索
  103. #define TS_STORING_MULTIMEDIA_DATA_RETRIEVAL 0x8802
  104. //存储多媒体数据检索应答
  105. #define TS_STORING_MULTIMEDIA_DATA_RETRIEVAL_RESPONSE 0x0802
  106. //存储多媒体数据上传命令
  107. #define TS_STORING_MULTIMEDIA_DATA_UPLOAD_COMMAND 0x8803
  108. //录音开始命令
  109. #define TS_RECORDING_START_COMMAND 0x8804
  110. //数据下行透传
  111. #define TS_DOWNLINK_DATA_PASSTHROUGH 0x8900
  112. //数据上行透传
  113. #define TS_UPLINK_DATA_PASSTHROUGH 0x0900
  114. //数据压缩上报
  115. #define TS_DATA_COMPRESSION_REPORTING 0x0901
  116. //平台RSA公钥
  117. #define TS_PLATFORM_RSA_PUBLIC_KEY 0x8A00
  118. //终端RSA公钥
  119. #define TS_TERMINAL_RSA_PUBLIC_KEY 0x0A00
  120. #endif
  121. //保留自定义
  122. //终端上传SOS消息
  123. #define TS_SEND_SOS_SMS 0x0F01
  124. #define TS_TERMINAL_REQTIME 0x0F02
  125. typedef struct registration{
  126. WORD proID;//省域ID 16byte
  127. WORD CityID; //市域ID16byte
  128. BYTE Manufacturers[5]; //制造商
  129. BYTE TerMod[20]; //终端型号 不足补0x00
  130. BYTE TerID[7]; //终端ID 不足补0x00 本来7个字节 为了跟星安一致 取4个字节
  131. BYTE PlateColor; //车牌颜色 未上牌取值为0
  132. // STRING Plate; //车牌
  133. BYTE Plate[8];//WORD 8
  134. }REGISTRATION;
  135. typedef enum ENCRYPTYPE1{NO_ENCRYP=0,RSA=1}ENCRYPTYPE;
  136. typedef struct msgBodyAttrib{
  137. BOOL bSepartePack;//是否分包
  138. ENCRYPTYPE EncrypType; //加密
  139. int msgBodyLength; //消息长度
  140. }AVL_MSG_BODY_ATTRIB;
  141. typedef struct SUT_GPS_SEND_DATA{
  142. unsigned int St;
  143. unsigned int status;
  144. unsigned char WWWW[4];
  145. unsigned char JJJJ[4];
  146. unsigned short Mileag;
  147. unsigned short SSFF;
  148. unsigned short Acpect;
  149. unsigned char Time[6];
  150. }__attribute__((packed)) SUT_GPS_SEND_DATA;
  151. typedef struct{
  152. unsigned char feedBackStart:1;
  153. unsigned short feedID;
  154. unsigned short feedliushuiID;
  155. unsigned char result;
  156. }__attribute__ ((packed)) FEEDBACK_DEF;
  157. extern FEEDBACK_DEF sutFeed;
  158. extern unsigned char buBiaoSosSendNow;
  159. void buBiaoLogic(unsigned char socketID);
  160. int reduce(unsigned char *pData,int DataLen);
  161. void TSMakeGpsSendData(SUT_GPS_SEND_DATA *sendGpsData);
  162. void buBiaoDataProcess(unsigned char *msg, unsigned short len);
  163. void TSGpsDataInit(void);
  164. void PrintBufferData(unsigned char *data, unsigned short length);
  165. #endif