Memory Management Improved
[pierogi] / keysets / toshiba.cpp
1 #include "toshiba.h"
2 #include "protocols/necprotocol.h"
3
4 ToshibaTV1::ToshibaTV1(
5   unsigned int index)
6   : PIRKeysetMetaData(
7       "TV Keyset 1",
8       Toshiba_Make,
9       index)
10 {
11   addControlledDevice(Toshiba_Make, "21S03D", TV_Device);
12 }
13
14
15 void ToshibaTV1::populateProtocol(
16   QObject *guiObject)
17 {
18   if (threadableProtocol)
19   {
20     // If the pointer is not null, the keyset must already be populated.
21     return;
22   }
23
24   threadableProtocol = new NECProtocol(guiObject, index, false, true);
25
26 //  setPreData(0x02FD, 16);
27   setPreData(0x40, 8);
28
29   addKey("0", Zero_Key, 0x00, 8);
30   addKey("1", One_Key, 0x01, 8);
31   addKey("2", Two_Key, 0x02, 8);
32   addKey("3", Three_Key, 0x03, 8);
33   addKey("4", Four_Key, 0x04, 8);
34   addKey("5", Five_Key, 0x05, 8);
35   addKey("6", Six_Key, 0x06, 8);
36   addKey("7", Seven_Key, 0x07, 8);
37   addKey("8", Eight_Key, 0x08, 8);
38   addKey("9", Nine_Key, 0x09, 8);
39   addKey("100", PlusOneHundred_Key, 0x0A, 8);
40   addKey("-/--", DoubleDigit_Key, 0x0B, 8);
41   addKey("reset", Reset_Key, 0x0C, 8);
42   addKey("tv/video", Unmapped_Key, 0x0F, 8); // "input"
43   addKey("MUTE", Mute_Key, 0x10, 8);
44   addKey("picturepref", PictureMode_Key, 0x11, 8); // "Contrast", "PP"
45   addKey("POWER", Power_Key, 0x12, 8);
46   addKey("mts", Audio_Key, 0x13, 8); // "audio_stereo_2channel"
47   addKey("SCART", Input_Key, 0x14, 8); // "AV", "inputs", "source"
48   addKey("sleep", Sleep_Key, 0x15, 8);
49   addKey("CALL", Call_Key, 0x16, 8);
50   addKey("ent", Enter_Key, 0x17, 8);  // "ch_rtn"
51   addKey("fav+", Unmapped_Key, 0x19, 8);
52   addKey("V+", VolumeUp_Key, 0x1A, 8);
53   addKey("V+", Right_Key, 0x1A, 8);
54   addKey("P+", ChannelUp_Key, 0x1B, 8);
55   addKey("P+", Up_Key, 0x1B, 8);
56   addKey("recall", PrevChannel_Key, 0x1C, 8);
57   addKey("fav-", Unmapped_Key, 0x1D, 8);
58   addKey("V-", VolumeDown_Key, 0x1E, 8);
59   addKey("V-", Left_Key, 0x1E, 8);
60   addKey("P-", ChannelDown_Key, 0x1F, 8);
61   addKey("P-", Down_Key, 0x1F, 8);
62   addKey("OK", Select_Key, 0x21, 8);
63   addKey("POP_DIR", Unmapped_Key, 0x26, 8);
64   addKey("a/d", Unmapped_Key, 0x44, 8);
65   addKey("RED", Red_Key, 0x48, 8);
66   addKey("GREEN", Green_Key, 0x49, 8);
67   addKey("YELLOW", Yellow_Key, 0x4A, 8);
68   addKey("pip_ch_up", PIPChannelUp_Key, 0x4A, 8); // Yellow
69   addKey("BLUE", Blue_Key, 0x4B, 8);
70   addKey("pip_ch_down", PIPChannelDown_Key, 0x4B, 8); // Blue
71   addKey("still", PIPPause_Key, 0x4C, 8);
72   addKey("locate", PIPMove_Key, 0x4E, 8);
73   addKey("source", PIPSource_Key, 0x4F, 8);
74   addKey("pip", PIP_Key, 0x51, 8);
75   addKey("swap", PIPSwap_Key, 0x53, 8); // Reduce
76   addKey("PIC_SIZE", AspectRatio_Key, 0x54, 8); // "16:9"
77   addKey("Tone", Unmapped_Key, 0x55, 8);
78   addKey("cap/text", Captions_Key, 0x57, 8); // Image
79   addKey("exit", Exit_Key, 0x58, 8);
80   addKey("SIZE", AspectRatio_Key, 0x59, 8); // "WIDE"
81   addKey("DOULBY", NoiseReduction_Key, 0x5A, 8);
82   addKey("MENU", Menu_Key, 0x5B, 8);
83   addKey("1/2", Unmapped_Key, 0x63, 8); // "cap1/cap2"
84   addKey("CLOCK", Timer_Key, 0x71, 8);  // "TIMER"
85   addKey("TV", Unmapped_Key, 0x72, 8);
86   addKey("SEARCH", Unmapped_Key, 0x8F, 8);
87   addKey("favorite", Favorites_Key, 0x90, 8);
88   addKey("multi", Unmapped_Key, 0x91, 8);
89   addKey("info", Info_Key, 0x93, 8);
90 }
91
92
93 ToshibaTV1a::ToshibaTV1a(
94   unsigned int index)
95   : ToshibaTV1(index)
96 {
97   setKeysetName("TV Keyset 1a");
98
99   addControlledDevice(Toshiba_Make, "27A51", TV_Device);
100 }
101
102
103 void ToshibaTV1a::populateProtocol(
104   QObject *guiObject)
105 {
106   if (threadableProtocol)
107   {
108     // If the pointer is not null, the keyset must already be populated.
109     return;
110   }
111
112   ToshibaTV1::populateProtocol(guiObject);
113
114   addKey("menu/enter", Menu_Key, 0x80, 8);
115   addKey("menu/enter", Select_Key, 0x80, 8);
116 }
117
118
119 ToshibaTV1b::ToshibaTV1b(
120   unsigned int index)
121   : ToshibaTV1(index)
122 {
123   setKeysetName("TV Keyset 1b");
124 }
125
126
127 void ToshibaTV1b::populateProtocol(
128   QObject *guiObject)
129 {
130   if (threadableProtocol)
131   {
132     // If the pointer is not null, the keyset must already be populated.
133     return;
134   }
135
136   ToshibaTV1::populateProtocol(guiObject);
137
138   addKey("right", Right_Key, 0x19, 8); // "fav+"
139   addKey("left", Left_Key, 0x1D, 8); // "fav-"
140   addKey("menu/enter", Menu_Key, 0x80, 8);
141   addKey("menu/enter", Select_Key, 0x80, 8);
142   addKey("up", Up_Key, 0x82, 8); // "set+"
143   addKey("down", Down_Key, 0x83, 8); // "set-"
144 }
145
146
147 ToshibaTV1c::ToshibaTV1c(
148   unsigned int index)
149   : ToshibaTV1f(index)
150 {
151   setKeysetName("TV Keyset 1c");
152 }
153
154
155 void ToshibaTV1c::populateProtocol(
156   QObject *guiObject)
157 {
158   if (threadableProtocol)
159   {
160     // If the pointer is not null, the keyset must already be populated.
161     return;
162   }
163
164   ToshibaTV1f::populateProtocol(guiObject);
165
166   addKey("textzoom", TeletextSize_Key, 0x0D, 8); // "Enlarge"
167   addKey("texttime", TeletextTime_Key, 0x15, 8);
168   addKey("TXT/MIX", Teletext_Key, 0x17, 8); // "teletext"
169   addKey("textindex", TeletextIndex_Key, 0x2B, 8);
170   addKey("textpages", Unmapped_Key, 0x2C, 8);
171   addKey("texthold", TeletextHold_Key, 0x53, 8);
172   addKey("textanswer", TeletextReveal_Key, 0x54, 8);
173   addKey("pipswap", PIPSwap_Key, 0x58, 8);
174 }
175
176
177 ToshibaTV1d::ToshibaTV1d(
178   unsigned int index)
179   : ToshibaTV1f(index)
180 {
181   setKeysetName("TV Keyset 1d");
182 }
183
184
185 void ToshibaTV1d::populateProtocol(
186   QObject *guiObject)
187 {
188   if (threadableProtocol)
189   {
190     // If the pointer is not null, the keyset must already be populated.
191     return;
192   }
193
194   ToshibaTV1f::populateProtocol(guiObject);
195
196   addKey("subtitle", Captions_Key, 0x0C, 8);
197   addKey("page+", PageDown_Key, 0x0D,8);
198   addKey("24+", Unmapped_Key, 0x15, 8);
199   addKey("Up", Up_Key, 0x19, 8);
200   addKey("Down", Down_Key, 0x1D, 8);
201   addKey("Right", Right_Key, 0x40, 8);
202   addKey("Left", Left_Key, 0x42, 8);
203   addKey("guide", Guide_Key, 0x45, 8);
204   addKey("tv/fav/radio", Favorites_Key, 0x47, 8); // might be wrong
205   addKey("page-", PageUp_Key, 0x53, 8);
206   addKey("24-", Unmapped_Key, 0x54, 8);
207 }
208
209
210 ToshibaTV1e::ToshibaTV1e(
211   unsigned int index)
212   : ToshibaTV1(index)
213 {
214   setKeysetName("TV Keyset 1e");
215 }
216
217
218 void ToshibaTV1e::populateProtocol(
219   QObject *guiObject)
220 {
221   if (threadableProtocol)
222   {
223     // If the pointer is not null, the keyset must already be populated.
224     return;
225   }
226
227   ToshibaTV1::populateProtocol(guiObject);
228
229   addKey("SKIPPREV", Previous_Key, 0x11, 8);
230   addKey("FFWD", FastForward_Key, 0x2A, 8);
231   addKey("STOP", Stop_Key, 0x40, 8);
232   addKey("frev", Rewind_Key, 0x4B, 8);
233   addKey("PLAY", Play_Key, 0x51, 8);
234   addKey("SKIPNEXT", Next_Key, 0x53, 8);
235 }
236
237
238 ToshibaTV1f::ToshibaTV1f(
239   unsigned int index)
240   : ToshibaTV1(index)
241 {
242   setKeysetName("TV Keyset 1f");
243
244   addControlledDevice(Toshiba_Make, "Regza AV50*", TV_Device);
245 }
246
247
248 void ToshibaTV1f::populateProtocol(
249   QObject *guiObject)
250 {
251   if (threadableProtocol)
252   {
253     // If the pointer is not null, the keyset must already be populated.
254     return;
255   }
256
257   ToshibaTV1::populateProtocol(guiObject);
258
259   addKey("info", Info_Key, 0x16, 8);
260   addKey("stillpicture", Pause_Key, 0x22, 8);
261   addKey("exit", Exit_Key, 0x43, 8);
262   addKey("back", PrevChannel_Key, 0x52, 8); // "Double_Arrow", "swap"
263 }
264
265
266 ToshibaTV1g::ToshibaTV1g(
267   unsigned int index)
268   : ToshibaTV1(index)
269 {
270   setKeysetName("TV Keyset 1g");
271 }
272
273
274 void ToshibaTV1g::populateProtocol(
275   QObject *guiObject)
276 {
277   if (threadableProtocol)
278   {
279     // If the pointer is not null, the keyset must already be populated.
280     return;
281   }
282
283   ToshibaTV1::populateProtocol(guiObject);
284
285   addKey("menu", Menu_Key, 0x80, 8);
286   addKey("set+", Right_Key, 0x82, 8);
287   addKey("set-", Left_Key, 0x83, 8);
288   addKey("enter", Select_Key, 0x89, 8);
289 }
290
291
292 ToshibaTV1h::ToshibaTV1h(
293   unsigned int index)
294   : ToshibaTV1b(index)
295 {
296   setKeysetName("TV Keyset 1h");
297 }
298
299
300 void ToshibaTV1h::populateProtocol(
301   QObject *guiObject)
302 {
303   if (threadableProtocol)
304   {
305     // If the pointer is not null, the keyset must already be populated.
306     return;
307   }
308
309   ToshibaTV1b::populateProtocol(guiObject);
310
311   addKey("last (prev ch)", PrevChannel_Key, 0x17, 8);
312   addKey("program guide", Guide_Key, 0x1C, 8);
313   addKey("pip on/off", PIP_Key, 0x54, 8);
314 }
315
316
317 ToshibaVCR1::ToshibaVCR1(
318   unsigned int index)
319   : PIRKeysetMetaData(
320       "VCR Keyset 1",
321       Toshiba_Make,
322       index)
323 {
324 }
325
326
327 void ToshibaVCR1::populateProtocol(
328   QObject *guiObject)
329 {
330   if (threadableProtocol)
331   {
332     // If the pointer is not null, the keyset must already be populated.
333     return;
334   }
335
336   threadableProtocol = new NECProtocol(guiObject, index, false, true);
337
338   setPreData(0x44, 8);
339
340   addKey("1", One_Key, 0x01, 8);
341   addKey("2", Two_Key, 0x02, 8);
342   addKey("3", Three_Key, 0x03, 8);
343   addKey("4", Four_Key, 0x04, 8);
344   addKey("5", Five_Key, 0x05, 8);
345   addKey("6", Six_Key, 0x06, 8);
346   addKey("7", Seven_Key, 0x07, 8);
347   addKey("8", Eight_Key, 0x08, 8);
348   addKey("9", Nine_Key, 0x09, 0);
349   addKey("0", Zero_Key, 0x0A, 8);
350   addKey("100", PlusOneHundred_Key, 0x0B, 8);
351   addKey("slow/dir_fwd", StepForward_Key, 0x0D, 8);
352   addKey("pause", Pause_Key, 0x10, 8);
353   addKey("tv/vcr", Input_Key, 0x11, 8);
354   addKey("power", Power_Key, 0x12, 8);
355   addKey("ff", FastForward_Key, 0x13, 8);
356   addKey("stop", Stop_Key, 0x14, 8);
357   addKey("play", Play_Key, 0x15, 8);
358   addKey("record", Record_Key, 0x18, 8);
359   addKey("rew", Rewind_Key, 0x19, 8);
360   addKey("ch+", ChannelUp_Key, 0x1B, 8);
361   addKey("ch-", ChannelDown_Key, 0x1F, 8);
362   addKey("input", Input_Key, 0x5F, 8);
363   addKey("recall", PrevChannel_Key, 0x83, 8);
364   addKey("skip", Next_Key, 0x9E, 8);
365   addKey("previous", Previous_Key, 0x9F, 8);
366   addKey("eject", Eject_Key, 0xF5, 8);
367 }
368
369
370 ToshibaVCR1a::ToshibaVCR1a(
371   unsigned int index)
372   : ToshibaVCR1(index)
373 {
374   setKeysetName("VCR Keyset 1a");
375 }
376
377
378 void ToshibaVCR1a::populateProtocol(
379   QObject *guiObject)
380 {
381   if (threadableProtocol)
382   {
383     // If the pointer is not null, the keyset must already be populated.
384     return;
385   }
386
387   ToshibaVCR1::populateProtocol(guiObject);
388
389   addKey("ch+", ChannelUp_Key, 0x1E, 8);
390 //  addKey("ch-", ChannelDown_Key, 0x1F, 8); // Already in parent
391 }
392
393
394 ToshibaDisc1::ToshibaDisc1(
395   unsigned int index)
396   : PIRKeysetMetaData(
397       "Disc Keyset 1",
398       Toshiba_Make,
399       index)
400 {
401 }
402
403
404 void ToshibaDisc1::populateProtocol(
405   QObject *guiObject)
406 {
407   if (threadableProtocol)
408   {
409     // If the pointer is not null, the keyset must already be populated.
410     return;
411   }
412
413   threadableProtocol = new NECProtocol(guiObject, index, false, true);
414
415 //  setPreData(0xA25D, 16);
416   setPreData(0x45, 8);
417
418   addKey("pause", Pause_Key, 0x00, 8);
419   addKey("1", One_Key, 0x01, 8);
420   addKey("2", Two_Key, 0x02, 8);
421   addKey("3", Three_Key, 0x03, 8);
422   addKey("4", Four_Key, 0x04, 8);
423   addKey("5", Five_Key, 0x05, 8);
424   addKey("6", Six_Key, 0x06, 8);
425   addKey("7", Seven_Key, 0x07, 8);
426   addKey("8", Eight_Key, 0x08, 8);
427   addKey("9", Nine_Key, 0x09, 8);
428   addKey("0", Zero_Key, 0x0A, 8);
429   addKey("slow/dir-fwd", StepForward_Key, 0x0D, 8);
430   addKey("slow/dir-rev", StepBack_Key, 0x0E, 8);
431   addKey("power", Power_Key, 0x12, 8);
432   addKey("ff", FastForward_Key, 0x13, 8);
433   addKey("stop", Stop_Key, 0x14, 8);
434   addKey("play", Play_Key, 0x15, 8);
435   addKey("display", Info_Key, 0x16, 8);
436   addKey("rew", Rewind_Key, 0x19, 8);
437   addKey("menu/enter", Menu_Key, 0x21, 8); // "ok", "enter"
438   addKey("menu/enter", Select_Key, 0x21, 8); // "ok", "enter"
439   addKey("exit", Exit_Key, 0x22, 8);
440   addKey("skip-", Previous_Key, 0x23, 8);
441   addKey("skip+", Next_Key, 0x24, 8);
442   addKey("+10", DoubleDigit_Key, 0x25, 8);
443   addKey("100", PlusOneHundred_Key, 0x25, 8);
444   addKey("T", Unmapped_Key, 0x26, 8); // "Index", direct access to title by number
445   addKey("SUBTITLE", Captions_Key, 0x28, 8);
446   addKey("KEY_ANGLE", Angle_Key, 0x29, 8);
447   addKey("MEMORY", Program_Key, 0x2A, 8);
448   addKey("REPEAT", Repeat_Key, 0x2B, 8);
449   addKey("A-B_RPT", RepeatAB_Key, 0x2C, 8);
450   addKey("RANDOM", Random_Key, 0x2E, 8);
451   addKey("FL_DIMMER", Unmapped_Key, 0x41, 8); // "FlDim"
452   addKey("3D", Unmapped_Key, 0x43, 8);
453   addKey("disc", NextDisc_Key, 0x4A, 8); // "DISC SELECT"
454   addKey("vol+", VolumeUp_Key, 0x4D, 8);
455   addKey("right", Right_Key, 0x4D, 8); // "vol+"
456   addKey("vol-", VolumeDown_Key, 0x51, 8);
457   addKey("left", Left_Key, 0x51, 8); // "vol-"
458   addKey("ch+", ChannelUp_Key, 0x80, 8);
459   addKey("up", Up_Key, 0x80, 8); // "ch+"
460   addKey("ch-", ChannelDown_Key, 0x81, 8);
461   addKey("down", Down_Key, 0x81, 8); // "ch-"
462   addKey("menu", DiscMenu_Key, 0x84, 8);
463   addKey("FlSelect", Unmapped_Key, 0xD7, 8);
464   addKey("top_menu", DiscTitle_Key, 0xDE, 8); // "title"
465   addKey("clear", Clear_Key, 0xEF, 8);
466   addKey("eject", Eject_Key, 0xF5, 8);
467 }
468
469
470 ToshibaDisc1a::ToshibaDisc1a(
471   unsigned int index)
472   : ToshibaDisc1(index)
473 {
474   setKeysetName("Disc Keyset 1a");
475 }
476
477
478 void ToshibaDisc1a::populateProtocol(
479   QObject *guiObject)
480 {
481   if (threadableProtocol)
482   {
483     // If the pointer is not null, the keyset must already be populated.
484     return;
485   }
486
487   ToshibaDisc1::populateProtocol(guiObject);
488
489   addKey("setup", Menu_Key, 0x20, 8);
490   addKey("audio", Audio_Key, 0x27, 8);
491   addKey("action", Unmapped_Key, 0x84, 8);
492 }
493
494
495
496 ToshibaDisc1b::ToshibaDisc1b(
497   unsigned int index)
498   : ToshibaDisc1(index)
499 {
500   setKeysetName("Disc Keyset 1b");
501 }
502
503
504 void ToshibaDisc1b::populateProtocol(
505   QObject *guiObject)
506 {
507   if (threadableProtocol)
508   {
509     // If the pointer is not null, the keyset must already be populated.
510     return;
511   }
512
513   ToshibaDisc1::populateProtocol(guiObject);
514
515   addKey("enter", Select_Key, 0x84, 8);
516   addKey("mark", Unmapped_Key, 0x21, 8);
517 }
518
519
520 ToshibaDisc1c::ToshibaDisc1c(
521   unsigned int index)
522   : ToshibaDisc1a(index)
523 {
524   setKeysetName("Disc Keyset 1c");
525 }
526
527
528 void ToshibaDisc1c::populateProtocol(
529   QObject *guiObject)
530 {
531   if (threadableProtocol)
532   {
533     // If the pointer is not null, the keyset must already be populated.
534     return;
535   }
536
537   ToshibaDisc1a::populateProtocol(guiObject);
538
539   addKey("KEY_DVD", Unmapped_Key, 0x22, 8);
540   addKey("KEY_SLOW", Slow_Key, 0x26, 8);
541   addKey("KEY_FAVORITES", Favorites_Key, 0xDE, 8);
542   addKey("KEY_EJECTCD", Eject_Key, 0xDF, 8);
543 }
544
545
546 ToshibaDisc1d::ToshibaDisc1d(
547   unsigned int index)
548   : ToshibaDisc1a(index)
549 {
550   setKeysetName("Disc Keyset 1d");
551 }
552
553
554 void ToshibaDisc1d::populateProtocol(
555   QObject *guiObject)
556 {
557   if (threadableProtocol)
558   {
559     // If the pointer is not null, the keyset must already be populated.
560     return;
561   }
562
563   ToshibaDisc1a::populateProtocol(guiObject);
564
565   addKey("recall", PrevChannel_Key, 0x16, 8);
566 }