918fdc2a1fa5e73ae81edc9e8b910398cff5e63f
[pierogi] / protocols / sharpprotocol.h
1 #ifndef SHARPPROTOCOL_H
2 #define SHARPPROTOCOL_H
3
4 #include "spaceprotocol.h"
5 #include "pirrx51hardware.h"
6
7 //
8 // Sharp has its own protocol.  It is "space-encoded", like the popular NEC
9 // protocol (i.e., a 1 takes longer to transmit than a 0), but differs in
10 // several ways.  Most notably, the entire command section of the pulse
11 // train is inverted for each odd-numbered repetition.  Also, there is no
12 // header pulse.
13 //
14
15 class SharpProtocol: public SpaceProtocol
16 {
17 public:
18   SharpProtocol(
19     QObject *guiObject,
20     unsigned int index,
21     bool expBit);
22
23 public slots:
24   void startSendingCommand(
25     unsigned int threadableID,
26     PIRKeyName command);
27
28 private:
29   // An "expansion bit".  Not sure what this is, but Sharp seems to leave it
30   // at 1, and Denon usually sets it to 0.
31   bool expansionBit;
32
33   int generateStandardCommand(
34     const PIRKeyBits &pkb,
35     PIRRX51Hardware &device);
36
37   int generateToggledCommand(
38     const PIRKeyBits &pkb,
39     PIRRX51Hardware &device);
40 };
41
42 #endif // SHARPPROTOCOL_H