EgoClient.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #pragma once
  2. #include "message_queue.h"
  3. #define WM_NOTIFY_CONNECTED WM_APP+100
  4. class IEgoNotify;
  5. class CEgoWindow;
  6. class IRender;
  7. #include "../common/sensor_socket.h"
  8. #include "./include/EgoInterface.h"
  9. class CControlSensor;
  10. class CCarSim;
  11. class CRadarSim;
  12. class CLidarSim;
  13. class CEgoClient : public INativeNotify
  14. {
  15. public:
  16. CEgoClient(IEgoNotify * C);
  17. void Login(std::string& account, std::string& pass);
  18. void OnCarConnect(int32_t peer);
  19. void OnCarLeave();
  20. void ReqCarList();
  21. void OnMoveBegin(int32_t rid, WorkArea area, int32_t no);
  22. void SwitchDriver(int32_t id);
  23. void ChangeState(UserState state);
  24. int32_t GetSteerAngle();
  25. //void SetCurrentPage(PageProp prop);
  26. //PageProp GetCurrentPage();
  27. void Start(std::array<IRender*, RenderPosition::ALL>& ar);
  28. void OnRadarData(int32_t r0, int32_t r1, int32_t r2, int32_t r3, int32_t r4, int32_t r5, int32_t r6);
  29. void OnEncodeData(int32_t left, int32_t right);
  30. void OnPingValue(int32_t value, double temp);
  31. void OnStopAck();
  32. void SetReady(bool b);
  33. std::string GetAccount() ;
  34. std::string GetPassword() ;
  35. std::string GetName();
  36. //bool IsAutoClose();
  37. ControlStatus CheckStatus();
  38. SocketClient* GetSocketClient();
  39. //virtual void Process(CIOBuffer* pBuffer) override;
  40. virtual void OnRobot(const RemoNet::Robot& robot) override;
  41. virtual void OnConnected(bool bRet) override;
  42. virtual void OnSigin(int32_t uid,bool bRet)override;
  43. virtual void OnVideoRep(bool ok,int32_t index, int32_t peer) override;
  44. virtual void OnVideoOffer(int32_t index, const char* type, const char* sdp) override;
  45. virtual void OnVideoAnswer(int32_t index, const char* type, const char* sdp) override;
  46. virtual void OnVideoCandidate(int32_t index, const char* candidate, int32_t sdp_mline_index, const char* sdp_mid) override;
  47. virtual void OnNotifyDel(int32_t peer, EgoType type) override;
  48. virtual void OnVideoLeave(int32_t peer, EgoType type) override;
  49. virtual void OnNotifyKick() override;
  50. virtual void OnMoveEnd(int32_t rid, WorkArea area, int32_t no) override;
  51. virtual void OnNotifyMoveRet(MoveDesc desc) override;
  52. virtual void OnNotifyState(int32_t rid, UserState state) override;
  53. void OnNDTPos(Position* pos);
  54. virtual void OnMessageFrameNotify(ChannelType type, int16_t cmd, int16_t length, const void* data) override;
  55. /// <summary>
  56. /*
  57. void OnEmergency(bool enable, bool motor, bool gear, bool turnl, bool turnR);
  58. void OnAccel(int16_t accel, bool onoff);
  59. void OnSteer(uint64_t steer);
  60. void OnArm(int16_t flip, int16_t armL, int16_t armR, bool onoff);
  61. */
  62. /// </summary>
  63. //virtual void OnLidarData(bool isLeft, bool isDense, int32_t seq, PointXYZI* data, int32_t length) override;
  64. void OnFeedPage(FeedData& data);
  65. private:
  66. std::unique_ptr<SocketClient> _client;
  67. int32_t _carpeer;
  68. std::string _account;
  69. std::string _pass;
  70. std::string _accountText;
  71. std::string _passText;
  72. std::string _name;
  73. //bool _autoclose = false;
  74. IEgoNotify* _notify;
  75. bool _connected;
  76. std::vector<std::unique_ptr<UserCamera> > _userInfo;
  77. CUpdateThread _updateThread;
  78. std::vector<std::unique_ptr<CEgoWindow>> _WindowArray;
  79. std::unique_ptr<CControlSensor> _can;
  80. std::unique_ptr<CCarSim> _carsim;
  81. // std::unique_ptr<COutSim> _outsim;
  82. std::unique_ptr<CRadarSim> _radarsim;
  83. //std::unique_ptr<CLidarSim> _lidarsim;
  84. int32_t _uid = 0;
  85. int32_t _steer_angle = 0;
  86. //PageProp _currentpage = PageProp::WorkPage1;
  87. };