-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 | |||
@@ -37,21 +37,21 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) | |||
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 | ||
@@ -72,21 +72,21 @@ typedef struct { | |||
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"; |
@@ -116,25 +116,25 @@ bool Wellenreiter::hasMessage() | |||
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 |
@@ -161,12 +161,16 @@ 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 | } |