00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef KSG_SENSORCLIENT_H
00025 #define KSG_SENSORCLIENT_H
00026
00027 #include <tqptrlist.h>
00028 #include <tqstring.h>
00029
00030 namespace KSGRD {
00031
00038 class SensorClient
00039 {
00040 public:
00041 SensorClient() { }
00042 virtual ~SensorClient() { }
00043
00049 virtual void answerReceived( int, const TQString& ) { }
00050
00055 virtual void sensorLost( int ) { }
00056 };
00057
00062 class SensorBoard
00063 {
00064 public:
00065 SensorBoard() { }
00066 virtual ~SensorBoard() { }
00067
00068 void updateInterval( int interval ) { mUpdateInterval = interval; }
00069
00070 int updateInterval() { return mUpdateInterval; }
00071
00072 private:
00073 int mUpdateInterval;
00074 };
00075
00081 class SensorTokenizer
00082 {
00083 public:
00084 SensorTokenizer( const TQString &info, TQChar separator )
00085 {
00086 mTokens = TQStringList::split( separator, info );
00087 }
00088
00089 ~SensorTokenizer() { }
00090
00091 const TQString& operator[]( unsigned idx )
00092 {
00093 return mTokens[ idx ];
00094 }
00095
00096 uint count()
00097 {
00098 return mTokens.count();
00099 }
00100
00101 private:
00102 TQStringList mTokens;
00103 };
00104
00110 class SensorIntegerInfo : public SensorTokenizer
00111 {
00112 public:
00113 SensorIntegerInfo( const TQString &info )
00114 : SensorTokenizer( info, '\t' ) { }
00115
00116 ~SensorIntegerInfo() { }
00117
00118 const TQString &name()
00119 {
00120 return (*this)[ 0 ];
00121 }
00122
00123 long min()
00124 {
00125 return (*this)[ 1 ].toLong();
00126 }
00127
00128 long max()
00129 {
00130 return (*this)[ 2 ].toLong();
00131 }
00132
00133 const TQString &unit()
00134 {
00135 return (*this)[ 3 ];
00136 }
00137 };
00138
00144 class SensorFloatInfo : public SensorTokenizer
00145 {
00146 public:
00147 SensorFloatInfo( const TQString &info )
00148 : SensorTokenizer( info, '\t' ) { }
00149
00150 ~SensorFloatInfo() { }
00151
00152 const TQString &name()
00153 {
00154 return (*this)[ 0 ];
00155 }
00156
00157 double min()
00158 {
00159 return (*this)[ 1 ].toDouble();
00160 }
00161
00162 double max()
00163 {
00164 return (*this)[ 2 ].toDouble();
00165 }
00166
00167 const TQString &unit()
00168 {
00169 return (*this)[ 3 ];
00170 }
00171 };
00172
00178 class SensorPSLine : public SensorTokenizer
00179 {
00180 public:
00181 SensorPSLine( const TQString &line )
00182 : SensorTokenizer( line, '\t' ) { }
00183
00184 ~SensorPSLine() { }
00185
00186 const TQString& name()
00187 {
00188 return (*this)[ 0 ];
00189 }
00190
00191 long pid()
00192 {
00193 return (*this)[ 1 ].toLong();
00194 }
00195
00196 long ppid()
00197 {
00198 return (*this)[ 2 ].toLong();
00199 }
00200
00201 long uid()
00202 {
00203 return (*this)[ 3 ].toLong();
00204 }
00205 };
00206
00207 }
00208
00209 #endif