Welcome to the first commit of the first version of my very first app.
[pierogi] / pirkeysetmetadata.h
1 #ifndef PIRKEYSETMETADATA_H
2 #define PIRKEYSETMETADATA_H
3
4 //#include <set>
5 #include <map>
6 #include <list>
7 //#include <string>
8
9 #include "pirkeynames.h"
10 #include "pirmakenames.h"
11
12 #include "pirprotocol.h"
13
14 typedef std::map<PIRKeyName, const char *> KeyCollection;
15
16 enum DeviceType
17 {
18   TV_Device,
19   VCR_Device,
20   DVD_Device,
21   Audio_Device,
22   Computer_Device
23 };
24
25 class DeviceInfo
26 {
27 public:
28   DeviceInfo(
29     PIRMakeName ma,
30     const char *mo,
31     DeviceType t)
32   : make(ma),
33     model(mo),
34     type(t)
35   {}
36
37   PIRMakeName make;
38   const char *model;
39   DeviceType type;
40 };
41
42 typedef std::list<DeviceInfo> DeviceCollection;
43
44 class PIRKeysetMetaData
45 {
46 public:
47   PIRKeysetMetaData(
48     const char *keysetName,
49     PIRMakeName make,
50     unsigned int index);
51
52   bool hasKey(
53     PIRKeyName name);
54
55   unsigned int getID();
56
57   PIRMakeName getMake();
58   const char *getKeysetName();
59
60   void moveProtocolToThread(
61     QThread &thread);
62
63 protected:
64   void addControlledDevice(
65     PIRMakeName make,
66     const char *model,
67     DeviceType type);
68
69   void addKey(
70     const char *name,
71     PIRKeyName key,
72     unsigned long data,
73     unsigned int bits);
74
75   KeyCollection keys;
76
77   DeviceCollection controlledDevices;
78
79   PIRProtocol *threadableProtocol;
80
81   void setKeysetName(
82     const char *name);
83
84 private:
85   const char *keysetName;
86   PIRMakeName make;
87
88   unsigned int id;
89 };
90
91
92 #endif // PIRKEYSETMETADATA_H