vehicle_upload.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #ifndef VEHICLE_UPLOAD_H
  2. #define VEHICLE_UPLOAD_H
  3. #include <QObject>
  4. #include <QTimer>
  5. #include <QDateTime>
  6. #include <QVector>
  7. #include <QThread>
  8. #include <iostream>
  9. #include <memory>
  10. #include <string>
  11. #include <grpcpp/grpcpp.h>
  12. #include "VehicleUpload_service.grpc.pb.h"
  13. #include "VehicleUpload.grpc.pb.h"
  14. using grpc::Channel;
  15. using grpc::ClientContext;
  16. using grpc::Status;
  17. using org::jeecg::defsDetails::grpc::DataExchange; ///< service name
  18. using org::jeecg::defsDetails::grpc::UplinkRequest; ///< rpc fuction parameter and return
  19. using org::jeecg::defsDetails::grpc::ResponseMessage;
  20. using org::jeecg::defsDetails::grpc::UploadPathRequest;
  21. using org::jeecg::defsDetails::grpc::VehicleStatus; ///< other enum
  22. class DataExchangeClient : public QThread{
  23. Q_OBJECT
  24. public:
  25. DataExchangeClient(std::shared_ptr<Channel> channel);
  26. ~DataExchangeClient(void);
  27. std::string uploadVehicleInfo(void);
  28. std::string uploadPath(void);
  29. void updateData(void);
  30. void updatePath(std::string pathID,QVector<org::jeecg::defsDetails::grpc::MapPoint> points);
  31. protected:
  32. void run();
  33. private:
  34. std::unique_ptr<DataExchange::Stub> stub_;
  35. std::string id;
  36. uint64_t timeStamp;
  37. double SOC; //0.0-100.0%
  38. VehicleStatus statusFeedback = VehicleStatus::STATUS_EMERGENCY_STOP;
  39. double mileage; // kilometer
  40. double speed; // m/s
  41. org::jeecg::defsDetails::grpc::ShiftStatus shiftFeedback;
  42. double steeringWheelAngleFeedback; //+/-540 degree
  43. double throttleFeedback;
  44. double brakeFeedback;
  45. int32_t GPSRTKStatus; //GPS-RTK status 0-6 6 is best
  46. org::jeecg::defsDetails::grpc::GPSPoint positionFeedback;
  47. double pitch;
  48. double roll;
  49. double heading;
  50. QByteArray cameraImageFront;
  51. QByteArray cameraImageRear;
  52. QByteArray cameraImageLeft;
  53. QByteArray cameraImageRight;
  54. bool sensorStatusGPSIMU; //0 GPS-IMU ok 1 GPS-IMU error
  55. bool sensorStatusLidar;
  56. bool sensorStatusRadar;
  57. bool sensorStatusCamFront;
  58. bool sensorStatusCamRear;
  59. bool sensorStatusCamLeft;
  60. bool sensorStatusCamRight;
  61. int32_t isArrived; //0 no destination 1 not arrived 2 arrived
  62. std::string plateNumber;
  63. org::jeecg::defsDetails::grpc::CtrlMode modeFeedback = org::jeecg::defsDetails::grpc::CtrlMode::CMD_EMERGENCY_STOP; //mode Feedback
  64. org::jeecg::defsDetails::grpc::GPSPoint destinationPosition;
  65. std::string patrolPathID;
  66. QVector<org::jeecg::defsDetails::grpc::MapPoint> pathPoints;
  67. signals:
  68. void uploadPath_Finished(std::string pathID);
  69. public slots:
  70. void patrolPOI_Recieved_Slot(std::string pathID);
  71. };
  72. #endif // VEHICLE_UPLOAD_H