Memory Management Improved
[pierogi] / keysets / roku.cpp
1 #include "roku.h"
2 #include "protocols/necprotocol.h"
3
4 RokuBox1::RokuBox1(
5   unsigned int index)
6   : PIRKeysetMetaData(
7       "Settop Box Keyset 1",
8       Roku_Make,
9       index)
10 {
11 }
12
13
14 void RokuBox1::populateProtocol(
15   QObject *guiObject)
16 {
17   if (threadableProtocol)
18   {
19     // If the pointer is not null, the keyset must already be populated.
20     return;
21   }
22
23   threadableProtocol = new NECProtocol(guiObject, index, true, false);
24
25   setPreData(0xEFBE, 16);
26
27   addKey("Home", Menu_Key, 0x00, 8);
28   addKey("Up", Up_Key, 0x01, 8);
29   addKey("Back", Left_Key, 0x02, 8);
30   addKey("Select", Select_Key, 0x03, 8);
31   addKey("Forward", Right_Key, 0x04, 8);
32   addKey("Down", Down_Key, 0x05, 8);
33   addKey("FastRev", Rewind_Key, 0x06, 8);
34   addKey("Start/Pause", Play_Key, 0x07, 8);
35   addKey("Start/Pause", Pause_Key, 0x07, 8);
36   addKey("FastFWD", FastForward_Key, 0x08, 8);
37 }
38
39
40 RokuBox2::RokuBox2(
41   unsigned int index)
42   : PIRKeysetMetaData(
43       "Soundbridge Keyset 1",
44       Roku_Make,
45       index)
46 {
47 }
48
49
50 void RokuBox2::populateProtocol(
51   QObject *guiObject)
52 {
53   if (threadableProtocol)
54   {
55     // If the pointer is not null, the keyset must already be populated.
56     return;
57   }
58
59   threadableProtocol = new NECProtocol(guiObject, index, false, true);
60
61   setPreData(0x6F, 8);
62
63   addKey("left", Left_Key, 0x10, 8);
64   addKey("right", Right_Key, 0x11, 8);
65   addKey("up", Up_Key, 0x12, 8);
66   addKey("down", Down_Key, 0x13, 8);
67   addKey("select", Select_Key, 0x14, 8);
68   addKey("exit", Exit_Key, 0x15, 8);
69   addKey("power", Power_Key, 0x16, 8);
70   addKey("menu", Menu_Key, 0x17, 8);
71   addKey("search", Unmapped_Key, 0x18, 8);
72   addKey("play", Play_Key, 0x19, 8);
73   addKey("next", Next_Key, 0x1A, 8);
74   addKey("prev", Previous_Key, 0x1B, 8);
75   addKey("pause", Pause_Key, 0x1C, 8);
76   addKey("add", Unmapped_Key, 0x1D, 8);
77   addKey("shuffle", Random_Key, 0x1E, 8);
78   addKey("repeat", Repeat_Key, 0x1F, 8);
79
80   addKey("volume_up", VolumeUp_Key, 0x40, 8);
81   addKey("volume_down", VolumeDown_Key, 0x41, 8);
82   addKey("bright", Unmapped_Key, 0x42, 8);
83   addKey("power_on", PowerOn_Key, 0x43, 8);
84   addKey("power_off", PowerOff_Key, 0x44, 8);
85   addKey("user1", Unmapped_Key, 0x45, 8);
86   addKey("user2", Unmapped_Key, 0x46, 8);
87   addKey("user3", Unmapped_Key, 0x47, 8);
88   addKey("user4", Unmapped_Key, 0x48, 8);
89   addKey("user5", Unmapped_Key, 0x49, 8);
90   addKey("user6", Unmapped_Key, 0x4A, 8);
91 }