sensorfw
sensormanagerinterface.h
Go to the documentation of this file.
1 
28 #ifndef SENSORMANAGERINTERFACE_H
29 #define SENSORMANAGERINTERFACE_H
30 
31 #include "sensormanager_i.h"
32 #include "abstractsensor_i.h"
33 
34 typedef AbstractSensorChannelInterface* (*SensorInterfaceFactoryMethod)(const QString& id, int sessionId);
35 
38  QString type; // could be an integer to safe memory
39 };
40 
42 {
43  Q_OBJECT
44 
45 public:
47 
48  template<class SensorInterfaceType>
49  void registerSensorInterface(const QString& sensorName);
50 
51  AbstractSensorChannelInterface* interface(const QString& id);
52  bool releaseInterface(const QString& id, int sessionId);
53 
54  bool registeredAndCorrectClassName(const QString& id, const QString& className ) const;
55 
56 protected:
59 
60  QMap<QString, SensorInterfaceEntry> sensorInterfaceMap_;
61 
63 };
64 
65 template<class SensorInterfaceType>
66 void SensorManagerInterface::registerSensorInterface(const QString& sensorName)
67 {
68  sensorInterfaceMap_[sensorName].sensorInterfaceFactory = SensorInterfaceType::factoryMethod;
69  sensorInterfaceMap_[sensorName].type = SensorInterfaceType::staticMetaObject.className();
70 }
71 
72 #endif // SENSORMANAGERINTERFACE_H
static SensorManagerInterface * ifc_
SensorInterfaceFactoryMethod sensorInterfaceFactory
AbstractSensorChannelInterface *(* SensorInterfaceFactoryMethod)(const QString &id, int sessionId)
bool releaseInterface(const QString &id, int sessionId)
Base class for sensor interface.
Base-class for client facades of different sensor types.
static SensorManagerInterface & instance()
QMap< QString, SensorInterfaceEntry > sensorInterfaceMap_
Proxy class for interface for SensorManager.
AbstractSensorChannelInterface * interface(const QString &id)
bool registeredAndCorrectClassName(const QString &id, const QString &className) const
void registerSensorInterface(const QString &sensorName)
DBus interface to SensorManager instance.