Advanced Settings Panel
[pierogi] / keysets / pioneer.cpp
index 30adfe1..d11aba8 100644 (file)
@@ -3,13 +3,24 @@
 #include "protocols/lircprotocol.h"
 
 PioneerTV1::PioneerTV1(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "TV Keyset 1",
       Pioneer_Make,
       index)
 {
+}
+
+
+void PioneerTV1::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
   threadableProtocol = new PioneerProtocol(guiObject, index);
 
   addNECKey("0", Zero_Key, 0xAA, 0x00);
@@ -70,13 +81,24 @@ PioneerTV1::PioneerTV1(
 
 
 PioneerTV2::PioneerTV2(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "TV (STB) Keyset 2",
       Pioneer_Make,
       index)
 {
+}
+
+
+void PioneerTV2::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
   threadableProtocol = new PioneerProtocol(guiObject, index);
 
   // I'm not sure this keyset even needs the "0xAA" keys at all...
@@ -130,13 +152,24 @@ PioneerTV2::PioneerTV2(
 
 
 PioneerTV3::PioneerTV3(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "TV (STB) Keyset 3",
       Pioneer_Make,
       index)
 {
+}
+
+
+void PioneerTV3::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
   threadableProtocol = new PioneerProtocol(guiObject, index);
 
   addNECKey("KEY_VOLUMEUP", VolumeUp_Key, 0xAA, 0x0A);
@@ -190,7 +223,6 @@ PioneerTV3::PioneerTV3(
 
 
 PioneerAudio1::PioneerAudio1(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "Audio Keyset 1",
@@ -201,6 +233,17 @@ PioneerAudio1::PioneerAudio1(
   addControlledDevice(Pioneer_Make, "Hi-Fi DU-L7", Audio_Device);
   addControlledDevice(Pioneer_Make, "CU-XR015", Audio_Device);
   addControlledDevice(Pioneer_Make, "A880", Audio_Device);
+}
+
+
+void PioneerAudio1::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
 
   threadableProtocol = new PioneerProtocol(guiObject, index);
 
@@ -252,7 +295,7 @@ PioneerAudio1::PioneerAudio1(
   addNECKey("12/CLR", Clear_Key, 0xA6, 0x41);
   addNECKey("cd", CDInput_Key, 0xA6, 0x44); // "CD_PLAY"
   addNECKey("scan", Scan_Key, 0xA6, 0x48);
-  addNECKey("FM/AM", TunerBand_Key, 0xA6, 0x49); // "BAND"
+  addNECKey("FM/AM", TunerInput_Key, 0xA6, 0x49); // "BAND"
   addNECKey("aux", AuxInput_Key, 0xA6, 0x4C);
   addNECKey("TAPE1_PLAY", Unmapped_Key, 0xA6, 0x5A);
   addNECKey("KARAOKE", Unmapped_Key, 0xA6, 0x69);
@@ -285,11 +328,23 @@ PioneerAudio1::PioneerAudio1(
 
 
 PioneerAudio1a::PioneerAudio1a(
-  QObject *guiObject,
   unsigned int index)
-  : PioneerAudio1(guiObject, index)
+  : PioneerAudio1(index)
 {
   setKeysetName("Audio Keyset 1a");
+}
+
+
+void PioneerAudio1a::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  PioneerAudio1::populateProtocol(guiObject);
 
   addNECKey("cd", CDInput_Key, 0xA6, 0x0E);
   addNECKey("tape", TapeInput_Key, 0xA6, 0x0F);
@@ -297,13 +352,24 @@ PioneerAudio1a::PioneerAudio1a(
 
 
 PioneerAudio2::PioneerAudio2(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "Audio Keyset 2",
       Pioneer_Make,
       index)
 {
+}
+
+
+void PioneerAudio2::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
   threadableProtocol = new PioneerProtocol(guiObject, index);
 
   addNECKey("VOL+", VolumeUp_Key, 0xA5, 0x0A);
@@ -354,7 +420,6 @@ PioneerAudio2::PioneerAudio2(
 
 
 PioneerAudio3::PioneerAudio3(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "Audio Keyset 3",
@@ -364,6 +429,17 @@ PioneerAudio3::PioneerAudio3(
   addControlledDevice(Pioneer_Make, "A-207R", Audio_Device);
   addControlledDevice(Pioneer_Make, "SX-302", Audio_Device);
   addControlledDevice(Pioneer_Make, "VSX-9300", Audio_Device);
+}
+
+
+void PioneerAudio3::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
 
   threadableProtocol = new PioneerProtocol(guiObject, index);
 
@@ -413,7 +489,8 @@ PioneerAudio3::PioneerAudio3(
   addNECKey("am", Unmapped_Key, 0xA4, 0x0E);
   addNECKey("tuner_station+", NextPreset_Key, 0xA4, 0x10);
   addNECKey("tuner_station-", PrevPreset_Key, 0xA4, 0x11);
-  addNECKey("tuner_band", TunerBand_Key, 0xA4, 0x13);
+  addNECKey("tuner_band", AM_Key, 0xA4, 0x13); // This is a hack
+  addNECKey("tuner_band", FM_Key, 0xA4, 0x13); // This too
   addNECKey("tuner_power", Unmapped_Key, 0xA4, 0x1C);
   addNECKey("mpx", Unmapped_Key, 0xA4, 0x1E); // Toggle mono FM
   addNECKey("tunerclass", Unmapped_Key, 0xA4, 0x40); // class A, B, C
@@ -508,13 +585,24 @@ PioneerAudio3::PioneerAudio3(
 
 
 PioneerAudio4::PioneerAudio4(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "Audio Keyset 4",
       Pioneer_Make,
       index)
 {
+}
+
+
+void PioneerAudio4::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
   threadableProtocol = new PioneerProtocol(guiObject, index);
 
   addNECKey("tapesel", Unmapped_Key, 0xA1, 0x4C);
@@ -544,7 +632,6 @@ PioneerAudio4::PioneerAudio4(
 
 
 PioneerAudio5::PioneerAudio5(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "Audio Keyset 5",
@@ -552,6 +639,17 @@ PioneerAudio5::PioneerAudio5(
       index)
 {
   addControlledDevice(Pioneer_Make, "XR-P240C", Audio_Device);
+}
+
+
+void PioneerAudio5::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
 
   LIRCProtocol *lp = new LIRCProtocol(
     guiObject,
@@ -571,7 +669,8 @@ PioneerAudio5::PioneerAudio5(
   addKey("POWER", Power_Key, 0x9867, 16);
   addKey("MONO", FMMode_Key, 0x48B7, 16);
   addKey("MEM_SCAN", Unmapped_Key, 0x8877, 16);
-  addKey("TUNER_BAND", TunerBand_Key, 0x18E7, 16);
+  addKey("TUNER_BAND", AM_Key, 0x18E7, 16);  // This is a hack
+  addKey("TUNER_BAND", FM_Key, 0x18E7, 16);  // This too
   addKey("1", One_Key, 0x00FF, 16);
   addKey("2", Two_Key, 0x807F, 16);
   addKey("3", Three_Key, 0x40BF, 16);
@@ -604,7 +703,6 @@ PioneerAudio5::PioneerAudio5(
 
 
 PioneerCD1::PioneerCD1(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "CD Keyset 1",
@@ -618,6 +716,17 @@ PioneerCD1::PioneerCD1(
   addControlledDevice(Pioneer_Make, "PD-M107", Audio_Device);
   addControlledDevice(Pioneer_Make, "PD-S503", Audio_Device);
   addControlledDevice(Pioneer_Make, "PD-F1007", Audio_Device);
+}
+
+
+void PioneerCD1::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
 
   threadableProtocol = new PioneerProtocol(guiObject, index);
 
@@ -697,7 +806,6 @@ PioneerCD1::PioneerCD1(
 
 
 PioneerLaserDisc1::PioneerLaserDisc1(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "LD Keyset 1",
@@ -705,6 +813,17 @@ PioneerLaserDisc1::PioneerLaserDisc1(
       index)
 {
   addControlledDevice(Pioneer_Make, "CLD-D925", Other_Device);
+}
+
+
+void PioneerLaserDisc1::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
 
   threadableProtocol = new PioneerProtocol(guiObject, index);
 
@@ -757,7 +876,6 @@ PioneerLaserDisc1::PioneerLaserDisc1(
 
 
 PioneerDVD1::PioneerDVD1(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "DVD Keyset 1",
@@ -766,6 +884,17 @@ PioneerDVD1::PioneerDVD1(
 {
   addControlledDevice(Pioneer_Make, "VXX2702", DVD_Device);
   addControlledDevice(Pioneer_Make, "VXX2801", DVD_Device);
+}
+
+
+void PioneerDVD1::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
 
   threadableProtocol = new PioneerProtocol(guiObject, index);
 
@@ -808,3 +937,60 @@ PioneerDVD1::PioneerDVD1(
   addPioneerKey("DOWN", Down_Key, 0xA3, 0x99, 0xAF, 0xF3);
   addPioneerKey("RETURN", Exit_Key, 0xA3, 0x99, 0xAF, 0xF4);
 }
+
+
+PioneerCarStereo1::PioneerCarStereo1(
+  unsigned int index)
+  : PIRKeysetMetaData(
+      "Car Stereo Keyset 1",
+      Pioneer_Make,
+      index)
+{
+}
+
+
+void PioneerCarStereo1::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // Keyset already populated.
+    return;
+  }
+
+  threadableProtocol = new PioneerProtocol(guiObject, index);
+
+  addNECKey("VOL+", VolumeUp_Key, 0xAD, 0x0A);
+  addNECKey("VOL-", VolumeDown_Key, 0xAD, 0x0B);
+  addNECKey("ATT", Mute_Key, 0xAD, 0x0C);
+  addNECKey("Audio", SoundMode_Key, 0xAD, 0x0D);
+  addNECKey("Band/Escape", FM_Key, 0xAD, 0x12);
+  addNECKey("Band/Escape", Exit_Key, 0xAD, 0x12);
+  addNECKey("Source", Input_Key, 0xAD, 0x1A);
+  addNECKey("Radio", TunerInput_Key, 0xAD, 0x1C);
+  addNECKey("CD/iPod", CDInput_Key, 0xAD, 0x1E);
+  addNECKey("Arrow Up", Up_Key, 0xAD, 0x40);
+  addNECKey("Arrow Down", Down_Key, 0xAD, 0x41);
+  addNECKey("Arrow Left", Left_Key, 0xAD, 0x42);
+  addNECKey("Arrow Right", Right_Key, 0xAD, 0x43);
+  addNECKey("Pause", Pause_Key, 0xAD, 0x58);
+
+  addPioneerKey("Entertainment", Unmapped_Key, 0xAD, 0x19, 0xAF, 0x2B);
+  addPioneerKey("List/Enter", Menu_Key, 0xAD, 0x19, 0xAF, 0x2C);
+  addPioneerKey("List/Enter", Select_Key, 0xAD, 0x19, 0xAF, 0x2C);
+  addPioneerKey("Function", Unmapped_Key, 0xAD, 0x19, 0xAF, 0x67);
+  addPioneerKey("PGM", Unmapped_Key, 0xAD, 0x19, 0xAF, 0x68);
+  addPioneerKey("Disp (Scroll)", Info_Key, 0xAD, 0x19, 0xAF, 0x6D);
+  addPioneerKey("Clear", Clear_Key, 0xAD, 0x19, 0xAF, 0xE0);
+  addPioneerKey("Direct", Unmapped_Key, 0xAD, 0x19, 0xAF, 0xE1);
+  addPioneerKey("0", Zero_Key, 0xAD, 0x19, 0xAF, 0xF0);
+  addPioneerKey("1", One_Key, 0xAD, 0x19, 0xAF, 0xF1);
+  addPioneerKey("2", Two_Key, 0xAD, 0x19, 0xAF, 0xF2);
+  addPioneerKey("3", Three_Key, 0xAD, 0x19, 0xAF, 0xF3);
+  addPioneerKey("4", Four_Key, 0xAD, 0x19, 0xAF, 0xF4);
+  addPioneerKey("5", Five_Key, 0xAD, 0x19, 0xAF, 0xF5);
+  addPioneerKey("6", Six_Key, 0xAD, 0x19, 0xAF, 0xF6);
+  addPioneerKey("7", Seven_Key, 0xAD, 0x19, 0xAF, 0xF7);
+  addPioneerKey("8", Eight_Key, 0xAD, 0x19, 0xAF, 0xF8);
+  addPioneerKey("9", Nine_Key, 0xAD, 0x19, 0xAF, 0xF9);
+}