platform.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #ifndef PLATFORM_H
  2. #define PLATFORM_H
  3. #include <common/boost.h>
  4. #include <istream>
  5. #include <stdlib.h>
  6. #include <string.h>
  7. #include <vector>
  8. #include <fstream>
  9. #include <qtimer.h>
  10. #include "dataformat.h"
  11. //#include <control/can.h>
  12. //#include <control/control_status.h>
  13. //#include <common/lidar.h>
  14. #include <common/car_status.h>
  15. #include <QtNetwork/QTcpSocket>
  16. #include <QFile>
  17. #include <QtNetwork/QNetworkRequest>
  18. #include <QtNetwork/QNetworkAccessManager>
  19. #include <QUrl>
  20. #include <QtNetwork/QNetworkReply>
  21. #include <QByteArray>
  22. //#include <QMessageBox>
  23. #include <QFileInfo>
  24. #include <QDir>
  25. #define SRV_ADDR_ "123.127.164.44"
  26. #define SRV_PORT_ 5602
  27. using namespace std;
  28. namespace iv {
  29. namespace platform {
  30. class Client
  31. {
  32. public:
  33. Client();
  34. ~Client();
  35. double srclng;
  36. double srclat;
  37. double deslng;
  38. double deslat;
  39. void start();
  40. void run();
  41. void stop();
  42. void Heartdetect();
  43. int PackagetHeadInfo(unsigned char commendID, int dataLen);
  44. bool CarCheckin(int count);//车辆登入0x01
  45. void RealtimeInfo();//实时信息上报0x01
  46. void SupplementInfo();//补发信息上报0x03
  47. bool CarCheckout(int count);//车辆登出0x04
  48. void Heartbeat();//发送心跳 0x07
  49. void TerminalCheckTime();//终端校时0x08
  50. void CarStatusInfo();//车身状态数据0x09
  51. void DriveDataLowInfo();//驾驶行为数据 低频 0x0A
  52. void DriveDataHighInfo();//驾驶行为数据 高频 0x0B
  53. void SenserConfig();
  54. void CarControlInfo(char recvBuf[]);
  55. void LongdistanceDriveInfo(char recvBuf[]);
  56. void AppointmentDispatchInfo(char recvBuf[]);
  57. void PlatformtToInfo(char recvBuf[]);
  58. void RoutePlaningInfo(char recvBuf[]);
  59. void CarCallSwitch();
  60. void Receive();//接收数据
  61. char BCCEncode(char sbuf[],int len);//计算校验
  62. bool BCCDecode(char sbuf[], int len);
  63. void ReadStation(char *filepath);
  64. private:
  65. QTcpSocket *socket;
  66. bool is_checkin ;
  67. bool is_receive;
  68. int heartdetect;
  69. int heartdetect_last;
  70. int checkInOutNum;
  71. bool is_order;
  72. bool is_going;
  73. bool is_stopnext;
  74. bool is_stopend;
  75. bool is_stopmid;
  76. bool is_endnow;
  77. bool is_endbegin;
  78. bool is_reorder;
  79. bool is_keepgoing;
  80. iv::platform::CarStatus carStatusInfo;
  81. iv::platform::DataPackageHead packageDataHead;
  82. };
  83. }
  84. }
  85. #endif // PLATFORM_H