openATV enigma2
openATV is an open source SetTopBox Graphical user interface.
hdmi_cec.h
Go to the documentation of this file.
1 #ifndef _hdmi_cec_h
2 #define _hdmi_cec_h
3 
4 #include <lib/driver/rc.h>
6 
7 class eSocketNotifier;
8 
10 class iCECMessage : public iObject
11 {
12 public:
13 #ifdef SWIG
14  iCECMessage();
15  ~iCECMessage();
16 #endif
17  virtual int getAddress() = 0;
18  virtual int getCommand() = 0;
19  virtual int getData(char *data, int length) = 0;
20  virtual int getControl0() = 0;
21  virtual int getControl1() = 0;
22  virtual int getControl2() = 0;
23  virtual int getControl3() = 0;
24 };
26 
27 extern PyObject *New_iCECMessagePtr(const ePtr<iCECMessage> &ref); /* defined in enigma_python.i */
28 
29 inline PyObject *PyFrom(ePtr<iCECMessage> &c)
30 {
31  return New_iCECMessagePtr(c);
32 }
33 
34 #ifndef SWIG
36 {
37  return New_iCECMessagePtr(ptr);
38 }
39 #define NEW_iCECMessagePtr(ptr) Impl_New_iCECMessagePtr(ptr)
40 #endif
41 
42 class eHdmiCEC : public eRCDriver
43 {
44 #ifndef SWIG
45 public:
46 #ifdef DREAMBOX
47  struct cec_message
48  {
49  unsigned char address;
50  unsigned char data[16];
51  unsigned char length;
52  unsigned char flag;
53  }__attribute__((packed));
54  struct cec_rx_message
55  {
56  unsigned char address;
57  unsigned char destination;
58  unsigned char data[16];
59  unsigned char length;
60  }__attribute__((packed));
61  struct addressinfo
62  {
63  unsigned char physical[2];
64  unsigned char logical;
65  unsigned char type;
66  };
67 #else
68  struct cec_message
69  {
70  unsigned char address;
71  unsigned char length;
72  unsigned char data[256];
73  }__attribute__((packed));
74 #define cec_rx_message cec_message
75  struct addressinfo
76  {
77  unsigned char logical;
78  unsigned char physical[2];
79  unsigned char type;
80  };
81 #endif
82  class eCECMessage : public iCECMessage
83  {
84  DECLARE_REF(eCECMessage);
85  unsigned char address;
86  unsigned char command;
87  unsigned char dataLength;
88  unsigned char messageData[255];
89  unsigned char control0;
90  unsigned char control1;
91  unsigned char control2;
92  unsigned char control3;
93  public:
94  eCECMessage(int address, int command, char *data, int length);
95  int getAddress();
96  int getCommand();
97  int getData(char *data, int length);
98  int getControl0() { return control0; }
99  int getControl1() { return control1; }
100  int getControl2() { return control2; }
101  int getControl3() { return control3; }
102  };
103  void sendMessage(struct cec_message &message);
104 #endif
105 protected:
107  bool linuxCEC;
108  unsigned char physicalAddress[2];
110  unsigned char deviceType, logicalAddress;
111  int hdmiFd;
113  void addressPoll();
114  void reportPhysicalAddress();
115  void getAddressInfo();
116  bool getActiveStatus();
117  long translateKey(unsigned char code);
118  void hdmiEvent(int what);
119 #ifdef SWIG
120  eHdmiCEC();
121  ~eHdmiCEC();
122 #endif
123 public:
124 #ifndef SWIG
125  eHdmiCEC();
126  ~eHdmiCEC();
127 #endif
128  static eHdmiCEC *getInstance();
131  void sendMessage(unsigned char address, unsigned char cmd, char *data, int length);
132  int getLogicalAddress();
133  int getPhysicalAddress();
135  int getDeviceType();
136 };
137 
138 #ifndef SWIG
139 class eHdmiCECDevice : public eRCDevice
140 {
141 public:
142  void handleCode(long code);
144  const char *getDescription() const;
145 };
146 #endif
147 
148 #endif
static int ptr
Definition: bcm.cpp:17
Definition: connections.h:57
Definition: hdmi_cec.h:83
int getCommand()
Definition: hdmi_cec.cpp:41
int getControl2()
Definition: hdmi_cec.h:100
eCECMessage(int address, int command, char *data, int length)
Definition: hdmi_cec.cpp:21
int getControl3()
Definition: hdmi_cec.h:101
int getControl1()
Definition: hdmi_cec.h:99
int getAddress()
Definition: hdmi_cec.cpp:36
int getControl0()
Definition: hdmi_cec.h:98
int getData(char *data, int length)
Definition: hdmi_cec.cpp:46
Definition: hdmi_cec.h:140
eHdmiCECDevice(eRCDriver *driver)
Definition: hdmi_cec.cpp:588
const char * getDescription() const
Get user readable description.
Definition: hdmi_cec.cpp:593
void handleCode(long code)
Handles a device specific code.
Definition: hdmi_cec.cpp:576
Definition: hdmi_cec.h:43
int hdmiFd
Definition: hdmi_cec.h:111
ePtr< eSocketNotifier > messageNotifier
Definition: hdmi_cec.h:112
bool linuxCEC
Definition: hdmi_cec.h:107
PSignal1< void, int > addressChanged
Definition: hdmi_cec.h:130
PSignal1< void, ePtr< iCECMessage > & > messageReceived
Definition: hdmi_cec.h:129
long translateKey(unsigned char code)
Definition: hdmi_cec.cpp:415
unsigned char deviceType
Definition: hdmi_cec.h:110
unsigned char physicalAddress[2]
Definition: hdmi_cec.h:108
int getLogicalAddress()
Definition: hdmi_cec.cpp:280
bool fixedAddress
Definition: hdmi_cec.h:109
struct eHdmiCEC::addressinfo __attribute__
static eHdmiCEC * getInstance()
Definition: hdmi_cec.cpp:172
void sendMessage(struct cec_message &message)
Definition: hdmi_cec.cpp:533
void setFixedPhysicalAddress(int address)
Definition: hdmi_cec.cpp:290
bool getActiveStatus()
Definition: hdmi_cec.cpp:318
int getDeviceType()
Definition: hdmi_cec.cpp:313
void hdmiEvent(int what)
Definition: hdmi_cec.cpp:326
~eHdmiCEC()
Definition: hdmi_cec.cpp:167
static eHdmiCEC * instance
Definition: hdmi_cec.h:106
unsigned char logicalAddress
Definition: hdmi_cec.h:110
void addressPoll()
void getAddressInfo()
Definition: hdmi_cec.cpp:190
void reportPhysicalAddress()
Definition: hdmi_cec.cpp:177
eHdmiCEC()
Definition: hdmi_cec.cpp:53
int getPhysicalAddress()
Definition: hdmi_cec.cpp:285
Definition: smartptr.h:11
Definition: python.h:31
A remote control.
Definition: rc.h:27
eRCDriver * driver
Definition: rc.h:30
Definition: rc.h:73
Gives a callback when data on a file descriptor is ready.
Definition: ebase.h:146
Definition: hdmi_cec.h:11
virtual int getAddress()=0
virtual int getCommand()=0
virtual int getControl1()=0
virtual int getControl3()=0
virtual int getData(char *data, int length)=0
virtual int getControl0()=0
virtual int getControl2()=0
Definition: object.h:15
SWIG_IGNORE(iCECMessage)
PyObject * New_iCECMessagePtr(const ePtr< iCECMessage > &ref)
unsigned char length
Definition: hdmi_cec.h:1
ePyObject Impl_New_iCECMessagePtr(const ePtr< iCECMessage > &ptr)
Definition: hdmi_cec.h:35
PyObject * PyFrom(ePtr< iCECMessage > &c)
Definition: hdmi_cec.h:29
SWIG_TEMPLATE_TYPEDEF(ePtr< iCECMessage >, iCECMessagePtr)
unsigned char address
Definition: hdmi_cec.h:0
unsigned char data[256]
Definition: hdmi_cec.h:2
#define cec_rx_message
Definition: hdmi_cec.h:74
list ref
Definition: create_picon_e1_to_e2.py:17
destination
Definition: lamedb2satxml.py:19
Definition: hdmi_cec.h:76
unsigned char logical
Definition: hdmi_cec.h:77
unsigned char physical[2]
Definition: hdmi_cec.h:78
unsigned char type
Definition: hdmi_cec.h:79
Definition: hdmi_cec.h:69
unsigned char data[256]
Definition: hdmi_cec.h:72
unsigned char length
Definition: hdmi_cec.h:71
unsigned char address
Definition: hdmi_cec.h:70