Memory Management Improved
[pierogi] / keysets / westinghouse.cpp
1 #include "westinghouse.h"
2 #include "protocols/necprotocol.h"
3 #include "protocols/sircprotocol.h"
4
5 WestinghouseTV1::WestinghouseTV1(
6   unsigned int index)
7   : PIRKeysetMetaData(
8       "TV Keyset 1",
9       Westinghouse_Make,
10       index)
11 {
12 }
13
14
15 void WestinghouseTV1::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, false);
25
26 //  setPreData(0x807F, 16);
27   setPreData(0x01, 8);
28
29   addKey("INPUT", Input_Key, 0x00, 8);
30   addKey("KEY_POWER", Power_Key, 0x01, 8);
31   addKey("KEY_VOLUMEUP", VolumeUp_Key, 0x04, 8);
32   addKey("KEY_VOLUMEDOWN", VolumeDown_Key, 0x05, 8);
33   addKey("DVI", Unmapped_Key, 0x06, 8);
34   addKey("ASPECT_RATIO", AspectRatio_Key, 0x07, 8);
35   addKey("KEY_BACK", PrevChannel_Key, 0x08, 8);
36   addKey("VGA", PCInput_Key, 0x09, 8);
37   addKey("YPbPr", Unmapped_Key, 0x0A, 8);
38   addKey("AV", Unmapped_Key, 0x0B, 8);
39   addKey("S-Video", Unmapped_Key, 0x0C, 8);
40   addKey("KEY_MUTE", Mute_Key, 0x10, 8);
41   addKey("KEY_1", One_Key, 0x11, 8);
42   addKey("KEY_2", Two_Key, 0x12, 8);
43   addKey("KEY_3", Three_Key, 0x13, 8);
44   addKey("KEY_4", Four_Key, 0x14, 8);
45   addKey("KEY_5", Five_Key, 0x15, 8);
46   addKey("KEY_6", Six_Key, 0x16, 8);
47   addKey("KEY_7", Seven_Key, 0x17, 8);
48   addKey("KEY_8", Eight_Key, 0x18, 8);
49   addKey("KEY_9", Nine_Key, 0x19, 8);
50   addKey("KEY_0", Zero_Key, 0x1A, 8);
51   addKey("KEY_INFO", Info_Key, 0x1B, 8);
52   addKey("FREEZE", Pause_Key, 0x1C, 8);
53   addKey("KEY_UP", Up_Key, 0x40, 8);
54   addKey("KEY_LEFT", Left_Key, 0x41, 8);
55   addKey("KEY_ENTER", Enter_Key, 0x42, 8);
56   addKey("KEY_RIGHT", Right_Key, 0x43, 8);
57   addKey("KEY_DOWN", Down_Key, 0x44, 8);
58   addKey("KEY_MENU", Menu_Key, 0x46, 8);
59 }
60
61
62 WestinghouseTV2::WestinghouseTV2(
63   unsigned int index)
64   : PIRKeysetMetaData(
65       "TV Keyset 2",
66       Westinghouse_Make,
67       index)
68 {
69   addControlledDevice(Westinghouse_Make, "LVM-42W2", TV_Device);
70 }
71
72
73 void WestinghouseTV2::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 SIRCProtocol(guiObject, index);
83
84   addSIRC12Key("1", One_Key, 0x01, 0x00);
85   addSIRC12Key("2", Two_Key, 0x01, 0x01);
86   addSIRC12Key("3", Three_Key, 0x01, 0x02);
87   addSIRC12Key("4", Four_Key, 0x01, 0x03);
88   addSIRC12Key("5", Five_Key, 0x01, 0x04);
89   addSIRC12Key("6", Six_Key, 0x01, 0x05);
90   addSIRC12Key("7", Seven_Key, 0x01, 0x06);
91   addSIRC12Key("8", Eight_Key, 0x01, 0x07);
92   addSIRC12Key("9", Nine_Key, 0x01, 0x08);
93   addSIRC12Key("0", Zero_Key, 0x01, 0x09);
94   addSIRC12Key(".", Unmapped_Key, 0x01, 0x0A);
95   addSIRC12Key("EnterNumPad", Enter_Key, 0x01, 0x0B);
96   addSIRC12Key("CC", Captions_Key, 0x01, 0x0C);
97   addSIRC12Key("EPG", Guide_Key, 0x01, 0x0E);
98   addSIRC12Key("Ch+", ChannelUp_Key, 0x01, 0x10);
99   addSIRC12Key("Ch-", ChannelDown_Key, 0x01, 0x11);
100   addSIRC12Key("Vol+", VolumeUp_Key, 0x01, 0x12);
101   addSIRC12Key("Vol-", VolumeDown_Key, 0x01, 0x13);
102   addSIRC12Key("Mute", Mute_Key, 0x01, 0x14);
103   addSIRC12Key("Power", Power_Key, 0x01, 0x15);
104   addSIRC12Key("Backlight", Unmapped_Key, 0x01, 0x18);
105   addSIRC12Key("Zoom", Zoom_Key, 0x01, 0x1C);
106   addSIRC12Key("TV", Unmapped_Key, 0x01, 0x24);
107   addSIRC12Key("Input", Input_Key, 0x01, 0x25);
108   addSIRC12Key("Right", Right_Key, 0x01, 0x33);
109   addSIRC12Key("Left", Left_Key, 0x01, 0x34);
110   addSIRC12Key("Sleep", Sleep_Key, 0x01, 0x36);
111   addSIRC12Key("Retry", Unmapped_Key, 0x01, 0x3B);
112   addSIRC12Key("Info", Info_Key, 0x01, 0x3A);
113   addSIRC12Key("Video", Unmapped_Key, 0x01, 0x40);
114   addSIRC12Key("HDMI", HDMIInput_Key, 0x01, 0x42);
115   addSIRC12Key("PC", PCInput_Key, 0x01, 0x43);
116   addSIRC12Key("DVI", Unmapped_Key, 0x01, 0x44);
117   addSIRC12Key("YPbPr1", Unmapped_Key, 0x01, 0x48);
118   addSIRC12Key("YPbPr2", Unmapped_Key, 0x01, 0x49);
119   addSIRC12Key("SVideo", Unmapped_Key, 0x01, 0x4D);
120   addSIRC12Key("PIP", PIP_Key, 0x01, 0x5B);
121   addSIRC12Key("PIPSwap", PIPSwap_Key, 0x01, 0x5F);
122   addSIRC12Key("Menu", Menu_Key, 0x01, 0x60);
123   addSIRC12Key("EnterNavigation", Select_Key, 0x01, 0x65);
124   addSIRC12Key("A", Unmapped_Key, 0x01, 0x6A);
125   addSIRC12Key("B", Unmapped_Key, 0x01, 0x6B);
126   addSIRC12Key("C", Unmapped_Key, 0x01, 0x6C);
127   addSIRC12Key("Up", Up_Key, 0x01, 0x74);
128   addSIRC12Key("Down", Down_Key, 0x01, 0x75);
129 }