4 // The generic remote controller.
8 #include "pirkeynames.h"
13 // We'll define a maximum number of repetitions, regardless of how long the
14 // user presses the button. (This is just in case we miss the point at which
15 // he stops pressing it...) 500 should be plenty.
16 #define MAX_REPEAT_COUNT 500
18 typedef std::deque<bool> CommandSequence;
20 // As I've learned more about IR protocols, the concept of what a specific
21 // key is gets more and more complex. To deal with this, I'm going to allow
22 // a key to have more than one command sequence associated with it. (I need
23 // up to three codes for Sony keys, and as many as four to define an
24 // individual Pioneer key.)
28 CommandSequence firstCode;
29 CommandSequence secondCode;
30 CommandSequence thirdCode;
31 CommandSequence fourthCode;
34 // I'll go ahead and use associative arrays to build up lists of keycodes.
35 typedef std::map<int, PIRKeyBits> KeycodeCollection;
38 // Right now, the only reason for this object to inherit from QObject is
39 // so it can participate in Qt-style threading. Note that it has no
40 // event loop, and no access to the GUI, so don't go trying to communicate
41 // with the user here...
42 class PIRProtocol: public QObject
58 // A special addKey used for Sony's SIRC protocol:
61 unsigned int addressData,
63 unsigned int commandData);
67 unsigned int secondaryAddressData,
68 unsigned int primaryAddressData,
69 unsigned int commandData);
73 unsigned int addressData,
74 unsigned int commandData);
78 unsigned int addressData,
79 unsigned int commandData);
83 unsigned int firstAddress,
84 unsigned int firstCommand,
85 unsigned int secondAddress,
86 unsigned int secondCommand);
88 void setCarrierFrequency(
94 void setMinimumRepetitions(
106 virtual void startSendingCommand(
107 unsigned int threadableID,
108 PIRKeyName command) = 0;
112 const char *errString);
115 bool isCommandSupported(
118 void clearRepeatFlag();
119 bool checkRepeatFlag();
121 unsigned int carrierFrequency;
122 unsigned int dutyCycle;
125 CommandSequence &bits,
129 KeycodeCollection keycodes;
131 // A sleep function for all protocols:
132 void sleepUntilRepeat(
133 int commandDuration);
135 // The "gap" parameter from LIRC. If the commands are "variable-length",
136 // this indicates the amount of time between the last pulse of one
137 // command and the first pulse of the next. If "constant-length", it is
138 // the time between the _first_ pulse of one command and the first pulse
141 bool isConstantLength;
144 // More administrative data wrapped around the actual command:
145 CommandSequence preData;
146 CommandSequence postData;
148 // Some remotes require a minimum number of repetitions:
149 // Note: thinking about removing this -- don't know if it is needed
150 int minimumRepetitions;
155 #endif // PIRPROTOCOL_H