1 #ifndef __EVENT_SERVER_H__
2 #define __EVENT_SERVER_H__
5 * Copyright (C) 2005-2008 Team XBMC
8 * This Program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
13 * This Program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with XBMC; see the file COPYING. If not, write to
20 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21 * http://www.gnu.org/copyleft/gpl.html
27 #include "EventClient.h"
28 #include "CriticalSection.h"
29 #include "SingleLock.h"
38 /**********************************************************************/
39 /* UDP Event Server Class */
40 /**********************************************************************/
41 class CEventServer
: private CThread
44 static void RemoveInstance();
45 static CEventServer
* GetInstance();
46 virtual ~CEventServer() {}
48 // IRunnable entry point for thread
49 virtual void Process();
56 void RefreshSettings()
58 CSingleLock
lock(m_critSection
);
59 m_bRefreshSettings
= true;
62 // start / stop server
64 void StopServer(bool bWait
);
67 unsigned short GetButtonCode(std::string
& strMapName
, bool& isAxis
, float& amount
);
68 bool ExecuteNextAction();
69 bool GetMousePos(float &x
, float &y
);
70 int GetNumberOfClients();
76 void ProcessPacket(SOCKETS::CAddress
& addr
, int packetSize
);
78 void RefreshClients();
80 std::map
<unsigned long, EVENTCLIENT::CEventClient
*> m_clients
;
81 static CEventServer
* m_pInstance
;
82 SOCKETS::CUDPSocket
* m_pSocket
;
86 unsigned char* m_pPacketBuffer
;
88 CCriticalSection m_critSection
;
89 bool m_bRefreshSettings
;
94 #endif // __EVENT_SERVER_H__