Torc  0.1
torci2cbus.h
Go to the documentation of this file.
1 #ifndef TORCI2CBUS_H
2 #define TORCI2CBUS_H
3 
4 // Qt
5 #include <QMap>
6 #include <QMutex>
7 #include <QVariant>
8 
9 // Torc
10 #include "torccentral.h"
11 
12 #define I2C QStringLiteral("i2c")
13 
15 {
16  public:
17  explicit TorcI2CDevice(int Address);
18  virtual ~TorcI2CDevice()= default;
19 
20  protected:
21  int m_address;
22  int m_fd;
23 
24  private:
25  Q_DISABLE_COPY(TorcI2CDevice)
26 };
27 
29 {
30  public:
32  virtual ~TorcI2CDeviceFactory() = default;
33 
34  static TorcI2CDeviceFactory* GetTorcI2CDeviceFactory (void);
35  TorcI2CDeviceFactory* NextFactory (void) const;
36  virtual TorcI2CDevice* Create (int Address, const QString &Name, const QVariantMap &Details) = 0;
37 
38  protected:
41 
42  private:
43  Q_DISABLE_COPY(TorcI2CDeviceFactory)
44 };
45 
47 {
48  public:
49  TorcI2CBus();
50 
52 
53  void Create (const QVariantMap &Details);
54  void Destroy (void);
55 
56  private:
57  QMap<int,TorcI2CDevice*> m_devices;
58 };
59 #endif // TORCI2CBUS_H
static TorcI2CDeviceFactory * gTorcI2CDeviceFactory
Definition: torci2cbus.h:39
static TorcI2CBus * gTorcI2CBus
Definition: torci2cbus.h:51
virtual ~TorcI2CDevice()=default
TorcI2CDevice(int Address)
Definition: torci2cbus.cpp:27
TorcI2CDeviceFactory * nextTorcI2CDeviceFactory
Definition: torci2cbus.h:40