author | mickeyl <mickeyl> | 2002-12-08 18:41:47 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2002-12-08 18:41:47 (UTC) |
commit | 1a4f97b01412700aaa19fda396844fd237f35c92 (patch) (unidiff) | |
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 | |||
@@ -45,8 +45,8 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) | |||
45 | daemon_fd = commsock( GUIADDR, GUIPORT ); | 45 | daemon_fd = commsock( GUIADDR, GUIPORT ); |
46 | if ( daemon_fd == -1 ) | 46 | if ( daemon_fd == -1 ) |
47 | qDebug( "D'oh! Could not get file descriptor for daemon-->gui communication socket." ); | 47 | qDebug( "D'oh! Could not get file descriptor for daemon-->gui communication socket." ); |
48 | //else | 48 | else |
49 | //startTimer( 700 ); | 49 | startTimer( 700 ); |
50 | 50 | ||
51 | } | 51 | } |
52 | 52 | ||
@@ -60,7 +60,7 @@ void Wellenreiter::handleMessage() | |||
60 | // FIXME: receive message and handle it | 60 | // FIXME: receive message and handle it |
61 | 61 | ||
62 | qDebug( "received message from daemon." ); | 62 | qDebug( "received message from daemon." ); |
63 | 63 | ||
64 | char buffer[128]; | 64 | char buffer[128]; |
65 | 65 | ||
66 | int result = recvcomm( &daemon_fd, (char*) &buffer, sizeof(buffer) ); | 66 | int result = recvcomm( &daemon_fd, (char*) &buffer, sizeof(buffer) ); |
@@ -77,21 +77,27 @@ typedef struct { | |||
77 | } wl_network_t; | 77 | } wl_network_t; |
78 | */ | 78 | */ |
79 | 79 | ||
80 | qDebug( "Sniffer sent: '%s'", buffer ); | ||
81 | |||
80 | if ( result == NETFOUND ) /* new network found */ | 82 | if ( result == NETFOUND ) /* new network found */ |
81 | { | 83 | { |
82 | qDebug( "Sniffer said: new network found." ); | 84 | qDebug( "Sniffer said: new network found." ); |
83 | wl_network_t n; | 85 | wl_network_t n; |
84 | get_network_found( &n, (char*) &buffer ); | 86 | get_network_found( &n, (char*) &buffer ); |
85 | n.bssid[n.ssid_len] = "\0"; | 87 | |
88 | qDebug( "Sniffer said: net_type is %d.", n.net_type ); | ||
89 | qDebug( "Sniffer said: MAC is %s", (const char*) &n.mac ); | ||
90 | |||
91 | //n.bssid[n.ssid_len] = "\0"; | ||
86 | 92 | ||
87 | QString type; | 93 | QString type; |
88 | 94 | ||
89 | if ( n.net_type == 1 ) | 95 | if ( n.net_type == 1 ) |
90 | type == "managed"; | 96 | type = "managed"; |
91 | else | 97 | else |
92 | type == "adhoc"; | 98 | type = "adhoc"; |
93 | 99 | ||
94 | addNewItem( type, n.bssid, n.mac, n.wep, n.channel, 0 ); | 100 | addNewItem( type, n.bssid, QString( (const char*) &n.mac ), n.wep, n.channel, 0 ); |
95 | 101 | ||
96 | } | 102 | } |
97 | 103 | ||
@@ -114,14 +120,14 @@ bool Wellenreiter::hasMessage() | |||
114 | FD_SET( daemon_fd, &rfds ); | 120 | FD_SET( daemon_fd, &rfds ); |
115 | struct timeval tv; | 121 | struct timeval tv; |
116 | tv.tv_sec = 0; | 122 | tv.tv_sec = 0; |
117 | tv.tv_usec = 0; | 123 | tv.tv_usec = 10; |
118 | int result = select( daemon_fd+1, &rfds, NULL, NULL, &tv ); | 124 | int result = select( daemon_fd+1, &rfds, NULL, NULL, &tv ); |
119 | return FD_ISSET( daemon_fd, &rfds ); | 125 | return FD_ISSET( daemon_fd, &rfds ); |
120 | } | 126 | } |
121 | 127 | ||
122 | void Wellenreiter::timerEvent( QTimerEvent* e ) | 128 | void Wellenreiter::timerEvent( QTimerEvent* e ) |
123 | { | 129 | { |
124 | //qDebug( "checking for message..." ); | 130 | qDebug( "checking for message..." ); |
125 | 131 | ||
126 | if ( hasMessage() ) | 132 | if ( hasMessage() ) |
127 | { | 133 | { |
@@ -129,11 +135,11 @@ void Wellenreiter::timerEvent( QTimerEvent* e ) | |||
129 | } | 135 | } |
130 | else | 136 | else |
131 | { | 137 | { |
132 | //qDebug( "no message :(" ); | 138 | qDebug( "no message :(" ); |
133 | } | 139 | } |
134 | } | 140 | } |
135 | 141 | ||
136 | void Wellenreiter::addNewItem( QString type, QString essid, QString ap, bool wep, int channel, int signal ) | 142 | void Wellenreiter::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) |
137 | { | 143 | { |
138 | // FIXME: this code belongs in customized QListView, not into this class | 144 | // FIXME: this code belongs in customized QListView, not into this class |
139 | 145 | ||
@@ -149,11 +155,11 @@ void Wellenreiter::addNewItem( QString type, QString essid, QString ap, bool wep | |||
149 | if ( item ) | 155 | if ( item ) |
150 | { | 156 | { |
151 | qDebug( "found!" ); | 157 | qDebug( "found!" ); |
152 | new MScanListItem( item, type, essid, ap, wep, channel, signal ); | 158 | new MScanListItem( item, type, essid, macaddr, wep, channel, signal ); |
153 | } | 159 | } |
154 | else | 160 | else |
155 | { | 161 | { |
156 | new MScanListItem( netview, type, essid, ap, wep, channel, signal ); | 162 | new MScanListItem( netview, type, essid, macaddr, wep, channel, signal ); |
157 | } | 163 | } |
158 | } | 164 | } |
159 | 165 | ||