Advanced Settings Panel
[pierogi] / keysets / jvc.cpp
index 0e6a6e5..6b17505 100644 (file)
@@ -3,13 +3,24 @@
 #include "protocols/lircprotocol.h"
 
 JVCSat1::JVCSat1(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "Sat (Dish) Keyset 1",
       JVC_Make,
       index)
 {
+}
+
+
+void JVCSat1::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
   LIRCProtocol *lp = new LIRCProtocol(
    guiObject,
    index,
@@ -70,13 +81,24 @@ JVCSat1::JVCSat1(
 
 
 JVCSat2::JVCSat2(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "Sat (Dish) Keyset 2",
       JVC_Make,
       index)
 {
+}
+
+
+void JVCSat2::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
   LIRCProtocol *lp = new LIRCProtocol(
     guiObject,
     index,
@@ -136,13 +158,24 @@ JVCSat2::JVCSat2(
 
 
 JVCVCR1::JVCVCR1(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "VCR Keyset 1",
       JVC_Make,
       index)
 {
+}
+
+
+void JVCVCR1::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
   threadableProtocol = new JVCProtocol(guiObject, index);
 
 //  setPreData(0xC2, 8);
@@ -228,11 +261,23 @@ JVCVCR1::JVCVCR1(
 
 
 JVCVCR1a::JVCVCR1a(
-  QObject *guiObject,
   unsigned int index)
-  : JVCVCR1(guiObject, index)
+  : JVCVCR1(index)
 {
   setKeysetName("VCR Keyset 1a");
+}
+
+
+void JVCVCR1a::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  JVCVCR1::populateProtocol(guiObject);
 
   addKey("red", Red_Key, 0x07, 8);
   addKey("green", Green_Key, 0x51, 8);
@@ -246,57 +291,96 @@ JVCVCR1a::JVCVCR1a(
 
 // Setup keysets for use in B-mode:
 JVCVCRBmode1::JVCVCRBmode1(
-  QObject *guiObject,
   unsigned int index)
-  : JVCVCR1(guiObject, index)
+  : JVCVCR1(index)
 {
   setKeysetName("VCR (B Mode) keyset 1");
+}
+
+
+void JVCVCRBmode1::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  JVCVCR1::populateProtocol(guiObject);
 
   setPreData(0x53, 8);
 }
 
 
 JVCVCRBmode1a::JVCVCRBmode1a(
-  QObject *guiObject,
   unsigned int index)
-  : JVCVCR1a(guiObject, index)
+  : JVCVCR1a(index)
 {
   setKeysetName("VCR (B Mode) keyset 1a");
+}
+
+
+void JVCVCRBmode1a::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  JVCVCR1a::populateProtocol(guiObject);
 
   setPreData(0x53, 8);
 }
 
 
 JVCTV1::JVCTV1(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "TV Keyset 1",
       JVC_Make,
       index)
 {
+}
+
+
+void JVCTV1::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
   threadableProtocol = new JVCProtocol(guiObject, index);
 
   setPreData(0x03, 8);
 
-  addKey("main/sap", Audio_Key, 0x00, 8); // "I/II"
-  addKey("info", Info_Key, 0x04, 8); // "display"
-  addKey("return", Unmapped_Key, 0x05, 8);
+  addKey("main/sap", Audio_Key, 0x00, 8); // "I/II", "Stereo/SAP/Mono"
+  addKey("info", Info_Key, 0x04, 8); // "display", "OSD"
+  addKey("last", PrevChannel_Key, 0x05, 8); // "return"
   addKey("RESET", Reset_Key, 0x06, 8);
+  addKey("antenna/cable", Unmapped_Key, 0x0A, 8);
   addKey("BROADCAST", Unmapped_Key, 0x0B, 8); // "ant/cable"
-  addKey("video_status", Unmapped_Key, 0x0D, 8);
+  addKey("video_status", Unmapped_Key, 0x0D, 8); // "AV Status/Reset"
   addKey("cc", Captions_Key, 0x0E, 8);
   addKey("input_s", Unmapped_Key, 0x0F, 8);
 
+  addKey("tuner discrete", AntennaInput_Key, 0x10, 8);
+  addKey("Video in discrete", CompositeInput_Key, 0x11, 8);
   addKey("input_2", Unmapped_Key, 0x12, 8);
   addKey("TV/VCR", Input_Key, 0x13, 8); // "input"
   addKey("input_3", Unmapped_Key, 0x14, 8);
   addKey("Power", Power_Key, 0x17, 8);
   addKey("Prog-", ChannelDown_Key, 0x18, 8);
   addKey("Prog+", ChannelUp_Key, 0x19, 8);
-  addKey("LEVELUP", Unmapped_Key, 0x1A, 8);
-  addKey("LEVELDOWN", Unmapped_Key, 0x1B, 8);
+  addKey("Power Off", PowerOff_Key, 0x1A, 8); // "LEVELUP"
+//  addKey("LEVELDOWN", Unmapped_Key, 0x1B, 8);
   addKey("AUDIO", Mute_Key, 0x1C, 8); // "mute"
+  addKey("Power On", PowerOn_Key, 0x1D, 8);
   addKey("Vol+", VolumeUp_Key, 0x1E, 8);
   addKey("Vol-", VolumeDown_Key, 0x1F, 8);
 
@@ -318,10 +402,10 @@ JVCTV1::JVCTV1(
   addKey("con_up", ContrastUp_Key, 0x36, 8);
   addKey("con_down", ContrastDown_Key, 0x37, 8);
   addKey("FUNCTION", Unmapped_Key, 0x3B, 8);
-  addKey("RECALL", PrevChannel_Key, 0x3C, 8);
+  addKey("RECALL", Unmapped_Key, 0x3C, 8); // "recall choice"
   addKey("sound", Unmapped_Key, 0x42, 8); // "<>"
   addKey("VNR", NoiseReduction_Key, 0x45, 8);
-  addKey("right", Right_Key, 0x55, 8);
+  addKey("right", Right_Key, 0x5A, 8);
   addKey("left", Left_Key, 0x5B, 8);
   addKey("X", Clear_Key, 0x70, 8);
   addKey("Timer", Sleep_Key, 0x71, 8);
@@ -351,33 +435,69 @@ JVCTV1::JVCTV1(
 
 
 JVCTV1a::JVCTV1a(
-  QObject *guiObject,
   unsigned int index)
-  : JVCTV1(guiObject, index)
+  : JVCTV1(index)
 {
   setKeysetName("TV Keyset 1a");
+}
+
+
+void JVCTV1a::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  JVCTV1::populateProtocol(guiObject);
 
   addKey("+10", DoubleDigit_Key, 0x71, 8);
 }
 
 
 JVCTV1b::JVCTV1b(
-  QObject *guiObject,
   unsigned int index)
-  : JVCTV1(guiObject, index)
+  : JVCTV1(index)
 {
   setKeysetName("TV Keyset 1b");
+}
+
+
+void JVCTV1b::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  JVCTV1::populateProtocol(guiObject);
 
   addKey("sleep_timer", Sleep_Key, 0x03, 8);
 }
 
 
 JVCTV1c::JVCTV1c(
-  QObject *guiObject,
   unsigned int index)
-  : JVCTV1(guiObject, index)
+  : JVCTV1(index)
 {
   setKeysetName("TV Keyset 1c");
+}
+
+
+void JVCTV1c::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  JVCTV1::populateProtocol(guiObject);
 
   addKey("STOP", Stop_Key, 0x00, 8);
   addKey("REC", Record_Key, 0x04, 8);
@@ -390,11 +510,23 @@ JVCTV1c::JVCTV1c(
 
 // TVs where "volume" and "channel" keys are used to navigate menus:
 JVCTV1d::JVCTV1d(
-  QObject *guiObject,
   unsigned int index)
-  : JVCTV1(guiObject, index)
+  : JVCTV1(index)
 {
   setKeysetName("TV Keyset 1d");
+}
+
+
+void JVCTV1d::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  JVCTV1::populateProtocol(guiObject);
 
   addKey("down", Down_Key, 0x18, 8);
   addKey("up", Up_Key, 0x19, 8);
@@ -404,13 +536,24 @@ JVCTV1d::JVCTV1d(
 
 
 JVCDAT1::JVCDAT1(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "DAT Keyset 1",
       JVC_Make,
       index)
 {
+}
+
+
+void JVCDAT1::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
   threadableProtocol = new JVCProtocol(guiObject, index);
 
 //  setPreData(0xC9, 8);
@@ -451,13 +594,24 @@ JVCDAT1::JVCDAT1(
 
 
 JVCCarDeck1::JVCCarDeck1(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "Car Deck Keyset 1",
       JVC_Make,
       index)
 {
+}
+
+
+void JVCCarDeck1::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
   threadableProtocol = new JVCProtocol(guiObject, index);
 
 //  setPreData(0xF1, 8);
@@ -484,13 +638,25 @@ JVCCarDeck1::JVCCarDeck1(
 // together, they might as well all be a single command anyway...
 
 JVCAudio1::JVCAudio1(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "Audio Keyset 1",
       JVC_Make,
       index)
 {
+  addControlledDevice(JVC_Make, "RX-5062", Audio_Device);
+}
+
+
+void JVCAudio1::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
   threadableProtocol = new JVCProtocol(guiObject, index);
 
   addKey("SLEEP", Sleep_Key, 0x03A3, 16);
@@ -500,7 +666,7 @@ JVCAudio1::JVCAudio1(
   addKey("MD-AUX", AuxInput_Key, 0x3EA3, 16); // "TAPE-AUX"
   addKey("TAPE", TapeInput_Key, 0x3FA3, 16);
   addKey("FM-MODE", FMMode_Key, 0x5AA3, 16);
-  addKey("TUNER-BAND", TunerBand_Key, 0x5BA3, 16);
+  addKey("TUNER-BAND", TunerInput_Key, 0x5BA3, 16);
   addKey("AHB-PRO", Unmapped_Key, 0x75A3, 16);
   addKey("AUTO-PRESET", Unmapped_Key, 0x77A3, 16);
 
@@ -545,11 +711,23 @@ JVCAudio1::JVCAudio1(
 
 
 JVCAudio1a::JVCAudio1a(
-  QObject *guiObject,
   unsigned int index)
-  : JVCAudio1(guiObject, index)
+  : JVCAudio1(index)
 {
   setKeysetName("Audio Keyset 1a");
+}
+
+
+void JVCAudio1a::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  JVCAudio1::populateProtocol(guiObject);
 
   addKey("CD-PLAY-PAUSE", Play_Key, 0x3DA3, 16);
   addKey("MD-PLAY-PAUSE", Unmapped_Key, 0x30AF, 16);
@@ -557,11 +735,23 @@ JVCAudio1a::JVCAudio1a(
 
 
 JVCAudio1b::JVCAudio1b(
-  QObject *guiObject,
   unsigned int index)
-  : JVCAudio1(guiObject, index)
+  : JVCAudio1(index)
 {
   setKeysetName("Audio Keyset 1b");
+}
+
+
+void JVCAudio1b::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  JVCAudio1::populateProtocol(guiObject);
 
   addKey("VCR", VCRInput_Key, 0x2443, 16);
 
@@ -619,13 +809,24 @@ JVCAudio1b::JVCAudio1b(
 
 
 JVCAudio2::JVCAudio2(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "Audio Keyset 2",
       JVC_Make,
       index)
 {
+}
+
+
+void JVCAudio2::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
   threadableProtocol = new JVCProtocol(guiObject, index);
 
 //  setPreData(0xF9, 8);
@@ -635,7 +836,7 @@ JVCAudio2::JVCAudio2(
   addKey("vol+", VolumeUp_Key, 0x01, 8);
   addKey("vol-", VolumeDown_Key, 0x02, 8);
   addKey("ACTIVE_HYPER_BASS", EnhancedBass_Key, 0x04, 8); // "bass"
-  addKey("band", TunerBand_Key, 0x0B, 8);  // "TUNER_BAND"
+  addKey("band", TunerInput_Key, 0x0B, 8);  // "TUNER_BAND"
   addKey("aux", AuxInput_Key, 0x0D, 8);
 
   addKey("enter", Enter_Key, 0x11, 8);
@@ -710,13 +911,25 @@ JVCAudio2::JVCAudio2(
 
 
 JVCDVD1::JVCDVD1(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "DVD Keyset 1",
       JVC_Make,
       index)
 {
+  addControlledDevice(JVC_Make, "JVC XV-N5SL", DVD_Device);
+}
+
+
+void JVCDVD1::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
   threadableProtocol = new JVCProtocol(guiObject, index);
 
 //  setPreData(0xF7, 8);