EgoClient.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. void ChangeState(int carID,UserState state); //ChangeState重新构建
  28. int32_t GetSteerAngle();
  29. //void SetCurrentPage(PageProp prop);
  30. //PageProp GetCurrentPage();
  31. void Start(std::array<IRender*, RenderPosition::ALL>& ar);
  32. 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);
  33. void OnImuData(float x, float y);
  34. void OnEncodeData(int32_t left, int32_t right);
  35. void OnPingValue(int32_t value, double temp);
  36. void OnStopAck();
  37. //增加wfg
  38. void SendCanDate(TPCANMsg* CANMsg);
  39. void SetReady(bool b);
  40. std::string GetAccount() ;
  41. std::string GetPassword() ;
  42. std::string GetName();
  43. //bool IsAutoClose();
  44. ControlStatus CheckStatus();
  45. SocketClient* GetSocketClient();
  46. //virtual void Process(CIOBuffer* pBuffer) override;
  47. //传递所有车辆信息
  48. virtual void OnRobot(const RemoNet::Robot& robot) override;
  49. virtual void OnConnected(bool bRet) override;
  50. virtual void OnSigin(int32_t uid,bool bRet,std::string user_uuid)override;
  51. virtual void OnVideoRep(bool ok,int32_t index, int32_t peer) override;
  52. virtual void OnVideoOffer(int32_t index, const char* type, const char* sdp) override;
  53. virtual void OnVideoAnswer(int32_t index, const char* type, const char* sdp) override;
  54. virtual void OnVideoCandidate(int32_t index, const char* candidate, int32_t sdp_mline_index, const char* sdp_mid) override;
  55. virtual void OnNotifyDel(int32_t peer, EgoType type) override;
  56. virtual void OnVideoLeave(int32_t peer, EgoType type) override;
  57. virtual void OnNotifyKick() override;
  58. virtual void OnMoveEnd(int32_t rid, WorkArea area, int32_t no) override;
  59. virtual void OnNotifyMoveRet(MoveDesc desc) override;
  60. virtual void OnNotifyState(int32_t rid, UserState state) override;
  61. void OnNDTPos(Position* pos);
  62. //当收到消息帧通知时,根据ChannelType来调用不同通道的处理函数
  63. virtual void OnMessageFrameNotify(ChannelType type, int16_t cmd, int16_t length, const void* data) override;
  64. //add-wfg
  65. void OnCautionLight(bool cautionLight);
  66. void OnLightL(bool lightL);
  67. void OnLightR(bool lightR);
  68. void OnGearF(bool gearF);
  69. void OnGearR(bool gearR);
  70. void OnCarPark(bool carPark);
  71. void OnBuzzerPlay(bool buzzerPlay);
  72. void OnLightFront(bool lightFront);
  73. void OnLightWork(bool lightWork);
  74. void OnEmergency(bool emergency);
  75. /// <summary>
  76. //mqtt
  77. void OnMqttData(cannet_frame* frames);
  78. /*
  79. void OnEmergency(bool enable, bool motor, bool gear, bool turnl, bool turnR);
  80. void OnAccel(int16_t accel, bool onoff);
  81. void OnSteer(uint64_t steer);
  82. void OnArm(int16_t flip, int16_t armL, int16_t armR, bool onoff);
  83. */
  84. /// </summary>
  85. //virtual void OnLidarData(bool isLeft, bool isDense, int32_t seq, PointXYZI* data, int32_t length) override;
  86. void OnFeedPage(FeedData& data);
  87. private:
  88. std::unique_ptr<SocketClient> _client;
  89. int32_t _carpeer;
  90. std::string _account;
  91. std::string _pass;
  92. std::string _accountText;
  93. std::string _passText;
  94. std::string _name;
  95. //bool _autoclose = false;
  96. IEgoNotify* _notify;
  97. bool _connected;
  98. std::vector<std::unique_ptr<UserCamera> > _userInfo;
  99. CUpdateThread _updateThread;
  100. std::vector<std::unique_ptr<CEgoWindow>> _WindowArray;
  101. std::unique_ptr<CControlSensor> _can;
  102. std::unique_ptr<CCarSim> _carsim;
  103. std::unique_ptr<COutSim> _outsim;
  104. std::unique_ptr<CRadarSim> _radarsim;
  105. //std::unique_ptr<CLidarSim> _lidarsim;
  106. int32_t _uid = 0;
  107. int32_t _steer_angle = 0;
  108. //PageProp _currentpage = PageProp::WorkPage1;
  109. };