author | mickeyl <mickeyl> | 2003-05-02 23:32:16 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-05-02 23:32:16 (UTC) |
commit | 4aaa8efd13ad014280a6f1f05391c1ec464790db (patch) (unidiff) | |
tree | 4c9612dcd9897d8b2af48a731305e304dd523dc9 | |
parent | 5ca7f12dab929b21c133f785a3328c949df69401 (diff) | |
download | opie-4aaa8efd13ad014280a6f1f05391c1ec464790db.zip opie-4aaa8efd13ad014280a6f1f05391c1ec464790db.tar.gz opie-4aaa8efd13ad014280a6f1f05391c1ec464790db.tar.bz2 |
add parsing and interpretating of fromDS frames and getting pretty close to the 1.0 release
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 23 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.h | 2 |
2 files changed, 20 insertions, 5 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index b8aa81c..1cf49e0 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp | |||
@@ -153,122 +153,137 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo | |||
153 | 153 | ||
154 | 154 | ||
155 | // insert new station as child from network | 155 | // insert new station as child from network |
156 | 156 | ||
157 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? | 157 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? |
158 | 158 | ||
159 | qDebug( "inserting new station %s", (const char*) macaddr ); | 159 | qDebug( "inserting new station %s", (const char*) macaddr ); |
160 | 160 | ||
161 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); | 161 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); |
162 | if ( _manufacturerdb ) | 162 | if ( _manufacturerdb ) |
163 | station->setManufacturer( _manufacturerdb->lookup( macaddr ) ); | 163 | station->setManufacturer( _manufacturerdb->lookup( macaddr ) ); |
164 | 164 | ||
165 | if ( type == "managed" ) | 165 | if ( type == "managed" ) |
166 | { | 166 | { |
167 | s.sprintf( "(i) new AP in '%s' [%d]", (const char*) essid, channel ); | 167 | s.sprintf( "(i) new AP in '%s' [%d]", (const char*) essid, channel ); |
168 | } | 168 | } |
169 | else | 169 | else |
170 | { | 170 | { |
171 | s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel ); | 171 | s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel ); |
172 | } | 172 | } |
173 | 173 | ||
174 | } | 174 | } |
175 | 175 | ||
176 | 176 | ||
177 | void MScanListView::addIfNotExisting( MScanListItem* network, QString addr ) | 177 | void MScanListView::addIfNotExisting( MScanListItem* network, QString addr, const QString& type ) |
178 | { | 178 | { |
179 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); | 179 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); |
180 | 180 | ||
181 | while ( subitem && ( subitem->text( col_ap ) != addr ) ) | 181 | while ( subitem && ( subitem->text( col_ap ) != addr ) ) |
182 | { | 182 | { |
183 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); | 183 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); |
184 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); | 184 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); |
185 | } | 185 | } |
186 | 186 | ||
187 | if ( subitem ) | 187 | if ( subitem ) |
188 | { | 188 | { |
189 | // we have already seen this item, it's a dupe | 189 | // we have already seen this item, it's a dupe |
190 | #ifdef DEBUG | 190 | #ifdef DEBUG |
191 | qDebug( "%s is a dupe - ignoring...", (const char*) addr ); | 191 | qDebug( "%s is a dupe - ignoring...", (const char*) addr ); |
192 | #endif | 192 | #endif |
193 | subitem->receivedBeacon(); //FIXME: sent data bit | 193 | subitem->receivedBeacon(); //FIXME: sent data bit |
194 | return; | 194 | return; |
195 | } | 195 | } |
196 | 196 | ||
197 | // Hey, it seems to be a new item :-D | 197 | // Hey, it seems to be a new item :-D |
198 | MScanListItem* station = new MScanListItem( network, "station", /* network->text( col_essid ) */ "", addr, false, -1, -1 ); | 198 | MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr, false, -1, -1 ); |
199 | if ( _manufacturerdb ) | 199 | if ( _manufacturerdb ) |
200 | station->setManufacturer( _manufacturerdb->lookup( addr ) ); | 200 | station->setManufacturer( _manufacturerdb->lookup( addr ) ); |
201 | } | 201 | } |
202 | 202 | ||
203 | 203 | ||
204 | void MScanListView::WDStraffic( QString from, QString to, QString viaFrom, QString viaTo ) | 204 | void MScanListView::WDStraffic( QString from, QString to, QString viaFrom, QString viaTo ) |
205 | { | 205 | { |
206 | QString s; | 206 | QString s; |
207 | MScanListItem* network; | 207 | MScanListItem* network; |
208 | 208 | ||
209 | QListViewItemIterator it( this ); | 209 | QListViewItemIterator it( this ); |
210 | while ( it.current() && | 210 | while ( it.current() && |
211 | it.current()->text( col_ap ) != viaFrom && | 211 | it.current()->text( col_ap ) != viaFrom && |
212 | it.current()->text( col_ap ) != viaTo ) ++it; | 212 | it.current()->text( col_ap ) != viaTo ) ++it; |
213 | 213 | ||
214 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); | 214 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); |
215 | 215 | ||
216 | if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations | 216 | if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations |
217 | { | 217 | { |
218 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from ); | 218 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from ); |
219 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to ); | 219 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to ); |
220 | } | 220 | } |
221 | else | 221 | else |
222 | { | 222 | { |
223 | qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" ); | 223 | qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" ); |
224 | } | 224 | } |
225 | } | 225 | } |
226 | 226 | ||
227 | 227 | ||
228 | void MScanListView::toDStraffic( QString from, QString to, QString via ) | 228 | void MScanListView::toDStraffic( QString from, QString to, QString via ) |
229 | { | 229 | { |
230 | QString s; | 230 | QString s; |
231 | MScanListItem* network; | 231 | MScanListItem* network; |
232 | 232 | ||
233 | QListViewItemIterator it( this ); | 233 | QListViewItemIterator it( this ); |
234 | while ( it.current() && it.current()->text( col_ap ) != via ) ++it; | 234 | while ( it.current() && it.current()->text( col_ap ) != via ) ++it; |
235 | 235 | ||
236 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); | 236 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); |
237 | 237 | ||
238 | if ( item ) // AP has shown up yet, so just add our new "from" - station | 238 | if ( item ) // AP has shown up yet, so just add our new "from" - station |
239 | { | 239 | { |
240 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from ); | 240 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "adhoc" ); |
241 | } | 241 | } |
242 | else | 242 | else |
243 | { | 243 | { |
244 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); | 244 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); |
245 | } | 245 | } |
246 | } | 246 | } |
247 | 247 | ||
248 | void MScanListView::fromDStraffic( QString from, QString to, QString via ) | 248 | void MScanListView::fromDStraffic( QString from, QString to, QString via ) |
249 | { | 249 | { |
250 | qWarning( "D'oh! Not yet implemented..." ); | 250 | QString s; |
251 | MScanListItem* network; | ||
252 | |||
253 | QListViewItemIterator it( this ); | ||
254 | while ( it.current() && it.current()->text( col_ap ) != via ) ++it; | ||
255 | |||
256 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); | ||
257 | |||
258 | if ( item ) // AP has shown up yet, so just add our new "from" - station | ||
259 | { | ||
260 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "station" ); | ||
261 | } | ||
262 | else | ||
263 | { | ||
264 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); | ||
265 | } | ||
251 | } | 266 | } |
252 | 267 | ||
253 | void MScanListView::IBSStraffic( QString from, QString to, QString via ) | 268 | void MScanListView::IBSStraffic( QString from, QString to, QString via ) |
254 | { | 269 | { |
255 | qWarning( "D'oh! Not yet implemented..." ); | 270 | qWarning( "D'oh! Not yet implemented..." ); |
256 | } | 271 | } |
257 | 272 | ||
258 | //============================================================ | 273 | //============================================================ |
259 | // MScanListItem | 274 | // MScanListItem |
260 | //============================================================ | 275 | //============================================================ |
261 | 276 | ||
262 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, | 277 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, |
263 | bool wep, int channel, int signal ) | 278 | bool wep, int channel, int signal ) |
264 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), | 279 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), |
265 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), | 280 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), |
266 | _channel( channel ), _signal( signal ), _beacons( 1 ) | 281 | _channel( channel ), _signal( signal ), _beacons( 1 ) |
267 | { | 282 | { |
268 | qDebug( "creating scanlist item" ); | 283 | qDebug( "creating scanlist item" ); |
269 | if ( WellenreiterConfigWindow::instance() && type == "network" ) | 284 | if ( WellenreiterConfigWindow::instance() && type == "network" ) |
270 | playSound( WellenreiterConfigWindow::instance()->soundOnNetwork() ); | 285 | playSound( WellenreiterConfigWindow::instance()->soundOnNetwork() ); |
271 | decorateItem( type, essid, macaddr, wep, channel, signal ); | 286 | decorateItem( type, essid, macaddr, wep, channel, signal ); |
272 | } | 287 | } |
273 | 288 | ||
274 | MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, | 289 | MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, |
diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h index a14d426..56bf837 100644 --- a/noncore/net/wellenreiter/gui/scanlist.h +++ b/noncore/net/wellenreiter/gui/scanlist.h | |||
@@ -26,49 +26,49 @@ class ManufacturerDB; | |||
26 | class MScanListItem; | 26 | class MScanListItem; |
27 | 27 | ||
28 | class MScanListView: public OListView | 28 | class MScanListView: public OListView |
29 | { | 29 | { |
30 | Q_OBJECT | 30 | Q_OBJECT |
31 | 31 | ||
32 | public: | 32 | public: |
33 | MScanListView( QWidget* parent = 0, const char* name = 0 ); | 33 | MScanListView( QWidget* parent = 0, const char* name = 0 ); |
34 | virtual ~MScanListView(); | 34 | virtual ~MScanListView(); |
35 | 35 | ||
36 | void setManufacturerDB( ManufacturerDB* manufacturerdb ); | 36 | void setManufacturerDB( ManufacturerDB* manufacturerdb ); |
37 | 37 | ||
38 | virtual OListViewItem* childFactory(); | 38 | virtual OListViewItem* childFactory(); |
39 | virtual void serializeTo( QDataStream& s ) const; | 39 | virtual void serializeTo( QDataStream& s ) const; |
40 | virtual void serializeFrom( QDataStream& s ); | 40 | virtual void serializeFrom( QDataStream& s ); |
41 | 41 | ||
42 | public slots: | 42 | public slots: |
43 | 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 ); |
44 | void fromDStraffic( QString from, QString to, QString via ); // NYI | 44 | void fromDStraffic( QString from, QString to, QString via ); // NYI |
45 | void toDStraffic( QString from, QString to, QString via ); | 45 | void toDStraffic( QString from, QString to, QString via ); |
46 | void WDStraffic( QString from, QString to, QString viaFrom, QString viaTo ); | 46 | void WDStraffic( QString from, QString to, QString viaFrom, QString viaTo ); |
47 | void IBSStraffic( QString from, QString to, QString via ); // NYI | 47 | void IBSStraffic( QString from, QString to, QString via ); // NYI |
48 | 48 | ||
49 | protected: | 49 | protected: |
50 | void addIfNotExisting( MScanListItem* parent, QString addr ); | 50 | void addIfNotExisting( MScanListItem* parent, QString addr, const QString& type = "station" ); |
51 | 51 | ||
52 | private: | 52 | private: |
53 | ManufacturerDB* _manufacturerdb; | 53 | ManufacturerDB* _manufacturerdb; |
54 | 54 | ||
55 | }; | 55 | }; |
56 | 56 | ||
57 | //****************************** MScanListItem **************************************************************** | 57 | //****************************** MScanListItem **************************************************************** |
58 | 58 | ||
59 | class MScanListItem: public OListViewItem | 59 | class MScanListItem: public OListViewItem |
60 | { | 60 | { |
61 | public: | 61 | public: |
62 | MScanListItem::MScanListItem( QListView* parent, | 62 | MScanListItem::MScanListItem( QListView* parent, |
63 | QString type = "unknown", | 63 | QString type = "unknown", |
64 | QString essid = "unknown", | 64 | QString essid = "unknown", |
65 | QString macaddr = "unknown", | 65 | QString macaddr = "unknown", |
66 | bool wep = false, | 66 | bool wep = false, |
67 | int channel = 0, | 67 | int channel = 0, |
68 | int signal = 0 ); | 68 | int signal = 0 ); |
69 | 69 | ||
70 | MScanListItem::MScanListItem( QListViewItem* parent, | 70 | MScanListItem::MScanListItem( QListViewItem* parent, |
71 | QString type = "unknown", | 71 | QString type = "unknown", |
72 | QString essid = "unknown", | 72 | QString essid = "unknown", |
73 | QString macaddr = "unknown", | 73 | QString macaddr = "unknown", |
74 | bool wep = false, | 74 | bool wep = false, |