• Main Page
  • Classes
  • Files
  • File List

CClientProxy.cpp

00001 /*
00002  * synergy -- mouse and keyboard sharing utility
00003  * Copyright (C) 2012 Bolton Software Ltd.
00004  * Copyright (C) 2002 Chris Schoeneman
00005  * 
00006  * This package is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * found in the file COPYING that should have accompanied this file.
00009  * 
00010  * This package is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
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 // CClientProxy
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     // force the close to be sent before we return
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 }

Generated on Thu May 23 2013 00:00:03 for Synergy by  doxygen 1.7.1