author | wimpie <wimpie> | 2005-01-06 17:59:54 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-06 17:59:54 (UTC) |
commit | 006091cfc3bb54286fd4dd74773fe5c09048077b (patch) (unidiff) | |
tree | 23075790a300998a674dafe104fdc05bb6d19789 /noncore/settings/networksettings2/opietooth2 | |
parent | fab28788f055b998803df9a6e8cfe2a4f9122351 (diff) | |
download | opie-006091cfc3bb54286fd4dd74773fe5c09048077b.zip opie-006091cfc3bb54286fd4dd74773fe5c09048077b.tar.gz opie-006091cfc3bb54286fd4dd74773fe5c09048077b.tar.bz2 |
Forgot networktemplate files
HCIdump seems to work -> bt sniffing is possible
Diffstat (limited to 'noncore/settings/networksettings2/opietooth2') (more/less context) (show whitespace changes)
3 files changed, 34 insertions, 21 deletions
diff --git a/noncore/settings/networksettings2/opietooth2/OTSniffGUI.ui b/noncore/settings/networksettings2/opietooth2/OTSniffGUI.ui index 9ef540e..ec0b387 100644 --- a/noncore/settings/networksettings2/opietooth2/OTSniffGUI.ui +++ b/noncore/settings/networksettings2/opietooth2/OTSniffGUI.ui | |||
@@ -9,30 +9,33 @@ | |||
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>274</width> | 14 | <width>274</width> |
15 | <height>160</height> | 15 | <height>173</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Bluetooth Sniffing</string> | 20 | <string>Bluetooth Sniffing</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | ||
26 | <name>layoutSpacing</name> | ||
27 | </property> | ||
25 | <vbox> | 28 | <vbox> |
26 | <property stdset="1"> | 29 | <property stdset="1"> |
27 | <name>margin</name> | 30 | <name>margin</name> |
28 | <number>3</number> | 31 | <number>3</number> |
29 | </property> | 32 | </property> |
30 | <property stdset="1"> | 33 | <property stdset="1"> |
31 | <name>spacing</name> | 34 | <name>spacing</name> |
32 | <number>6</number> | 35 | <number>2</number> |
33 | </property> | 36 | </property> |
34 | <widget> | 37 | <widget> |
35 | <class>QLayoutWidget</class> | 38 | <class>QLayoutWidget</class> |
36 | <property stdset="1"> | 39 | <property stdset="1"> |
37 | <name>name</name> | 40 | <name>name</name> |
38 | <cstring>Layout3</cstring> | 41 | <cstring>Layout3</cstring> |
@@ -121,20 +124,16 @@ | |||
121 | <string>Trace</string> | 124 | <string>Trace</string> |
122 | </property> | 125 | </property> |
123 | </widget> | 126 | </widget> |
124 | </hbox> | 127 | </hbox> |
125 | </widget> | 128 | </widget> |
126 | <widget> | 129 | <widget> |
127 | <class>QListBox</class> | 130 | <class>QTextView</class> |
128 | <property stdset="1"> | 131 | <property stdset="1"> |
129 | <name>name</name> | 132 | <name>name</name> |
130 | <cstring>Output_LB</cstring> | 133 | <cstring>Output_TV</cstring> |
131 | </property> | ||
132 | <property stdset="1"> | ||
133 | <name>selectionMode</name> | ||
134 | <enum>NoSelection</enum> | ||
135 | </property> | 134 | </property> |
136 | </widget> | 135 | </widget> |
137 | <widget> | 136 | <widget> |
138 | <class>QLayoutWidget</class> | 137 | <class>QLayoutWidget</class> |
139 | <property stdset="1"> | 138 | <property stdset="1"> |
140 | <name>name</name> | 139 | <name>name</name> |
diff --git a/noncore/settings/networksettings2/opietooth2/Opietooth.cpp b/noncore/settings/networksettings2/opietooth2/Opietooth.cpp index 5a890da..b14cc2f 100644 --- a/noncore/settings/networksettings2/opietooth2/Opietooth.cpp +++ b/noncore/settings/networksettings2/opietooth2/Opietooth.cpp | |||
@@ -18,13 +18,15 @@ using namespace Opie::Ui; | |||
18 | #include <qlayout.h> | 18 | #include <qlayout.h> |
19 | #include <qlistbox.h> | 19 | #include <qlistbox.h> |
20 | #include <qlistview.h> | 20 | #include <qlistview.h> |
21 | #include <qmessagebox.h> | 21 | #include <qmessagebox.h> |
22 | #include <qprogressbar.h> | 22 | #include <qprogressbar.h> |
23 | #include <qpushbutton.h> | 23 | #include <qpushbutton.h> |
24 | #include <qscrollbar.h> | ||
24 | #include <qtextstream.h> | 25 | #include <qtextstream.h> |
26 | #include <qtextview.h> | ||
25 | 27 | ||
26 | #include <Opietooth.h> | 28 | #include <Opietooth.h> |
27 | #include <OTDriver.h> | 29 | #include <OTDriver.h> |
28 | #include <OTPeer.h> | 30 | #include <OTPeer.h> |
29 | #include <OTGateway.h> | 31 | #include <OTGateway.h> |
30 | #include <OTSDPAttribute.h> | 32 | #include <OTSDPAttribute.h> |
@@ -117,29 +119,33 @@ private : | |||
117 | // | 119 | // |
118 | 120 | ||
119 | OTSniffing::OTSniffing( QWidget * parent ) : OTSniffGUI( parent ) { | 121 | OTSniffing::OTSniffing( QWidget * parent ) : OTSniffGUI( parent ) { |
120 | 122 | ||
121 | OT = OTGateway::getOTGateway(); | 123 | OT = OTGateway::getOTGateway(); |
122 | HciDump = 0; | 124 | HciDump = 0; |
123 | Sys = new System(); | ||
124 | } | 125 | } |
125 | 126 | ||
126 | OTSniffing::~OTSniffing() { | 127 | OTSniffing::~OTSniffing() { |
127 | printf( "CLOSE \n" ); | 128 | SLOT_Trace( 0 ); |
129 | } | ||
130 | |||
131 | void OTSniffing::SLOT_Trace( bool Run ) { | ||
132 | |||
133 | if( ! Run ) { | ||
128 | if ( HciDump ) { | 134 | if ( HciDump ) { |
129 | HciDump->process().kill(); | 135 | HciDump->process().kill(); |
130 | delete HciDump; | 136 | delete HciDump; |
131 | } | 137 | } |
132 | delete Sys; | 138 | HciDump = 0; |
139 | return; | ||
133 | } | 140 | } |
134 | 141 | ||
135 | void OTSniffing::SLOT_Trace( bool ) { | ||
136 | HciDump = new MyProcess(); | 142 | HciDump = new MyProcess(); |
137 | QStringList SL; | 143 | QStringList SL; |
138 | 144 | ||
139 | SL << "hcidump"; | 145 | SL << "/usr/sbin/hcidump"; |
140 | switch( DataFormat_CB->currentItem() ) { | 146 | switch( DataFormat_CB->currentItem() ) { |
141 | case 0 : // Hex | 147 | case 0 : // Hex |
142 | SL << "-x"; | 148 | SL << "-x"; |
143 | break; | 149 | break; |
144 | case 1 : // Ascii | 150 | case 1 : // Ascii |
145 | SL << "-a"; | 151 | SL << "-a"; |
@@ -159,28 +165,36 @@ void OTSniffing::SLOT_Trace( bool ) { | |||
159 | 165 | ||
160 | connect( HciDump, | 166 | connect( HciDump, |
161 | SIGNAL(processExited(MyProcess*) ), | 167 | SIGNAL(processExited(MyProcess*) ), |
162 | this, | 168 | this, |
163 | SLOT( SLOT_ProcessExited(MyProcess*) ) ); | 169 | SLOT( SLOT_ProcessExited(MyProcess*) ) ); |
164 | 170 | ||
165 | if( ! Sys->runAsRoot( SL, HciDump ) ) { | 171 | HciDump->process() << SL; |
172 | |||
173 | if( ! HciDump->process().start( OProcess::DontCare, | ||
174 | OProcess::AllOutput ) | ||
175 | ) { | ||
166 | QMessageBox::warning(0, | 176 | QMessageBox::warning(0, |
167 | tr("Run hcidump"), | 177 | tr("Run hcidump"), |
168 | tr("Cannot start %1").arg(SL.join(" ")) | 178 | tr("Cannot start %1").arg(SL.join(" ")) |
169 | ); | 179 | ); |
170 | delete HciDump; | 180 | delete HciDump; |
171 | HciDump = 0; | 181 | HciDump = 0; |
172 | } | 182 | } |
173 | 183 | ||
174 | } | 184 | } |
175 | 185 | ||
176 | void OTSniffing::SLOT_Show( const QString & S ) { | 186 | void OTSniffing::SLOT_Show( const QString & S ) { |
177 | printf( "%s\n", S.latin1() ); | 187 | printf( "%s\n", S.latin1() ); |
178 | Output_LB->insertItem( S ); | 188 | Output_TV->setText( Output_TV->text() + S + "\n" ); |
179 | Output_LB->setCurrentItem( Output_LB->count()-1 ); | 189 | |
180 | Output_LB->ensureCurrentVisible(); | 190 | QScrollBar *scroll = Output_TV->verticalScrollBar(); |
191 | scroll->setValue(scroll->maxValue()); | ||
192 | //Output_LB->insertItem( S ); | ||
193 | //Output_LB->setCurrentItem( Output_LB->count()-1 ); | ||
194 | //Output_LB->ensureCurrentVisible(); | ||
181 | } | 195 | } |
182 | 196 | ||
183 | void OTSniffing::SLOT_ProcessExited( MyProcess * ) { | 197 | void OTSniffing::SLOT_ProcessExited( MyProcess * ) { |
184 | printf( "Exited\n" ); | 198 | printf( "Exited\n" ); |
185 | delete HciDump; | 199 | delete HciDump; |
186 | HciDump = 0; | 200 | HciDump = 0; |
@@ -225,18 +239,20 @@ void OTSniffing::SLOT_Load( void ) { | |||
225 | ); | 239 | ); |
226 | return; | 240 | return; |
227 | } | 241 | } |
228 | QTextStream TS ( &F ); | 242 | QTextStream TS ( &F ); |
229 | SLOT_ClearLog(); | 243 | SLOT_ClearLog(); |
230 | S = TS.read(); | 244 | S = TS.read(); |
231 | Output_LB->insertStringList( QStringList::split( "\n", S ) ); | 245 | // Output_LB->insertStringList( QStringList::split( "\n", S ) ); |
246 | Output_TV->setText( S ); | ||
232 | } | 247 | } |
233 | } | 248 | } |
234 | 249 | ||
235 | void OTSniffing::SLOT_ClearLog( void ) { | 250 | void OTSniffing::SLOT_ClearLog( void ) { |
236 | Output_LB->clear(); | 251 | // Output_LB->clear(); |
252 | Output_TV->setText( "" ); | ||
237 | } | 253 | } |
238 | 254 | ||
239 | // | 255 | // |
240 | // | 256 | // |
241 | // | 257 | // |
242 | // | 258 | // |
diff --git a/noncore/settings/networksettings2/opietooth2/Opietooth.h b/noncore/settings/networksettings2/opietooth2/Opietooth.h index 2b20975..e66787f 100644 --- a/noncore/settings/networksettings2/opietooth2/Opietooth.h +++ b/noncore/settings/networksettings2/opietooth2/Opietooth.h | |||
@@ -1,13 +1,12 @@ | |||
1 | #ifndef OPIETOOTH_H | 1 | #ifndef OPIETOOTH_H |
2 | #define OPIETOOTH_H | 2 | #define OPIETOOTH_H |
3 | 3 | ||
4 | #include <OTIcons.h> | 4 | #include <OTIcons.h> |
5 | 5 | ||
6 | class MyProcess; | 6 | class MyProcess; |
7 | class System; | ||
8 | 7 | ||
9 | namespace Opie { | 8 | namespace Opie { |
10 | 9 | ||
11 | namespace Ui { | 10 | namespace Ui { |
12 | 11 | ||
13 | class OLedBox; | 12 | class OLedBox; |
@@ -48,13 +47,12 @@ signals : | |||
48 | protected : | 47 | protected : |
49 | 48 | ||
50 | private : | 49 | private : |
51 | 50 | ||
52 | OTGateway * OT; | 51 | OTGateway * OT; |
53 | MyProcess * HciDump; | 52 | MyProcess * HciDump; |
54 | System * Sys; | ||
55 | }; | 53 | }; |
56 | }; | 54 | }; |
57 | 55 | ||
58 | #include <OTPairingGUI.h> | 56 | #include <OTPairingGUI.h> |
59 | 57 | ||
60 | namespace Opietooth2 { | 58 | namespace Opietooth2 { |