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