aboutsummaryrefslogtreecommitdiff
path: root/src/input/linux/LIRC.h
blob: 386a353b8f11d3b3a27af4303ab350371674b17c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
*      Copyright (C) 2007-2013 Team XBMC
 *      http://xbmc.org
 *
 *  This Program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2, or (at your option)
 *  any later version.
 *
 *  This Program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with XBMC; see the file COPYING.  If not, see
 *  <http://www.gnu.org/licenses/>.
 *
 */

#ifndef LIRC_H
#define LIRC_H

#include "system.h"
#include <string>

class CRemoteControl
{
public:
  CRemoteControl();
  ~CRemoteControl();
  void Initialize();
  void Disconnect();
  void Reset();
  void Update();
  WORD GetButton();
  /*! \brief retrieve the time in milliseconds that the button has been held
   \return time in milliseconds the button has been down
   */
  unsigned int GetHoldTime() const;
  void setDeviceName(const std::string& value);
  void setUsed(bool value);
  bool IsInUse() const { return m_used; }
  bool IsInitialized() const { return m_bInitialized; }
  void AddSendCommand(const std::string& command);

private:
  int     m_fd;
  int     m_inotify_fd;
  int     m_inotify_wd;
  int     m_lastInitAttempt;
  int     m_initRetryPeriod;
  FILE*   m_file;
  unsigned int m_holdTime;
  int32_t m_button;
  char    m_buf[128];
  bool    m_bInitialized;
  bool    m_used;
  bool    m_bLogConnectFailure;
  uint32_t    m_firstClickTime;
  std::string  m_deviceName;
  bool        CheckDevice();
  std::string  m_sendData;
  bool        m_inReply;
  int         m_nrSending;
};

extern CRemoteControl g_RemoteControl;

#endif