-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 90 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.h | 10 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 28 |
3 files changed, 85 insertions, 43 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index a8cadd8..7733934 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp | |||
@@ -193,10 +193,32 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo | |||
193 | 193 | ||
194 | void MScanListView::traffic( QString type, QString from, QString to, QString via, QString additional ) | 194 | |
195 | void MScanListView::addIfNotExisting( MScanListItem* network, QString addr ) | ||
195 | { | 196 | { |
196 | if ( type != "toDS" ) return; | 197 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); |
198 | |||
199 | while ( subitem && ( subitem->text( col_ap ) != addr ) ) | ||
200 | { | ||
201 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); | ||
202 | subitem = static_cast<MScanListItem*> ( subitem->itemBelow() ); | ||
203 | } | ||
204 | |||
205 | if ( subitem ) | ||
206 | { | ||
207 | // we have already seen this item, it's a dupe | ||
208 | #ifdef DEBUG | ||
209 | qDebug( "%s is a dupe - ignoring...", (const char*) addr ); | ||
210 | #endif | ||
211 | subitem->receivedBeacon(); //FIXME: sent data bit | ||
212 | return; | ||
213 | } | ||
214 | |||
215 | // Hey, it seems to be a new item :-D | ||
216 | MScanListItem* station = new MScanListItem( network, "station", /* network->text( col_essid ) */ "", addr, false, -1, -1 ); | ||
217 | if ( _manufacturerdb ) | ||
218 | station->setManufacturer( _manufacturerdb->lookup( addr ) ); | ||
219 | } | ||
197 | 220 | ||
198 | qDebug( "MScanList::traffic( [%s] | %s -> %s (via %s)", | ||
199 | (const char*) type, (const char*) from, | ||
200 | (const char*) to, (const char*) via ); | ||
201 | 221 | ||
222 | void MScanListView::WDStraffic( QString from, QString to, QString viaFrom, QString viaTo ) | ||
223 | { | ||
202 | QString s; | 224 | QString s; |
@@ -205,3 +227,5 @@ void MScanListView::traffic( QString type, QString from, QString to, QString via | |||
205 | QListViewItemIterator it( this ); | 227 | QListViewItemIterator it( this ); |
206 | while ( it.current() && it.current()->text( col_ap ) != via ) ++it; | 228 | while ( it.current() && |
229 | it.current()->text( col_ap ) != viaFrom && | ||
230 | it.current()->text( col_ap ) != viaTo ) ++it; | ||
207 | 231 | ||
@@ -209,27 +233,27 @@ void MScanListView::traffic( QString type, QString from, QString to, QString via | |||
209 | 233 | ||
210 | if ( item ) // AP has been shown up, so just add our new "from" - station | 234 | if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations |
235 | { | ||
236 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from ); | ||
237 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to ); | ||
238 | } | ||
239 | else | ||
211 | { | 240 | { |
212 | network = static_cast<MScanListItem*>( item->parent() ); | 241 | qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" ); |
213 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); | 242 | } |
243 | } | ||
214 | 244 | ||
215 | while ( subitem && ( subitem->text( col_ap ) != from ) ) | ||
216 | { | ||
217 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); | ||
218 | subitem = static_cast<MScanListItem*> ( subitem->itemBelow() ); | ||
219 | } | ||
220 | 245 | ||
221 | if ( subitem ) | 246 | void MScanListView::toDStraffic( QString from, QString to, QString via ) |
222 | { | 247 | { |
223 | // we have already seen this item, it's a dupe | 248 | QString s; |
224 | #ifdef DEBUG | 249 | MScanListItem* network; |
225 | qDebug( "%s is a dupe - ignoring...", (const char*) from ); | 250 | |
226 | #endif | 251 | QListViewItemIterator it( this ); |
227 | subitem->receivedBeacon(); //FIXME: sent data bit | 252 | while ( it.current() && it.current()->text( col_ap ) != via ) ++it; |
228 | return; | 253 | |
229 | } | 254 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); |
230 | 255 | ||
231 | // Hey, it seems to be a new item :-D | 256 | if ( item ) // AP has shown up yet, so just add our new "from" - station |
232 | MScanListItem* station = new MScanListItem( item->parent(), "adhoc", /* network->text( col_essid ) */ "", from, false, -1, -1 ); | 257 | { |
233 | if ( _manufacturerdb ) | 258 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from ); |
234 | station->setManufacturer( _manufacturerdb->lookup( from ) ); | ||
235 | } | 259 | } |
@@ -237,3 +261,3 @@ void MScanListView::traffic( QString type, QString from, QString to, QString via | |||
237 | { | 261 | { |
238 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in alpha-4 version :-D" ); | 262 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); |
239 | } | 263 | } |
@@ -241,2 +265,12 @@ void MScanListView::traffic( QString type, QString from, QString to, QString via | |||
241 | 265 | ||
266 | void MScanListView::fromDStraffic( QString from, QString to, QString via ) | ||
267 | { | ||
268 | qWarning( "D'oh! Not yet implemented..." ); | ||
269 | } | ||
270 | |||
271 | void MScanListView::IBSStraffic( QString from, QString to, QString via ) | ||
272 | { | ||
273 | qWarning( "D'oh! Not yet implemented..." ); | ||
274 | } | ||
275 | |||
242 | //============================================================ | 276 | //============================================================ |
diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h index bed69f1..a14d426 100644 --- a/noncore/net/wellenreiter/gui/scanlist.h +++ b/noncore/net/wellenreiter/gui/scanlist.h | |||
@@ -25,2 +25,4 @@ class ManufacturerDB; | |||
25 | 25 | ||
26 | class MScanListItem; | ||
27 | |||
26 | class MScanListView: public OListView | 28 | class MScanListView: public OListView |
@@ -41,3 +43,9 @@ class MScanListView: public OListView | |||
41 | void addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); | 43 | void addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); |
42 | void traffic( QString type, QString from, QString to, QString via, QString additional = QString::null ); | 44 | void fromDStraffic( QString from, QString to, QString via ); // NYI |
45 | void toDStraffic( QString from, QString to, QString via ); | ||
46 | void WDStraffic( QString from, QString to, QString viaFrom, QString viaTo ); | ||
47 | void IBSStraffic( QString from, QString to, QString via ); // NYI | ||
48 | |||
49 | protected: | ||
50 | void addIfNotExisting( MScanListItem* parent, QString addr ); | ||
43 | 51 | ||
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 5ec9ee4..4b82c9a 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -182,5 +182,5 @@ void Wellenreiter::receivePacket(OPacket* p) | |||
182 | (const char*) wlan->macAddress2().toString(true) ); | 182 | (const char*) wlan->macAddress2().toString(true) ); |
183 | netView()->traffic( "fromDS", wlan->macAddress3().toString(), | 183 | netView()->fromDStraffic( wlan->macAddress3().toString(), |
184 | wlan->macAddress1().toString(), | 184 | wlan->macAddress1().toString(), |
185 | wlan->macAddress2().toString() ); | 185 | wlan->macAddress2().toString() ); |
186 | } | 186 | } |
@@ -193,5 +193,5 @@ void Wellenreiter::receivePacket(OPacket* p) | |||
193 | (const char*) wlan->macAddress1().toString(true) ); | 193 | (const char*) wlan->macAddress1().toString(true) ); |
194 | netView()->traffic( "toDS", wlan->macAddress2().toString(), | 194 | netView()->toDStraffic( wlan->macAddress2().toString(), |
195 | wlan->macAddress3().toString(), | 195 | wlan->macAddress3().toString(), |
196 | wlan->macAddress1().toString() ); | 196 | wlan->macAddress1().toString() ); |
197 | } | 197 | } |
@@ -200,3 +200,3 @@ void Wellenreiter::receivePacket(OPacket* p) | |||
200 | { | 200 | { |
201 | qDebug( "WSD(bridge) traffic: '%s' -> '%s' via '%s' and '%s'", | 201 | qDebug( "WDS(bridge) traffic: '%s' -> '%s' via '%s' and '%s'", |
202 | (const char*) wlan->macAddress4().toString(true), | 202 | (const char*) wlan->macAddress4().toString(true), |
@@ -205,6 +205,6 @@ void Wellenreiter::receivePacket(OPacket* p) | |||
205 | (const char*) wlan->macAddress2().toString(true) ); | 205 | (const char*) wlan->macAddress2().toString(true) ); |
206 | netView()->traffic( "WSD", wlan->macAddress4().toString(), | 206 | netView()->WDStraffic( wlan->macAddress4().toString(), |
207 | wlan->macAddress3().toString(), | 207 | wlan->macAddress3().toString(), |
208 | wlan->macAddress1().toString(), | 208 | wlan->macAddress1().toString(), |
209 | wlan->macAddress2().toString() ); | 209 | wlan->macAddress2().toString() ); |
210 | } | 210 | } |
@@ -216,5 +216,5 @@ void Wellenreiter::receivePacket(OPacket* p) | |||
216 | (const char*) wlan->macAddress3().toString(true) ); | 216 | (const char*) wlan->macAddress3().toString(true) ); |
217 | netView()->traffic( "IBSS", wlan->macAddress2().toString(), | 217 | netView()->IBSStraffic( wlan->macAddress2().toString(), |
218 | wlan->macAddress1().toString(), | 218 | wlan->macAddress1().toString(), |
219 | wlan->macAddress3().toString() ); | 219 | wlan->macAddress3().toString() ); |
220 | } | 220 | } |