Keyset Memory Management Bugfix
[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 ToshibaTV1i::ToshibaTV1i(
318   unsigned int index)
319   : ToshibaTV1h(index)
320 {
321   setKeysetName("TV Keyset 1i");
322
323   addControlledDevice(Toshiba_Make, "MW-27H62", TV_Device);
324 }
325
326
327 void ToshibaTV1i::populateProtocol(
328   QObject *guiObject)
329 {
330   if (threadableProtocol)
331   {
332     // Keyset already populated.
333     return;
334   }
335
336   ToshibaTV1h::populateProtocol(guiObject);
337
338   addKey("Menu", Menu_Key, 0x0E, 8);
339   addKey("DvdMenu", DiscMenu_Key, 0x19, 8);
340   addKey("ChapterNext", Next_Key, 0x57, 8);
341 }
342
343
344 ToshibaVCR1::ToshibaVCR1(
345   unsigned int index)
346   : PIRKeysetMetaData(
347       "VCR Keyset 1",
348       Toshiba_Make,
349       index)
350 {
351 }
352
353
354 void ToshibaVCR1::populateProtocol(
355   QObject *guiObject)
356 {
357   if (threadableProtocol)
358   {
359     // If the pointer is not null, the keyset must already be populated.
360     return;
361   }
362
363   threadableProtocol = new NECProtocol(guiObject, index, false, true);
364
365   setPreData(0x44, 8);
366
367   addKey("1", One_Key, 0x01, 8);
368   addKey("2", Two_Key, 0x02, 8);
369   addKey("3", Three_Key, 0x03, 8);
370   addKey("4", Four_Key, 0x04, 8);
371   addKey("5", Five_Key, 0x05, 8);
372   addKey("6", Six_Key, 0x06, 8);
373   addKey("7", Seven_Key, 0x07, 8);
374   addKey("8", Eight_Key, 0x08, 8);
375   addKey("9", Nine_Key, 0x09, 0);
376   addKey("0", Zero_Key, 0x0A, 8);
377   addKey("100", PlusOneHundred_Key, 0x0B, 8);
378   addKey("slow/dir_fwd", StepForward_Key, 0x0D, 8);
379   addKey("pause", Pause_Key, 0x10, 8);
380   addKey("tv/vcr", Input_Key, 0x11, 8);
381   addKey("power", Power_Key, 0x12, 8);
382   addKey("ff", FastForward_Key, 0x13, 8);
383   addKey("stop", Stop_Key, 0x14, 8);
384   addKey("play", Play_Key, 0x15, 8);
385   addKey("record", Record_Key, 0x18, 8);
386   addKey("rew", Rewind_Key, 0x19, 8);
387   addKey("ch+", ChannelUp_Key, 0x1B, 8);
388   addKey("ch-", ChannelDown_Key, 0x1F, 8);
389   addKey("InputDVD", DVDInput_Key, 0x20, 8);
390   addKey("DirectionRight", Right_Key, 0x4D, 8);
391   addKey("Select/Ok", Select_Key, 0x4E, 8);
392   addKey("DirectionLeft", Left_Key, 0x51, 8);
393   addKey("Audio", Audio_Key, 0x53, 8);
394   addKey("Program", Program_Key, 0x5C, 8);
395   addKey("SP/SLP", VHSSpeed_Key, 0x5D, 8);
396   addKey("input", Input_Key, 0x5F, 8);
397   addKey("DirectionUp", Up_Key, 0x80, 8);
398   addKey("DirectionDown", Down_Key, 0x81, 8);
399   addKey("recall", PrevChannel_Key, 0x83, 8);
400   addKey("Subtitle", Captions_Key, 0x87, 8);
401   addKey("Angle", Angle_Key, 0x96, 8);
402   addKey("Greater100", PlusOneHundred_Key, 0x9B, 8);
403   addKey("skip", Next_Key, 0x9E, 8);
404   addKey("previous", Previous_Key, 0x9F, 8);
405   addKey("TopMenu", DiscTitle_Key, 0xDF, 8);
406   addKey("Cancel", Clear_Key, 0xEF, 8);
407   addKey("eject", Eject_Key, 0xF5, 8);
408 }
409
410
411 ToshibaVCR1a::ToshibaVCR1a(
412   unsigned int index)
413   : ToshibaVCR1(index)
414 {
415   setKeysetName("VCR Keyset 1a");
416 }
417
418
419 void ToshibaVCR1a::populateProtocol(
420   QObject *guiObject)
421 {
422   if (threadableProtocol)
423   {
424     // If the pointer is not null, the keyset must already be populated.
425     return;
426   }
427
428   ToshibaVCR1::populateProtocol(guiObject);
429
430   addKey("ch+", ChannelUp_Key, 0x1E, 8);
431 //  addKey("ch-", ChannelDown_Key, 0x1F, 8); // Already in parent
432 }
433
434
435 ToshibaDisc1::ToshibaDisc1(
436   unsigned int index)
437   : PIRKeysetMetaData(
438       "Disc Keyset 1",
439       Toshiba_Make,
440       index)
441 {
442 }
443
444
445 void ToshibaDisc1::populateProtocol(
446   QObject *guiObject)
447 {
448   if (threadableProtocol)
449   {
450     // If the pointer is not null, the keyset must already be populated.
451     return;
452   }
453
454   threadableProtocol = new NECProtocol(guiObject, index, false, true);
455
456 //  setPreData(0xA25D, 16);
457   setPreData(0x45, 8);
458
459   addKey("pause", Pause_Key, 0x00, 8);
460   addKey("1", One_Key, 0x01, 8);
461   addKey("2", Two_Key, 0x02, 8);
462   addKey("3", Three_Key, 0x03, 8);
463   addKey("4", Four_Key, 0x04, 8);
464   addKey("5", Five_Key, 0x05, 8);
465   addKey("6", Six_Key, 0x06, 8);
466   addKey("7", Seven_Key, 0x07, 8);
467   addKey("8", Eight_Key, 0x08, 8);
468   addKey("9", Nine_Key, 0x09, 8);
469   addKey("0", Zero_Key, 0x0A, 8);
470   addKey("slow/dir-fwd", StepForward_Key, 0x0D, 8);
471   addKey("slow/dir-rev", StepBack_Key, 0x0E, 8);
472   addKey("power", Power_Key, 0x12, 8);
473   addKey("ff", FastForward_Key, 0x13, 8);
474   addKey("stop", Stop_Key, 0x14, 8);
475   addKey("play", Play_Key, 0x15, 8);
476   addKey("display", Info_Key, 0x16, 8);
477   addKey("rew", Rewind_Key, 0x19, 8);
478   addKey("menu/enter", Menu_Key, 0x21, 8); // "ok", "enter"
479   addKey("menu/enter", Select_Key, 0x21, 8); // "ok", "enter"
480   addKey("exit", Exit_Key, 0x22, 8);
481   addKey("skip-", Previous_Key, 0x23, 8);
482   addKey("skip+", Next_Key, 0x24, 8);
483   addKey("+10", DoubleDigit_Key, 0x25, 8);
484   addKey("100", PlusOneHundred_Key, 0x25, 8);
485   addKey("T", Unmapped_Key, 0x26, 8); // "Index", direct access to title by number
486   addKey("SUBTITLE", Captions_Key, 0x28, 8);
487   addKey("KEY_ANGLE", Angle_Key, 0x29, 8);
488   addKey("MEMORY", Program_Key, 0x2A, 8);
489   addKey("REPEAT", Repeat_Key, 0x2B, 8);
490   addKey("A-B_RPT", RepeatAB_Key, 0x2C, 8);
491   addKey("RANDOM", Random_Key, 0x2E, 8);
492   addKey("FL_DIMMER", Unmapped_Key, 0x41, 8); // "FlDim"
493   addKey("3D", Unmapped_Key, 0x43, 8);
494   addKey("disc", NextDisc_Key, 0x4A, 8); // "DISC SELECT"
495   addKey("vol+", VolumeUp_Key, 0x4D, 8);
496   addKey("right", Right_Key, 0x4D, 8); // "vol+"
497   addKey("vol-", VolumeDown_Key, 0x51, 8);
498   addKey("left", Left_Key, 0x51, 8); // "vol-"
499   addKey("ch+", ChannelUp_Key, 0x80, 8);
500   addKey("up", Up_Key, 0x80, 8); // "ch+"
501   addKey("ch-", ChannelDown_Key, 0x81, 8);
502   addKey("down", Down_Key, 0x81, 8); // "ch-"
503   addKey("menu", DiscMenu_Key, 0x84, 8);
504   addKey("FlSelect", Unmapped_Key, 0xD7, 8);
505   addKey("top_menu", DiscTitle_Key, 0xDE, 8); // "title"
506   addKey("clear", Clear_Key, 0xEF, 8);
507   addKey("eject", Eject_Key, 0xF5, 8);
508 }
509
510
511 ToshibaDisc1a::ToshibaDisc1a(
512   unsigned int index)
513   : ToshibaDisc1(index)
514 {
515   setKeysetName("Disc Keyset 1a");
516 }
517
518
519 void ToshibaDisc1a::populateProtocol(
520   QObject *guiObject)
521 {
522   if (threadableProtocol)
523   {
524     // If the pointer is not null, the keyset must already be populated.
525     return;
526   }
527
528   ToshibaDisc1::populateProtocol(guiObject);
529
530   addKey("setup", Menu_Key, 0x20, 8);
531   addKey("audio", Audio_Key, 0x27, 8);
532   addKey("action", Unmapped_Key, 0x84, 8);
533 }
534
535
536
537 ToshibaDisc1b::ToshibaDisc1b(
538   unsigned int index)
539   : ToshibaDisc1(index)
540 {
541   setKeysetName("Disc Keyset 1b");
542 }
543
544
545 void ToshibaDisc1b::populateProtocol(
546   QObject *guiObject)
547 {
548   if (threadableProtocol)
549   {
550     // If the pointer is not null, the keyset must already be populated.
551     return;
552   }
553
554   ToshibaDisc1::populateProtocol(guiObject);
555
556   addKey("enter", Select_Key, 0x84, 8);
557   addKey("mark", Unmapped_Key, 0x21, 8);
558 }
559
560
561 ToshibaDisc1c::ToshibaDisc1c(
562   unsigned int index)
563   : ToshibaDisc1a(index)
564 {
565   setKeysetName("Disc Keyset 1c");
566 }
567
568
569 void ToshibaDisc1c::populateProtocol(
570   QObject *guiObject)
571 {
572   if (threadableProtocol)
573   {
574     // If the pointer is not null, the keyset must already be populated.
575     return;
576   }
577
578   ToshibaDisc1a::populateProtocol(guiObject);
579
580   addKey("KEY_DVD", Unmapped_Key, 0x22, 8);
581   addKey("KEY_SLOW", Slow_Key, 0x26, 8);
582   addKey("KEY_FAVORITES", Favorites_Key, 0xDE, 8);
583   addKey("KEY_EJECTCD", Eject_Key, 0xDF, 8);
584 }
585
586
587 ToshibaDisc1d::ToshibaDisc1d(
588   unsigned int index)
589   : ToshibaDisc1a(index)
590 {
591   setKeysetName("Disc Keyset 1d");
592 }
593
594
595 void ToshibaDisc1d::populateProtocol(
596   QObject *guiObject)
597 {
598   if (threadableProtocol)
599   {
600     // If the pointer is not null, the keyset must already be populated.
601     return;
602   }
603
604   ToshibaDisc1a::populateProtocol(guiObject);
605
606   addKey("recall", PrevChannel_Key, 0x16, 8);
607 }