author | mickeyl <mickeyl> | 2002-12-03 19:47:18 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2002-12-03 19:47:18 (UTC) |
commit | b840b9c453badfec16deffeffae5337320bff5a7 (patch) (unidiff) | |
tree | 9f13605ecedb3a41bfbd9ea104454c66f238048e | |
parent | 6759138a8d4d6fdd16838511c099c6d7ec03a54f (diff) | |
download | opie-b840b9c453badfec16deffeffae5337320bff5a7.zip opie-b840b9c453badfec16deffeffae5337320bff5a7.tar.gz opie-b840b9c453badfec16deffeffae5337320bff5a7.tar.bz2 |
GUI used wrong comm port.
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 02a6f76..693f20d 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -33,29 +33,29 @@ | |||
33 | 33 | ||
34 | Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) | 34 | Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) |
35 | : WellenreiterBase( parent, name, fl ) | 35 | : WellenreiterBase( parent, name, fl ) |
36 | { | 36 | { |
37 | 37 | ||
38 | connect( button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) ); | 38 | connect( button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) ); |
39 | netview->setColumnWidthMode( 1, QListView::Manual ); | 39 | netview->setColumnWidthMode( 1, QListView::Manual ); |
40 | 40 | ||
41 | // | 41 | // |
42 | // setup socket for daemon communication and start poller | 42 | // setup socket for daemon communication and start poller |
43 | // | 43 | // |
44 | 44 | ||
45 | daemon_fd = commsock( DAEMONADDR, DAEMONPORT ); | 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 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 | ||
53 | Wellenreiter::~Wellenreiter() | 53 | Wellenreiter::~Wellenreiter() |
54 | { | 54 | { |
55 | // no need to delete child widgets, Qt does it all for us | 55 | // no need to delete child widgets, Qt does it all for us |
56 | } | 56 | } |
57 | 57 | ||
58 | void Wellenreiter::handleMessage() | 58 | void Wellenreiter::handleMessage() |
59 | { | 59 | { |
60 | // FIXME: receive message and handle it | 60 | // FIXME: receive message and handle it |
61 | 61 | ||
@@ -68,29 +68,29 @@ void Wellenreiter::handleMessage() | |||
68 | 68 | ||
69 | /* | 69 | /* |
70 | typedef struct { | 70 | typedef struct { |
71 | int net_type; 1 = Accesspoint ; 2 = Ad-Hoc | 71 | int net_type; 1 = Accesspoint ; 2 = Ad-Hoc |
72 | int ssid_len; Length of SSID | 72 | int ssid_len; Length of SSID |
73 | int channel; Channel | 73 | int channel; Channel |
74 | int wep; 1 = WEP enabled ; 0 = disabled | 74 | int wep; 1 = WEP enabled ; 0 = disabled |
75 | char mac[64]; MAC address of Accesspoint | 75 | char mac[64]; MAC address of Accesspoint |
76 | char bssid[128]; BSSID of Accesspoint | 76 | char bssid[128]; BSSID of Accesspoint |
77 | } wl_network_t; | 77 | } wl_network_t; |
78 | */ | 78 | */ |
79 | 79 | ||
80 | if ( result == 1 ) /* new network found */ | 80 | if ( result == NETFOUND ) /* new network found */ |
81 | { | 81 | { |
82 | qDebug( "Sniffer said: new network found." ); | 82 | qDebug( "Sniffer said: new network found." ); |
83 | wl_network_t n; | 83 | wl_network_t n; |
84 | get_network_found( &n, (const char*) &buffer ); | 84 | get_network_found( &n, (char*) &buffer ); |
85 | n.bssid[n.ssid_len] = "\0"; | 85 | n.bssid[n.ssid_len] = "\0"; |
86 | 86 | ||
87 | QString type; | 87 | QString type; |
88 | 88 | ||
89 | if ( n.net_type == 1 ) | 89 | if ( n.net_type == 1 ) |
90 | type == "managed"; | 90 | type == "managed"; |
91 | else | 91 | else |
92 | type == "adhoc"; | 92 | type == "adhoc"; |
93 | 93 | ||
94 | addNewItem( type, n.bssid, n.mac, n.wep, n.channel, 0 ); | 94 | addNewItem( type, n.bssid, n.mac, n.wep, n.channel, 0 ); |
95 | 95 | ||
96 | } | 96 | } |
@@ -112,33 +112,33 @@ bool Wellenreiter::hasMessage() | |||
112 | fd_set rfds; | 112 | fd_set rfds; |
113 | FD_ZERO( &rfds ); | 113 | FD_ZERO( &rfds ); |
114 | FD_SET( daemon_fd, &rfds ); | 114 | FD_SET( daemon_fd, &rfds ); |
115 | struct timeval tv; | 115 | struct timeval tv; |
116 | tv.tv_sec = 0; | 116 | tv.tv_sec = 0; |
117 | tv.tv_usec = 0; | 117 | tv.tv_usec = 0; |
118 | int result = select( daemon_fd+1, &rfds, NULL, NULL, &tv ); | 118 | int result = select( daemon_fd+1, &rfds, NULL, NULL, &tv ); |
119 | return FD_ISSET( daemon_fd, &rfds ); | 119 | return FD_ISSET( daemon_fd, &rfds ); |
120 | } | 120 | } |
121 | 121 | ||
122 | void Wellenreiter::timerEvent( QTimerEvent* e ) | 122 | void Wellenreiter::timerEvent( QTimerEvent* e ) |
123 | { | 123 | { |
124 | qDebug( "checking for message..." ); | 124 | //qDebug( "checking for message..." ); |
125 | 125 | ||
126 | if ( hasMessage() ) | 126 | if ( hasMessage() ) |
127 | { | 127 | { |
128 | handleMessage(); | 128 | handleMessage(); |
129 | } | 129 | } |
130 | else | 130 | else |
131 | { | 131 | { |
132 | qDebug( "no message :(" ); | 132 | //qDebug( "no message :(" ); |
133 | } | 133 | } |
134 | } | 134 | } |
135 | 135 | ||
136 | void Wellenreiter::addNewItem( QString type, QString essid, QString ap, bool wep, int channel, int signal ) | 136 | void Wellenreiter::addNewItem( QString type, QString essid, QString ap, bool wep, int channel, int signal ) |
137 | { | 137 | { |
138 | // FIXME: this code belongs in customized QListView, not into this class | 138 | // FIXME: this code belongs in customized QListView, not into this class |
139 | 139 | ||
140 | // search, if we had an item with this essid once before | 140 | // search, if we had an item with this essid once before |
141 | 141 | ||
142 | QListViewItem* item = netview->firstChild(); | 142 | QListViewItem* item = netview->firstChild(); |
143 | 143 | ||
144 | while ( item && ( item->text( 0 ) != essid ) ) | 144 | while ( item && ( item->text( 0 ) != essid ) ) |
@@ -157,16 +157,20 @@ void Wellenreiter::addNewItem( QString type, QString essid, QString ap, bool wep | |||
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
160 | void Wellenreiter::buttonClicked() | 160 | void Wellenreiter::buttonClicked() |
161 | { | 161 | { |
162 | 162 | ||
163 | // FIXME: communicate with daemon and set button text according to state | 163 | // FIXME: communicate with daemon and set button text according to state |
164 | 164 | ||
165 | button->setText( "Stop Scanning" ); | 165 | button->setText( "Stop Scanning" ); |
166 | 166 | ||
167 | // add some icons, so that we can see if this works | 167 | // add some icons, so that we can see if this works |
168 | 168 | ||
169 | addNewItem( "managed", "MyNet", "04:00:20:EF:A6:43", true, 6, 80 ); | 169 | addNewItem( "managed", "DummyNet", "04:00:20:EF:A6:43", true, 6, 80 ); |
170 | addNewItem( "adhoc", "YourNet", "40:03:A3:E7:56:22", false, 11, 30 ); | 170 | addNewItem( "adhoc", "DummyNet", "40:03:A3:E7:56:22", false, 11, 30 ); |
171 | |||
172 | QString command ("98"); | ||
173 | |||
174 | sendcomm( DAEMONADDR, DAEMONPORT, (const char*) command ); | ||
171 | 175 | ||
172 | } | 176 | } |