00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "CClientProxy.h"
00020 #include "CProtocolUtil.h"
00021 #include "IStream.h"
00022 #include "CLog.h"
00023 #include "CEventQueue.h"
00024
00025
00026
00027
00028
00029 CEvent::Type CClientProxy::s_readyEvent = CEvent::kUnknown;
00030 CEvent::Type CClientProxy::s_disconnectedEvent = CEvent::kUnknown;
00031 CEvent::Type CClientProxy::s_clipboardChangedEvent= CEvent::kUnknown;
00032 CEvent::Type CClientProxy::s_gameDeviceTimingRecvEvent= CEvent::kUnknown;
00033
00034 CClientProxy::CClientProxy(const CString& name, synergy::IStream* stream) :
00035 CBaseClientProxy(name),
00036 m_stream(stream)
00037 {
00038 }
00039
00040 CClientProxy::~CClientProxy()
00041 {
00042 delete m_stream;
00043 }
00044
00045 void
00046 CClientProxy::close(const char* msg)
00047 {
00048 LOG((CLOG_DEBUG1 "send close \"%s\" to \"%s\"", msg, getName().c_str()));
00049 CProtocolUtil::writef(getStream(), msg);
00050
00051
00052 getStream()->flush();
00053 }
00054
00055 synergy::IStream*
00056 CClientProxy::getStream() const
00057 {
00058 return m_stream;
00059 }
00060
00061 CEvent::Type
00062 CClientProxy::getReadyEvent()
00063 {
00064 return EVENTQUEUE->registerTypeOnce(s_readyEvent,
00065 "CClientProxy::ready");
00066 }
00067
00068 CEvent::Type
00069 CClientProxy::getDisconnectedEvent()
00070 {
00071 return EVENTQUEUE->registerTypeOnce(s_disconnectedEvent,
00072 "CClientProxy::disconnected");
00073 }
00074
00075 CEvent::Type
00076 CClientProxy::getClipboardChangedEvent()
00077 {
00078 return EVENTQUEUE->registerTypeOnce(s_clipboardChangedEvent,
00079 "CClientProxy::clipboardChanged");
00080 }
00081
00082 CEvent::Type
00083 CClientProxy::getGameDeviceTimingRespEvent()
00084 {
00085 return EVENTQUEUE->registerTypeOnce(s_gameDeviceTimingRecvEvent,
00086 "CClientProxy::gameDeviceTimingRecv");
00087 }
00088
00089 void*
00090 CClientProxy::getEventTarget() const
00091 {
00092 return static_cast<IScreen*>(const_cast<CClientProxy*>(this));
00093 }