#pragma once #include #include #include #include #include "../Protocol/win/Protocol.pb.h" #include "../common/comm.h" class CUserSocket; class CIOBuffer; struct Robot { int32_t uid; int32_t type; std::string name; RemoNet::UserState state; CarType car; }; class CUserManager { public: void Add(CUserSocket* ptr); void Check(int32_t uid); void Remove(CUserSocket* lhs); void Write(int32_t id, CIOBuffer* pBuffer); RemoNet::UserState GetState(int32_t uid); static CUserManager& GetInstance(); RemoNet::VideoDesc ConnectPeerVideo(int32_t peer, int32_t uid, int32_t index); void NotifyOffer(int32_t peer, int32_t uid, int32_t video, const char* type, const char* sdp); void NotifyAnswer(int32_t peer, int32_t uid, int32_t video, const char* type, const char* sdp); void NotifyCandidate(int32_t peer, int32_t uid, int32_t video, const char* type, const char* candidate, int32_t sdp_mline_index, const char* sdp_mid); void ReplyPeerVideo(int32_t peer, int32_t uid, RemoNet::VideoDesc ret, int32_t index); void LeavePeerVideo(int32_t peer, int32_t uid, EgoType type); void ClosePeerVideo(int32_t peer, int32_t uid, EgoType type,int32_t index); void NotifyMoveBegin(int32_t peer, int32_t uid, WorkArea area, int32_t no); void NotifyMoveEnd(int32_t peer,int32_t uid, WorkArea, int32_t no); void GetRobot(std::vector& ret); void BroadCast(CIOBuffer* pBuffer); void NotifyState(int32_t uid,EgoType type, RemoNet::UserState state ); void NotifySwitchDriver(int32_t peer, int32_t uid); void NotifyMoveRet(int32_t peer, int32_t uid, RemoNet::MoveDesc desc); void Start(); void Run(); private: std::vector SocketList; std::mutex _lock; std::thread _thread; bool _run; };