equal
deleted
inserted
replaced
61 AbstractSensorChannelInterface* m_sensorInterface; |
61 AbstractSensorChannelInterface* m_sensorInterface; |
62 |
62 |
63 static const float GRAVITY_EARTH; |
63 static const float GRAVITY_EARTH; |
64 static const float GRAVITY_EARTH_THOUSANDTH; //for speed |
64 static const float GRAVITY_EARTH_THOUSANDTH; //for speed |
65 |
65 |
|
66 void setRanges(qreal correctionFactor); |
|
67 |
66 template<typename T> |
68 template<typename T> |
67 void initSensor(QString sensorName, bool &initDone) |
69 void initSensor(QString sensorName, bool &initDone) |
68 { |
70 { |
69 |
71 |
70 if (!initDone) { |
72 if (!initDone) { |
76 m_sensorInterface = const_cast<T*>(T::listenInterface(sensorName)); |
78 m_sensorInterface = const_cast<T*>(T::listenInterface(sensorName)); |
77 } |
79 } |
78 |
80 |
79 initDone = true; |
81 initDone = true; |
80 |
82 |
81 if (sensorName=="alssensor") return; // SensorFW returns lux values, plugin enumerated values |
|
82 |
|
83 |
83 |
84 //metadata |
84 //metadata |
85 int l = m_sensorInterface->getAvailableIntervals().size(); |
85 int l = m_sensorInterface->getAvailableIntervals().size(); |
86 for (int i=0; i<l; i++){ |
86 for (int i=0; i<l; i++){ |
87 qreal intervalMax = ((DataRange)(m_sensorInterface->getAvailableIntervals().at(i))).max; |
87 qreal intervalMax = ((DataRange)(m_sensorInterface->getAvailableIntervals().at(i))).max; |
92 qreal rateMax = 1/intervalMin * 1000; |
92 qreal rateMax = 1/intervalMin * 1000; |
93 // qreal rateMax = (intervalMin<1) ? rateMin : 1/intervalMin * 1000; // TODO: replace the two lines above with this one once sensord does provide interval>0 |
93 // qreal rateMax = (intervalMin<1) ? rateMin : 1/intervalMin * 1000; // TODO: replace the two lines above with this one once sensord does provide interval>0 |
94 addDataRate(rateMin, rateMax); |
94 addDataRate(rateMin, rateMax); |
95 } |
95 } |
96 |
96 |
97 l = m_sensorInterface->getAvailableDataRanges().size(); |
97 if (sensorName=="alssensor") return; // SensorFW returns lux values, plugin enumerated values |
98 |
98 |
99 for (int i=0; i<l; i++){ |
|
100 qreal rangeMin = ((DataRange)(m_sensorInterface->getAvailableDataRanges().at(i))).min; |
|
101 qreal rangeMax =((DataRange)(m_sensorInterface->getAvailableDataRanges().at(i))).max; |
|
102 qreal resolution = ((DataRange)(m_sensorInterface->getAvailableDataRanges().at(i))).min; |
|
103 addOutputRange(rangeMin, rangeMax, resolution); |
|
104 } |
|
105 setDescription(m_sensorInterface->property("description").toString()); |
99 setDescription(m_sensorInterface->property("description").toString()); |
|
100 |
|
101 if (sensorName=="accelerometersensor") return; // SensorFW returns milliGs, plugin m/s^2 |
|
102 if (sensorName=="magnetometersensor") return; // SensorFW returns nanoTeslas, plugin Teslas |
|
103 |
|
104 setRanges(1); |
106 }; |
105 }; |
107 |
106 |
108 private: |
107 private: |
109 static SensorManagerInterface* m_remoteSensorManager; |
108 static SensorManagerInterface* m_remoteSensorManager; |
110 |
109 |