Advanced Settings Panel
[pierogi] / keysets / jvc.cpp
index 1879e54..6b17505 100644 (file)
@@ -1,29 +1,39 @@
 #include "jvc.h"
-#include "jvcprotocol.h"
-#include "necprotocol.h"
+#include "protocols/jvcprotocol.h"
+#include "protocols/lircprotocol.h"
 
 JVCSat1::JVCSat1(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "Sat (Dish) Keyset 1",
       JVC_Make,
       index)
 {
-  NECProtocol *np = new NECProtocol(
+}
+
+
+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,
    624, 1500,
    624, 2600,
-   6000, false,
-   LIRC_NEC);
+   6000, false);
 
-  threadableProtocol = np;
+  threadableProtocol = lp;
 
-  np->setHeaderPair(750, 6000);
-  np->setTrailerPulse(624);
+  lp->setHeaderPair(750, 6000);
+  lp->setTrailerPulse(624);
 
-  np->setFullHeadlessRepeat(true);
+  lp->setFullHeadlessRepeat(true);
 
 //  np->setCarrierFrequency(56000);
 //  np->setDutyCycle(32);
@@ -71,31 +81,41 @@ JVCSat1::JVCSat1(
 
 
 JVCSat2::JVCSat2(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "Sat (Dish) Keyset 2",
       JVC_Make,
       index)
 {
-  NECProtocol *np = new NECProtocol(
+}
+
+
+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,
     440, 2780,
     440, 1645,
-    6115, false,
-    LIRC_NEC);
+    6115, false);
 
-  threadableProtocol = np;
+  threadableProtocol = lp;
 
-  np->setHeaderPair(525, 6045);
-  np->setTrailerPulse(450);
+  lp->setHeaderPair(525, 6045);
+  lp->setTrailerPulse(450);
 
-//  np->setMinimumRepetitions(6);
-  np->setFullHeadlessRepeat(true);
+//  lp->setMinimumRepetitions(6);
+  lp->setFullHeadlessRepeat(true);
 
-  np->setCarrierFrequency(56000);
-  np->setDutyCycle(32);
+  lp->setCarrierFrequency(56000);
+  lp->setDutyCycle(32);
 
   setPostData(0x000, 10);
 
@@ -138,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);
@@ -193,7 +224,7 @@ JVCVCR1::JVCVCR1(
 
   addKey("ch_set", Unmapped_Key, 0x66, 8);
   addKey("line", Unmapped_Key, 0x6E, 8);
-  addKey("mode", Unmapped_Key, 0x81, 8);
+  addKey("mode", Mode_Key, 0x81, 8);
   addKey("Red", Red_Key, 0x91, 8);
   addKey("INDEX1", Unmapped_Key, 0x93, 8);
   addKey("INDEX2", Unmapped_Key, 0x94, 8);
@@ -230,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);
@@ -248,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);
 
@@ -313,17 +395,17 @@ JVCTV1::JVCTV1(
   addKey("8", Eight_Key, 0x28, 8);
   addKey("9", Nine_Key, 0x29, 8);
 
-  addKey("br_up", Unmapped_Key, 0x30, 8);
-  addKey("br_down", Unmapped_Key, 0x31, 8);
-  addKey("col_up", Unmapped_Key, 0x32, 8);
-  addKey("col_down", Unmapped_Key, 0x33, 8);
-  addKey("con_up", Unmapped_Key, 0x36, 8);
-  addKey("con_down", Unmapped_Key, 0x37, 8);
+  addKey("br_up", BrightnessUp_Key, 0x30, 8);
+  addKey("br_down", BrightnessDown_Key, 0x31, 8);
+  addKey("col_up", ColorUp_Key, 0x32, 8);
+  addKey("col_down", ColorDown_Key, 0x33, 8);
+  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", Unmapped_Key, 0x45, 8);
-  addKey("right", Right_Key, 0x55, 8);
+  addKey("VNR", NoiseReduction_Key, 0x45, 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);
@@ -353,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);
@@ -392,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);
@@ -406,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);
@@ -428,7 +569,7 @@ JVCDAT1::JVCDAT1(
   addKey("INTRO", Unmapped_Key, 0x11, 8);
   addKey("MEMORY", Program_Key, 0x12, 8);
   addKey("DISPLAY", Info_Key, 0x14, 8);
-  addKey("CALL", Unmapped_Key, 0x15, 8);
+  addKey("CALL", Call_Key, 0x15, 8);
   addKey("SEARCH->>", Unmapped_Key, 0x16, 8);
   addKey("<<-SEARCH", Unmapped_Key, 0x17, 8);
   addKey("|<-SKIP", Previous_Key, 0x18, 8);
@@ -453,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);
@@ -486,23 +638,35 @@ 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);
   addKey("POWER", Power_Key, 0x17A3, 16);
   addKey("VOL+", VolumeUp_Key, 0x1EA3, 16);
   addKey("VOL-", VolumeDown_Key, 0x1FA3, 16);
-  addKey("MD-AUX", Unmapped_Key, 0x3EA3, 16); // "TAPE-AUX"
-  addKey("TAPE", Unmapped_Key, 0x3FA3, 16);
-  addKey("FM-MODE", Unmapped_Key, 0x5AA3, 16);
-  addKey("TUNER-BAND", TunerBand_Key, 0x5BA3, 16);
+  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", TunerInput_Key, 0x5BA3, 16);
   addKey("AHB-PRO", Unmapped_Key, 0x75A3, 16);
   addKey("AUTO-PRESET", Unmapped_Key, 0x77A3, 16);
 
@@ -547,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);
@@ -559,13 +735,25 @@ 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;
+  }
 
-  addKey("VCR", Unmapped_Key, 0x2443, 16);
+  JVCAudio1::populateProtocol(guiObject);
+
+  addKey("VCR", VCRInput_Key, 0x2443, 16);
 
   addKey("tape-stop", Unmapped_Key, 0x0383, 16); // "Deck.Stop"
   addKey("FORWARDS", Unmapped_Key, 0x0683, 16); // "Deck.Right"
@@ -582,7 +770,7 @@ JVCAudio1b::JVCAudio1b(
   addKey("RecPause", RecordPause_Key, 0xED83, 16);
 
   addKey("MONITOR/TAPE2", Unmapped_Key, 0x07A3, 16);
-  addKey("TUNER", Unmapped_Key, 0x0BA3, 16);
+  addKey("TUNER", TunerInput_Key, 0x0BA3, 16);
   addKey("tuner-", ChannelDown_Key, 0x18A3, 16);
   addKey("tuner+", ChannelUp_Key, 0x19A3, 16);
   addKey("FADE_MUTING", Unmapped_Key, 0x1CA3, 16);
@@ -599,7 +787,7 @@ JVCAudio1b::JVCAudio1b(
   addKey("Tuner 10", Unmapped_Key, 0x2AA3, 16);
   addKey("Tuner +10", Unmapped_Key, 0x2FA3, 16);
   addKey("SoundMode", SoundMode_Key, 0x38A3, 16);
-  addKey("PHONO", Unmapped_Key, 0x3CA3, 16);
+  addKey("PHONO", PhonoInput_Key, 0x3CA3, 16);
   addKey("cd-play", Play_Key, 0x3DA3, 16); // "CD"
 
   addKey("cd-stop", Stop_Key, 0x43B3, 16);
@@ -621,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);
@@ -636,9 +835,9 @@ JVCAudio2::JVCAudio2(
   addKey("power", Power_Key, 0x00, 8);
   addKey("vol+", VolumeUp_Key, 0x01, 8);
   addKey("vol-", VolumeDown_Key, 0x02, 8);
-  addKey("ACTIVE_HYPER_BASS", Unmapped_Key, 0x04, 8); // "bass"
-  addKey("band", TunerBand_Key, 0x0B, 8);  // "TUNER_BAND"
-  addKey("aux", Unmapped_Key, 0x0D, 8);
+  addKey("ACTIVE_HYPER_BASS", EnhancedBass_Key, 0x04, 8); // "bass"
+  addKey("band", TunerInput_Key, 0x0B, 8);  // "TUNER_BAND"
+  addKey("aux", AuxInput_Key, 0x0D, 8);
 
   addKey("enter", Enter_Key, 0x11, 8);
   addKey("PRESET_SCAN", Scan_Key, 0x12, 8);
@@ -649,7 +848,7 @@ JVCAudio2::JVCAudio2(
   addKey("right-select", Unmapped_Key, 0x18, 8);
   addKey("left-select", Unmapped_Key, 0x19, 8);
   addKey("display", Info_Key, 0x1C, 8); // "CLOCK"
-  addKey("auto_mono", Unmapped_Key, 0x1F, 8);  // "fmstereo", "mode"
+  addKey("auto_mono", FMMode_Key, 0x1F, 8);  // "fmstereo", "mode"
 
   addKey("1", One_Key, 0x21, 8);
   addKey("2", Two_Key, 0x22, 8);
@@ -693,13 +892,13 @@ JVCAudio2::JVCAudio2(
   addKey("repeat", Repeat_Key, 0x78, 8);
   addKey("open_close", Eject_Key, 0x7B, 8); // "allcdeject"
   addKey("continue", Unmapped_Key, 0x7D, 8);
-  addKey("call", Unmapped_Key, 0x7F, 8);
+  addKey("call", Call_Key, 0x7F, 8);
   addKey("FREQUENCY", Unmapped_Key, 0x80, 8);
   addKey("tone", Unmapped_Key, 0x86, 8);
-  addKey("bass+", Unmapped_Key, 0x87, 8);
-  addKey("bass-", Unmapped_Key, 0x88, 8);
-  addKey("treble+", Unmapped_Key, 0x89, 8);
-  addKey("treble-", Unmapped_Key, 0x8A, 8);
+  addKey("bass+", BassUp_Key, 0x87, 8);
+  addKey("bass-", BassDown_Key, 0x88, 8);
+  addKey("treble+", TrebleUp_Key, 0x89, 8);
+  addKey("treble-", TrebleDown_Key, 0x8A, 8);
   addKey("sound", Unmapped_Key, 0x8F, 8);
   addKey("beat-cut", Unmapped_Key, 0xEE, 8);
   addKey("playcd1", Unmapped_Key, 0xF1, 8);
@@ -712,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);