Search for Power Button Panel
[pierogi] / protocols / pirprotocol.cpp
index f1de67c..2203b4d 100644 (file)
@@ -12,9 +12,9 @@
 extern bool stopRepeatingFlag;
 extern QMutex stopRepeatingMutex;
 
-// Total of all running commands
-extern bool commandInFlight;
-extern QMutex commandIFMutex;
+// Check if a command is running:
+//extern bool commandInFlight;
+//extern QMutex commandIFMutex;
 
 // From what I understand (mostly from reading LIRC config files), NEC
 // protocol based remotes mostly use a frequency of 38000 units and a
@@ -185,6 +185,32 @@ void PIRProtocol::addNECKey(
 }
 
 
+void PIRProtocol::addPanOldKey(
+  PIRKeyName key,
+  unsigned int addressData,
+  unsigned int commandData)
+{
+  PIRKeyBits *pkb = 0;
+  KeycodeCollection::iterator i = keycodes.find(key);
+  if (i != keycodes.end())
+  {
+    pkb = &(i->second);
+    pkb->firstCode.clear();
+    pkb->secondCode.clear();
+    pkb->thirdCode.clear();
+    pkb->fourthCode.clear();
+  }
+  else
+  {
+    pkb = &(keycodes[key]);
+  }
+
+  // The "Old Panasonic" commands have 5 bits address, 6 bits command:
+  appendToBitSeq(pkb->firstCode, addressData, 5);
+  appendToBitSeq(pkb->secondCode, commandData, 6);
+}
+
+
 // Most Pioneer keys use the NEC key format, but some are pairs of
 // NEC keys sent together:
 void PIRProtocol::addPioneerKey(
@@ -266,6 +292,52 @@ void PIRProtocol::addKaseikyoKey(
 }
 
 
+void PIRProtocol::addDishKey(
+  PIRKeyName key,
+  unsigned int firstCommand,
+  unsigned int secondCommand)
+{
+  PIRKeyBits *pkb = 0;
+  KeycodeCollection::iterator i = keycodes.find(key);
+  if (i != keycodes.end())
+  {
+    pkb = &(i->second);
+    pkb->firstCode.clear();
+    pkb->secondCode.clear();
+  }
+  else
+  {
+    pkb = &(keycodes[key]);
+  }
+
+  appendToBitSeq(pkb->firstCode, firstCommand, 6);
+  appendToBitSeq(pkb->secondCode, secondCommand, 5);
+}
+
+
+void PIRProtocol::addXMPKey(
+  PIRKeyName key,
+  unsigned int firstCommand,
+  unsigned int secondCommand)
+{
+  PIRKeyBits *pkb = 0;
+  KeycodeCollection::iterator i = keycodes.find(key);
+  if (i != keycodes.end())
+  {
+    pkb = &(i->second);
+    pkb->firstCode.clear();
+    pkb->secondCode.clear();
+  }
+  else
+  {
+    pkb = &(keycodes[key]);
+  }
+
+  appendToBitSeq(pkb->firstCode, firstCommand, 8);
+  appendToBitSeq(pkb->secondCode, secondCommand, 8);
+}
+
+
 void PIRProtocol::setCarrierFrequency(
   unsigned int freq)
 {
@@ -424,3 +496,12 @@ void PIRProtocol::sleepUntilRepeat(
     throw PIRException(ss.str());
   }
 }
+
+
+void PIRProtocol::setGapSize(
+  int gapSize,
+  bool iclFlag)
+{
+  gap = gapSize;
+  isConstantLength = iclFlag;
+}