Interim Update
[pierogi] / keysets / lg.cpp
index 0f9fbba..9a419a1 100644 (file)
@@ -4,14 +4,30 @@
 #include "protocols/rc5protocol.h"
 
 LGTV1::LGTV1(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "TV Keyset 1",
       LG_Make,
       index)
 {
-  threadableProtocol = new NECProtocol(guiObject, index, false, false);
+  addControlledDevice(LG_Make, "32LC56", TV_Device);
+  addControlledDevice(LG_Make, "32LH301C", TV_Device);
+  addControlledDevice(LG_Make, "50PS3000", TV_Device);
+  addControlledDevice(LG_Make, "FLATRON M227WDP", TV_Device);
+  addControlledDevice(LG_Make, "FLATRON M2280DF", TV_Device);
+}
+
+
+void LGTV1::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  threadableProtocol = new NECProtocol(guiObject, index, false, true);
 
 //  setPreData(0x20DF, 16);
   setPreData(0x04, 8);
@@ -115,11 +131,23 @@ LGTV1::LGTV1(
 
 
 LGTV1a::LGTV1a(
-  QObject *guiObject,
   unsigned int index)
-  : LGTV1(guiObject, index)
+  : LGTV1(index)
 {
   setKeysetName("TV Keyset 1a");
+}
+
+
+void LGTV1a::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  LGTV1::populateProtocol(guiObject);
 
   addKey("*", Unmapped_Key, 0x39, 8);
   addKey("exit", Exit_Key, 0x5B, 8);
@@ -136,11 +164,23 @@ LGTV1a::LGTV1a(
 
 
 LGTV1b::LGTV1b(
-  QObject *guiObject,
   unsigned int index)
-  : LGTV1(guiObject, index)
+  : LGTV1(index)
 {
   setKeysetName("TV Keyset 1b");
+}
+
+
+void LGTV1b::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  LGTV1::populateProtocol(guiObject);
 
   addKey("PR+/Up_Arrow", Up_Key, 0x00, 8);
   addKey("PR-/Down_Arrow", Down_Key, 0x01, 8);
@@ -154,15 +194,27 @@ LGTV1b::LGTV1b(
 
 
 LGTV1c::LGTV1c(
-  QObject *guiObject,
   unsigned int index)
-  : LGTV1(guiObject, index)
+  : LGTV1(index)
 {
   setKeysetName("TV Keyset 1c");
 
-  addControlledDevice(LG_Make, "60px950", TV_Device);
-  addControlledDevice(LG_Make, "60pg60", TV_Device);
-  addControlledDevice(LG_Make, "55lw9500", TV_Device);
+  addControlledDevice(LG_Make, "55LW9500", TV_Device);
+  addControlledDevice(LG_Make, "60PX950", TV_Device);
+  addControlledDevice(LG_Make, "60PG60", TV_Device);
+}
+
+
+void LGTV1c::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  LGTV1::populateProtocol(guiObject);
 
 //  addKey("Mark", Unmapped_Key, 0x1E, 8); // This is probably an error
 //  addKey("3DOption", Unmapped_Key, 0x45, 8); // also probably error
@@ -183,13 +235,24 @@ LGTV1c::LGTV1c(
 
 
 LGTV2::LGTV2(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "TV Keyset 2",
       LG_Make,
       index)
 {
+}
+
+
+void LGTV2::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
   threadableProtocol = new RC5Protocol(guiObject, index, 0x40);
 
   addKey("0", Zero_Key, 0x00, 6);
@@ -239,11 +302,23 @@ LGTV2::LGTV2(
 
 
 LGTV2a::LGTV2a(
-  QObject *guiObject,
   unsigned int index)
-  : LGTV2(guiObject, index)
+  : LGTV2(index)
 {
   setKeysetName("TV Keyset 2a");
+}
+
+
+void LGTV2a::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  LGTV2::populateProtocol(guiObject);
 
   addKey("KEY_YELLOW", Yellow_Key, 0x32, 6);
   addKey("KEY_BLUE", Blue_Key, 0x34, 6);
@@ -253,11 +328,23 @@ LGTV2a::LGTV2a(
 
 
 LGTV2b::LGTV2b(
-  QObject *guiObject,
   unsigned int index)
-  : LGTV2(guiObject, index)
+  : LGTV2(index)
 {
   setKeysetName("TV Keyset 2b");
+}
+
+
+void LGTV2b::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  LGTV2::populateProtocol(guiObject);
 
   addKey("sleep", Sleep_Key, 0x26, 6); // might need separate class
   addKey("Q.VIEW", Unmapped_Key, 0x32, 6);
@@ -268,13 +355,24 @@ LGTV2b::LGTV2b(
 
 
 LGDisc1::LGDisc1(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "DVD/BD Keyset 1",
       LG_Make,
       index)
 {
+}
+
+
+void LGDisc1::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
   threadableProtocol = new NECXProtocol(guiObject, index, true);
 
 //  setPreData(0x3434, 16);
@@ -344,13 +442,25 @@ LGDisc1::LGDisc1(
 
 
 LGDisc2::LGDisc2(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "DVD/BD Keyset 2",
       LG_Make,
       index)
 {
+  addControlledDevice(LG_Make, "DV552", DVD_Device);
+}
+
+
+void LGDisc2::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
   threadableProtocol = new NECXProtocol(guiObject, index, true);
 
 //  setPreData(0xB4B4, 16);
@@ -406,11 +516,23 @@ LGDisc2::LGDisc2(
 
 
 LGDisc2a::LGDisc2a(
-  QObject *guiObject,
   unsigned int index)
-  : LGDisc2(guiObject, index)
+  : LGDisc2(index)
 {
   setKeysetName("DVD/BD Keyset 2a");
+}
+
+
+void LGDisc2a::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  LGDisc2::populateProtocol(guiObject);
 
   addKey("KEY_HOME", Menu_Key, 0x67, 8);
   addKey("KEY_CLEAR", Clear_Key, 0x7C, 8);
@@ -422,13 +544,24 @@ LGDisc2a::LGDisc2a(
 
 
 LGVCR1::LGVCR1(
-  QObject *guiObject,
   unsigned int index)
   : PIRKeysetMetaData(
       "VCR Keyset 1",
       LG_Make,
       index)
 {
+}
+
+
+void LGVCR1::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
   threadableProtocol = new NECProtocol(guiObject, index, false, true);
 
 //  setPreData(0x7689, 16);
@@ -487,22 +620,46 @@ LGVCR1::LGVCR1(
 
 
 LGVCR1a::LGVCR1a(
-  QObject *guiObject,
   unsigned int index)
-  : LGVCR1(guiObject, index)
+  : LGVCR1(index)
 {
   setKeysetName("VCR Keyset 1a");
+}
+
+
+void LGVCR1a::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  LGVCR1::populateProtocol(guiObject);
 
   addKey("power", Power_Key, 0x7D, 8);
 }
 
 
 LGVCR1b::LGVCR1b(
-  QObject *guiObject,
   unsigned int index)
-  : LGVCR1(guiObject, index)
+  : LGVCR1(index)
 {
   setKeysetName("VCR Keyset 1b");
+}
+
+
+void LGVCR1b::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  LGVCR1::populateProtocol(guiObject);
 
   addKey("menu-up", Up_Key, 0x82, 8);
   addKey("menu-left", Left_Key, 0x83, 8);
@@ -511,3 +668,34 @@ LGVCR1b::LGVCR1b(
   addKey("menu-right", Right_Key, 0x90, 8);
 }
 
+
+LGAC1::LGAC1(
+  unsigned int index)
+  : PIRKeysetMetaData(
+      "Air Conditioner 1",
+      LG_Make,
+      index)
+{
+}
+
+
+void LGAC1::populateProtocol(
+  QObject *guiObject)
+{
+  if (threadableProtocol)
+  {
+    // If the pointer is not null, the keyset must already be populated.
+    return;
+  }
+
+  threadableProtocol = new NECProtocol(guiObject, index, true, true);
+
+  setPreData(0x6681, 16);
+
+  addKey("power", Power_Key, 0x81, 8);
+  addKey("temp up", TempUp_Key, 0x85, 8);
+  addKey("temp down", TempDown_Key, 0x8A, 8);
+  addKey("timer", Timer_Key, 0x90, 8);
+  addKey("fan speed", FanFaster_Key, 0x99, 8);
+  addKey("mode", Mode_Key, 0x9B, 8);
+}