EgoClient.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. #include "udpcan.h"
  12. #include "control_sensor.h"
  13. class CControlSensor;
  14. class CCarSim;
  15. class COutSim;
  16. class CRadarSim;
  17. class CLidarSim;
  18. class CUdpSensor;
  19. class CEgoClient : public INativeNotify
  20. {
  21. public:
  22. CEgoClient(IEgoNotify * C);
  23. void Login(std::string& account, std::string& pass);
  24. void OnCarConnect(int32_t peer);
  25. void OnCarLeave();
  26. void ReqCarList();
  27. void OnMoveBegin(int32_t rid, WorkArea area, int32_t no);
  28. void SwitchDriver(int32_t id);
  29. void ChangeState(UserState state);
  30. int32_t GetSteerAngle();
  31. //void SetCurrentPage(PageProp prop);
  32. //PageProp GetCurrentPage();
  33. void Start(std::array<IRender*, RenderPosition::ALL>& ar);
  34. 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,int32_t r8);
  35. void OnEncodeData(int32_t left, int32_t right);
  36. void OnPingValue(int32_t value, double temp);
  37. void OnStopAck();
  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. 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. virtual void OnMessageFrameNotify(ChannelType type, int16_t cmd, int16_t length, const void* data) override;
  62. /// <summary>
  63. /*
  64. void OnEmergency(bool enable, bool motor, bool gear, bool turnl, bool turnR);
  65. void OnAccel(int16_t accel, bool onoff);
  66. void OnSteer(uint64_t steer);
  67. void OnArm(int16_t flip, int16_t armL, int16_t armR, bool onoff);
  68. */
  69. /// </summary>
  70. std::unique_ptr<SensorSocket<CUdpSensor>> _udpcan;
  71. std::unique_ptr<CControlSensor> _can;
  72. std::unique_ptr<CCarSim> _carsim;
  73. //virtual void OnLidarData(bool isLeft, bool isDense, int32_t seq, PointXYZI* data, int32_t length) override;
  74. void OnFeedPage(FeedData& data);
  75. private:
  76. std::unique_ptr<SocketClient> _client;
  77. int32_t _carpeer;
  78. std::string _account;
  79. std::string _pass;
  80. std::string _accountText;
  81. std::string _passText;
  82. std::string _name;
  83. //bool _autoclose = false;
  84. IEgoNotify* _notify;
  85. bool _connected;
  86. std::vector<std::unique_ptr<UserCamera> > _userInfo;
  87. CUpdateThread _updateThread;
  88. std::vector<std::unique_ptr<CEgoWindow>> _WindowArray;
  89. //std::unique_ptr<COutSim> _outsim;
  90. std::unique_ptr<CRadarSim> _radarsim;
  91. //std::unique_ptr<CLidarSim> _lidarsim;
  92. int32_t _uid = 0;
  93. float _steer_angle = 0;
  94. //PageProp _currentpage = PageProp::WorkPage1;
  95. };