superkaramba
sensor.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "sensor.h"
00011 Sensor::Sensor(int iMsec)
00012 {
00013 objList = new TQObjectList();
00014 objList->setAutoDelete( true );
00015 msec = iMsec;
00016 }
00017
00018 void Sensor::start()
00019 {
00020 if (!timer.isActive())
00021 {
00022 connect (&timer,TQT_SIGNAL(timeout()),this,TQT_SLOT(update()));
00023 timer.start( (msec == 0)?1000:msec);
00024 }
00025 }
00026
00027 Sensor::~Sensor()
00028 {
00029 objList->clear();
00030 delete objList;
00031 }
00032
00033 void Sensor::addMeter( SensorParams *sp )
00034 {
00035 objList->append(sp);
00036 }
00037
00038 SensorParams* Sensor::hasMeter( Meter *meter )
00039 {
00040 TQObjectListIt it( *objList );
00041 while ( it != 0 )
00042 {
00043 if (((SensorParams*) *it)->getMeter() == meter)
00044 {
00045 return (SensorParams*) *it;
00046 }
00047 ++it;
00048 }
00049 return NULL;
00050 }
00051
00052 void Sensor::deleteMeter( Meter *meter )
00053 {
00054 SensorParams* sp = hasMeter(meter);
00055
00056 if (sp)
00057 objList->removeRef(sp);
00058 }
00059
00060 void Sensor::setMaxValue( SensorParams* )
00061 {
00062 }
00063
00064 #include "sensor.moc"