author | mickeyl <mickeyl> | 2003-04-07 22:06:01 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-04-07 22:06:01 (UTC) |
commit | eee5531d24fdb17011debaa7acd42683330e55b6 (patch) (side-by-side diff) | |
tree | 5e82bb5e7c39b1bdb1240eff47dbbe13adcf18cb /noncore/net/wellenreiter/gui/scanlist.cpp | |
parent | c32ffdaa4cac3cbe60d4bb6f72e0444a6f9e323f (diff) | |
download | opie-eee5531d24fdb17011debaa7acd42683330e55b6.zip opie-eee5531d24fdb17011debaa7acd42683330e55b6.tar.gz opie-eee5531d24fdb17011debaa7acd42683330e55b6.tar.bz2 |
New feature! Finally, non-AP stations in an infrastructure network show up.
Diffstat (limited to 'noncore/net/wellenreiter/gui/scanlist.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 81 |
1 files changed, 67 insertions, 14 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index 34c69f5..1525934 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp @@ -23,12 +23,30 @@ #ifdef QWS #include <opie/odevice.h> using namespace Opie; #endif + +#ifdef QWS +#include <qpe/resource.h> +#else +#include "resource.h" +#endif + +const int col_type = 0; +const int col_essid = 0; +const int col_sig = 1; +const int col_ap = 2; +const int col_channel = 3; +const int col_wep = 4; +const int col_traffic = 5; +const int col_manuf = 6; +const int col_firstseen = 7; +const int col_lastseen = 8; + MScanListView::MScanListView( QWidget* parent, const char* name ) :OListView( parent, name ), _manufacturerdb( 0 ) { setFrameShape( QListView::StyledPanel ); setFrameShadow( QListView::Sunken ); @@ -170,28 +188,63 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo { s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel ); } } -#ifdef QWS -#include <qpe/resource.h> -#else -#include "resource.h" +void MScanListView::traffic( QString type, QString from, QString to, QString via, QString additional ) +{ + if ( type != "toDS" ) return; + + qDebug( "MScanList::traffic( [%s] | %s -> %s (via %s)", + (const char*) type, (const char*) from, + (const char*) to, (const char*) via ); + + QString s; + MScanListItem* network; + + QListViewItemIterator it( this ); + while ( it.current() && it.current()->text( col_ap ) != via ) ++it; + + MScanListItem* item = static_cast<MScanListItem*>( it.current() ); + + if ( item ) // AP has been shown up, so just add our new "from" - station + { + network = static_cast<MScanListItem*>( item->parent() ); + MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); + + while ( subitem && ( subitem->text( col_ap ) != from ) ) + { + qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); + subitem = static_cast<MScanListItem*> ( subitem->itemBelow() ); + } + + if ( subitem ) + { + // we have already seen this item, it's a dupe + #ifdef DEBUG + qDebug( "%s is a dupe - ignoring...", (const char*) from ); #endif + subitem->receivedBeacon(); //FIXME: sent data bit + return; + } -const int col_type = 0; -const int col_essid = 0; -const int col_sig = 1; -const int col_ap = 2; -const int col_channel = 3; -const int col_wep = 4; -const int col_traffic = 5; -const int col_manuf = 6; -const int col_firstseen = 7; -const int col_lastseen = 8; + // Hey, it seems to be a new item :-D + MScanListItem* station = new MScanListItem( item->parent(), "adhoc", /* network->text( col_essid ) */ "", from, false, -1, -1 ); + if ( _manufacturerdb ) + station->setManufacturer( _manufacturerdb->lookup( from ) ); + } + else + { + qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in alpha-4 version :-D" ); + } +} + +//============================================================ +// MScanListItem +//============================================================ MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), _channel( channel ), _signal( signal ), _beacons( 1 ) |