Memory Management Improved
[pierogi] / keysets / sharp.cpp
1 #include "sharp.h"
2 #include "protocols/sharpprotocol.h"
3 #include "protocols/necprotocol.h"
4
5 SharpTV1::SharpTV1(
6   unsigned int index)
7   : PIRKeysetMetaData(
8       "TV Keyset 1",
9       Sharp_Make,
10       index)
11 {
12 }
13
14
15 void SharpTV1::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 SharpProtocol(guiObject, index, true);
25
26   addSharpKey("1", One_Key, 0x01, 0x01);
27   addSharpKey("2", Two_Key, 0x01, 0x02);
28   addSharpKey("3", Three_Key, 0x01, 0x03);
29   addSharpKey("4", Four_Key, 0x01, 0x04);
30   addSharpKey("5", Five_Key, 0x01, 0x05);
31   addSharpKey("6", Six_Key, 0x01, 0x06);
32   addSharpKey("7", Seven_Key, 0x01, 0x07);
33   addSharpKey("8", Eight_Key, 0x01, 0x08);
34   addSharpKey("9", Nine_Key, 0x01, 0x09);
35   addSharpKey("0", Zero_Key, 0x01, 0x0A);
36   addSharpKey("100", PlusOneHundred_Key, 0x01, 0x0B);
37   addSharpKey("stereo", Unmapped_Key, 0x01, 0x0C); // "VpsPds"
38   addSharpKey("40+", Unmapped_Key, 0x01, 0x0F); // odd!
39
40   addSharpKey("NR", NoiseReduction_Key, 0x01, 0x10);
41   addSharpKey("CH_UP", ChannelUp_Key, 0x01, 0x11);
42   addSharpKey("CH_DOWN", ChannelDown_Key, 0x01, 0x12);
43   addSharpKey("TV/VIDEO", Input_Key, 0x01, 0x13);
44   addSharpKey("VOL_UP", VolumeUp_Key, 0x01, 0x14);
45   addSharpKey("VOL_DOWN", VolumeDown_Key, 0x01, 0x15);
46   addSharpKey("POWER", Power_Key, 0x01, 0x16);
47   addSharpKey("MUTE", Mute_Key, 0x01, 0x17); // "VOLUME_KILL"
48   addSharpKey("SOUND_MODE", Audio_Key, 0x01, 0x18); // I/II/I+II
49   addSharpKey("program_timer", Timer_Key, 0x01, 0x19); // "on_timer"
50   addSharpKey("TIMER", Sleep_Key, 0x01, 0x1A);
51   addSharpKey("INFO", Info_Key, 0x01, 0x1B); // "disp_del" "TEXT"
52   addSharpKey("TIME", TeletextTime_Key, 0x01, 0x1C);
53   addSharpKey("PROG", Program_Key, 0x01, 0x1D);
54
55   addSharpKey("PICTURE_NORMALIZE", Unmapped_Key, 0x01, 0x21);
56   addSharpKey("CONTRAST_UP", ContrastUp_Key, 0x01, 0x22);
57   addSharpKey("CONTRAST_DOWN", ContrastDown_Key, 0x01, 0x23);
58   addSharpKey("COLOR_UP", ColorUp_Key, 0x01, 0x24);
59   addSharpKey("COLOR_DOWN", ColorDown_Key, 0x01, 0x25);
60   addSharpKey("SOUND_NORMALIZE", Unmapped_Key, 0x01, 0x26);
61   addSharpKey("BRIGHTNESS_UP", BrightnessUp_Key, 0x01, 0x28);
62   addSharpKey("BRIGHTNESS_DOWN", BrightnessDown_Key, 0x01, 0x29);
63   addSharpKey("CH_SWAP", PrevChannel_Key, 0x01, 0x27); // "FLASHBACK", "ret"
64   addSharpKey("MONO", Unmapped_Key, 0x01, 0x2C);
65   addSharpKey("BROWSE", Unmapped_Key, 0x01, 0x2F);
66   addSharpKey("10+", Unmapped_Key, 0x01, 0x2F);
67
68   addSharpKey("20+", Unmapped_Key, 0x01, 0x30);
69   addSharpKey("30+", Unmapped_Key, 0x01, 0x31);
70   addSharpKey("PICTURE", Unmapped_Key, 0x01, 0x32);
71   addSharpKey("HOLD", TeletextHold_Key, 0x01, 0x33);
72   addSharpKey("TELETEXT", Teletext_Key, 0x01, 0x34);
73 //  addSharpKey("SINGLE_DOUBLE", DoubleDigit_Key, 0x01, 0x35);
74   addSharpKey("PROGRAM", Program_Key, 0x01, 0x36);
75   addSharpKey("TOP_BOTTOM_FULL", TeletextSize_Key, 0x01, 0x37);
76   addSharpKey("REVEAL", TeletextReveal_Key, 0x01, 0x38);
77   addSharpKey("message", Unmapped_Key, 0x01, 0x3B);
78   addSharpKey("./..", DoubleDigit_Key, 0x01, 0x3C);
79   addSharpKey("p/c", Unmapped_Key, 0x01, 0x3D);
80
81   addSharpKey("pr", Unmapped_Key, 0x01, 0x41);
82   addSharpKey("COLOR_RED", Red_Key, 0x01, 0x48);
83   addSharpKey("COLOR_GREEN", Green_Key, 0x01, 0x49);
84   addSharpKey("COLOR_YELLOW", Yellow_Key, 0x01, 0x4A);
85   addSharpKey("COLOR_BLUE", Blue_Key, 0x01, 0x4B);
86   addSharpKey("INDEX", TeletextIndex_Key, 0x01, 0x4C);
87   addSharpKey("MENU", Menu_Key, 0x01, 0x4D);
88   addSharpKey("LOCK", Unmapped_Key, 0x01, 0x51);
89   addSharpKey("RESET", Reset_Key, 0x01, 0x52);
90   addSharpKey("FUNCTIONS", Unmapped_Key, 0x01, 0x5F);
91
92   addSharpKey("PICTURE", PictureMode_Key, 0x01, 0x60);
93   addSharpKey("SOUND", SoundMode_Key, 0x01, 0x61);
94   addSharpKey("TREBLE_UP", TrebleUp_Key, 0x01, 0x62);
95   addSharpKey("TREBLE_DOWN", TrebleDown_Key, 0x01, 0x63);
96   addSharpKey("BASS_UP", BassUp_Key, 0x01, 0x64);
97   addSharpKey("BASS_DOWN", BassDown_Key, 0x01, 0x65);
98   addSharpKey("WOOFER_UP", Unmapped_Key, 0x01, 0x66);
99   addSharpKey("WOOFER_DOWN", Unmapped_Key, 0x01, 0x67);
100   addSharpKey("BALANCE_LEFT", BalanceLeft_Key, 0x01, 0x6B);
101   addSharpKey("BALANCE_RIGHT", BalanceRight_Key, 0x01, 0x6C);
102   addSharpKey("SURROUND", Surround_Key, 0x01, 0x6E);
103
104   addSharpKey("calendar", Unmapped_Key, 0x01, 0x76);
105   addSharpKey("language", Audio_Key, 0x01, 0x78);
106   addSharpKey("BT_END", Unmapped_Key, 0x01, 0xF5);
107   addSharpKey("AV_MODE", Unmapped_Key, 0x01, 0xF8);
108
109   addSharpKey("AV-", Unmapped_Key, 0x11, 0x73); // reverse-direction input 
110   addSharpKey("DTV", Unmapped_Key, 0x11, 0xA0);
111   addSharpKey("DTV_MENU", Unmapped_Key, 0x11, 0xA1);
112   addSharpKey("LIST", Unmapped_Key, 0x11, 0xA2);
113   addSharpKey("RADIO", Unmapped_Key, 0x11, 0xA4);
114   addSharpKey("ESG", Unmapped_Key, 0x11, 0xA7);
115   addSharpKey("WIDE_MODES", AspectRatio_Key, 0x11, 0xC8);
116   addSharpKey("TRUD", Unmapped_Key, 0x11, 0xDD);
117   addSharpKey("ACTION", Unmapped_Key, 0x11, 0xF9);
118
119   addSharpKey("BACKLIGHT", Unmapped_Key, 0x1E, 0x8B); // "OPC"
120   addSharpKey("ROTATE", Unmapped_Key, 0x1E, 0x8C);
121   addSharpKey("SUBTITLE", Captions_Key, 0x1E, 0x9F);
122   addSharpKey("SUBPAGE", Unmapped_Key, 0x1E, 0xCD);
123 }
124
125
126 SharpTV1a::SharpTV1a(
127   unsigned int index)
128   : SharpTV1(index)
129 {
130   setKeysetName("TV Keyset 1a");
131 }
132
133
134 void SharpTV1a::populateProtocol(
135   QObject *guiObject)
136 {
137   if (threadableProtocol)
138   {
139     // If the pointer is not null, the keyset must already be populated.
140     return;
141   }
142
143   SharpTV1::populateProtocol(guiObject);
144
145   addSharpKey("Key", Unmapped_Key, 0x01, 0x0D);
146   addSharpKey("Time", Sleep_Key, 0x01, 0x0E);
147   addSharpKey("Replay", Replay_Key, 0x01, 0x10);
148   addSharpKey("TapeSpeed", VHSSpeed_Key, 0x01, 0x1F);
149   addSharpKey("FF", FastForward_Key, 0x01, 0x21);
150   addSharpKey("Play", Play_Key, 0x01, 0x22);
151   addSharpKey("REW", Rewind_Key, 0x01, 0x23);
152   addSharpKey("Pause", Pause_Key, 0x01, 0x25);
153   addSharpKey("Stop", Stop_Key, 0x01, 0x27);
154   addSharpKey("REC", Record_Key, 0x01, 0x28);
155   addSharpKey("Slow", Slow_Key, 0x01, 0x29);
156   addSharpKey("DPSS+", Unmapped_Key, 0x01, 0x2F);
157
158   addSharpKey("DPSS-", Unmapped_Key, 0x01, 0x30);
159   addSharpKey("Input", Input_Key, 0x01, 0x34);
160   addSharpKey("ZeroBack", Unmapped_Key, 0x01, 0x83);
161   addSharpKey("SkipSearch", Advance_Key, 0x01, 0x90);
162 }
163
164
165 SharpTV1b::SharpTV1b(
166   unsigned int index)
167   : SharpTV1(index)
168 {
169   setKeysetName("TV Keyset 1b");
170 }
171
172
173 void SharpTV1b::populateProtocol(
174   QObject *guiObject)
175 {
176   if (threadableProtocol)
177   {
178     // If the pointer is not null, the keyset must already be populated.
179     return;
180   }
181
182   SharpTV1::populateProtocol(guiObject);
183
184   addSharpKey("FINE_TUNING", Unmapped_Key, 0x01, 0x0E);
185   addSharpKey("chScan", Scan_Key, 0x01, 0x1C);
186   addSharpKey("setup", Menu_Key, 0x01, 0x20);
187   addSharpKey("fback_clr", Unmapped_Key, 0x01, 0x2F);
188   addSharpKey("BLUE_BACK", Unmapped_Key, 0x01, 0x3B);
189   addSharpKey("SKIP", Unmapped_Key, 0x01, 0x47);
190   addSharpKey("video", Input_Key, 0x01, 0x49);
191   addSharpKey("plus", Up_Key, 0x01, 0x4F); // "UP"
192   addSharpKey("minus", Down_Key, 0x01, 0x50); // "DOWN"
193   addSharpKey("TIMER", Timer_Key, 0x01, 0x53);
194   addSharpKey("SYSTEM_SOUND", SoundMode_Key, 0x01, 0x6F);
195   addSharpKey("SYSTEM_COLOUR", PictureMode_Key, 0x01, 0x71);
196 }
197
198
199 SharpTV1c::SharpTV1c(
200   unsigned int index)
201   : SharpTV1(index)
202 {
203   setKeysetName("TV Keyset 1c");
204 }
205
206
207 void SharpTV1c::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   SharpTV1::populateProtocol(guiObject);
217
218   addSharpKey("save_ch", Unmapped_Key, 0x01, 0x41);
219   addSharpKey("del_ch", Unmapped_Key, 0x01, 0x3D);
220 }
221
222
223 SharpTV1d::SharpTV1d(
224   unsigned int index)
225   : SharpTV1(index)
226 {
227   setKeysetName("TV Keyset 1d");
228 }
229
230
231 void SharpTV1d::populateProtocol(
232   QObject *guiObject)
233 {
234   if (threadableProtocol)
235   {
236     // If the pointer is not null, the keyset must already be populated.
237     return;
238   }
239
240   SharpTV1::populateProtocol(guiObject);
241
242   addSharpKey("P-MODE", PictureMode_Key, 0x01, 0x4D);
243   addSharpKey("S-MODE", SoundMode_Key, 0x01, 0x26);
244 }
245
246
247 SharpTV1e::SharpTV1e(
248   unsigned int index)
249   : SharpTV1(index)
250 {
251   setKeysetName("TV Keyset 1e");
252 }
253
254
255 void SharpTV1e::populateProtocol(
256   QObject *guiObject)
257 {
258   if (threadableProtocol)
259   {
260     // If the pointer is not null, the keyset must already be populated.
261     return;
262   }
263
264   SharpTV1::populateProtocol(guiObject);
265
266   addSharpKey("DOWN", Down_Key, 0x01, 0x20);
267   addSharpKey("OK", Select_Key, 0x01, 0x52);
268   addSharpKey("UP", Up_Key, 0x01, 0x57);
269   addSharpKey("LEFT", Left_Key, 0x01, 0xD7);
270   addSharpKey("RIGHT", Right_Key, 0x01, 0xD8);
271   addSharpKey("RETURN", Exit_Key, 0x01, 0xE4);
272
273   addSharpKey("MENU", Menu_Key, 0x11, 0xC6);
274 }
275
276
277 SharpVCR1::SharpVCR1(
278   unsigned int index)
279   : PIRKeysetMetaData(
280       "VCR Keyset 1",
281       Sharp_Make,
282       index)
283 {
284 }
285
286
287 void SharpVCR1::populateProtocol(
288   QObject *guiObject)
289 {
290   if (threadableProtocol)
291   {
292     // If the pointer is not null, the keyset must already be populated.
293     return;
294   }
295
296   threadableProtocol = new SharpProtocol(guiObject, index, true);
297
298   addSharpKey("1", One_Key, 0x03, 0x01);
299   addSharpKey("2", Two_Key, 0x03, 0x02);
300   addSharpKey("3", Three_Key, 0x03, 0x03);
301   addSharpKey("4", Four_Key, 0x03, 0x04);
302   addSharpKey("5", Five_Key, 0x03, 0x05);
303   addSharpKey("6", Six_Key, 0x03, 0x06);
304   addSharpKey("7", Seven_Key, 0x03, 0x07);
305   addSharpKey("8", Eight_Key, 0x03, 0x08);
306   addSharpKey("9", Nine_Key, 0x03, 0x09);
307   addSharpKey("0", Zero_Key, 0x03, 0x0A);
308   addSharpKey("./..", DoubleDigit_Key, 0x03, 0x0B);
309   addSharpKey("Display", Info_Key, 0x03, 0x0C); // "vps"
310   addSharpKey("Key", Unmapped_Key, 0x03, 0x0D);  // "C-LOCK", "tamper_proof"
311   addSharpKey("TIME", Unmapped_Key, 0x03, 0x0E);
312   addSharpKey("REC_TIME", Unmapped_Key, 0x03, 0x0F); // "TIME-0"
313   addSharpKey("repeat", Repeat_Key, 0x03, 0x10);
314   addSharpKey("ChnUp", ChannelUp_Key, 0x03, 0x11);
315   addSharpKey("ChnDn", ChannelDown_Key, 0x03, 0x12);
316   addSharpKey("TV/VCR", Unmapped_Key, 0x03, 0x13);
317   addSharpKey("Power", Power_Key, 0x03, 0x16);
318   addSharpKey("MUTE", Mute_Key, 0x03, 0x17);
319   addSharpKey("AudioOut", Surround_Key, 0x03, 0x18);
320   addSharpKey("TimerOn/Off", Unmapped_Key, 0x03, 0x19);
321   addSharpKey("osp", Unmapped_Key, 0x03, 0x1C);
322   addSharpKey("PROG", Program_Key, 0x03, 0x1D);
323   addSharpKey("TapeSpeed", VHSSpeed_Key, 0x03, 0x1F);
324   addSharpKey("Clear", Clear_Key, 0x03, 0x20);
325   addSharpKey("FF", FastForward_Key, 0x03, 0x21);
326   addSharpKey("Play", Play_Key, 0x03, 0x22);
327   addSharpKey("Rew", Rewind_Key, 0x03, 0x23);
328   addSharpKey("F.ADV", StepForward_Key, 0x03, 0x24);
329   addSharpKey("Pause", Pause_Key, 0x03, 0x25);
330   addSharpKey("Stop", Stop_Key, 0x03, 0x27);
331   addSharpKey("Rec", Record_Key, 0x03, 0x28);
332   addSharpKey("Slow", Slow_Key, 0x03, 0x29);
333   addSharpKey("CLOCK", Clock_Key, 0x03, 0x2C);
334   addSharpKey("DPSS+", SlowPlus_Key, 0x03, 0x2F); // "slow+"
335   addSharpKey("DPSS-", SlowMinus_Key, 0x03, 0x30); // "slow-"
336   addSharpKey("x2", Unmapped_Key, 0x03, 0x31);
337   addSharpKey("EJECT", Eject_Key, 0x03, 0x33);
338   addSharpKey("InputSelect", Input_Key, 0x03, 0x34); // "simul"
339   addSharpKey("SEARCH", Unmapped_Key, 0x03, 0x37);
340   addSharpKey("ZeroBack", Unmapped_Key, 0x03, 0x83);  // "MEMORY"
341   addSharpKey("cancel", Unmapped_Key, 0x03, 0x84);  // could be exit key
342   addSharpKey("TRACKING_UP", TrackingPlus_Key, 0x03, 0x85);
343   addSharpKey("TRACKING_DOWN", TrackingMinus_Key, 0x03, 0x86);
344   addSharpKey("100", PlusOneHundred_Key, 0x03, 0x88);
345   addSharpKey("ModeOsd", Unmapped_Key, 0x03, 0x8D);
346   addSharpKey("SkipSearch", Unmapped_Key, 0x03, 0x90);
347   addSharpKey("Menu", Menu_Key, 0x03, 0x98);
348   addSharpKey("Up", Up_Key, 0x03, 0x99);
349   addSharpKey("Set", Select_Key, 0x03, 0x9A);
350   addSharpKey("Right", Right_Key, 0x03, 0x9B);
351   addSharpKey("Dn", Down_Key, 0x03, 0x9C);
352   addSharpKey("Left", Left_Key, 0x03, 0x9D);
353   addSharpKey("SHUTTLE+1", Unmapped_Key, 0x03, 0xA0);
354   addSharpKey("SHUTTLE+2", Unmapped_Key, 0x03, 0xA2);
355   addSharpKey("SHUTTLE+3", Unmapped_Key, 0x03, 0xA4);
356   addSharpKey("SHUTTLE+4", Unmapped_Key, 0x03, 0xA6);
357   addSharpKey("SHUTTLE+5", Unmapped_Key, 0x03, 0xA8);
358   addSharpKey("SHUTTLE-1", Unmapped_Key, 0x03, 0xA9);
359   addSharpKey("SHUTTLE+6", Unmapped_Key, 0x03, 0xAA);
360   addSharpKey("SHUTTLE-2", Unmapped_Key, 0x03, 0xAB);
361   addSharpKey("SHUTTLE0", Unmapped_Key, 0x03, 0xAE);
362   addSharpKey("SV/V+/Timer", Timer_Key, 0x03, 0xC0);
363 }
364
365
366 SharpReceiver1::SharpReceiver1(
367   unsigned int index)
368   : PIRKeysetMetaData(
369       "Receiver Keyset 1",
370       Sharp_Make,
371       index)
372 {
373 }
374
375
376 void SharpReceiver1::populateProtocol(
377   QObject *guiObject)
378 {
379   if (threadableProtocol)
380   {
381     // If the pointer is not null, the keyset must already be populated.
382     return;
383   }
384
385   threadableProtocol = new SharpProtocol(guiObject, index, true);
386
387   addSharpKey("PRESET+", ChannelUp_Key, 0x12, 0x11);
388   addSharpKey("PRESET-", ChannelDown_Key, 0x12, 0x12);
389   addSharpKey("VOL+", VolumeUp_Key, 0x12, 0x14);
390   addSharpKey("VOL-", VolumeDown_Key, 0x12, 0x15);
391   addSharpKey("POWER", Power_Key, 0x12, 0x16);
392   addSharpKey("TUNER", TunerInput_Key, 0x12, 0x19);
393   addSharpKey("TAPE", TapeInput_Key, 0x12, 0x1A);
394   addSharpKey("CD", CDInput_Key, 0x12, 0x1B);
395   addSharpKey("PHONO", PhonoInput_Key, 0x12, 0x1D);
396   addSharpKey("X-BASS", EnhancedBass_Key, 0x12, 0x2E);
397   addSharpKey("FM", Unmapped_Key, 0x12, 0x32);
398   addSharpKey("LW", Unmapped_Key, 0x12, 0x33);
399   addSharpKey("MW", Unmapped_Key, 0x12, 0x34);
400   addSharpKey("SW", Unmapped_Key, 0x12, 0xCA);
401
402   addSharpKey("1", One_Key, 0x14, 0x01);
403   addSharpKey("2", Two_Key, 0x14, 0x02);
404   addSharpKey("3", Three_Key, 0x14, 0x03);
405   addSharpKey("4", Four_Key, 0x14, 0x04);
406   addSharpKey("5", Five_Key, 0x14, 0x05);
407   addSharpKey("6", Six_Key, 0x14, 0x06);
408   addSharpKey("7", Seven_Key, 0x14, 0x07);
409   addSharpKey("8", Eight_Key, 0x14, 0x08);
410   addSharpKey("9", Nine_Key, 0x14, 0x09);
411   addSharpKey("0", Zero_Key, 0x14, 0x0A);
412   addSharpKey("CALL", Call_Key, 0x14, 0x11);
413   addSharpKey("CLEAR", Clear_Key, 0x14, 0x12);
414   addSharpKey("MEMORY", Program_Key, 0x14, 0x13);
415   addSharpKey("CUE", FastForward_Key, 0x14, 0x19);
416   addSharpKey("REVIEW", Rewind_Key, 0x14, 0x1A);
417   addSharpKey("TIME_DISPLAY", Info_Key, 0x14, 0x1B);
418   addSharpKey("RANDOM", Random_Key, 0x14, 0x1E);
419   addSharpKey("APSS+", Unmapped_Key, 0x14, 0x21);
420   addSharpKey("PLAY", Play_Key, 0x14, 0x22);
421   addSharpKey("APSS-", Unmapped_Key, 0x14, 0x23);
422   addSharpKey("PAUSE", Pause_Key, 0x14, 0x25);
423   addSharpKey("STOP", Stop_Key, 0x14, 0x27);
424   addSharpKey("REPEAT", Repeat_Key, 0x14, 0x36);
425   addSharpKey("+10", DoubleDigit_Key, 0x14, 0x38);
426 }
427
428
429 SharpAC1::SharpAC1(
430   unsigned int index)
431   : PIRKeysetMetaData(
432       "Air Conditioner 1",
433       Sharp_Make,
434       index)
435 {
436 }
437
438
439 void SharpAC1::populateProtocol(
440   QObject *guiObject)
441 {
442   if (threadableProtocol)
443   {
444     // If the pointer is not null, the keyset must already be populated.
445     return;
446   }
447
448   threadableProtocol = new NECProtocol(guiObject, index, false, true);
449
450   setPreData(0xF508, 16);
451
452   addKey("Fan Faster", VolumeUp_Key, 0x01, 8);
453   addKey("Energy Save", Green_Key, 0x02, 8);
454   addKey("Fan Slower", VolumeDown_Key, 0x04, 8);
455   addKey("Timer", Sleep_Key, 0x06, 8);
456   addKey("Fan", Yellow_Key, 0x07, 8);
457   addKey("Cool", Blue_Key, 0x09, 8);
458   addKey("Temp/Timer-", ChannelDown_Key, 0x0D, 8);
459   addKey("Temp/Timer+", ChannelUp_Key, 0x0E, 8);
460   addKey("Auto/Cool", Info_Key, 0x0F, 8);
461   addKey("power", Power_Key, 0x11, 8);
462 }