• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include "OISConfig.h"
2 #ifdef OIS_LIRC_SUPPORT
3 /*
4 The zlib/libpng License
5 
6 Copyright (c) 2005-2007 Phillip Castaneda (pjcast -- www.wreckedgames.com)
7 
8 This software is provided 'as-is', without any express or implied warranty. In no event will
9 the authors be held liable for any damages arising from the use of this software.
10 
11 Permission is granted to anyone to use this software for any purpose, including commercial
12 applications, and to alter it and redistribute it freely, subject to the following
13 restrictions:
14 
15     1. The origin of this software must not be misrepresented; you must not claim that
16 		you wrote the original software. If you use this software in a product,
17 		an acknowledgment in the product documentation would be appreciated but is
18 		not required.
19 
20     2. Altered source versions must be plainly marked as such, and must not be
21 		misrepresented as being the original software.
22 
23     3. This notice may not be removed or altered from any source distribution.
24 */
25 #ifndef OIS_LIRCFactoryCreator_H
26 #define OIS_LIRCFactoryCreator_H
27 
28 #include "OISPrereqs.h"
29 #include "OISFactoryCreator.h"
30 #include "OISLIRC.h"
31 
32 namespace OIS
33 {
34 	//Forward declare local classes
35 	class LIRCControl;
36 
37 	/** LIRC Factory Creator Class */
38 	class _OISExport LIRCFactoryCreator : public FactoryCreator
39 	{
40 	public:
41 		LIRCFactoryCreator();
42 		~LIRCFactoryCreator();
43 
44 		//FactoryCreator Overrides
45 		/** @copydoc FactoryCreator::deviceList */
46 		DeviceList freeDeviceList();
47 
48 		/** @copydoc FactoryCreator::totalDevices */
49 		int totalDevices(Type iType);
50 
51 		/** @copydoc FactoryCreator::freeDevices */
52 		int freeDevices(Type iType);
53 
54 		/** @copydoc FactoryCreator::vendorExist */
55 		bool vendorExist(Type iType, const std::string & vendor);
56 
57 		/** @copydoc FactoryCreator::createObject */
58 		Object* createObject(InputManager* creator, Type iType, bool bufferMode, const std::string & vendor = "");
59 
60 		/** @copydoc FactoryCreator::destroyObject */
61 		void destroyObject(Object* obj);
62 
63 	protected:
64 		//! Gets a list of all remotes available
65 		void discoverRemotes();
66 
67 		//! Connects to LIRC server
68 		void enableConnection(bool enable, bool blocking = true);
69 
70 		//! Creates/destroys threaded read
71 		void enableConnectionThread(bool enable);
72 
73 		void threadUpdate();
74 
75 		std::string mIP;
76 		std::string mPort;
77 		bool mConnected;
78 		volatile bool mThreadRunning;
79 		std::map<std::string, LIRCControl*> mUpdateRemotes;
80 
81 		//! List of vendor named remotes that are not used yet
82 		std::vector<std::string> mUnusedRemotes;
83 
84 		//! Information about enumerated remotes
85 		std::map<std::string, RemoteInfo> mJoyStickInformation;
86 
87 		//! Number of total found remotes
88 		int mCount;
89 
90 		//! Get the slow boost header includes from this header by using a proxy wrapper
91 		class BoostWrapper;
92 
93 		//! Wrapped objects
94 		BoostWrapper *mWrapped;
95 	};
96 }
97 #endif //OIS_LIRCFactoryCreator_H
98 #endif
99