-rw-r--r-- | noncore/net/wellenreiter/gui/configbase.ui | 52 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 20 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.h | 4 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/gps.cpp | 48 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/gps.h | 19 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 40 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 2 |
7 files changed, 153 insertions, 32 deletions
diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui index c1da98d..d9a0aea 100644 --- a/noncore/net/wellenreiter/gui/configbase.ui +++ b/noncore/net/wellenreiter/gui/configbase.ui | |||
@@ -303,24 +303,28 @@ | |||
303 | </grid> | 303 | </grid> |
304 | </widget> | 304 | </widget> |
305 | <widget row="0" column="1" rowspan="1" colspan="3" > | 305 | <widget row="0" column="1" rowspan="1" colspan="3" > |
306 | <class>QComboBox</class> | 306 | <class>QComboBox</class> |
307 | <property stdset="1"> | 307 | <property stdset="1"> |
308 | <name>name</name> | 308 | <name>name</name> |
309 | <cstring>interfaceName</cstring> | 309 | <cstring>interfaceName</cstring> |
310 | </property> | 310 | </property> |
311 | <property stdset="1"> | 311 | <property stdset="1"> |
312 | <name>enabled</name> | 312 | <name>enabled</name> |
313 | <bool>true</bool> | 313 | <bool>true</bool> |
314 | </property> | 314 | </property> |
315 | <property stdset="1"> | ||
316 | <name>editable</name> | ||
317 | <bool>false</bool> | ||
318 | </property> | ||
315 | <property> | 319 | <property> |
316 | <name>whatsThis</name> | 320 | <name>whatsThis</name> |
317 | <string>Choose the interface used for sniffing.</string> | 321 | <string>Choose the interface used for sniffing.</string> |
318 | </property> | 322 | </property> |
319 | </widget> | 323 | </widget> |
320 | <widget row="1" column="1" rowspan="1" colspan="3" > | 324 | <widget row="1" column="1" rowspan="1" colspan="3" > |
321 | <class>QComboBox</class> | 325 | <class>QComboBox</class> |
322 | <item> | 326 | <item> |
323 | <property> | 327 | <property> |
324 | <name>text</name> | 328 | <name>text</name> |
325 | <string><select></string> | 329 | <string><select></string> |
326 | </property> | 330 | </property> |
@@ -1011,25 +1015,25 @@ | |||
1011 | </property> | 1015 | </property> |
1012 | </widget> | 1016 | </widget> |
1013 | <widget> | 1017 | <widget> |
1014 | <class>QComboBox</class> | 1018 | <class>QComboBox</class> |
1015 | <item> | 1019 | <item> |
1016 | <property> | 1020 | <property> |
1017 | <name>text</name> | 1021 | <name>text</name> |
1018 | <string>localhost</string> | 1022 | <string>localhost</string> |
1019 | </property> | 1023 | </property> |
1020 | </item> | 1024 | </item> |
1021 | <property stdset="1"> | 1025 | <property stdset="1"> |
1022 | <name>name</name> | 1026 | <name>name</name> |
1023 | <cstring>ComboBox8</cstring> | 1027 | <cstring>gpsdHost</cstring> |
1024 | </property> | 1028 | </property> |
1025 | <property stdset="1"> | 1029 | <property stdset="1"> |
1026 | <name>enabled</name> | 1030 | <name>enabled</name> |
1027 | <bool>false</bool> | 1031 | <bool>false</bool> |
1028 | </property> | 1032 | </property> |
1029 | <property stdset="1"> | 1033 | <property stdset="1"> |
1030 | <name>editable</name> | 1034 | <name>editable</name> |
1031 | <bool>true</bool> | 1035 | <bool>true</bool> |
1032 | </property> | 1036 | </property> |
1033 | <property stdset="1"> | 1037 | <property stdset="1"> |
1034 | <name>currentItem</name> | 1038 | <name>currentItem</name> |
1035 | <number>0</number> | 1039 | <number>0</number> |
@@ -1041,107 +1045,107 @@ | |||
1041 | <name>name</name> | 1045 | <name>name</name> |
1042 | <cstring>TextLabel2_2</cstring> | 1046 | <cstring>TextLabel2_2</cstring> |
1043 | </property> | 1047 | </property> |
1044 | <property stdset="1"> | 1048 | <property stdset="1"> |
1045 | <name>text</name> | 1049 | <name>text</name> |
1046 | <string>:</string> | 1050 | <string>:</string> |
1047 | </property> | 1051 | </property> |
1048 | </widget> | 1052 | </widget> |
1049 | <widget> | 1053 | <widget> |
1050 | <class>QSpinBox</class> | 1054 | <class>QSpinBox</class> |
1051 | <property stdset="1"> | 1055 | <property stdset="1"> |
1052 | <name>name</name> | 1056 | <name>name</name> |
1053 | <cstring>SpinBox2</cstring> | 1057 | <cstring>gpsdPort</cstring> |
1054 | </property> | 1058 | </property> |
1055 | <property stdset="1"> | 1059 | <property stdset="1"> |
1056 | <name>enabled</name> | 1060 | <name>enabled</name> |
1057 | <bool>false</bool> | 1061 | <bool>false</bool> |
1058 | </property> | 1062 | </property> |
1059 | <property stdset="1"> | 1063 | <property stdset="1"> |
1060 | <name>maxValue</name> | 1064 | <name>maxValue</name> |
1061 | <number>65535</number> | 1065 | <number>65535</number> |
1062 | </property> | 1066 | </property> |
1063 | <property stdset="1"> | 1067 | <property stdset="1"> |
1064 | <name>minValue</name> | 1068 | <name>minValue</name> |
1065 | <number>1024</number> | 1069 | <number>1024</number> |
1066 | </property> | 1070 | </property> |
1067 | <property stdset="1"> | 1071 | <property stdset="1"> |
1068 | <name>value</name> | 1072 | <name>value</name> |
1069 | <number>2947</number> | 1073 | <number>2947</number> |
1070 | </property> | 1074 | </property> |
1071 | </widget> | 1075 | </widget> |
1072 | </hbox> | 1076 | </hbox> |
1073 | </widget> | 1077 | </widget> |
1074 | <widget> | 1078 | <widget> |
1075 | <class>QCheckBox</class> | 1079 | <class>QLineEdit</class> |
1076 | <property stdset="1"> | 1080 | <property stdset="1"> |
1077 | <name>name</name> | 1081 | <name>name</name> |
1078 | <cstring>enableGPS</cstring> | 1082 | <cstring>commandGPS</cstring> |
1083 | </property> | ||
1084 | <property stdset="1"> | ||
1085 | <name>enabled</name> | ||
1086 | <bool>false</bool> | ||
1079 | </property> | 1087 | </property> |
1080 | <property stdset="1"> | 1088 | <property stdset="1"> |
1081 | <name>geometry</name> | 1089 | <name>geometry</name> |
1082 | <rect> | 1090 | <rect> |
1083 | <x>10</x> | 1091 | <x>10</x> |
1084 | <y>10</y> | 1092 | <y>110</y> |
1085 | <width>199</width> | 1093 | <width>210</width> |
1086 | <height>21</height> | 1094 | <height>22</height> |
1087 | </rect> | 1095 | </rect> |
1088 | </property> | 1096 | </property> |
1089 | <property stdset="1"> | 1097 | <property stdset="1"> |
1090 | <name>text</name> | 1098 | <name>text</name> |
1091 | <string>Enable GPS logging w/ gpsd</string> | 1099 | <string>gpsd -p /dev/ttyS3 -s 57600</string> |
1092 | </property> | 1100 | </property> |
1093 | </widget> | 1101 | </widget> |
1094 | <widget> | 1102 | <widget> |
1095 | <class>QCheckBox</class> | 1103 | <class>QCheckBox</class> |
1096 | <property stdset="1"> | 1104 | <property stdset="1"> |
1097 | <name>name</name> | 1105 | <name>name</name> |
1098 | <cstring>startGPS</cstring> | 1106 | <cstring>enableGPS</cstring> |
1099 | </property> | 1107 | </property> |
1100 | <property stdset="1"> | 1108 | <property stdset="1"> |
1101 | <name>geometry</name> | 1109 | <name>geometry</name> |
1102 | <rect> | 1110 | <rect> |
1103 | <x>10</x> | 1111 | <x>10</x> |
1104 | <y>80</y> | 1112 | <y>10</y> |
1105 | <width>171</width> | 1113 | <width>199</width> |
1106 | <height>21</height> | 1114 | <height>21</height> |
1107 | </rect> | 1115 | </rect> |
1108 | </property> | 1116 | </property> |
1109 | <property stdset="1"> | 1117 | <property stdset="1"> |
1110 | <name>text</name> | 1118 | <name>text</name> |
1111 | <string>Start gpsd on localhost</string> | 1119 | <string>Enable GPS logging w/ gpsd</string> |
1112 | </property> | 1120 | </property> |
1113 | </widget> | 1121 | </widget> |
1114 | <widget> | 1122 | <widget> |
1115 | <class>QLineEdit</class> | 1123 | <class>QCheckBox</class> |
1116 | <property stdset="1"> | 1124 | <property stdset="1"> |
1117 | <name>name</name> | 1125 | <name>name</name> |
1118 | <cstring>commandGPS</cstring> | 1126 | <cstring>startGPS</cstring> |
1119 | </property> | ||
1120 | <property stdset="1"> | ||
1121 | <name>enabled</name> | ||
1122 | <bool>false</bool> | ||
1123 | </property> | 1127 | </property> |
1124 | <property stdset="1"> | 1128 | <property stdset="1"> |
1125 | <name>geometry</name> | 1129 | <name>geometry</name> |
1126 | <rect> | 1130 | <rect> |
1127 | <x>10</x> | 1131 | <x>10</x> |
1128 | <y>110</y> | 1132 | <y>80</y> |
1129 | <width>210</width> | 1133 | <width>171</width> |
1130 | <height>22</height> | 1134 | <height>21</height> |
1131 | </rect> | 1135 | </rect> |
1132 | </property> | 1136 | </property> |
1133 | <property stdset="1"> | 1137 | <property stdset="1"> |
1134 | <name>text</name> | 1138 | <name>text</name> |
1135 | <string>gpsd -p /dev/ttyS3 -s 57600</string> | 1139 | <string>Start gpsd on localhost</string> |
1136 | </property> | 1140 | </property> |
1137 | </widget> | 1141 | </widget> |
1138 | </widget> | 1142 | </widget> |
1139 | </widget> | 1143 | </widget> |
1140 | </grid> | 1144 | </grid> |
1141 | </widget> | 1145 | </widget> |
1142 | <customwidgets> | 1146 | <customwidgets> |
1143 | <customwidget> | 1147 | <customwidget> |
1144 | <class>ProtocolListView</class> | 1148 | <class>ProtocolListView</class> |
1145 | <header location="local">protolistview.h</header> | 1149 | <header location="local">protolistview.h</header> |
1146 | <sizehint> | 1150 | <sizehint> |
1147 | <width>100</width> | 1151 | <width>100</width> |
@@ -1198,29 +1202,29 @@ | |||
1198 | <receiver>captureFileName</receiver> | 1202 | <receiver>captureFileName</receiver> |
1199 | <slot>setEnabled(bool)</slot> | 1203 | <slot>setEnabled(bool)</slot> |
1200 | </connection> | 1204 | </connection> |
1201 | <connection> | 1205 | <connection> |
1202 | <sender>writeCaptureFile</sender> | 1206 | <sender>writeCaptureFile</sender> |
1203 | <signal>toggled(bool)</signal> | 1207 | <signal>toggled(bool)</signal> |
1204 | <receiver>capturePackets</receiver> | 1208 | <receiver>capturePackets</receiver> |
1205 | <slot>setEnabled(bool)</slot> | 1209 | <slot>setEnabled(bool)</slot> |
1206 | </connection> | 1210 | </connection> |
1207 | <connection> | 1211 | <connection> |
1208 | <sender>enableGPS</sender> | 1212 | <sender>enableGPS</sender> |
1209 | <signal>toggled(bool)</signal> | 1213 | <signal>toggled(bool)</signal> |
1210 | <receiver>ComboBox8</receiver> | 1214 | <receiver>gpsdHost</receiver> |
1211 | <slot>setEnabled(bool)</slot> | 1215 | <slot>setEnabled(bool)</slot> |
1212 | </connection> | 1216 | </connection> |
1213 | <connection> | 1217 | <connection> |
1214 | <sender>enableGPS</sender> | 1218 | <sender>enableGPS</sender> |
1215 | <signal>toggled(bool)</signal> | 1219 | <signal>toggled(bool)</signal> |
1216 | <receiver>SpinBox2</receiver> | 1220 | <receiver>gpsdPort</receiver> |
1217 | <slot>setEnabled(bool)</slot> | 1221 | <slot>setEnabled(bool)</slot> |
1218 | </connection> | 1222 | </connection> |
1219 | <connection> | 1223 | <connection> |
1220 | <sender>startGPS</sender> | 1224 | <sender>startGPS</sender> |
1221 | <signal>toggled(bool)</signal> | 1225 | <signal>toggled(bool)</signal> |
1222 | <receiver>commandGPS</receiver> | 1226 | <receiver>commandGPS</receiver> |
1223 | <slot>setEnabled(bool)</slot> | 1227 | <slot>setEnabled(bool)</slot> |
1224 | </connection> | 1228 | </connection> |
1225 | </connections> | 1229 | </connections> |
1226 | </UI> | 1230 | </UI> |
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index 11394d7..a331925 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp | |||
@@ -178,15 +178,33 @@ void WellenreiterConfigWindow::channelAllClicked(int state) | |||
178 | channel2->setChecked( b ); | 178 | channel2->setChecked( b ); |
179 | channel3->setChecked( b ); | 179 | channel3->setChecked( b ); |
180 | channel4->setChecked( b ); | 180 | channel4->setChecked( b ); |
181 | channel5->setChecked( b ); | 181 | channel5->setChecked( b ); |
182 | channel6->setChecked( b ); | 182 | channel6->setChecked( b ); |
183 | channel7->setChecked( b ); | 183 | channel7->setChecked( b ); |
184 | channel8->setChecked( b ); | 184 | channel8->setChecked( b ); |
185 | channel9->setChecked( b ); | 185 | channel9->setChecked( b ); |
186 | channel10->setChecked( b ); | 186 | channel10->setChecked( b ); |
187 | channel11->setChecked( b ); | 187 | channel11->setChecked( b ); |
188 | channel12->setChecked( b ); | 188 | channel12->setChecked( b ); |
189 | channel13->setChecked( b ); | 189 | channel13->setChecked( b ); |
190 | channel14->setChecked( b ); | 190 | channel14->setChecked( b ); |
191 | } | 191 | } |
192 | 192 | ||
193 | |||
194 | bool WellenreiterConfigWindow::useGPS() const | ||
195 | { | ||
196 | return enableGPS->isChecked(); | ||
197 | } | ||
198 | |||
199 | |||
200 | const QString WellenreiterConfigWindow::gpsHost() const | ||
201 | { | ||
202 | return useGPS() ? gpsdHost->currentText() : QString::null; | ||
203 | } | ||
204 | |||
205 | |||
206 | int WellenreiterConfigWindow::gpsPort() const | ||
207 | { | ||
208 | bool ok; | ||
209 | return useGPS() ? gpsdPort->value() : -1; | ||
210 | } | ||
diff --git a/noncore/net/wellenreiter/gui/configwindow.h b/noncore/net/wellenreiter/gui/configwindow.h index 32dc840..8f160b1 100644 --- a/noncore/net/wellenreiter/gui/configwindow.h +++ b/noncore/net/wellenreiter/gui/configwindow.h | |||
@@ -37,24 +37,28 @@ class WellenreiterConfigWindow : public WellenreiterConfigBase | |||
37 | 37 | ||
38 | public: | 38 | public: |
39 | WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 ); | 39 | WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 ); |
40 | int driverType() const; | 40 | int driverType() const; |
41 | const QString soundOnNetwork() const { return "";/*netSound->currentText();*/ }; | 41 | const QString soundOnNetwork() const { return "";/*netSound->currentText();*/ }; |
42 | const QString soundOnBeacon() const { return "";/*beaconSound->currentText();*/ }; | 42 | const QString soundOnBeacon() const { return "";/*beaconSound->currentText();*/ }; |
43 | static WellenreiterConfigWindow* instance() { return _instance; }; | 43 | static WellenreiterConfigWindow* instance() { return _instance; }; |
44 | 44 | ||
45 | int hoppingInterval() const; | 45 | int hoppingInterval() const; |
46 | bool usePrismHeader() const; | 46 | bool usePrismHeader() const; |
47 | bool isChannelChecked( int ) const; | 47 | bool isChannelChecked( int ) const; |
48 | 48 | ||
49 | bool useGPS() const; | ||
50 | const QString gpsHost() const; | ||
51 | int gpsPort() const; | ||
52 | |||
49 | public slots: | 53 | public slots: |
50 | void changedDeviceType(int); | 54 | void changedDeviceType(int); |
51 | void getCaptureFileNameClicked(); | 55 | void getCaptureFileNameClicked(); |
52 | 56 | ||
53 | void channelAllClicked(int); | 57 | void channelAllClicked(int); |
54 | 58 | ||
55 | protected: | 59 | protected: |
56 | QMap<QString, int> _devicetype; | 60 | QMap<QString, int> _devicetype; |
57 | static WellenreiterConfigWindow* _instance; | 61 | static WellenreiterConfigWindow* _instance; |
58 | int _guess; | 62 | int _guess; |
59 | 63 | ||
60 | }; | 64 | }; |
diff --git a/noncore/net/wellenreiter/gui/gps.cpp b/noncore/net/wellenreiter/gui/gps.cpp index c3bff53..4a24647 100644 --- a/noncore/net/wellenreiter/gui/gps.cpp +++ b/noncore/net/wellenreiter/gui/gps.cpp | |||
@@ -6,12 +6,60 @@ | |||
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "gps.h" | 16 | #include "gps.h" |
17 | 17 | ||
18 | GPS::GPS( QObject* parent, const char * name ) | ||
19 | :QObject( parent, name ) | ||
20 | { | ||
21 | qDebug( "GPS::GPS()" ); | ||
22 | _socket = new QSocket( this, "gpsd commsock" ); | ||
23 | } | ||
24 | |||
25 | |||
26 | GPS::~GPS() | ||
27 | { | ||
28 | qDebug( "GPS::~GPS()" ); | ||
29 | } | ||
30 | |||
31 | |||
32 | bool GPS::open( const QString& host, int port ) | ||
33 | { | ||
34 | _socket->connectToHost( host, port ); | ||
35 | } | ||
36 | |||
37 | |||
38 | float GPS::latitude() const | ||
39 | { | ||
40 | char buf[256]; | ||
41 | |||
42 | int result = _socket->writeBlock( "p\r\n", 3 ); | ||
43 | if ( result ) | ||
44 | { | ||
45 | qDebug( "GPS write succeeded" ); | ||
46 | _socket->waitForMore( 20 ); | ||
47 | if ( _socket->canReadLine() ) | ||
48 | { | ||
49 | |||
50 | int num = _socket->readLine( &buf[0], sizeof buf ); | ||
51 | if ( num ) | ||
52 | { | ||
53 | qDebug( "GPS got line: %s", &buf ); | ||
54 | return 0.0; | ||
55 | } | ||
56 | } | ||
57 | } | ||
58 | return -1.0; | ||
59 | } | ||
60 | |||
61 | |||
62 | float GPS::longitute() const | ||
63 | { | ||
64 | } | ||
65 | |||
diff --git a/noncore/net/wellenreiter/gui/gps.h b/noncore/net/wellenreiter/gui/gps.h index e7c3dce..ad0b6de 100644 --- a/noncore/net/wellenreiter/gui/gps.h +++ b/noncore/net/wellenreiter/gui/gps.h | |||
@@ -7,13 +7,32 @@ | |||
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #ifndef GPS_H | 16 | #ifndef GPS_H |
17 | #define GPS_H | 17 | #define GPS_H |
18 | 18 | ||
19 | #include <qobject.h> | ||
20 | #include <qsocket.h> | ||
21 | |||
22 | class GPS : public QObject | ||
23 | { | ||
24 | Q_OBJECT | ||
25 | |||
26 | public: | ||
27 | GPS( QObject* parent = 0, const char * name = "GPS" ); | ||
28 | ~GPS(); | ||
29 | |||
30 | bool open( const QString& host = "localhost", int port = 2947 ); | ||
31 | float latitude() const; | ||
32 | float longitute() const; | ||
33 | |||
34 | private: | ||
35 | QSocket* _socket; | ||
36 | }; | ||
37 | |||
19 | #endif // GPS_H | 38 | #endif // GPS_H |
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 96733ff..c03debb 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -6,24 +6,25 @@ | |||
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ***********************************************************************/ | 14 | ***********************************************************************/ |
15 | 15 | ||
16 | // Local | 16 | // Local |
17 | 17 | ||
18 | #include "gps.h" | ||
18 | #include "wellenreiter.h" | 19 | #include "wellenreiter.h" |
19 | #include "scanlist.h" | 20 | #include "scanlist.h" |
20 | #include "logwindow.h" | 21 | #include "logwindow.h" |
21 | #include "hexwindow.h" | 22 | #include "hexwindow.h" |
22 | #include "configwindow.h" | 23 | #include "configwindow.h" |
23 | #include "statwindow.h" | 24 | #include "statwindow.h" |
24 | #include "graphwindow.h" | 25 | #include "graphwindow.h" |
25 | #include "protolistview.h" | 26 | #include "protolistview.h" |
26 | 27 | ||
27 | // Opie | 28 | // Opie |
28 | 29 | ||
29 | #ifdef QWS | 30 | #ifdef QWS |
@@ -76,24 +77,26 @@ Wellenreiter::Wellenreiter( QWidget* parent ) | |||
76 | 77 | ||
77 | #ifdef QWS | 78 | #ifdef QWS |
78 | QString sys; | 79 | QString sys; |
79 | sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); | 80 | sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); |
80 | _system = ODevice::inst()->system(); | 81 | _system = ODevice::inst()->system(); |
81 | logwindow->log( sys ); | 82 | logwindow->log( sys ); |
82 | #endif | 83 | #endif |
83 | 84 | ||
84 | netview->setColumnWidthMode( 1, QListView::Manual ); | 85 | netview->setColumnWidthMode( 1, QListView::Manual ); |
85 | connect( netview, SIGNAL( joinNetwork(const QString&,const QString&,int,const QString&) ), | 86 | connect( netview, SIGNAL( joinNetwork(const QString&,const QString&,int,const QString&) ), |
86 | this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) ); | 87 | this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) ); |
87 | pcap = new OPacketCapturer(); | 88 | pcap = new OPacketCapturer(); |
89 | |||
90 | gps = new GPS( this ); | ||
88 | } | 91 | } |
89 | 92 | ||
90 | 93 | ||
91 | Wellenreiter::~Wellenreiter() | 94 | Wellenreiter::~Wellenreiter() |
92 | { | 95 | { |
93 | delete pcap; | 96 | delete pcap; |
94 | } | 97 | } |
95 | 98 | ||
96 | 99 | ||
97 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) | 100 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) |
98 | { | 101 | { |
99 | configwindow = cw; | 102 | configwindow = cw; |
@@ -158,24 +161,32 @@ void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) | |||
158 | else | 161 | else |
159 | { | 162 | { |
160 | qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); | 163 | qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); |
161 | return; | 164 | return; |
162 | } | 165 | } |
163 | 166 | ||
164 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | 167 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); |
165 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); | 168 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); |
166 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | 169 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); |
167 | int channel = ds ? ds->channel() : -1; | 170 | int channel = ds ? ds->channel() : -1; |
168 | 171 | ||
169 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 172 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
173 | |||
174 | if ( configwindow->enableGPS->isChecked() ) | ||
175 | { | ||
176 | qDebug( "Wellenreiter::gathering GPS data..." ); | ||
177 | float lat = gps->latitude(); | ||
178 | qDebug( "Wellenreiter::GPS data received is ( %f , %f )", lat, 0.0 ); | ||
179 | } | ||
180 | |||
170 | netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0 ); | 181 | netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0 ); |
171 | 182 | ||
172 | // update graph window | 183 | // update graph window |
173 | if ( ds ) | 184 | if ( ds ) |
174 | { | 185 | { |
175 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); | 186 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); |
176 | if ( prism ) | 187 | if ( prism ) |
177 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); | 188 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); |
178 | else | 189 | else |
179 | graphwindow->traffic( ds->channel(), 95 ); | 190 | graphwindow->traffic( ds->channel(), 95 ); |
180 | } | 191 | } |
181 | } | 192 | } |
@@ -229,25 +240,25 @@ QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) | |||
229 | if ( configwindow->parsePackets->isProtocolChecked( protocol ) ) | 240 | if ( configwindow->parsePackets->isProtocolChecked( protocol ) ) |
230 | if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" ) | 241 | if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" ) |
231 | return 0; | 242 | return 0; |
232 | 243 | ||
233 | return p->child( protocol ); | 244 | return p->child( protocol ); |
234 | } | 245 | } |
235 | 246 | ||
236 | 247 | ||
237 | bool Wellenreiter::checkDumpPacket( OPacket* p ) | 248 | bool Wellenreiter::checkDumpPacket( OPacket* p ) |
238 | { | 249 | { |
239 | // go through all child packets and see if one is inside the child hierarchy for p | 250 | // go through all child packets and see if one is inside the child hierarchy for p |
240 | // if so, do what the user requested (protocolAction), e.g. pass or discard | 251 | // if so, do what the user requested (protocolAction), e.g. pass or discard |
241 | if ( !configwindow->writeCaptureFile->isOn() ) | 252 | if ( !configwindow->writeCaptureFile->isChecked() ) |
242 | return false; | 253 | return false; |
243 | 254 | ||
244 | QObjectList* l = p->queryList(); | 255 | QObjectList* l = p->queryList(); |
245 | QObjectListIt it( *l ); | 256 | QObjectListIt it( *l ); |
246 | QObject* o; | 257 | QObject* o; |
247 | 258 | ||
248 | while ( (o = it.current()) != 0 ) | 259 | while ( (o = it.current()) != 0 ) |
249 | { | 260 | { |
250 | QString name = it.current()->name(); | 261 | QString name = it.current()->name(); |
251 | if ( configwindow->capturePackets->isProtocolChecked( name ) ) | 262 | if ( configwindow->capturePackets->isProtocolChecked( name ) ) |
252 | { | 263 | { |
253 | QString action = configwindow->capturePackets->protocolAction( name ); | 264 | QString action = configwindow->capturePackets->protocolAction( name ); |
@@ -348,25 +359,28 @@ void Wellenreiter::startClicked() | |||
348 | const int cardtype = configwindow->driverType(); | 359 | const int cardtype = configwindow->driverType(); |
349 | const int interval = configwindow->hoppingInterval(); | 360 | const int interval = configwindow->hoppingInterval(); |
350 | 361 | ||
351 | if ( ( interface == "" ) || ( cardtype == 0 ) ) | 362 | if ( ( interface == "" ) || ( cardtype == 0 ) ) |
352 | { | 363 | { |
353 | QMessageBox::information( this, "Wellenreiter II", | 364 | QMessageBox::information( this, "Wellenreiter II", |
354 | tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); | 365 | tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); |
355 | return; | 366 | return; |
356 | } | 367 | } |
357 | 368 | ||
358 | // configure device | 369 | // configure device |
359 | ONetwork* net = ONetwork::instance(); | 370 | ONetwork* net = ONetwork::instance(); |
360 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); | 371 | |
372 | // TODO: check if interface is wireless and support sniffing for non-wireless interfaces | ||
373 | |||
374 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless! | ||
361 | 375 | ||
362 | // bring device UP | 376 | // bring device UP |
363 | iface->setUp( true ); | 377 | iface->setUp( true ); |
364 | if ( !iface->isUp() ) | 378 | if ( !iface->isUp() ) |
365 | { | 379 | { |
366 | QMessageBox::warning( this, "Wellenreiter II", | 380 | QMessageBox::warning( this, "Wellenreiter II", |
367 | tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) ); | 381 | tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) ); |
368 | return; | 382 | return; |
369 | } | 383 | } |
370 | 384 | ||
371 | // set monitor mode | 385 | // set monitor mode |
372 | bool usePrism = configwindow->usePrismHeader(); | 386 | bool usePrism = configwindow->usePrismHeader(); |
@@ -380,38 +394,47 @@ void Wellenreiter::startClicked() | |||
380 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; | 394 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; |
381 | case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; | 395 | case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; |
382 | default: assert( 0 ); // shouldn't reach this | 396 | default: assert( 0 ); // shouldn't reach this |
383 | } | 397 | } |
384 | 398 | ||
385 | // switch device into monitor mode | 399 | // switch device into monitor mode |
386 | if ( cardtype < DEVTYPE_FILE ) | 400 | if ( cardtype < DEVTYPE_FILE ) |
387 | { | 401 | { |
388 | if ( cardtype != DEVTYPE_MANUAL ) | 402 | if ( cardtype != DEVTYPE_MANUAL ) |
389 | iface->setMonitorMode( true ); | 403 | iface->setMonitorMode( true ); |
390 | if ( !iface->monitorMode() ) | 404 | if ( !iface->monitorMode() ) |
391 | { | 405 | { |
392 | QMessageBox::warning( this, "Wellenreiter II", | 406 | if ( QMessageBox::warning( this, "Wellenreiter II", |
393 | tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) ); | 407 | tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) + |
394 | return; | 408 | tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) |
409 | return; | ||
395 | } | 410 | } |
396 | } | 411 | } |
397 | 412 | ||
413 | // open GPS device | ||
414 | if ( configwindow->enableGPS->isChecked() ) | ||
415 | { | ||
416 | qDebug( "Wellenreiter:GPS enabled @ %s:%d", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); | ||
417 | gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); | ||
418 | } | ||
419 | |||
398 | // open pcap and start sniffing | 420 | // open pcap and start sniffing |
399 | if ( cardtype != DEVTYPE_FILE ) | 421 | if ( cardtype != DEVTYPE_FILE ) |
400 | { | 422 | { |
401 | pcap->open( interface ); | 423 | pcap->open( interface ); |
402 | 424 | ||
403 | if ( configwindow->writeCaptureFile->isOn() ) | 425 | if ( configwindow->writeCaptureFile->isChecked() ) |
404 | { | 426 | { |
405 | QString dumpname( configwindow->captureFileName->text() ); | 427 | QString dumpname( configwindow->captureFileName->text() ); |
428 | if ( dumpname.isEmpty() ) dumpname = "captureFile"; | ||
406 | dumpname.append( '-' ); | 429 | dumpname.append( '-' ); |
407 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); | 430 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); |
408 | dumpname.append( ".wellenreiter" ); | 431 | dumpname.append( ".wellenreiter" ); |
409 | pcap->openDumpFile( dumpname ); | 432 | pcap->openDumpFile( dumpname ); |
410 | } | 433 | } |
411 | else | 434 | else |
412 | { | 435 | { |
413 | pcap->open( interface ); | 436 | pcap->open( interface ); |
414 | } | 437 | } |
415 | } | 438 | } |
416 | else | 439 | else |
417 | { | 440 | { |
@@ -421,25 +444,28 @@ void Wellenreiter::startClicked() | |||
421 | if ( !pcap->isOpen() ) | 444 | if ( !pcap->isOpen() ) |
422 | { | 445 | { |
423 | QMessageBox::warning( this, "Wellenreiter II", | 446 | QMessageBox::warning( this, "Wellenreiter II", |
424 | tr( "Can't open packet capturer for '%1':\n" ).arg( iface->name() ) + QString(strerror( errno ) )); | 447 | tr( "Can't open packet capturer for '%1':\n" ).arg( iface->name() ) + QString(strerror( errno ) )); |
425 | return; | 448 | return; |
426 | } | 449 | } |
427 | 450 | ||
428 | // set capturer to non-blocking mode | 451 | // set capturer to non-blocking mode |
429 | pcap->setBlocking( false ); | 452 | pcap->setBlocking( false ); |
430 | 453 | ||
431 | // start channel hopper | 454 | // start channel hopper |
432 | if ( cardtype != DEVTYPE_FILE ) | 455 | if ( cardtype != DEVTYPE_FILE ) |
433 | iface->setChannelHopping( 1000 ); //use interval from config window | 456 | { |
457 | logwindow->log( QString().sprintf( "(i) Starting channel hopper (d=%d ms)", configwindow->hopInterval->value() ) ); | ||
458 | iface->setChannelHopping( configwindow->hopInterval->value() ); //use interval from config window | ||
459 | } | ||
434 | 460 | ||
435 | if ( cardtype != DEVTYPE_FILE ) | 461 | if ( cardtype != DEVTYPE_FILE ) |
436 | { | 462 | { |
437 | // connect socket notifier and start channel hopper | 463 | // connect socket notifier and start channel hopper |
438 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | 464 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); |
439 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | 465 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); |
440 | } | 466 | } |
441 | else | 467 | else |
442 | { | 468 | { |
443 | // start timer for reading packets | 469 | // start timer for reading packets |
444 | startTimer( 100 ); | 470 | startTimer( 100 ); |
445 | } | 471 | } |
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h index e1062df..43f6f99 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.h +++ b/noncore/net/wellenreiter/gui/wellenreiter.h | |||
@@ -24,24 +24,25 @@ using namespace Opie; | |||
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | class QTimerEvent; | 26 | class QTimerEvent; |
27 | class QPixmap; | 27 | class QPixmap; |
28 | class OPacket; | 28 | class OPacket; |
29 | class OWaveLanManagementPacket; | 29 | class OWaveLanManagementPacket; |
30 | class OWaveLanDataPacket; | 30 | class OWaveLanDataPacket; |
31 | class OPacketCapturer; | 31 | class OPacketCapturer; |
32 | class OWirelessNetworkInterface; | 32 | class OWirelessNetworkInterface; |
33 | class WellenreiterConfigWindow; | 33 | class WellenreiterConfigWindow; |
34 | class MLogWindow; | 34 | class MLogWindow; |
35 | class MHexWindow; | 35 | class MHexWindow; |
36 | class GPS; | ||
36 | 37 | ||
37 | class Wellenreiter : public WellenreiterBase { | 38 | class Wellenreiter : public WellenreiterBase { |
38 | Q_OBJECT | 39 | Q_OBJECT |
39 | 40 | ||
40 | public: | 41 | public: |
41 | Wellenreiter( QWidget* parent = 0 ); | 42 | Wellenreiter( QWidget* parent = 0 ); |
42 | ~Wellenreiter(); | 43 | ~Wellenreiter(); |
43 | 44 | ||
44 | void setConfigWindow( WellenreiterConfigWindow* cw ); | 45 | void setConfigWindow( WellenreiterConfigWindow* cw ); |
45 | MScanListView* netView() const { return netview; }; | 46 | MScanListView* netView() const { return netview; }; |
46 | MLogWindow* logWindow() const { return logwindow; }; | 47 | MLogWindow* logWindow() const { return logwindow; }; |
47 | MHexWindow* hexWindow() const { return hexwindow; }; | 48 | MHexWindow* hexWindow() const { return hexwindow; }; |
@@ -72,20 +73,21 @@ class Wellenreiter : public WellenreiterBase { | |||
72 | void doAction( const QString& action, const QString& protocol, OPacket* p ); | 73 | void doAction( const QString& action, const QString& protocol, OPacket* p ); |
73 | QObject* childIfToParse( OPacket* p, const QString& protocol ); | 74 | QObject* childIfToParse( OPacket* p, const QString& protocol ); |
74 | bool checkDumpPacket( OPacket* p ); | 75 | bool checkDumpPacket( OPacket* p ); |
75 | 76 | ||
76 | private: | 77 | private: |
77 | #ifdef QWS | 78 | #ifdef QWS |
78 | OSystem _system; // Opie Operating System identifier | 79 | OSystem _system; // Opie Operating System identifier |
79 | #endif | 80 | #endif |
80 | 81 | ||
81 | OWirelessNetworkInterface* iface; | 82 | OWirelessNetworkInterface* iface; |
82 | OPacketCapturer* pcap; | 83 | OPacketCapturer* pcap; |
83 | WellenreiterConfigWindow* configwindow; | 84 | WellenreiterConfigWindow* configwindow; |
85 | GPS* gps; | ||
84 | 86 | ||
85 | //void readConfig(); | 87 | //void readConfig(); |
86 | //void writeConfig(); | 88 | //void writeConfig(); |
87 | }; | 89 | }; |
88 | 90 | ||
89 | 91 | ||
90 | 92 | ||
91 | #endif | 93 | #endif |