More Keysets
[pierogi] / pirkeysetmetadata.h
index bed34bb..c961b00 100644 (file)
@@ -1,15 +1,18 @@
 #ifndef PIRKEYSETMETADATA_H
 #define PIRKEYSETMETADATA_H
 
-#include <map>
-#include <list>
-//#include <string>
-
 #include "pirkeynames.h"
 #include "pirmakenames.h"
 #include "pirdevicetypenames.h"
-#include "pirkeysetwidgetitem.h"
-#include "pirprotocol.h"
+
+#include <map>
+#include <list>
+
+class QThread;
+class QObject;
+
+class PIRKeysetWidgetItem;
+class PIRProtocol;
 
 typedef std::map<PIRKeyName, const char *> KeyCollection;
 
@@ -41,18 +44,22 @@ public:
     unsigned int index);
 
   bool hasKey(
-    PIRKeyName name);
+    PIRKeyName name) const;
+
+  unsigned int getID() const;
+
+  PIRMakeName getMake() const;
 
-  unsigned int getID();
+  const char *getKeysetName() const;
 
-  PIRMakeName getMake();
-  const char *getKeysetName();
+  virtual void populateProtocol(
+    QObject *guiObject) = 0;
 
-  void moveProtocolToThread(
-    QThread &thread);
+  void moveToThread(
+    QThread *thread);
 
   void populateDeviceTypes(
-    PIRKeysetWidgetItem *kwi);
+    PIRKeysetWidgetItem *kwi) const;
 
 protected:
   void addControlledDevice(
@@ -67,23 +74,91 @@ protected:
     const char *name,
     PIRKeyName key,
     unsigned long data,
+    unsigned int size);
+
+  // Special helper methods for SIRC keys:
+  void addSIRC12Key(
+    const char *name,
+    PIRKeyName key,
+    unsigned int addressData,
+    unsigned int commandData);
+
+  void addSIRC15Key(
+    const char *name,
+    PIRKeyName key,
+    unsigned int addressData,
+    unsigned int commandData);
+
+  void addSIRC20Key(
+    const char *name,
+    PIRKeyName key,
+    unsigned int secondaryAddressData,
+    unsigned int primaryAddressData,
+    unsigned int commandData);
+
+  // Helper method for Sharp keys:
+  void addSharpKey(
+    const char *name,
+    PIRKeyName key,
+    unsigned int addressData,
+    unsigned int commandData);
+
+  void addNECKey(
+    const char *name,
+    PIRKeyName key,
+    unsigned int addressData,
+    unsigned int commandData);
+
+  void addPioneerKey(
+    const char *name,
+    PIRKeyName key,
+    unsigned int addressOne,
+    unsigned int commandOne,
+    unsigned int addressTwo,
+    unsigned int commandTwo);
+
+/*
+  void addRCAKey(
+    const char *name,
+    PIRKeyName key,
+    unsigned int addressData,
+    unsigned int commandData);
+*/
+
+  void addKaseikyoKey(
+    const char *name,
+    PIRKeyName key,
+    unsigned int addressData,
+    unsigned int commandData);
+
+  void addDishKey(
+    const char *name,
+    PIRKeyName key,
+    unsigned int firstCommand,
+    unsigned int secondCommand);
+
+  void setPreData(
+    unsigned long data,
+    unsigned int bits);
+
+  void setPostData(
+    unsigned long data,
     unsigned int bits);
 
+  void setKeysetName(
+    const char *name);
+
   KeyCollection keys;
 
   DeviceCollection controlledDevices;
 
   PIRProtocol *threadableProtocol;
-
-  void setKeysetName(
-    const char *name);
+  unsigned int index;
 
 private:
   const char *keysetName;
   PIRMakeName make;
   PIRDeviceTypeCollection deviceTypes;
-
-  unsigned int id;
 };