blob: d4ed46326e176887be2f84910ae7be260ba0fa78 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
 | /***************************************************************************
                          sensorslist.h  -  description
                             -------------------
    begin                : mié abr 24 2002
    copyright            : (C) 2002 by Miguel Novas
    email                : michaell@teleline.es
 ***************************************************************************/
/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
#ifndef SENSORSLIST_H
#define SENSORSLIST_H
#include <tqobject.h>
#include <tqobjectlist.h>
#include <tdeconfig.h>
#include <tqstringlist.h>
#include <sensor.h>
/**
  *@author Miguel Novas
  */
class SensorsList : public TQObject  {
TQ_OBJECT
  friend class Sensor;
public:
	SensorsList(TQObject *parent=0, const char *name=0);
	~SensorsList();
  void setMonitorized(bool enable);
  const TQString &getDescription()        { return description; };
  TQObjectList *getSensors()              { return (TQObjectList *)children(); };
  Sensor *getSensor(int index)           { return children() ? (Sensor *)((TQObjectList *)children())->at(index) : 0; }
  Sensor *getSensor(const char *name)    { return (Sensor *)child(name); }
  int count() 									         { return children() ? children()->count() : 0; }
  void setTempScale(Sensor::TempScale scale);
  Sensor::TempScale getTempScale()       { return tempScale; }
  void setUpdateInterval(int seconds);
  int  getUpdateInterval()               {  return updateInterval/1000; }
  Sensor::SensorClass getClass()         { return clas; };
public slots:
  virtual void updateSensors()= 0;
  virtual void readConfig();
  virtual void writeConfig();
signals:
  void valueChanged(Sensor *);
  void configChanged(const char *name);
protected slots:
  void slotConfigChanged();
  void slotValueChanged();
protected:
  void setDescription(const TQString &name) { description= name; };
  void setClass(Sensor::SensorClass newClass) { clas= newClass; }
  void childEvent ( TQChildEvent *e );
private:
  TQString description;
  Sensor::SensorClass clas;
  bool monitorized;
  int  updateInterval;
  TDEConfig *ksConfig;
  Sensor::TempScale tempScale;
  void timerEvent( TQTimerEvent * );
};
#endif
 |