EgoClient.h 3.4 KB

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