summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2002-11-30 18:33:06 (UTC)
committer mickeyl <mickeyl>2002-11-30 18:33:06 (UTC)
commit2e2bbf823ba532f349ad9ca3dd84cf7f758f36b0 (patch) (unidiff)
treeb554ae6b7f2bd4e7db9b34bf25e85b8f129fa2dd
parent197b74a6193151cca8b7f5f725fb19098cb76eb2 (diff)
downloadopie-2e2bbf823ba532f349ad9ca3dd84cf7f758f36b0.zip
opie-2e2bbf823ba532f349ad9ca3dd84cf7f758f36b0.tar.gz
opie-2e2bbf823ba532f349ad9ca3dd84cf7f758f36b0.tar.bz2
gui should now show newly found stations.
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp58
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.h2
2 files changed, 53 insertions, 7 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index afb010c..02a6f76 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -28,6 +28,7 @@
28#include "scanlistitem.h" 28#include "scanlistitem.h"
29 29
30#include "../libwellenreiter/source/sock.hh" // <--- ugly path, FIX THIS! 30#include "../libwellenreiter/source/sock.hh" // <--- ugly path, FIX THIS!
31#include "../libwellenreiter/source/proto.hh" // <--- ugly path, FIX THIS!
31#include "../daemon/source/config.hh" // <--- ugly path, FIX THIS! 32#include "../daemon/source/config.hh" // <--- ugly path, FIX THIS!
32 33
33Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) 34Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl )
@@ -59,23 +60,68 @@ void Wellenreiter::handleMessage()
59 // FIXME: receive message and handle it 60 // FIXME: receive message and handle it
60 61
61 qDebug( "received message from daemon." ); 62 qDebug( "received message from daemon." );
63
64 char buffer[128];
65
66 int result = recvcomm( &daemon_fd, (char*) &buffer, sizeof(buffer) );
67 qDebug( "received %d from recvcomm", result );
68
69/*
70typedef struct {
71 int net_type; 1 = Accesspoint ; 2 = Ad-Hoc
72 int ssid_len; Length of SSID
73 int channel; Channel
74 int wep; 1 = WEP enabled ; 0 = disabled
75 char mac[64]; MAC address of Accesspoint
76 char bssid[128]; BSSID of Accesspoint
77} wl_network_t;
78*/
79
80 if ( result == 1 ) /* new network found */
81 {
82 qDebug( "Sniffer said: new network found." );
83 wl_network_t n;
84 get_network_found( &n, (const char*) &buffer );
85 n.bssid[n.ssid_len] = "\0";
86
87 QString type;
88
89 if ( n.net_type == 1 )
90 type == "managed";
91 else
92 type == "adhoc";
93
94 addNewItem( type, n.bssid, n.mac, n.wep, n.channel, 0 );
95
96 }
97
98 else
99
100 {
101 qDebug( "unknown sniffer command." );
102 }
103
62} 104}
63 105
64 106
65bool Wellenreiter::hasMessage() 107bool Wellenreiter::hasMessage()
66{ 108{
109
110 // FIXME: do this in libwellenreiter, not here!!!
111
67 fd_set rfds; 112 fd_set rfds;
68 FD_ZERO( &rfds ); 113 FD_ZERO( &rfds );
69 FD_SET( daemon_fd, &rfds ); 114 FD_SET( daemon_fd, &rfds );
70 struct timeval tv; 115 struct timeval tv;
71 tv.tv_sec = 0; 116 tv.tv_sec = 0;
72 tv.tv_usec = 0; 117 tv.tv_usec = 0;
73 return select( 1, &rfds, NULL, NULL, &tv ); 118 int result = select( daemon_fd+1, &rfds, NULL, NULL, &tv );
119 return FD_ISSET( daemon_fd, &rfds );
74} 120}
75 121
76void Wellenreiter::timerEvent( QTimerEvent* e ) 122void Wellenreiter::timerEvent( QTimerEvent* e )
77{ 123{
78 // qDebug( "checking for message..." ); 124 qDebug( "checking for message..." );
79 125
80 if ( hasMessage() ) 126 if ( hasMessage() )
81 { 127 {
@@ -83,11 +129,11 @@ void Wellenreiter::timerEvent( QTimerEvent* e )
83 } 129 }
84 else 130 else
85 { 131 {
86 // qDebug( "no message :(" ); 132 qDebug( "no message :(" );
87 } 133 }
88} 134}
89 135
90void Wellenreiter::addNewStation( QString type, QString essid, QString ap, bool wep, int channel, int signal ) 136void Wellenreiter::addNewItem( QString type, QString essid, QString ap, bool wep, int channel, int signal )
91{ 137{
92 // FIXME: this code belongs in customized QListView, not into this class 138 // FIXME: this code belongs in customized QListView, not into this class
93 139
@@ -120,7 +166,7 @@ void Wellenreiter::buttonClicked()
120 166
121 // add some icons, so that we can see if this works 167 // add some icons, so that we can see if this works
122 168
123 addNewStation( "managed", "MyNet", "04:00:20:EF:A6:43", true, 6, 80 ); 169 addNewItem( "managed", "MyNet", "04:00:20:EF:A6:43", true, 6, 80 );
124 addNewStation( "adhoc", "YourNet", "40:03:A3:E7:56:22", false, 11, 30 ); 170 addNewItem( "adhoc", "YourNet", "40:03:A3:E7:56:22", false, 11, 30 );
125 171
126} 172}
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h
index b0f41e3..61f7503 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.h
+++ b/noncore/net/wellenreiter/gui/wellenreiter.h
@@ -33,7 +33,7 @@ protected:
33 33
34public slots: 34public slots:
35 void buttonClicked(); 35 void buttonClicked();
36 void addNewStation( QString type, QString essid, QString ap, bool wep, int channel, int signal ); 36 void addNewItem( QString type, QString essid, QString ap, bool wep, int channel, int signal );
37 37
38private: 38private:
39 int daemon_fd; // socket filedescriptor for udp communication socket 39 int daemon_fd; // socket filedescriptor for udp communication socket