#pragma once #include #include #include #include "remote_def.h" #include "../common/comm.h" class CUserHandler; class CIOBuffer; struct Benchboard { int32_t uid; int32_t type; std::string name; UserState state; }; class CUserManager { public: void Add(CUserHandler* ptr); void Check(int32_t uid); void Remove(CUserHandler* lhs); void Write(int32_t id, CIOBuffer* pBuffer); static CUserManager& GetInstance(); remote::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, remote::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 GetRobot(std::vector& ret); void BroadCast(CIOBuffer* pBuffer); void NotifyState(int32_t uid,EgoType type, UserState state ); void Start(); void Run(); private: std::vector SocketList; std::mutex _lock; std::thread _thread; bool _run; };