Advanced Settings Panel
[pierogi] / pirkeysetmetadata.h
index bed34bb..09569f5 100644 (file)
@@ -1,36 +1,23 @@
 #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 "pirdevicetypenames.h"
 
-typedef std::map<PIRKeyName, const char *> KeyCollection;
+#include "pirdeviceinfo.h"
 
-class DeviceInfo
-{
-public:
-  DeviceInfo(
-    PIRMakeName ma,
-    const char *mo,
-    PIRDeviceTypeName t)
-  : make(ma),
-    model(mo),
-    type(t)
-  {}
+#include <map>
+//#include <list>
 
-  PIRMakeName make;
-  const char *model;
-  PIRDeviceTypeName type;
-};
+class QThread;
+class QObject;
+
+class PIRSelectDeviceForm;
+class PIRProtocol;
+
+typedef std::map<PIRKeyName, const char *> KeyCollection;
 
-typedef std::list<DeviceInfo> DeviceCollection;
 
 class PIRKeysetMetaData
 {
@@ -40,19 +27,37 @@ public:
     PIRMakeName make,
     unsigned int index);
 
+  ~PIRKeysetMetaData();
+
   bool hasKey(
-    PIRKeyName name);
+    PIRKeyName name) const;
+
+  unsigned int getID() const;
+
+  PIRMakeName getMake() const;
+
+  const char *getKeysetName() const;
+
+  unsigned int getCarrierFrequency() const;
 
-  unsigned int getID();
+  void setCarrierFrequency(
+    unsigned int carrierFrequency);
 
-  PIRMakeName getMake();
-  const char *getKeysetName();
+  unsigned int getDutyCycle() const;
 
-  void moveProtocolToThread(
-    QThread &thread);
+  void setDutyCycle(
+    unsigned int dutyCycle);
 
-  void populateDeviceTypes(
-    PIRKeysetWidgetItem *kwi);
+  virtual void populateProtocol(
+    QObject *guiObject) = 0;
+
+  bool clearProtocol();
+
+  void moveToThread(
+    QThread *thread);
+
+  static void populateDevices(
+    PIRSelectDeviceForm *sdf);
 
 protected:
   void addControlledDevice(
@@ -67,23 +72,102 @@ protected:
     const char *name,
     PIRKeyName key,
     unsigned long data,
-    unsigned int bits);
+    unsigned int size);
 
-  KeyCollection keys;
+  // 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);
 
-  DeviceCollection controlledDevices;
+  void addSIRC20Key(
+    const char *name,
+    PIRKeyName key,
+    unsigned int secondaryAddressData,
+    unsigned int primaryAddressData,
+    unsigned int commandData);
 
-  PIRProtocol *threadableProtocol;
+  // 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 addPanOldKey(
+    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 addXMPKey(
+    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;
+
+  PIRProtocol *threadableProtocol;
+  unsigned int index;
+
 private:
   const char *keysetName;
   PIRMakeName make;
-  PIRDeviceTypeCollection deviceTypes;
-
-  unsigned int id;
+  static PIRDeviceCollection controlledDevices;
+//  PIRDeviceTypeCollection deviceTypes;
 };