EgoClient.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #pragma once
  2. #include "message_queue.h"
  3. #include "api.h"
  4. #define WM_NOTIFY_CONNECTED WM_APP+100
  5. class IEgoNotify;
  6. class CEgoWindow;
  7. class IRender;
  8. #include "../common/sensor_socket.h"
  9. #include "./include/EgoInterface.h"
  10. #include "PCANBasic.h"
  11. class CControlSensor;
  12. class CCarSim;
  13. class COutSim;
  14. class CRadarSim;
  15. class CLidarSim;
  16. class CEgoClient : public INativeNotify
  17. {
  18. public:
  19. CEgoClient(IEgoNotify * C);
  20. void Login(std::string& account, std::string& pass);
  21. void OnCarConnect(int32_t peer);
  22. void OnCarLeave();
  23. void ReqCarList();
  24. void OnMoveBegin(int32_t rid, WorkArea area, int32_t no);
  25. void SwitchDriver(int32_t id);
  26. void ChangeState(UserState state);
  27. int32_t GetSteerAngle();
  28. //void SetCurrentPage(PageProp prop);
  29. //PageProp GetCurrentPage();
  30. void Start(std::array<IRender*, RenderPosition::ALL>& ar);
  31. void OnRadarData(int32_t r0, int32_t r1, int32_t r2, int32_t r3, int32_t r4, int32_t r5, int32_t r6, int32_t r7);
  32. void OnImuData(float x, float y);
  33. void OnEncodeData(int32_t left, int32_t right);
  34. void OnPingValue(int32_t value, double temp);
  35. void OnStopAck();
  36. //增加wfg
  37. void SendCanDate(TPCANMsg* CANMsg);
  38. void SetReady(bool b);
  39. std::string GetAccount() ;
  40. std::string GetPassword() ;
  41. std::string GetName();
  42. //bool IsAutoClose();
  43. ControlStatus CheckStatus();
  44. SocketClient* GetSocketClient();
  45. //virtual void Process(CIOBuffer* pBuffer) override;
  46. //传递所有车辆信息
  47. virtual void OnRobot(const RemoNet::Robot& robot) override;
  48. virtual void OnConnected(bool bRet) override;
  49. virtual void OnSigin(int32_t uid,bool bRet)override;
  50. virtual void OnVideoRep(bool ok,int32_t index, int32_t peer) override;
  51. virtual void OnVideoOffer(int32_t index, const char* type, const char* sdp) override;
  52. virtual void OnVideoAnswer(int32_t index, const char* type, const char* sdp) override;
  53. virtual void OnVideoCandidate(int32_t index, const char* candidate, int32_t sdp_mline_index, const char* sdp_mid) override;
  54. virtual void OnNotifyDel(int32_t peer, EgoType type) override;
  55. virtual void OnVideoLeave(int32_t peer, EgoType type) override;
  56. virtual void OnNotifyKick() override;
  57. virtual void OnMoveEnd(int32_t rid, WorkArea area, int32_t no) override;
  58. virtual void OnNotifyMoveRet(MoveDesc desc) override;
  59. virtual void OnNotifyState(int32_t rid, UserState state) override;
  60. void OnNDTPos(Position* pos);
  61. //当收到消息帧通知时,根据ChannelType来调用不同通道的处理函数
  62. virtual void OnMessageFrameNotify(ChannelType type, int16_t cmd, int16_t length, const void* data) override;
  63. //add-wfg
  64. void OnCautionLight(bool cautionLight);
  65. void OnLightL(bool lightL);
  66. void OnLightR(bool lightR);
  67. void OnGearF(bool gearF);
  68. void OnGearR(bool gearR);
  69. void OnCarPark(bool carPark);
  70. void OnBuzzerPlay(bool buzzerPlay);
  71. void OnLightFront(bool lightFront);
  72. void OnLightWork(bool lightWork);
  73. void OnEmergency(bool emergency);
  74. /// <summary>
  75. /*
  76. void OnEmergency(bool enable, bool motor, bool gear, bool turnl, bool turnR);
  77. void OnAccel(int16_t accel, bool onoff);
  78. void OnSteer(uint64_t steer);
  79. void OnArm(int16_t flip, int16_t armL, int16_t armR, bool onoff);
  80. */
  81. /// </summary>
  82. //virtual void OnLidarData(bool isLeft, bool isDense, int32_t seq, PointXYZI* data, int32_t length) override;
  83. void OnFeedPage(FeedData& data);
  84. private:
  85. std::unique_ptr<SocketClient> _client;
  86. int32_t _carpeer;
  87. std::string _account;
  88. std::string _pass;
  89. std::string _accountText;
  90. std::string _passText;
  91. std::string _name;
  92. //bool _autoclose = false;
  93. IEgoNotify* _notify;
  94. bool _connected;
  95. std::vector<std::unique_ptr<UserCamera> > _userInfo;
  96. CUpdateThread _updateThread;
  97. std::vector<std::unique_ptr<CEgoWindow>> _WindowArray;
  98. std::unique_ptr<CControlSensor> _can;
  99. std::unique_ptr<CCarSim> _carsim;
  100. std::unique_ptr<COutSim> _outsim;
  101. std::unique_ptr<CRadarSim> _radarsim;
  102. //std::unique_ptr<CLidarSim> _lidarsim;
  103. int32_t _uid = 0;
  104. int32_t _steer_angle = 0;
  105. //PageProp _currentpage = PageProp::WorkPage1;
  106. };