shenlanfd.h 796 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef SHENLANFD_H
  2. #define SHENLANFD_H
  3. #include <thread>
  4. #include <iostream>
  5. #include <mutex>
  6. namespace iv {
  7. struct dcs
  8. {
  9. double mfTorque;
  10. double mfBrake;
  11. double mfWheel;
  12. double mblampleft;
  13. double mblampright;
  14. };
  15. }
  16. class Shenlanfd
  17. {
  18. public:
  19. Shenlanfd();
  20. ~Shenlanfd();
  21. void SetSpeed(double fSpeed);
  22. void SetDecision(iv::dcs &xdcs);
  23. void Get1C4(unsigned char * p1C4);
  24. void Get24E(unsigned char * p24E);
  25. void Get25E(unsigned char * p25E);
  26. private:
  27. void threadsend();
  28. void ExecuteDecision(iv::dcs & xdcs);
  29. private:
  30. std::thread * mpthreadsend;
  31. bool mbRun = true;
  32. bool mbHaveVehSpd = false;
  33. double mfVehSpd = 0.0;
  34. iv::dcs mdcs;
  35. std::mutex mmutexdcs;
  36. int64_t mnLastUpdate = 0;
  37. };
  38. #endif // SHENLANFD_H