6cf0333b767cd76455ec90c8e248bae805fe2ec1
[pierogi] / protocols / sircprotocol.h
1 #ifndef SIRCPROTOCOL_H
2 #define SIRCPROTOCOL_H
3
4 #include "spaceprotocol.h"
5 #include "pirrx51hardware.h"
6
7 //
8 // The SIRC protocol is Sony's system for transmitting information via
9 // infrared light.  As with the very popular "NEC" protocol, binary data is
10 // encoded by varying the amount of time each bit is held: a zero is held for
11 // a short span of time, a one lasts a little bit longer.
12 //
13 // Currently, there seem to be three types of SIRC commands; 12 bit, 15 bit,
14 // and 20 bit.  In each type, it appears the last seven bits specify the
15 // command, and the rest specify the device being addressed.  (The bits are
16 // passed in reverse order in the actual IR stream.)
17 //
18 // The marvelous thing about the Sony Infrared Remote Control protocol is just
19 // how simple and easy it is; just a header pulse, the command, the address,
20 // and a trailer pulse.  The terrible thing about the protocol is that Sony
21 // has given up on following their own rules.  Sony devices today regularly
22 // support commands from a variety of addresses, making the whole concept of
23 // the "address" kind of meaningless. :(  I can see why the LIRC guys would
24 // give up and just encode the raw IR bits, rather than wade into this mess...
25 //
26
27 class SIRCProtocol: public SpaceProtocol
28 {
29 public:
30   SIRCProtocol(
31     QObject *guiObject,
32     unsigned int index);
33
34 public slots:
35   void startSendingCommand(
36     unsigned int threadableID,
37     PIRKeyName command);
38
39 private:
40   int generateStandardCommand(
41     const PIRKeyBits &pkb,
42     PIRRX51Hardware &device);
43 };
44
45 #endif // SIRCPROTOCOL_H