dataformat.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  1. #ifndef DATAFORMAT_H
  2. #define DATAFORMAT_H
  3. //////////////////////////////
  4. // 命令标识 //
  5. /////////////////////////////
  6. #define carCheckin (0x01)//车辆登入
  7. #define realtimeInfoUpload (0x02)//实时信息上报
  8. #define supplementInfoUpload (0x03)//补发信息上报
  9. #define carCheckout (0x04)//车辆登出
  10. #define platformReserve1 (0x05)//平台数据传输占用
  11. #define platfoemReserve2 (0x06)//平台数据传输占用
  12. #define heartbeats (0x07)//心跳
  13. #define terminalCheckTime (0x08)//终端校时
  14. #define carStatus (0x09)//车身状态
  15. #define driveDataLow (0x0A)//驾驶行为数据(低频)
  16. #define driveDataHigh (0x0B)//驾驶行为数据(高频)
  17. #define carAlarm (0x0C)//车辆报警信息
  18. #define sensorConfig (0x0D)//传感器配置信息
  19. #define multimedia (0x0E)//多媒体信息
  20. #define V2X (0x0F)//V2X信息
  21. #define APPcarcall (0x10)//APP约车上行信息
  22. #define humanIntervene (0x11)//人工干预信息
  23. #define inquire (0x80)//查询命令
  24. #define setting (0x81)//设置命令
  25. #define carTerminalControl (0x82)//车载终端控制命令
  26. #define carLongdistanceControl (0x83)//车身远程遥控命令
  27. #define longdistanceDrive (0x84)//远程遥控驾驶
  28. #define appointmentDispatch (0x85)//预约与远程调度
  29. #define routePlane (0x86)//路径规划
  30. #define carCamControl (0x87)//车载摄像头控制
  31. #define platformTo (0x88)//与APP通讯下行信息
  32. #define downDataReserve (0x89)//下行数据系统预留
  33. #define platformReserve (0xC0)//平台交换自定义数据
  34. //////////////////////////////
  35. // 应答标识 //
  36. /////////////////////////////
  37. #define resuccess (0x01)//成功
  38. #define reerror (0x02)//错误
  39. #define VINrepetition (0x03)//VIN重复
  40. #define reserves (0x40)//保留
  41. #define comment (0xFE)//命令
  42. #include <string>
  43. using namespace std;
  44. namespace iv {
  45. namespace platform {
  46. struct DataPackageHead//数据包结构
  47. {
  48. unsigned char startSymbol1;//起始符1
  49. unsigned char startSymbol2;//起始符2
  50. unsigned char commentSymbol;//命令标识
  51. unsigned char responseSymbol;//应答标识
  52. char VIN[17];//车辆识别码
  53. unsigned char encryptionType;//数据加密方式
  54. char dataLength[2];//数据单元长度
  55. // unsigned char *data;//数据单元
  56. // unsigned char verifyCode;//校验码
  57. };
  58. struct CarcheckinData //车辆登入数据包格式 0x01
  59. {
  60. unsigned char year;//年
  61. unsigned char month;//月
  62. unsigned char day;//日
  63. unsigned char hour;//时
  64. unsigned char minute;//分
  65. unsigned char second;//秒
  66. char checkinID[2];//登入号
  67. char ICCID[20];//sim卡iccid号
  68. unsigned char storageSysCount;//可充电储能系统数
  69. unsigned char storageSysEncodeLen;//可充电储能系统编码长度
  70. //string storageSysEncode[];//可充电储能系统编码
  71. };
  72. struct RealtimeInfo//实时数据上报 0x02
  73. {
  74. unsigned char year;//年
  75. unsigned char month;//月
  76. unsigned char day;//日
  77. unsigned char hour;//时
  78. unsigned char minute;//分
  79. unsigned char second;//秒
  80. };
  81. struct CarData//整车数据
  82. {
  83. unsigned char head;//头
  84. unsigned char carstatus;//车辆状态
  85. unsigned char chargeStatus;//充电状态
  86. unsigned char runMode;//运行模式
  87. char carSpeed[2];//车速
  88. char carMileage[4];//累计里程
  89. char totalVoltage[2];//总电压
  90. char totalElectricity[2];//总电流
  91. unsigned char SOC;//SOC
  92. unsigned char DCDC;//DC-DC状态
  93. unsigned char gear;//档位
  94. char resistance[2];//绝缘电阻
  95. unsigned char accelerateMile;//加速踏板行程值
  96. unsigned char brakingMile;//制动踏板行程值
  97. };
  98. struct DriveMotorInfo//驱动电机数据
  99. {
  100. unsigned char head;//头
  101. unsigned char motorCount;//驱动电机个数
  102. unsigned char motorNum;//驱动电机序号
  103. unsigned char motorStatus;//驱动电机状态
  104. unsigned char motorControlTemperature;//驱动电机控制器温度
  105. char motorRevolveSpeed[2];//驱动电机转速
  106. char motorTorque[2];//驱动电机转矩
  107. unsigned char motorTemperature;//驱动电机温度
  108. char motorInputVoltage[2];//电机控制器输入电压
  109. char motorElectricity[2];//电机控制器直流母线电流
  110. };
  111. struct FuelCellInfo//燃料电池数据
  112. {
  113. unsigned char head;//头
  114. char fuelCellVoltage[2];//燃料电池电压
  115. char fuelCellElectricity[2];//燃料电池电流
  116. char fuelConsumptionRate[2];//燃料消耗率
  117. char fuelTemperatureNeedleCount[2];//燃料电池温度探针总数
  118. char needleTemperature[4];//探针温度值
  119. char hydrogenTemperature[2];//氢系统中最高温度
  120. unsigned char hydrogenTemperatureNum;//氢系统中最高温度探针代号
  121. char hydrogenConcentration[2];//氢气最高浓度
  122. unsigned char hydrogenConcentrationNum;//氢气最高浓度传感器代号
  123. char hydrogenPressure[2];//氢气最高压力
  124. unsigned char hydrogenPressureNum;//氢气最高压力传感器代号
  125. unsigned char DCDC;//高压DC-DC状态
  126. };
  127. struct EngineInfo//发动机数据
  128. {
  129. unsigned char head;//头
  130. unsigned char engineStatus;//发动机状态
  131. char bentAxleRevolveSpeed[2];//曲轴转速
  132. char fuelConsumptionRate[2];//燃料消耗率
  133. };
  134. struct LocationInfo//定位数据
  135. {
  136. unsigned char head;//头
  137. unsigned char localStatus;//定位状态
  138. char longtitude[4];//经度
  139. char latitude[4];//纬度
  140. };
  141. struct ExtremumInfo//极值数据
  142. {
  143. unsigned char highVoltageNum;//最高电压电池子系统号
  144. unsigned char highCellVoltageNum;//最高电池电压单体代号
  145. char highCellVoltage[2];//电池单体电压最高值
  146. unsigned char lowVoltageNum;//最低电压电池子系统代号
  147. unsigned char lowCellVoltageNum;//最低电压电池单体代号
  148. char lowCellVoltage[2];//电池单体电压最低值
  149. unsigned char highTemperatureNum;//最高温度子系统号
  150. unsigned char highNeedleTemNum;//最高温度探针序号
  151. unsigned char highTemperature;//最高温度值
  152. unsigned char lowTemperatureNum;//最低温度子系统号
  153. unsigned char lowNeedleTemNum;//最低温度探针序号
  154. unsigned char lowTemperature;//最低温度值
  155. };
  156. struct AlarmInfo//报警数据
  157. {
  158. unsigned char head;//头
  159. unsigned char highAlarmGrade;//最高报警等级
  160. char normalAlarm[4];//通用报警
  161. unsigned char chargeableDeviceCount;//可充电储能装置故障总数
  162. char chargeableDevice;//可充电储能装置故障代码列表
  163. unsigned char driveMotorCount;//驱动电机故障总数
  164. char driveMotor[4];//驱动电机故障代码列表
  165. unsigned char engineCount;//发动机故障总数
  166. char engine[4];//发动机故障列表
  167. unsigned char elseCount;//其他故障总数
  168. char elses[4];//其他故障代码列表
  169. };
  170. struct ChargeableDeviceVoltageInfo//可充电储能系统单体电压数据
  171. {
  172. unsigned char head;//头
  173. unsigned char chargeableDeviceCount;//可充电储能装置子系统个数
  174. unsigned char chargeableDeviceNum;//可充电储能装置子系统号
  175. char chargeableDeviceVoltage[2];//可充电储能装置电压
  176. char chargeableDeviceElectricity[2];//可充电储能装置电流
  177. char cellCount[2];//单体电池总数
  178. char beginCellNum[2];//本帧起始电池序号
  179. unsigned char beginCellCount;//本帧单体电池总数
  180. };
  181. struct ChargeableDeviceTemperatureInfo//可充电储能装置温度数据
  182. {
  183. unsigned char head;//头
  184. unsigned char chargeableDeviceCount;//可充电储能装置子系统个数
  185. unsigned char chargeableDeviceNum;//可充电储能装置子系统号
  186. char temperatureNeedleCount[2];//可充电储能温度探针个数
  187. char temperature[4];//可充电储能子系统温度探针温度值
  188. };
  189. struct CarcheckoutData //车辆登出数据包格式 0x04
  190. {
  191. unsigned char year;//年
  192. unsigned char month;//月
  193. unsigned char day;//日
  194. unsigned char hour;//时
  195. unsigned char minute;//分
  196. unsigned char second;//秒
  197. char checkoutID[2];//登入号
  198. };
  199. struct CarStatus//车身状态 0x09
  200. {
  201. unsigned char year;//年
  202. unsigned char month;//月
  203. unsigned char day;//日
  204. unsigned char hour;//时
  205. unsigned char minute;//分
  206. unsigned char second;//秒
  207. unsigned char leftFrontdoor;//左前车门
  208. unsigned char rightFrontdoor;//右前车门
  209. unsigned char leftBackdoor;//左后车门
  210. unsigned char rightBackdoor;//右后车门
  211. unsigned char backTrunk;//后尾箱
  212. unsigned char leftFrontWindow;//左前车窗
  213. unsigned char rightFrontWindow;//右前车窗
  214. unsigned char leftBackWindow;//左后车窗
  215. unsigned char rightBackWindow;//右后车窗
  216. unsigned char skyWindow;//天窗
  217. unsigned char leftFrontLock;//左前车锁
  218. unsigned char rightFrontLock;//右前车锁
  219. unsigned char leftBackLock;//左后车锁
  220. unsigned char rightBackLock;//右后车锁
  221. unsigned char handBrake;//手刹
  222. unsigned char positionLight;//位置灯
  223. unsigned char nearLight;//近光灯
  224. unsigned char farLight;//远光灯
  225. unsigned char frontFogLight;//前雾灯
  226. unsigned char backFogLight;//后雾灯
  227. unsigned char airConditioner;//空调
  228. unsigned char block;//档位
  229. unsigned char key;//钥匙
  230. };
  231. struct DriveDataLow//驾驶行为数据 (低频) 0x0A
  232. {
  233. unsigned char year;//年
  234. unsigned char month;//月
  235. unsigned char day;//日
  236. unsigned char hour;//时
  237. unsigned char minute;//分
  238. unsigned char second;//秒
  239. unsigned char autoDriveMode;//自动驾驶模式
  240. unsigned char urgentStop;//急停开关状态
  241. unsigned char UCStatus;//UC工作状态
  242. unsigned char UCError;//UC故障状态
  243. unsigned char UCMode;//UC工作模式
  244. unsigned char UC2EPSRequest;//UC请求控制EPS请求位
  245. unsigned char UC2EPSMess;//UC请求控制EPS消息有效性
  246. unsigned char CDDAccelerate;//指示CDD加速度请求信号有效性
  247. unsigned char UCBlock;//UC请求档位
  248. unsigned char brakeSatus;//刹车踏板状态
  249. unsigned char leftStatus;//左转向状态
  250. unsigned char rightStatus;//右转向状态
  251. unsigned char UC2ACCStart;//指示UC是否有ACC起步请求
  252. unsigned char UC2ACCStandstill;//指示UC是否有ACC standstill 刹停请求
  253. };
  254. struct DriveDataHigh//驾驶行为数据 (高频) 0x0B
  255. {
  256. unsigned char year;//年
  257. unsigned char month;//月
  258. unsigned char day;//日
  259. unsigned char hour;//时
  260. unsigned char minute;//分
  261. unsigned char second;//秒
  262. unsigned char collectCycle;//数据采集周期
  263. char UC2EPSAngle[2];//UC请求控制EPS目标角度
  264. unsigned char UC2AEBDecelerate;//指示UC是否有AEB减速请求
  265. char carSpeed[2];//车速
  266. char engineRevolve[2];//发动机转速
  267. char accelerate[2];//实际加速度(减速度)
  268. unsigned char UC2Accelerator;//UC请求油门踏板开度
  269. };
  270. struct CarAlarm//车辆报警信息 0x0C
  271. {
  272. unsigned char year;//年
  273. unsigned char month;//月
  274. unsigned char day;//日
  275. unsigned char hour;//时
  276. unsigned char minute;//分
  277. unsigned char second;//秒
  278. unsigned char EPSStatus;//EPS状态
  279. unsigned char UCStatus;//UC工作状态
  280. unsigned char UCError;//UC故障状态
  281. unsigned char MCUStatus;//MCU工作状态反馈
  282. unsigned char BCMStatus;//BCM当前状态反馈
  283. unsigned char VCMStatus;//VCM工作状态反馈
  284. unsigned char EPS2ACCError;//指示ESP检测到ACC发出的信息是否有误
  285. };
  286. struct SensorConfig//传感器配置信息 0x0D
  287. {
  288. unsigned char year;//年
  289. unsigned char month;//月
  290. unsigned char day;//日
  291. unsigned char hour;//时
  292. unsigned char minute;//分
  293. unsigned char second;//秒
  294. unsigned char lidar64;//64线激光雷达
  295. unsigned char lidar16left;//左16线激光雷达
  296. unsigned char lidar16right;//右16线激光雷达
  297. unsigned char lidar4;//4线激光雷达
  298. unsigned char radarFront;//前毫米波雷达
  299. unsigned char radarBack;//后毫米波雷达
  300. unsigned char GPS;//GPS
  301. unsigned char camera;//摄像头
  302. };
  303. struct Multimedia//多媒体信息上报 0X0E
  304. {
  305. unsigned char year;//年
  306. unsigned char month;//月
  307. unsigned char day;//日
  308. unsigned char hour;//时
  309. unsigned char minute;//分
  310. unsigned char second;//秒
  311. char multimediaID[4];//多媒体ID
  312. unsigned char multimediaType;//多媒体类型
  313. unsigned char multimediaEncode;//多媒体格式编码
  314. unsigned char eventEncode;//事件项编码
  315. unsigned char channelID;//通道ID
  316. char localzation[28];//位置信息上报
  317. char multimediaData[100];//多媒体数据包
  318. };
  319. struct V2XInfo//V2X 信息 0x0F
  320. {
  321. };
  322. struct ToPlatform//与云平台服务的上行消息 0x10
  323. {
  324. unsigned char year;//年
  325. unsigned char month;//月
  326. unsigned char day;//日
  327. unsigned char hour;//时
  328. unsigned char minute;//分
  329. unsigned char second;//秒
  330. unsigned char commID1;//上传信息ID
  331. unsigned char commInfo;//约车反馈
  332. };
  333. struct HumanIntervene//人工干预信息上报 0x11
  334. {
  335. unsigned char year;//年
  336. unsigned char month;//月
  337. unsigned char day;//日
  338. unsigned char hour;//时
  339. unsigned char minute;//分
  340. unsigned char second;//秒
  341. unsigned char humanInterType;//人工干预类型
  342. char humanInterTime[2];//人工干预转换时间
  343. };
  344. struct CarControl//车辆远程控制信息 0x83 下行
  345. {
  346. unsigned char year;//年
  347. unsigned char month;//月
  348. unsigned char day;//日
  349. unsigned char hour;//时
  350. unsigned char minute;//分
  351. unsigned char second;//秒
  352. unsigned char controlID1;//控制ID1
  353. unsigned char leftFrontdoor;//左前门控制
  354. unsigned char controlID2;//控制ID2
  355. unsigned char rightFrontdoor;//右前门控制
  356. unsigned char controlID3;//控制ID3
  357. unsigned char leftBackdoor;//左后门控制
  358. unsigned char controlID4;//控制ID4
  359. unsigned char rightBackdoor;//右后门控制
  360. unsigned char controlID5;//控制ID5
  361. unsigned char backTrunk;//后尾箱控制
  362. unsigned char controlID6;//控制ID6
  363. unsigned char leftFrontWindow;//左前窗控制
  364. unsigned char controlID7;//控制ID7
  365. unsigned char rightFrontWindow;//右前窗控制
  366. unsigned char controlID8;//控制ID8
  367. unsigned char leftBackWindow;//左后窗控制
  368. unsigned char controlID9;//控制ID9
  369. unsigned char rightBackWindow;//右后窗控制
  370. unsigned char controlID0A;//控制ID10
  371. unsigned char skyWindow;//天窗
  372. unsigned char controlID0B;//控制ID11
  373. unsigned char leftFrontLock;//左前车锁
  374. unsigned char controlID0C;//控制ID12
  375. unsigned char rightFrontLock;//右前车锁
  376. unsigned char controlID0D;//控制ID13
  377. unsigned char leftBackLock;//左后车锁
  378. unsigned char controlID0E;//控制ID14
  379. unsigned char rightBackLock;//右后车锁
  380. unsigned char controlID0F;//控制ID15
  381. unsigned char handBrake;//手刹
  382. unsigned char controlID10;//控制ID16
  383. unsigned char positionLight;//位置灯
  384. unsigned char controlID11;//控制ID17
  385. unsigned char nearLight;//近光灯
  386. unsigned char controlID12;//控制ID18
  387. unsigned char farLight;//远光灯
  388. unsigned char controlID13;//控制ID19
  389. unsigned char frontFogLight;//前雾灯
  390. unsigned char controlID14;//控制ID20
  391. unsigned char backFogLight;//后雾灯
  392. unsigned char controlID15;//控制ID21
  393. unsigned char airConditioner;//空调
  394. unsigned char controlID16;//控制ID22
  395. char speed[2];//速度设置
  396. unsigned char controlID17;//控制ID23
  397. unsigned char key;//钥匙
  398. };
  399. struct FarControl//远程遥控驾驶 0x84 下行
  400. {
  401. unsigned char year;//年
  402. unsigned char month;//月
  403. unsigned char day;//日
  404. unsigned char hour;//时
  405. unsigned char minute;//分
  406. unsigned char second;//秒
  407. unsigned char platMode;//云平台工作模式
  408. char CP2EPSAngle[2];//CP请求控制EPS目标角度
  409. char CP2Decelerate[2];//CP请求制动减速度值
  410. unsigned char CP2Accelerate;//CP请求油门开度
  411. unsigned char CP2Block;//CP请求档位信息
  412. };
  413. struct AppointmentDispatch//预约与远程调度 0x85 下行
  414. {
  415. unsigned char year;//年
  416. unsigned char month;//月
  417. unsigned char day;//日
  418. unsigned char hour;//时
  419. unsigned char minute;//分
  420. unsigned char second;//秒
  421. unsigned char appointYear;//年 预约时间
  422. unsigned char appointMonth;//月 预约时间
  423. unsigned char appointDay;//日 预约时间
  424. unsigned char appointHour;//时 预约时间
  425. unsigned char appointMinute;//分 预约时间
  426. unsigned char appointSecond;//秒 预约时间
  427. unsigned char humanCount;//预约人数
  428. unsigned char srcLocalStatus;//预约出发地定位状态
  429. char srcLocalLong[4];//预约出发地经度
  430. char srcLocalLat[4];//预约出发地纬度
  431. unsigned char desLocalStatus;//目的地定位状态
  432. char desLocalLong[4];//目的地定位经度
  433. char desLocalLat[4];//目的地定位纬度
  434. };
  435. struct RoutePlaning
  436. {
  437. unsigned char year;//年
  438. unsigned char month;//月
  439. unsigned char day;//日
  440. unsigned char hour;//时
  441. unsigned char minute;//分
  442. unsigned char second;//秒
  443. unsigned char lineID;
  444. char numName[5];
  445. char usename[3];
  446. char password[3];
  447. char address[6];
  448. char port[2];
  449. char filename1[7];
  450. char filename2[12];
  451. char URLAddress[16];
  452. char connectTime[2];
  453. };
  454. struct PlatformTo//与云平台服务的下行消息 0x88
  455. {
  456. unsigned char year;//年
  457. unsigned char month;//月
  458. unsigned char day;//日
  459. unsigned char hour;//时
  460. unsigned char minute;//分
  461. unsigned char second;//秒
  462. unsigned char infoID1;//下发信息ID
  463. unsigned char appointStart;//出发
  464. unsigned char infoID2;//下发信息ID
  465. unsigned char carStart;//车辆出发
  466. unsigned char infoID3;//下发信息ID
  467. unsigned char carStop;//停车
  468. unsigned char infoID4;//下发信息ID
  469. unsigned char backToGarage;//返回车库
  470. unsigned char infoID5;//下发信息ID
  471. unsigned char reAppoint;//重新预约
  472. unsigned char infoID6;//下发信息ID
  473. unsigned char keepGoing;//继续行程
  474. };
  475. struct station
  476. {
  477. double longtitude;
  478. double latitude;
  479. int ID;
  480. };
  481. }
  482. }
  483. #endif // DATAFORMAT_H