/src/ois/src/extras/LIRC/OISLIRC.h

https://bitbucket.org/cabalistic/ogredeps/ · C++ Header · 88 lines · 40 code · 14 blank · 34 comment · 0 complexity · e7d1c8527f18b7665c36f17ff722772a MD5 · raw file

  1. #include "OISConfig.h"
  2. #ifdef OIS_LIRC_SUPPORT
  3. /*
  4. The zlib/libpng License
  5. Copyright (c) 2005-2007 Phillip Castaneda (pjcast -- www.wreckedgames.com)
  6. This software is provided 'as-is', without any express or implied warranty. In no event will
  7. the authors be held liable for any damages arising from the use of this software.
  8. Permission is granted to anyone to use this software for any purpose, including commercial
  9. applications, and to alter it and redistribute it freely, subject to the following
  10. restrictions:
  11. 1. The origin of this software must not be misrepresented; you must not claim that
  12. you wrote the original software. If you use this software in a product,
  13. an acknowledgment in the product documentation would be appreciated but is
  14. not required.
  15. 2. Altered source versions must be plainly marked as such, and must not be
  16. misrepresented as being the original software.
  17. 3. This notice may not be removed or altered from any source distribution.
  18. */
  19. #ifndef OIS_LIRC_H
  20. #define OIS_LIRC_H
  21. #include "OISJoyStick.h"
  22. #include "OISLIRCRingBuffer.h"
  23. namespace OIS
  24. {
  25. class LIRCFactoryCreator;
  26. struct RemoteInfo
  27. {
  28. RemoteInfo() : buttons(0) {}
  29. RemoteInfo( const RemoteInfo &other )
  30. {
  31. buttons = other.buttons;
  32. buttonMap = other.buttonMap;
  33. }
  34. int buttons;
  35. std::map<std::string, int> buttonMap;
  36. };
  37. //Number of ring buffer events. should be nice sized (the structure is not very big)
  38. //Will be rounded up to power of two automatically
  39. #define OIS_LIRC_EVENT_BUFFER 16
  40. /** Specialty joystick - Linux Infrared Remote Support */
  41. class _OISExport LIRCControl : public JoyStick
  42. {
  43. friend class LIRCFactoryCreator;
  44. public:
  45. LIRCControl(InputManager* creator, int id, bool buffered, LIRCFactoryCreator* local_creator, RemoteInfo &info);
  46. ~LIRCControl();
  47. //Overrides of Object
  48. /** copydoc Object::setBuffered */
  49. void setBuffered(bool buffered);
  50. /** copydoc Object::capture */
  51. void capture();
  52. /** copydoc Object::queryInterface */
  53. Interface* queryInterface(Interface::IType type);
  54. /** copydoc Object::_intialize */
  55. void _initialize();
  56. protected:
  57. //! Internal method used to add a button press to the queue (called from thread)
  58. void queueButtonPressed(const std::string &id);
  59. //! The creator who created us
  60. LIRCFactoryCreator *mLIRCCreator;
  61. //! Ringbuffer is used to store events from thread and be read from capture
  62. LIRCRingBuffer mRingBuffer;
  63. //! Information about remote
  64. RemoteInfo mInfo;
  65. };
  66. }
  67. #endif //OIS_LIRC_H
  68. #endif