Improved to "half-way usable" (version 0.5)
[pierogi] / rc5protocol.h
1 #ifndef RC5PROTOCOL_H
2 #define RC5PROTOCOL_H
3
4 #include "pirprotocol.h"
5 #include "pirrx51hardware.h"
6
7 //
8 // The RC5 protocol is not as widespread as the NEC protocol, but still
9 // somewhat popular.  Philips, the inventor, uses it extensively.
10 //
11
12 class RC5Protocol: public PIRProtocol
13 {
14 public:
15   // For standard RC5, the control portion will be passed in as
16   // a seven-bit value:
17   RC5Protocol(
18     QObject *guiObject,
19     unsigned int index,
20     unsigned int sevenBitControl);
21
22   // For extended RC5, each key must contain the entire 13 bits.
23   RC5Protocol(
24     QObject *guiObject,
25     unsigned int index);
26
27 public slots:
28   void startSendingCommand(
29     unsigned int threadableID,
30     PIRKeyName command);
31
32 protected:
33   unsigned int biphaseUnit;
34
35 private:
36   int pushControlBits(
37     PIRRX51Hardware &device);
38
39   int pushKeyCommandBits(
40     const CommandSequence &bits,
41     PIRRX51Hardware &device);
42
43   int pushNonStandardRC5(
44     const CommandSequence &bits,
45     PIRRX51Hardware &device);
46
47   int pushBit(
48     bool bitValue,
49     PIRRX51Hardware &device);
50
51   unsigned int buffer;
52   int keypressCount;
53
54   // Only one of the following can be true, but both can be false:
55   bool bufferContainsSpace;
56   bool bufferContainsPulse;
57 };
58
59 #endif // RC5PROTOCOL_H