Memory Management Improved
[pierogi] / keysets / sanyo.cpp
1 #include "sanyo.h"
2
3 #include "protocols/necprotocol.h"
4
5 SanyoVCR1::SanyoVCR1(
6   unsigned int index)
7   : PIRKeysetMetaData(
8       "DVD/VCR Keyset 1",
9       Sanyo_Make,
10       index)
11 {
12   addControlledDevice(Sanyo_Make, "DVW-5000", VCR_Device);
13   addControlledDevice(Sanyo_Make, "DVW-5000", DVD_Device);
14 }
15
16
17 void SanyoVCR1::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(0x8C73, 16);
29   setPreData(0x31, 8);
30
31   addKey("Ch Up", ChannelUp_Key, 0x01, 8);
32   addKey("Ch Down", ChannelDown_Key, 0x02, 8);
33   addKey("Audio", Audio_Key, 0x03, 8);
34   addKey("1", One_Key, 0x04, 8);
35   addKey("2", Two_Key, 0x05, 8);
36   addKey("3", Three_Key, 0x06, 8);
37   addKey("4", Four_Key, 0x07, 8);
38   addKey("TV/VCR", Input_Key, 0x08, 8);
39   addKey("x2", Unmapped_Key, 0x0B, 8);
40   addKey("5", Five_Key, 0x0C, 8);
41   addKey("6", Six_Key, 0x0D, 8);
42   addKey("7", Seven_Key, 0x0E, 8);
43   addKey("8", Eight_Key, 0x0F, 8);
44   addKey("Stop", Stop_Key, 0x10, 8);
45   addKey("Pause", Pause_Key, 0x11, 8);
46   addKey("Rew", Rewind_Key, 0x12, 8);
47   addKey("FF", FastForward_Key, 0x13, 8);
48   addKey("Play", Play_Key, 0x14, 8);
49   addKey("Rec", Record_Key, 0x15, 8);
50   addKey("Index", Unmapped_Key, 0x19, 8);
51   addKey("Slow", Slow_Key, 0x1A, 8);
52   addKey("+100", PlusOneHundred_Key, 0x1B, 8);
53   addKey("9", Nine_Key, 0x1C, 8);
54   addKey("0", Zero_Key, 0x1D, 8);
55   addKey("Input", Unmapped_Key, 0x1E, 8);  // need a subclass for this?
56   addKey("ATR", Unmapped_Key, 0x1F, 8);
57   addKey("Memory", Memory_Key, 0x43, 8); // "->0<-"
58   addKey("Reset", Reset_Key, 0x44, 8);
59   addKey("PROG", Program_Key, 0x46, 8);
60   addKey("Cancel", Clear_Key, 0x4A, 8);
61   addKey("Ok", Select_Key, 0x4B, 8);
62   addKey("Display", Info_Key, 0x4C, 8);
63   addKey("VPS", Unmapped_Key, 0x4F, 8); // "vps/pdc", "dpc"
64   addKey("Monitor", Unmapped_Key, 0x51, 8);
65   addKey("Clock", Clock_Key, 0x56, 8);
66   addKey("Power", Power_Key, 0x5B, 8);
67   addKey("SP/LP", VHSSpeed_Key, 0x5E, 8);
68   addKey("ShowView", Unmapped_Key, 0x8C, 8);
69   addKey("Right", Right_Key, 0x94, 8);
70   addKey("Left", Left_Key, 0x95, 8);
71   addKey("Down", Down_Key, 0x96, 8);
72   addKey("Up", Up_Key, 0x97, 8);
73   addKey("Preset", Unmapped_Key, 0x9E, 8);
74   addKey("Menu", Menu_Key, 0xCA, 8);
75   addKey("BLANK", Unmapped_Key, 0xD0, 8);
76 }
77
78
79 SanyoDVD1::SanyoDVD1(
80   unsigned int index)
81   : PIRKeysetMetaData(
82       "DVD Keyset 1",
83       Sanyo_Make,
84       index)
85 {
86   addControlledDevice(Sanyo_Make, "DVD-SL25", DVD_Device);
87 }
88
89
90 void SanyoDVD1::populateProtocol(
91   QObject *guiObject)
92 {
93   if (threadableProtocol)
94   {
95     // If the pointer is not null, the keyset must already be populated.
96     return;
97   }
98
99   threadableProtocol = new NECProtocol(guiObject, index, true, true);
100
101 //  setPreData(0x3C23, 16);
102   setPreData(0xC43C, 16);
103
104   addKey("On", Power_Key, 0x00, 8);
105   addKey("OpenClose", Eject_Key, 0x01, 8);
106   addKey("Setup", Menu_Key, 0x02, 8);
107   addKey("OnScreen", Unmapped_Key, 0x03, 8);
108   addKey("SubtitleChange", Unmapped_Key, 0x05, 8);
109   addKey("TopMenu", DiscTitle_Key, 0x06, 8);
110   addKey("Menu", DiscMenu_Key, 0x07, 8);
111   addKey("Angle", Angle_Key, 0x08, 8);
112   addKey("AngleReplay", Unmapped_Key, 0x09, 8);
113   addKey("Audio", Audio_Key, 0x0A, 8);
114   addKey("Up", Up_Key, 0x0B, 8);
115   addKey("Down", Down_Key, 0x0C, 8);
116   addKey("Left", Left_Key, 0x0D, 8);
117   addKey("Right", Right_Key, 0x0E, 8);
118   addKey("Enter", Select_Key, 0x0F, 8);
119   addKey("Return", Exit_Key, 0x10, 8);
120   addKey("1", One_Key, 0x11, 8);
121   addKey("2", Two_Key, 0x12, 8);
122   addKey("3", Three_Key, 0x13, 8);
123   addKey("4", Four_Key, 0x14, 8);
124   addKey("5", Five_Key, 0x15, 8);
125   addKey("6", Six_Key, 0x16, 8);
126   addKey("7", Seven_Key, 0x17, 8);
127   addKey("8", Eight_Key, 0x18, 8);
128   addKey("9", Nine_Key, 0x19, 8);
129   addKey("0", Zero_Key, 0x1A, 8);
130   addKey("Clear", Clear_Key, 0x1C, 8);
131   addKey("Stop", Stop_Key, 0x1E, 8);
132   addKey("Play", Play_Key, 0x1F, 8);
133   addKey("PauseStep", Pause_Key, 0x20, 8);
134   addKey("Next", Next_Key, 0x21, 8);
135   addKey("Prev", Previous_Key, 0x22, 8);
136   addKey("Fwd", FastForward_Key, 0x23, 8);
137   addKey("Rev", Rewind_Key, 0x26, 8);
138   addKey("FwdSlow", StepForward_Key, 0x29, 8);
139   addKey("RevSlow", StepBack_Key, 0x2C, 8);
140   addKey("LastMemo", Unmapped_Key, 0x2F, 8);
141   addKey("Repeat", Repeat_Key, 0x35, 8);
142   addKey("ABRepeat", RepeatAB_Key, 0x36, 8);
143   addKey("SearchMode", Unmapped_Key, 0x38, 8);
144   addKey("ProgramRandom", Random_Key, 0x39, 8);
145   addKey("PictureMode", PictureMode_Key, 0x3A, 8);
146   addKey("Zoom", Zoom_Key, 0x3B, 8);
147   addKey("SubtitleOnOff", Captions_Key, 0x4A, 8);
148 }
149
150
151 SanyoTV1::SanyoTV1(
152   unsigned int index)
153   : PIRKeysetMetaData(
154       "TV Keyset 1",
155       Sanyo_Make,
156       index)
157 {
158 }
159
160
161 void SanyoTV1::populateProtocol(
162   QObject *guiObject)
163 {
164   if (threadableProtocol)
165   {
166     // If the pointer is not null, the keyset must already be populated.
167     return;
168   }
169
170   threadableProtocol = new NECProtocol(guiObject, index, false, true);
171
172 //  setPreData(0x1CE3, 16);
173   setPreData(0x38, 8);
174
175   addKey("0", Zero_Key, 0x00, 8);
176   addKey("1", One_Key, 0x01, 8);
177   addKey("2", Two_Key, 0x02, 8);
178   addKey("3", Three_Key, 0x03, 8);
179   addKey("4", Four_Key, 0x04, 8);
180   addKey("5", Five_Key, 0x05, 8);
181   addKey("6", Six_Key, 0x06, 8);
182   addKey("7", Seven_Key, 0x07, 8);
183   addKey("8", Eight_Key, 0x08, 8);
184   addKey("9", Nine_Key, 0x09, 8);
185   addKey("Channel Up", ChannelUp_Key, 0x0A, 8);
186   addKey("Channel Down", ChannelDown_Key, 0x0B, 8);
187   addKey("Display", Info_Key, 0x0C, 8);
188   addKey("Sleep", Sleep_Key, 0x0D, 8);
189   addKey("Volume Up", VolumeUp_Key, 0x0E, 8);
190   addKey("Volume Down", VolumeDown_Key, 0x0F, 8);
191   addKey("Closed Captions", Captions_Key, 0x11, 8);
192   addKey("Power", Power_Key, 0x12, 8);
193   addKey("video_mode", Input_Key, 0x13, 8); // "input"
194   addKey("Surround Toggle", Surround_Key, 0x14, 8);
195   addKey("Enter", Enter_Key, 0x15, 8); // odd
196   addKey("Menu", Menu_Key, 0x17, 8); // "setup"
197   addKey("Mute", Mute_Key, 0x18, 8);
198   addKey("Recall", PrevChannel_Key, 0x19, 8);
199   addKey("audio", Audio_Key, 0x1A, 8);
200   addKey("reset", Reset_Key, 0x1C, 8);
201   addKey("right arrow", Right_Key, 0x1E, 8);
202   addKey("left arrow", Left_Key, 0x1F, 8);
203   addKey("V-guide menu", Unmapped_Key, 0x4C, 8);
204   addKey("up arrow", Up_Key, 0x4E, 8);
205   addKey("down arrow", Down_Key, 0x4F, 8);
206   addKey("exit", Exit_Key, 0x53, 8);
207   addKey("enter", Select_Key, 0x54, 8);
208   addKey("tuner", Unmapped_Key, 0x55, 8); // "Tuner Toggle (analog-digital)"
209   addKey("pix shape", AspectRatio_Key, 0x57, 8);
210   addKey("pip up", Unmapped_Key, 0x59, 8);
211   addKey("pip down", Unmapped_Key, 0x5A, 8);
212   addKey("PIP", PIP_Key, 0x5B, 8);
213   addKey("Swap", PIPSwap_Key, 0x5D, 8);
214   addKey("freeze", PIPPause_Key, 0x5E, 8);
215   addKey("Volume Cycle (Max/Min/Normal)", Unmapped_Key, 0x80, 8);
216   addKey("puts 'A' on the screen", Unmapped_Key, 0x81, 8);
217   addKey("puts 'P' on the screen", Unmapped_Key, 0x82, 8);
218   addKey("Scan Velocity Cycle (Hi/Lo/Off)", Unmapped_Key, 0x87, 8);
219   addKey("Color Cycle", ColorUp_Key, 0x88, 8);
220   addKey("Tint Cycle", Unmapped_Key, 0x89, 8);
221   addKey("Contrast Cycle", ContrastUp_Key, 0x8A, 8);
222   addKey("Brightness Cycle", BrightnessUp_Key, 0x8B, 8);
223   addKey("Sharpness Cycle", Unmapped_Key, 0x8C, 8);
224   addKey("bass", BassUp_Key, 0x8E, 8);
225   addKey("Treble", TrebleUp_Key, 0x8F, 8);
226   addKey("Service Menu", Unmapped_Key, 0x91, 8);
227   addKey("Crude Info", Unmapped_Key, 0x96, 8);
228   addKey("refresh?", Unmapped_Key, 0x97, 8);
229   addKey("Color Enhancer Cycle (Normal/Warm/Cool)", Unmapped_Key, 0x98, 8);
230   addKey("Component2 Input", Unmapped_Key, 0x9C, 8);
231   addKey("Speaker Toggle", Unmapped_Key, 0x9D, 8);
232   addKey("puts 'R32 B26' on the screen.  MENU cancels.", Unmapped_Key, 0x9F, 8);
233   addKey("Reset?", Unmapped_Key, 0xC0, 8);
234   addKey("Clear?", Unmapped_Key, 0xC1, 8);
235   addKey("Self Test", Unmapped_Key, 0xC3, 8);
236
237 //  addKey("Black screen (recoverable with 0x9F then MENU)", Unmapped_Key, 0x9E, 8);
238 }
239
240
241 SanyoTV1a::SanyoTV1a(
242   unsigned int index)
243   : SanyoTV1(index)
244 {
245   setKeysetName("TV Keyset 1a");
246
247   addControlledDevice(Sanyo_Make, "28LN4-C", TV_Device);
248   addControlledDevice(Sanyo_Make, "28CN7F", TV_Device);
249   addControlledDevice(Sanyo_Make, "C21EF44", TV_Device);
250   addControlledDevice(Sanyo_Make, "C25EG64", TV_Device);
251   addControlledDevice(Sanyo_Make, "C28EH64", TV_Device);
252 //  addControlledDevice(Sanyo_Make, "CED3011PV", TV_Device);
253 //  addControlledDevice(Sanyo_Make, "CEM6011PV", TV_Device);
254 //  addControlledDevice(Sanyo_Make, "DP32746", TV_Device);
255 }
256
257
258 void SanyoTV1a::populateProtocol(
259   QObject *guiObject)
260 {
261   if (threadableProtocol)
262   {
263     // If the pointer is not null, the keyset must already be populated.
264     return;
265   }
266
267   SanyoTV1::populateProtocol(guiObject);
268
269   addKey("-/--", DoubleDigit_Key, 0x0A, 8);
270   addKey("CS", Unmapped_Key, 0x0B, 8); // 2-
271   addKey("P+", ChannelUp_Key, 0x0C, 8);
272   addKey("UP", Up_Key, 0x0C, 8);
273   addKey("P-", ChannelDown_Key, 0x0D, 8);
274   addKey("DOWN", Down_Key, 0x0D, 8);
275   addKey("NORMAL", Unmapped_Key, 0x11, 8); // "SYMBOL_2"
276   addKey("MUTE", Mute_Key, 0x15, 8);
277   addKey("VOL+", VolumeUp_Key, 0x16, 8);
278   addKey("RIGHT", Right_Key, 0x16, 8);
279   addKey("VOL-", VolumeDown_Key, 0x17, 8);
280   addKey("LEFT", Left_Key, 0x17, 8);
281   addKey("OSD", Info_Key, 0x18, 8); // "SYMBOL_1
282   addKey("RECALL/TEXT_REVEAL", TeletextReveal_Key, 0x18, 8);
283   addKey("CLOCK", Sleep_Key, 0x19, 8); // "SLEEP/ON-TIMER/TEXT_CANCEL"
284   addKey("POWER", Power_Key, 0x1C, 8);
285   addKey("P--P", PrevChannel_Key, 0x1D, 8); // "ALTERNATE"
286   addKey("A-B", Unmapped_Key, 0x40, 8); //?
287   addKey("WIDE", Unmapped_Key, 0x43, 8);
288   addKey("TXT/TV", Teletext_Key, 0x46, 8); // teletext
289   addKey("Red", Red_Key, 0x49, 8);
290   addKey("Green", Green_Key, 0x4A, 8);
291   addKey("Yellow", Yellow_Key, 0x4B, 8);
292   addKey("Blue", Blue_Key, 0x4C, 8);
293   addKey("TEXT_HOLD", TeletextHold_Key, 0x4E, 8); // "SHRINK"
294   addKey("TEXT_INDEX-PAGE", TeletextIndex_Key, 0x51, 8);
295   addKey("TEXT_SIZE", TeletextSize_Key, 0x56, 8); // "EXPAND"
296   addKey("MENU", Menu_Key, 0x51, 8);
297 }
298
299
300 SanyoTV1b::SanyoTV1b(
301   unsigned int index)
302   : SanyoTV1(index)
303 {
304   setKeysetName("TV Keyset 1b");
305 }
306
307
308 void SanyoTV1b::populateProtocol(
309   QObject *guiObject)
310 {
311   if (threadableProtocol)
312   {
313     // If the pointer is not null, the keyset must already be populated.
314     return;
315   }
316
317   SanyoTV1::populateProtocol(guiObject);
318
319   addKey("image", PictureMode_Key, 0x11, 8);
320   addKey("TV", Unmapped_Key, 0x14, 8); // "tv/video"?
321   addKey("Enter", Select_Key, 0x1A, 8); // "F/OK"
322 }
323
324
325 SanyoTV1c::SanyoTV1c(
326   unsigned int index)
327   : SanyoTV1a(index)
328 {
329   setKeysetName("TV Keyset 1c");
330 }
331
332
333 void SanyoTV1c::populateProtocol(
334   QObject *guiObject)
335 {
336   if (threadableProtocol)
337   {
338     // If the pointer is not null, the keyset must already be populated.
339     return;
340   }
341
342   SanyoTV1a::populateProtocol(guiObject);
343
344   addKey("contrast_>", ContrastUp_Key, 0x0E, 8);
345   addKey("contrast_<", ContrastDown_Key, 0x0F, 8);
346   addKey("prg_scan", Scan_Key, 0x10, 8);
347   addKey("tuning_>", ChannelUp_Key, 0x12, 8);
348   addKey("tuning_<", ChannelDown_Key, 0x13, 8);
349   addKey("clear_screen", Unmapped_Key, 0x18, 8);
350   addKey("colour_>", ColorUp_Key, 0x1A, 8);
351   addKey("colour_<", ColorDown_Key, 0x1B, 8);
352   addKey("bright_>", BrightnessUp_Key, 0x1E, 8);
353   addKey("bright_<", BrightnessDown_Key, 0x1F, 8);
354 }
355
356
357 SanyoTV1d::SanyoTV1d(
358   unsigned int index)
359   : SanyoTV1(index)
360 {
361   setKeysetName("TV Keyset 1d");
362
363   addControlledDevice(Sanyo_Make, "CTP-6791P", TV_Device);
364 }
365
366
367 void SanyoTV1d::populateProtocol(
368   QObject *guiObject)
369 {
370   if (threadableProtocol)
371   {
372     // If the pointer is not null, the keyset must already be populated.
373     return;
374   }
375
376   SanyoTV1::populateProtocol(guiObject);
377
378   addKey("audio_mode", SoundMode_Key, 0x1C, 8); // "auto"
379   addKey("Digicon", PictureMode_Key, 0x1D, 8);
380   addKey("Menu +", Right_Key, 0x1E, 8);
381   addKey("Menu -", Left_Key, 0x1F, 8);
382 }
383
384
385 SanyoProjector::SanyoProjector(
386   unsigned int index)
387   : PIRKeysetMetaData(
388       "Projector Keyset 1",
389       Sanyo_Make,
390       index)
391 {
392   addControlledDevice(Sanyo_Make, "PLV-Z1", Other_Device);
393 }
394
395
396 void SanyoProjector::populateProtocol(
397   QObject *guiObject)
398 {
399   if (threadableProtocol)
400   {
401     // If the pointer is not null, the keyset must already be populated.
402     return;
403   }
404
405   threadableProtocol = new NECProtocol(guiObject, index, false, true);
406
407 //  setPreData(0x0CF3, 16);
408   setPreData(0x30, 16);
409
410   addKey("ONOFF0", Power_Key, 0x00, 8);
411   addKey("D.Zoom +", Unmapped_Key, 0x01, 8);
412   addKey("D.ZOOM -", Unmapped_Key, 0x02, 8);
413   addKey("INPUT", Input_Key, 0x05, 8);
414   addKey("VOLUME +", VolumeUp_Key, 0x09, 8);
415   addKey("VOLUME -", VolumeDown_Key, 0x0A, 8);
416   addKey("MUTE", Mute_Key, 0x0B, 8);
417   addKey("IMAGE", Unmapped_Key, 0x0C, 8);
418   addKey("SELECT", Select_Key, 0x0F, 8);
419   addKey("INFORMATION", Info_Key, 0x16, 8);
420   addKey("AUTO SET", Unmapped_Key, 0x17, 8);
421   addKey("LAMP CONTROL", Unmapped_Key, 0x18, 8);
422   addKey("MENU", Menu_Key, 0x1C, 8);
423   addKey("RIGHT", Right_Key, 0x1D, 8);
424   addKey("LEFT", Left_Key, 0x1E, 8);
425   addKey("HDMI", HDMIInput_Key, 0x37, 8);
426   addKey("COMPUTER 1", PCInput_Key, 0x38, 8);
427   addKey("COMPUTER 2", Unmapped_Key, 0x39, 8);
428   addKey("AUTO", Unmapped_Key, 0x3C, 8);
429   addKey("COMPOSITE", Unmapped_Key, 0x3D, 8); // "VIDEO"
430   addKey("S-VIDEO", Unmapped_Key, 0x3E, 8); // "S-VIDEO"
431   addKey("FREEZE", Pause_Key, 0x43, 8);
432   addKey("IMAGE_1", One_Key, 0x50, 8);
433   addKey("IMAGE_2", Two_Key, 0x51, 8);
434   addKey("IMAGE_3", Three_Key, 0x56, 8);
435   addKey("IMAGE_4", Four_Key, 0x57, 8);
436   addKey("KEYSTONE", Unmapped_Key, 0x5B, 8);
437   addKey("SCREEN", AspectRatio_Key, 0x82, 8); // "ASPECT"
438   addKey("COMPONENT", Unmapped_Key, 0x83, 8);
439   addKey("AUTO_PC_ADJ", Unmapped_Key, 0x89, 8);
440   addKey("P-TIMER", Unmapped_Key, 0x8A, 8);
441   addKey("NOSHOW", Unmapped_Key, 0x8B, 8); // "AV MUTE"
442   addKey("UP", Up_Key, 0x8C, 8);
443   addKey("DOWN", Down_Key, 0x8D, 8);
444   addKey("KEYSTONE_UP", Unmapped_Key, 0x8E, 8);
445   addKey("KEYSTONE_DOWN", Unmapped_Key, 0x8F, 8);
446 //  addKey("ONOFF1", Unmapped_Key, 0x0C73FF00, 32);
447 }
448