summaryrefslogtreecommitdiff
path: root/noncore/applets/wirelessapplet/networkinfo.cpp
authormickeyl <mickeyl>2002-08-31 10:43:26 (UTC)
committer mickeyl <mickeyl>2002-08-31 10:43:26 (UTC)
commitcd33eed8d5eccebdc37dcd0e30d7917b91765222 (patch) (unidiff)
treecec3d088b58501bcc660686f468c4a968dc2d729 /noncore/applets/wirelessapplet/networkinfo.cpp
parent3b720187b21a3b9b3d17fc2b26489723febdaec2 (diff)
downloadopie-cd33eed8d5eccebdc37dcd0e30d7917b91765222.zip
opie-cd33eed8d5eccebdc37dcd0e30d7917b91765222.tar.gz
opie-cd33eed8d5eccebdc37dcd0e30d7917b91765222.tar.bz2
- debug output is now #ifdef'd
- wireless applet icon shows on demand (like cardmon - applet has an advanced configuration dialog - applet features experimental dhcp renew on change of essid/freq/ap/mode
Diffstat (limited to 'noncore/applets/wirelessapplet/networkinfo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/wirelessapplet/networkinfo.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/noncore/applets/wirelessapplet/networkinfo.cpp b/noncore/applets/wirelessapplet/networkinfo.cpp
index 22d7d83..8531fd5 100644
--- a/noncore/applets/wirelessapplet/networkinfo.cpp
+++ b/noncore/applets/wirelessapplet/networkinfo.cpp
@@ -51,6 +51,8 @@
51#define PROCNETDEV "/proc/net/dev" 51#define PROCNETDEV "/proc/net/dev"
52#define PROCNETWIRELESS "/proc/net/wireless" 52#define PROCNETWIRELESS "/proc/net/wireless"
53 53
54#define MDEBUG 0
55
54//--------------------------------------------------------------------------- 56//---------------------------------------------------------------------------
55// class MNetworkInterface 57// class MNetworkInterface
56// 58//
@@ -69,8 +71,9 @@ MNetworkInterface::~MNetworkInterface()
69 close( fd ); 71 close( fd );
70} 72}
71 73
72void MNetworkInterface::updateStatistics() 74bool MNetworkInterface::updateStatistics()
73{ 75{
76 return true;
74} 77}
75 78
76//--------------------------------------------------------------------------- 79//---------------------------------------------------------------------------
@@ -104,9 +107,11 @@ int MWirelessNetworkInterface::noisePercent()
104 return ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER; 107 return ( ( noise-IW_LOWER ) * 100 ) / IW_UPPER;
105} 108}
106 109
107void MWirelessNetworkInterface::updateStatistics() 110bool MWirelessNetworkInterface::updateStatistics()
108{ 111{
109 MNetworkInterface::updateStatistics(); 112 bool base = MNetworkInterface::updateStatistics();
113 if ( !base )
114 return false;
110 115
111 const char* buffer[200]; 116 const char* buffer[200];
112 117
@@ -181,21 +186,32 @@ void MWirelessNetworkInterface::updateStatistics()
181 } 186 }
182 if ( ( !hasFile ) || ( wstream.atEnd() ) ) 187 if ( ( !hasFile ) || ( wstream.atEnd() ) )
183 { 188 {
189#ifdef MDEBUG
184 qDebug( "WIFIAPPLET: D'oh! Someone removed the card..." ); 190 qDebug( "WIFIAPPLET: D'oh! Someone removed the card..." );
191#endif
185 quality = -1; 192 quality = -1;
186 signal = IW_LOWER; 193 signal = IW_LOWER;
187 noise = IW_LOWER; 194 noise = IW_LOWER;
188 return; 195 return false;
189 } 196 }
190 197
191 wstream >> name >> status >> quality >> c >> signal >> c >> noise; 198 wstream >> name >> status >> quality >> c >> signal >> c >> noise;
192 199
193 if ( quality > 92 ) 200 if ( quality > 92 )
201#ifdef MDEBUG
194 qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality ); 202 qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality );
203#endif
195 if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) ) 204 if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) )
205#ifdef MDEBUG
196 qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal ); 206 qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal );
207#endif
197 if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) ) 208 if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) )
209#ifdef MDEBUG
198 qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise ); 210 qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise );
211#endif
212
213 return true;
214
199} 215}
200 216
201//--------------------------------------------------------------------------- 217//---------------------------------------------------------------------------
@@ -204,13 +220,11 @@ void MWirelessNetworkInterface::updateStatistics()
204 220
205MNetwork::MNetwork() 221MNetwork::MNetwork()
206{ 222{
207 //qDebug( "MNetwork::MNetwork()" );
208 procfile = PROCNETDEV; 223 procfile = PROCNETDEV;
209} 224}
210 225
211MNetwork::~MNetwork() 226MNetwork::~MNetwork()
212{ 227{
213 //qDebug( "MNetwork::~MNetwork()" );
214} 228}
215 229
216//--------------------------------------------------------------------------- 230//---------------------------------------------------------------------------
@@ -219,13 +233,11 @@ MNetwork::~MNetwork()
219 233
220MWirelessNetwork::MWirelessNetwork() 234MWirelessNetwork::MWirelessNetwork()
221{ 235{
222 //qDebug( "MWirelessNetwork::MWirelessNetwork()" );
223 procfile = PROCNETWIRELESS; 236 procfile = PROCNETWIRELESS;
224} 237}
225 238
226MWirelessNetwork::~MWirelessNetwork() 239MWirelessNetwork::~MWirelessNetwork()
227{ 240{
228 //qDebug( "MWirelessNetwork::~MWirelessNetwork()" );
229} 241}
230 242
231MNetworkInterface* MWirelessNetwork::createInterface( const char* n ) const 243MNetworkInterface* MWirelessNetwork::createInterface( const char* n ) const
@@ -259,7 +271,9 @@ void MNetwork::enumerateInterfaces()
259 { 271 {
260 s >> str; 272 s >> str;
261 str.truncate( str.find( ':' ) ); 273 str.truncate( str.find( ':' ) );
274#ifdef MDEBUG
262 qDebug( "WIFIAPPLET: found interface '%s'", (const char*) str ); 275 qDebug( "WIFIAPPLET: found interface '%s'", (const char*) str );
276#endif
263 interfaces.insert( str, createInterface( str ) ); 277 interfaces.insert( str, createInterface( str ) );
264 s.readLine(); 278 s.readLine();
265 } 279 }