author | mickeyl <mickeyl> | 2003-04-07 22:06:01 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-04-07 22:06:01 (UTC) |
commit | eee5531d24fdb17011debaa7acd42683330e55b6 (patch) (unidiff) | |
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) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 85 |
1 files changed, 69 insertions, 16 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 @@ | |||
23 | 23 | ||
24 | #ifdef QWS | 24 | #ifdef QWS |
25 | #include <opie/odevice.h> | 25 | #include <opie/odevice.h> |
26 | using namespace Opie; | 26 | using namespace Opie; |
27 | #endif | 27 | #endif |
28 | 28 | ||
29 | |||
30 | #ifdef QWS | ||
31 | #include <qpe/resource.h> | ||
32 | #else | ||
33 | #include "resource.h" | ||
34 | #endif | ||
35 | |||
36 | const int col_type = 0; | ||
37 | const int col_essid = 0; | ||
38 | const int col_sig = 1; | ||
39 | const int col_ap = 2; | ||
40 | const int col_channel = 3; | ||
41 | const int col_wep = 4; | ||
42 | const int col_traffic = 5; | ||
43 | const int col_manuf = 6; | ||
44 | const int col_firstseen = 7; | ||
45 | const int col_lastseen = 8; | ||
46 | |||
29 | MScanListView::MScanListView( QWidget* parent, const char* name ) | 47 | MScanListView::MScanListView( QWidget* parent, const char* name ) |
30 | :OListView( parent, name ), _manufacturerdb( 0 ) | 48 | :OListView( parent, name ), _manufacturerdb( 0 ) |
31 | { | 49 | { |
32 | 50 | ||
33 | setFrameShape( QListView::StyledPanel ); | 51 | setFrameShape( QListView::StyledPanel ); |
34 | setFrameShadow( QListView::Sunken ); | 52 | setFrameShadow( QListView::Sunken ); |
@@ -102,13 +120,13 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo | |||
102 | qDebug( "itemtext: %s", (const char*) item->text( 0 ) ); | 120 | qDebug( "itemtext: %s", (const char*) item->text( 0 ) ); |
103 | item = static_cast<MScanListItem*> ( item->itemBelow() ); | 121 | item = static_cast<MScanListItem*> ( item->itemBelow() ); |
104 | } | 122 | } |
105 | if ( item ) | 123 | if ( item ) |
106 | { | 124 | { |
107 | // animate the item | 125 | // animate the item |
108 | 126 | ||
109 | /* | 127 | /* |
110 | 128 | ||
111 | const QPixmap* pixmap = item->pixmap( 0 ); | 129 | const QPixmap* pixmap = item->pixmap( 0 ); |
112 | const QPixmap* nextpixmap = ani2; | 130 | const QPixmap* nextpixmap = ani2; |
113 | if ( pixmap == ani1 ) | 131 | if ( pixmap == ani1 ) |
114 | nextpixmap = ani2; | 132 | nextpixmap = ani2; |
@@ -170,28 +188,63 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo | |||
170 | { | 188 | { |
171 | s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel ); | 189 | s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel ); |
172 | } | 190 | } |
173 | 191 | ||
174 | } | 192 | } |
175 | 193 | ||
176 | #ifdef QWS | 194 | void MScanListView::traffic( QString type, QString from, QString to, QString via, QString additional ) |
177 | #include <qpe/resource.h> | 195 | { |
178 | #else | 196 | if ( type != "toDS" ) return; |
179 | #include "resource.h" | ||
180 | #endif | ||
181 | 197 | ||
182 | const int col_type = 0; | 198 | qDebug( "MScanList::traffic( [%s] | %s -> %s (via %s)", |
183 | const int col_essid = 0; | 199 | (const char*) type, (const char*) from, |
184 | const int col_sig = 1; | 200 | (const char*) to, (const char*) via ); |
185 | const int col_ap = 2; | 201 | |
186 | const int col_channel = 3; | 202 | QString s; |
187 | const int col_wep = 4; | 203 | MScanListItem* network; |
188 | const int col_traffic = 5; | 204 | |
189 | const int col_manuf = 6; | 205 | QListViewItemIterator it( this ); |
190 | const int col_firstseen = 7; | 206 | while ( it.current() && it.current()->text( col_ap ) != via ) ++it; |
191 | const int col_lastseen = 8; | 207 | |
208 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); | ||
209 | |||
210 | if ( item ) // AP has been shown up, so just add our new "from" - station | ||
211 | { | ||
212 | network = static_cast<MScanListItem*>( item->parent() ); | ||
213 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); | ||
214 | |||
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 | |||
221 | if ( subitem ) | ||
222 | { | ||
223 | // we have already seen this item, it's a dupe | ||
224 | #ifdef DEBUG | ||
225 | qDebug( "%s is a dupe - ignoring...", (const char*) from ); | ||
226 | #endif | ||
227 | subitem->receivedBeacon(); //FIXME: sent data bit | ||
228 | return; | ||
229 | } | ||
230 | |||
231 | // Hey, it seems to be a new item :-D | ||
232 | MScanListItem* station = new MScanListItem( item->parent(), "adhoc", /* network->text( col_essid ) */ "", from, false, -1, -1 ); | ||
233 | if ( _manufacturerdb ) | ||
234 | station->setManufacturer( _manufacturerdb->lookup( from ) ); | ||
235 | } | ||
236 | else | ||
237 | { | ||
238 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in alpha-4 version :-D" ); | ||
239 | } | ||
240 | } | ||
241 | |||
242 | //============================================================ | ||
243 | // MScanListItem | ||
244 | //============================================================ | ||
192 | 245 | ||
193 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, | 246 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, |
194 | bool wep, int channel, int signal ) | 247 | bool wep, int channel, int signal ) |
195 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), | 248 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), |
196 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), | 249 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), |
197 | _channel( channel ), _signal( signal ), _beacons( 1 ) | 250 | _channel( channel ), _signal( signal ), _beacons( 1 ) |