25 lines
543 B
C++
25 lines
543 B
C++
#include "sunsensor.h"
|
|
|
|
SunSensorSource::SunSensorSource(double lat, double lon, QObject *parent): QObject(parent), sun_(lat, lon)
|
|
{
|
|
connect(&timer, SIGNAL(timeout()), this, SLOT(doTick()));
|
|
}
|
|
|
|
void SunSensorSource::run()
|
|
{
|
|
connect(&timer, SIGNAL(timeout()), this, SLOT(doTick()));
|
|
timer.setInterval(10000); //10s
|
|
timer.start();
|
|
doTick();
|
|
}
|
|
|
|
|
|
void SunSensorSource::abort()
|
|
{
|
|
if(timer.isActive())timer.stop();
|
|
}
|
|
|
|
void SunSensorSource::doTick()
|
|
{
|
|
stateChanged(Sensor(Sensor::TYPE_SUN_ALTITUDE, 0, static_cast<float>(sun_.altitude())));
|
|
}
|