Memory Management Improved
[pierogi] / keysets / goldstar.cpp
1 #include "goldstar.h"
2 #include "protocols/necprotocol.h"
3 #include "protocols/rc5protocol.h"
4 #include "protocols/lircprotocol.h"
5
6 GoldStarTV1::GoldStarTV1(
7   unsigned int index)
8   : PIRKeysetMetaData(
9       "105-210A TV",
10       GoldStar_Make,
11       index)
12 {
13   addControlledDevice(GoldStar_Make, "105-210A", TV_Device);
14 }
15
16
17 void GoldStarTV1::populateProtocol(
18   QObject *guiObject)
19 {
20   if (threadableProtocol)
21   {
22     // If the pointer is not null, the keyset must already be populated.
23     return;
24   }
25
26   threadableProtocol = new NECProtocol(guiObject, index, false, true);
27
28 //  setPreData(0x20DF, 16);
29   setPreData(0x04, 8);
30
31   addKey("prup", ChannelUp_Key, 0x00, 8);
32   addKey("prup", Up_Key, 0x00, 8);
33   addKey("prdown", ChannelDown_Key, 0x01, 8);
34   addKey("prdown", Down_Key, 0x01, 16);
35   addKey("volup", VolumeUp_Key, 0x02, 8);
36   addKey("volup", Right_Key, 0x02, 8);
37   addKey("voldown", VolumeDown_Key, 0x03, 8);
38   addKey("voldown", Left_Key, 0x03, 8);
39   addKey("power", Power_Key, 0x08, 8);
40   addKey("mute", Mute_Key, 0x09, 8);
41   addKey("tvav", Input_Key, 0x0B, 8);
42   addKey("picture", PictureMode_Key, 0x0C, 8);
43   addKey("sleep", Sleep_Key, 0x0E, 8);
44   addKey("0", Zero_Key, 0x10, 8);
45   addKey("1", One_Key, 0x11, 8);
46   addKey("2", Two_Key, 0x12, 8);
47   addKey("3", Three_Key, 0x13, 8);
48   addKey("4", Four_Key, 0x14, 8);
49   addKey("5", Five_Key, 0x15, 8);
50   addKey("6", Six_Key, 0x16, 8);
51   addKey("7", Seven_Key, 0x17, 8);
52   addKey("8", Eight_Key, 0x18, 8);
53   addKey("9", Nine_Key, 0x19, 8);
54   addKey("qview", Unmapped_Key, 0x1A, 8);
55   addKey("recall", PrevChannel_Key, 0x1B, 8);
56   addKey("lowhigh", DoubleDigit_Key, 0x1C, 8);
57   addKey("menu", Menu_Key, 0x43, 8);
58   addKey("ok", Select_Key, 0x44, 8);
59   addKey("psm", Unmapped_Key, 0x4F, 8);
60 }
61
62
63 GoldStarTV2::GoldStarTV2(
64   unsigned int index)
65   : PIRKeysetMetaData(
66       "TV Keyset 2",
67       GoldStar_Make,
68       index)
69 {
70 }
71
72
73 void GoldStarTV2::populateProtocol(
74   QObject *guiObject)
75 {
76   if (threadableProtocol)
77   {
78     // If the pointer is not null, the keyset must already be populated.
79     return;
80   }
81
82   threadableProtocol = new RC5Protocol(guiObject, index, 0x40);
83
84   addKey("0", Zero_Key, 0x00, 6);
85   addKey("1", One_Key, 0x01, 6);
86   addKey("2", Two_Key, 0x02, 6);
87   addKey("3", Three_Key, 0x03, 6);
88   addKey("4", Four_Key, 0x04, 6);
89   addKey("5", Five_Key, 0x05, 6);
90   addKey("6", Six_Key, 0x06, 6);
91   addKey("7", Seven_Key, 0x07, 6);
92   addKey("8", Eight_Key, 0x08, 6);
93   addKey("9", Nine_Key, 0x09, 6);
94   addKey("-/--", DoubleDigit_Key, 0x0A, 6);
95   addKey("<=", Unmapped_Key, 0x0B, 6);
96   addKey("POWER", Power_Key, 0x0C, 6);
97   addKey("MUTE", Mute_Key, 0x0D, 6);
98   addKey("PP", PrevChannel_Key, 0x0E, 6);
99   addKey("VOL+", VolumeUp_Key, 0x10, 6);
100   addKey("VOL-", VolumeDown_Key, 0x11, 6);
101   addKey("PROG+", ChannelUp_Key, 0x20, 6);
102   addKey("PROG-", ChannelDown_Key, 0x21, 6);
103   addKey("LOOP", Unmapped_Key, 0x22, 6);
104   addKey("OK", Select_Key, 0x25, 6);
105   addKey(">=<", Unmapped_Key, 0x29, 6);
106   addKey("=o", Unmapped_Key, 0x2A, 6);
107   addKey("=^", Unmapped_Key, 0x2B, 6);
108   addKey("=?", TeletextReveal_Key, 0x2C, 6);
109   addKey("=X", Unmapped_Key, 0x2D, 6);
110   addKey("=/", Unmapped_Key, 0x2E, 6);
111   addKey("YELLOW", Yellow_Key, 0x32, 6);
112   addKey("BLUE", Blue_Key, 0x34, 6);
113   addKey("=i", Unmapped_Key, 0x35, 6);
114   addKey("GREEN", Green_Key, 0x36, 6);
115   addKey("RED", Red_Key, 0x37, 6);
116   addKey("AV", Unmapped_Key, 0x38, 6);
117   addKey("MENU", Menu_Key, 0x3B, 6);
118   addKey("=", Unmapped_Key, 0x3C, 6);
119   addKey("=M", Unmapped_Key, 0x3E, 6);
120   addKey("TV", Unmapped_Key, 0x3F, 6);
121 }
122
123
124 GoldStarVCR1::GoldStarVCR1(
125   unsigned int index)
126   : PIRKeysetMetaData(
127       "VCR Keyset 1",
128       GoldStar_Make,
129       index)
130 {
131   addControlledDevice(GoldStar_Make, "GSE-Q204P", VCR_Device);
132   addControlledDevice(GoldStar_Make, "QUISY 500", VCR_Device);
133 }
134
135
136 void GoldStarVCR1::populateProtocol(
137   QObject *guiObject)
138 {
139   if (threadableProtocol)
140   {
141     // If the pointer is not null, the keyset must already be populated.
142     return;
143   }
144
145   threadableProtocol = new NECProtocol(guiObject, index, false, true);
146
147 //  setPreData(0x7689, 16);
148   setPreData(0x6E, 8);
149
150   addKey("eject", Eject_Key, 0x00, 8);
151   addKey("stop", Stop_Key, 0x01, 8);
152   addKey("<rew", Rewind_Key, 0x02, 8);
153   addKey("ff>", FastForward_Key, 0x03, 8);
154   addKey("0", Zero_Key, 0x04, 16);
155   addKey("1", One_Key, 0x05, 8);
156   addKey("2", Two_Key, 0x06, 8);
157   addKey("3", Three_Key, 0x07, 8);
158   addKey("play", Play_Key, 0x08, 8);
159   addKey("record", Record_Key, 0x09, 8);
160   addKey("pause||", Pause_Key, 0x0B, 8);
161   addKey("4", Four_Key, 0x0C, 8);
162   addKey("5", Five_Key, 0x0D, 8);
163   addKey("6", Six_Key, 0x0E, 8);
164   addKey("7", Seven_Key, 0x0F, 8);
165   addKey("f/a", StepForward_Key, 0x10, 8); // frame advance?
166   addKey("slow", Slow_Key, 0x13, 8);
167   addKey("power", Power_Key, 0x14, 8);
168   addKey("tv_vcr", Input_Key, 0x15, 8);
169   addKey("menu", Menu_Key, 0x16, 8);
170   addKey("prog+", ChannelUp_Key, 0x18, 8);
171   addKey("prog-", ChannelDown_Key, 0x19, 8);
172   addKey("slow+", SlowPlus_Key, 0x1A, 8);
173   addKey("slow-", SlowMinus_Key, 0x1B, 8);
174   addKey("8", Eight_Key, 0x1C, 8);
175   addKey("9", Nine_Key, 0x1D, 8);
176   addKey("display", Info_Key, 0x1E, 8);
177   addKey("clear", Clear_Key, 0x1F, 8);
178   addKey("child_lock", Unmapped_Key, 0x3F, 8);
179   addKey("viss", Unmapped_Key, 0x41, 8);
180   addKey("tracking+", TrackingPlus_Key, 0x44, 8);
181   addKey("tracking-", TrackingMinus_Key, 0x45, 8);
182   addKey("show_view", Unmapped_Key, 0x47, 8);
183   addKey("sp/lp", VHSSpeed_Key, 0x48, 8);
184   addKey("vps", Unmapped_Key, 0x49, 8);
185   addKey("start", Unmapped_Key, 0x4A, 8);
186   addKey("length", Unmapped_Key, 0x4B, 8);
187   addKey("clock_count", Clock_Key, 0x4C, 8); // "memory"
188   addKey("reset", Reset_Key, 0x4D, 8);
189   addKey("preset", Unmapped_Key, 0x4E, 8);
190   addKey("a_trk", AutoTracking_Key, 0x5F, 8);
191   addKey("up", Up_Key, 0x82, 8);
192   addKey("left", Left_Key, 0x83, 8);
193   addKey("down", Down_Key, 0x89, 8);
194   addKey("ok", Select_Key, 0x8E, 8);
195   addKey("right", Right_Key, 0x90, 8);
196 }
197
198
199 GoldStarVCR1a::GoldStarVCR1a(
200   unsigned int index)
201   : GoldStarVCR1(index)
202 {
203   setKeysetName("VCR Keyset 1a");
204 }
205
206
207 void GoldStarVCR1a::populateProtocol(
208   QObject *guiObject)
209 {
210   if (threadableProtocol)
211   {
212     // If the pointer is not null, the keyset must already be populated.
213     return;
214   }
215
216   GoldStarVCR1::populateProtocol(guiObject);
217
218   addKey("TU_AV", Input_Key, 0x56, 16);
219 }
220
221
222 GoldStarVCR1b::GoldStarVCR1b(
223   unsigned int index)
224   : GoldStarVCR1(index)
225 {
226   setKeysetName("VCR Keyset 1b");
227 }
228
229
230 void GoldStarVCR1b::populateProtocol(
231   QObject *guiObject)
232 {
233   if (threadableProtocol)
234   {
235     // If the pointer is not null, the keyset must already be populated.
236     return;
237   }
238
239   GoldStarVCR1::populateProtocol(guiObject);
240
241   addKey("BACK", Exit_Key, 0x4C, 8);
242 }
243
244
245 GoldStarVCR1c::GoldStarVCR1c(
246   unsigned int index)
247   : GoldStarVCR1(index)
248 {
249   setKeysetName("VCR Keyset 1c");
250 }
251
252
253 void GoldStarVCR1c::populateProtocol(
254   QObject *guiObject)
255 {
256   if (threadableProtocol)
257   {
258     // If the pointer is not null, the keyset must already be populated.
259     return;
260   }
261
262   GoldStarVCR1::populateProtocol(guiObject);
263
264   addKey("trk-", TrackingMinus_Key, 0xED, 8);
265   addKey("trk+", TrackingPlus_Key, 0xEE, 8);
266   addKey("a.trk", AutoTracking_Key, 0xE8, 8);
267   addKey("a.repeart", Unmapped_Key, 0xF5, 8);
268 }
269
270
271 GoldStarCD1::GoldStarCD1(
272   unsigned int index)
273   : PIRKeysetMetaData(
274       "Audio Keyset 1",
275       GoldStar_Make,
276       index)
277 {
278   addControlledDevice(GoldStar_Make, "FFH-272A/L", Audio_Device);
279 }
280
281
282
283 // Based on LIRC 6710S-6000A config file
284 void GoldStarCD1::populateProtocol(
285   QObject *guiObject)
286 {
287   if (threadableProtocol)
288   {
289     // If the pointer is not null, the keyset must already be populated.
290     return;
291   }
292
293   LIRCProtocol *lp = new LIRCProtocol(
294     guiObject,
295     index,
296     600, 500,
297     600, 1600,
298     108000, true);
299
300   threadableProtocol = lp;
301
302   lp->setHeaderPair(4500, 4500);
303   lp->setTrailerPulse(600);
304   lp->setRepeatPair(600, 1600);
305   lp->setRepeatNeedsHeader(true);
306
307   setPreData(0x0808, 16);
308   setPostData(0x1, 1);
309
310   addKey("power", Power_Key, 0x3C43, 15);
311   addKey("mute", Mute_Key, 0x7C03, 15);
312   addKey("cd", CDInput_Key, 0x601F, 15);
313   addKey("tape", TapeInput_Key, 0x0877, 15);
314   addKey("aux", AuxInput_Key, 0x4837, 15);
315   addKey("fm", Unmapped_Key, 0x007F, 15);
316   addKey("mw", Unmapped_Key, 0x403F, 15);
317   addKey("lw", Unmapped_Key, 0x205F, 15);
318   addKey("pre-", ChannelDown_Key, 0x245B, 15);
319   addKey("pre-", PrevPreset_Key, 0x245B, 15);
320   addKey("pre+", ChannelUp_Key, 0x641B, 15);
321   addKey("pre+", NextPreset_Key, 0x641B, 15);
322   addKey("ply/pau", Play_Key, 0x106F, 15);
323   addKey("stop", Stop_Key, 0x502F, 15);
324   addKey("prev", Previous_Key, 0x304F, 15);
325   addKey("next", Next_Key, 0x700F, 15);
326   addKey("prog", Program_Key, 0x5926, 15);
327   addKey("repeat", Repeat_Key, 0x3946, 15);
328   addKey("random", Random_Key, 0x057A, 15);
329   addKey("dskip", NextDisc_Key, 0x2956, 15);
330   addKey("remain", Unmapped_Key, 0x453A, 15);
331   addKey("eqpatt", Unmapped_Key, 0x017E, 15);
332   addKey("vol-", VolumeDown_Key, 0x344B, 15);
333   addKey("vol+", VolumeUp_Key, 0x740B, 15);
334 }