Several GUI fixes
[pierogi] / keysets / bose.cpp
1 #include "bose.h"
2 #include "protocols/boseprotocol.h"
3 #include "protocols/necprotocol.h"
4
5 BoseRadio1::BoseRadio1(
6   unsigned int index)
7   : PIRKeysetMetaData(
8       "Wave Radio Keyset 1",
9       Bose_Make,
10       index)
11 {
12 }
13
14
15 void BoseRadio1::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 BoseProtocol(guiObject, index);
25
26   addKey("Mute", Mute_Key, 0x01, 8);
27   addKey("Volume_Down", VolumeDown_Key, 0x02, 8);
28   addKey("Volume_Up", VolumeUp_Key, 0x03, 8);
29   addKey("FM_AM", TunerBand_Key, 0x06, 8);
30   addKey("1", One_Key, 0x07, 8);
31   addKey("2", Two_Key, 0x08, 8);
32   addKey("3", Three_Key, 0x09, 8);
33   addKey("4", Four_Key, 0x0A, 8);
34   addKey("5", Five_Key, 0x0B, 8);
35   addKey("6", Six_Key, 0x0C, 8);
36   addKey("AUX", AuxInput_Key, 0x0F, 8);
37
38   addKey("Seek_Track_Backward", Previous_Key, 0x18, 8);
39   addKey("Seek_Track_Forward", Next_Key, 0x19, 8);
40   addKey("Stop_Eject", Stop_Key, 0x1A, 8);
41   addKey("Stop_Eject", Eject_Key, 0x1A, 8);
42   addKey("Play_Pause", Play_Key, 0x1B, 8);
43   addKey("Play_Pause", Pause_Key, 0x1B, 8);
44   addKey("Play_Mode", Mode_Key, 0x21, 8);
45   addKey("Alarm_On_Off", Unmapped_Key, 0x22, 8);
46   addKey("Alarm_Time", Timer_Key, 0x23, 8);
47   addKey("Time_Plus", Unmapped_Key, 0x24, 8);
48
49   addKey("On_Off", Power_Key, 0x4C, 8);
50   addKey("CD", CDInput_Key, 0x53, 8);
51   addKey("Sleep", Sleep_Key, 0x54, 8);
52   addKey("Tune_MP3_Down", ChannelDown_Key, 0x57, 8);
53   addKey("Tune_MP3_Up", ChannelUp_Key, 0x58, 8);
54
55   addKey("Alarm_Wake_To", Unmapped_Key, 0x70, 8);
56   addKey("Time_Minus", Unmapped_Key, 0x9E, 8);
57 }
58
59
60 BoseRadio2::BoseRadio2(
61   unsigned int index)
62   : PIRKeysetMetaData(
63       "Wave Radio Keyset 2",
64       Bose_Make,
65       index)
66 {
67 }
68
69
70 void BoseRadio2::populateProtocol(
71   QObject *guiObject)
72 {
73   if (threadableProtocol)
74   {
75     // If the pointer is not null, the keyset must already be populated.
76     return;
77   }
78
79   threadableProtocol = new BoseProtocol(guiObject, index);
80
81   addKey("on/off", Power_Key, 0x00, 8);
82   addKey("4", Four_Key, 0x08, 8);
83   addKey("am", Red_Key, 0x10, 8); // sort of a hack to get AM in
84   addKey("6", Six_Key, 0x20, 8);
85   addKey("trackprev", Previous_Key, 0x30, 8);
86   addKey("trackprev", ChannelDown_Key, 0x30, 8);
87   addKey("volup", VolumeUp_Key, 0x40,8);
88   addKey("cdstop", Stop_Key, 0x50, 8);
89   addKey("fm", Green_Key, 0x60, 8); // also hack
90   addKey("2", Two_Key, 0x70, 8);
91   addKey("mute", Mute_Key, 0x80, 8);
92   addKey("5", Five_Key, 0x88, 8);
93   addKey("cdplaypause", Play_Key, 0x90, 8);
94   addKey("cdplaypause", Pause_Key, 0x90, 8);
95   addKey("sleep", Sleep_Key, 0xA0, 8);
96   addKey("1", One_Key, 0xB0, 8);
97   addKey("voldown", VolumeDown_Key, 0xC0, 8);
98   addKey("tracknext", Next_Key, 0xD0, 8);
99   addKey("tracknext", ChannelUp_Key, 0xD0, 8);
100   addKey("aux", AuxInput_Key, 0xE0, 8);
101   addKey("3", Three_Key, 0xF0, 8);
102 }
103
104
105 BoseRadio3::BoseRadio3(
106   unsigned int index)
107   : PIRKeysetMetaData(
108       "Wave Radio Keyset 3",
109       Bose_Make,
110       index)
111 {
112 }
113
114
115 void BoseRadio3::populateProtocol(
116   QObject *guiObject)
117 {
118   if (threadableProtocol)
119   {
120     // If the pointer is not null, the keyset must already be populated.
121     return;
122   }
123
124   threadableProtocol = new NECProtocol(guiObject, index, false, false);
125
126   setPreData(0xBA, 8);
127
128   addKey("MUTE", Mute_Key, 0x01, 8);
129   addKey("VOL-", VolumeDown_Key, 0x02, 8);
130   addKey("VOL+", VolumeUp_Key, 0x03, 8);
131   addKey("STATION", Unmapped_Key, 0x04, 8);
132   addKey("AM/FM", TunerBand_Key, 0x05, 8);
133   addKey("1", One_Key, 0x07, 8);
134   addKey("2", Two_Key, 0x08, 8);
135   addKey("3", Three_Key, 0x09, 8);
136   addKey("4", Four_Key, 0x0A, 8);
137   addKey("5", Five_Key, 0x0B, 8);
138   addKey("6", Six_Key, 0x0C, 8);
139   addKey("AUX", AuxInput_Key, 0x0F, 8);
140
141   addKey("TUNE+", ChannelUp_Key, 0x10, 8); // "Tune/Time+"
142   addKey("TUNE-", ChannelDown_Key, 0x11, 8); // "Tune/Time-"
143   addKey("ALARM/TIME", Timer_Key, 0x12, 8);
144   addKey("ALARM/WAKEUPTO", Unmapped_Key, 0x13, 8);
145
146   addKey("SLEEP", Sleep_Key, 0x1E, 8);
147
148   addKey("POWER", Power_Key, 0x4C, 8); // also "enter"?
149 }
150
151
152 BoseHomeTheater1::BoseHomeTheater1(
153   unsigned int index)
154   : PIRKeysetMetaData(
155       "Home Theater 1",
156       Bose_Make,
157       index)
158 {
159 }
160
161
162 void BoseHomeTheater1::populateProtocol(
163   QObject *guiObject)
164 {
165   if (threadableProtocol)
166   {
167     // If the pointer is not null, the keyset must already be populated.
168     return;
169   }
170
171   threadableProtocol = new NECProtocol(guiObject, index, true, false);
172
173   setPreData(0x4BBA, 16);
174
175   addKey("mute", Mute_Key, 0x01, 8);
176   addKey("vol down", VolumeDown_Key, 0x02, 8);
177   addKey("vol up", VolumeUp_Key, 0x03, 8);
178   addKey("AM", Unmapped_Key, 0x05, 8);
179   addKey("Video2", CableInput_Key, 0x0D, 8);
180   addKey("Video1", AntennaInput_Key, 0x0E, 8);
181   addKey("AUX", AuxInput_Key, 0x0F, 8);
182
183   addKey("channel down", ChannelDown_Key, 0x18, 8);
184   addKey("channel up", ChannelUp_Key, 0x19, 8);
185   addKey("stop", Stop_Key, 0x1A, 8);
186   addKey("down arrow", Down_Key, 0x20, 8);
187   addKey("pause", Pause_Key, 0x36, 8);
188
189   addKey("0", Zero_Key, 0x40, 8);
190   addKey("1", One_Key, 0x41, 8);
191   addKey("2", Two_Key, 0x42, 8);
192   addKey("3", Three_Key, 0x43, 8);
193   addKey("4", Four_Key, 0x44, 8);
194   addKey("5", Five_Key, 0x45, 8);
195   addKey("6", Six_Key, 0x46, 8);
196   addKey("7", Seven_Key, 0x47, 8);
197   addKey("8", Eight_Key, 0x48, 8);
198   addKey("9", Nine_Key, 0x49, 8);
199   addKey("power", Power_Key, 0x4C, 8);
200
201   addKey("CD/DVD", DVDInput_Key, 0x53, 8);
202   addKey("play", Play_Key, 0x55, 8);
203   addKey("rewind", Rewind_Key, 0x57, 8);
204   addKey("fast fwd", FastForward_Key, 0x58, 8);
205   addKey("FM", TunerBand_Key, 0x59, 8);
206
207   addKey("right arrow", Right_Key, 0x60, 8);
208   addKey("display/info", Info_Key, 0x80, 8);
209   addKey("menu", Menu_Key, 0x90, 8);
210   addKey("left arrow", Left_Key, 0xA0, 8);
211   addKey("up arrow", Up_Key, 0xC0, 8);
212   addKey("select", Select_Key, 0xE0, 8);
213 }