author | mickeyl <mickeyl> | 2002-12-08 18:41:47 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2002-12-08 18:41:47 (UTC) |
commit | 1a4f97b01412700aaa19fda396844fd237f35c92 (patch) (side-by-side diff) | |
tree | e439f505f73a71e179748aca0bcaa93d70b6f594 /noncore/net/wellenreiter/gui/wellenreiter.cpp | |
parent | ff55ff70dc982d070bb085acb96831ae30b30902 (diff) | |
download | opie-1a4f97b01412700aaa19fda396844fd237f35c92.zip opie-1a4f97b01412700aaa19fda396844fd237f35c92.tar.gz opie-1a4f97b01412700aaa19fda396844fd237f35c92.tar.bz2 |
- new networks finally show up in the GUI
- using OTabWidget instead of QTabWidget
- bugfixes
- preparing to fully integrate libwellenreiter
and the daemon into our buildsystem
Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 693f20d..11cdaef 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -42,14 +42,14 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) // setup socket for daemon communication and start poller // daemon_fd = commsock( GUIADDR, GUIPORT ); if ( daemon_fd == -1 ) qDebug( "D'oh! Could not get file descriptor for daemon-->gui communication socket." ); - //else - //startTimer( 700 ); + else + startTimer( 700 ); } Wellenreiter::~Wellenreiter() { // no need to delete child widgets, Qt does it all for us @@ -57,13 +57,13 @@ Wellenreiter::~Wellenreiter() void Wellenreiter::handleMessage() { // FIXME: receive message and handle it qDebug( "received message from daemon." ); - + char buffer[128]; int result = recvcomm( &daemon_fd, (char*) &buffer, sizeof(buffer) ); qDebug( "received %d from recvcomm", result ); /* @@ -74,27 +74,33 @@ typedef struct { int wep; 1 = WEP enabled ; 0 = disabled char mac[64]; MAC address of Accesspoint char bssid[128]; BSSID of Accesspoint } wl_network_t; */ + qDebug( "Sniffer sent: '%s'", buffer ); + if ( result == NETFOUND ) /* new network found */ { qDebug( "Sniffer said: new network found." ); wl_network_t n; get_network_found( &n, (char*) &buffer ); - n.bssid[n.ssid_len] = "\0"; + + qDebug( "Sniffer said: net_type is %d.", n.net_type ); + qDebug( "Sniffer said: MAC is %s", (const char*) &n.mac ); + + //n.bssid[n.ssid_len] = "\0"; QString type; if ( n.net_type == 1 ) - type == "managed"; + type = "managed"; else - type == "adhoc"; - - addNewItem( type, n.bssid, n.mac, n.wep, n.channel, 0 ); + type = "adhoc"; + + addNewItem( type, n.bssid, QString( (const char*) &n.mac ), n.wep, n.channel, 0 ); } else { @@ -111,32 +117,32 @@ bool Wellenreiter::hasMessage() fd_set rfds; FD_ZERO( &rfds ); FD_SET( daemon_fd, &rfds ); struct timeval tv; tv.tv_sec = 0; - tv.tv_usec = 0; + tv.tv_usec = 10; int result = select( daemon_fd+1, &rfds, NULL, NULL, &tv ); return FD_ISSET( daemon_fd, &rfds ); } void Wellenreiter::timerEvent( QTimerEvent* e ) { - //qDebug( "checking for message..." ); + qDebug( "checking for message..." ); if ( hasMessage() ) { handleMessage(); } else { - //qDebug( "no message :(" ); + qDebug( "no message :(" ); } } -void Wellenreiter::addNewItem( QString type, QString essid, QString ap, bool wep, int channel, int signal ) +void Wellenreiter::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) { // FIXME: this code belongs in customized QListView, not into this class // search, if we had an item with this essid once before QListViewItem* item = netview->firstChild(); @@ -146,17 +152,17 @@ void Wellenreiter::addNewItem( QString type, QString essid, QString ap, bool wep qDebug( "itemtext: %s", (const char*) item->text( 0 ) ); item = item->itemBelow(); } if ( item ) { qDebug( "found!" ); - new MScanListItem( item, type, essid, ap, wep, channel, signal ); + new MScanListItem( item, type, essid, macaddr, wep, channel, signal ); } else { - new MScanListItem( netview, type, essid, ap, wep, channel, signal ); + new MScanListItem( netview, type, essid, macaddr, wep, channel, signal ); } } void Wellenreiter::buttonClicked() { |