author | wimpie <wimpie> | 2005-01-06 17:59:54 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-06 17:59:54 (UTC) |
commit | 006091cfc3bb54286fd4dd74773fe5c09048077b (patch) (side-by-side diff) | |
tree | 23075790a300998a674dafe104fdc05bb6d19789 /noncore/settings/networksettings2/opietooth2/Opietooth.cpp | |
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/Opietooth.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/opietooth2/Opietooth.cpp | 38 |
1 files changed, 27 insertions, 11 deletions
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; #include <qlayout.h> #include <qlistbox.h> #include <qlistview.h> #include <qmessagebox.h> #include <qprogressbar.h> #include <qpushbutton.h> +#include <qscrollbar.h> #include <qtextstream.h> +#include <qtextview.h> #include <Opietooth.h> #include <OTDriver.h> #include <OTPeer.h> #include <OTGateway.h> #include <OTSDPAttribute.h> @@ -117,29 +119,33 @@ private : // OTSniffing::OTSniffing( QWidget * parent ) : OTSniffGUI( parent ) { OT = OTGateway::getOTGateway(); HciDump = 0; - Sys = new System(); } OTSniffing::~OTSniffing() { - printf( "CLOSE \n" ); + SLOT_Trace( 0 ); +} + +void OTSniffing::SLOT_Trace( bool Run ) { + + if( ! Run ) { if ( HciDump ) { HciDump->process().kill(); delete HciDump; } - delete Sys; + HciDump = 0; + return; } -void OTSniffing::SLOT_Trace( bool ) { HciDump = new MyProcess(); QStringList SL; - SL << "hcidump"; + SL << "/usr/sbin/hcidump"; switch( DataFormat_CB->currentItem() ) { case 0 : // Hex SL << "-x"; break; case 1 : // Ascii SL << "-a"; @@ -159,28 +165,36 @@ void OTSniffing::SLOT_Trace( bool ) { connect( HciDump, SIGNAL(processExited(MyProcess*) ), this, SLOT( SLOT_ProcessExited(MyProcess*) ) ); - if( ! Sys->runAsRoot( SL, HciDump ) ) { + HciDump->process() << SL; + + if( ! HciDump->process().start( OProcess::DontCare, + OProcess::AllOutput ) + ) { QMessageBox::warning(0, tr("Run hcidump"), tr("Cannot start %1").arg(SL.join(" ")) ); delete HciDump; HciDump = 0; } } void OTSniffing::SLOT_Show( const QString & S ) { printf( "%s\n", S.latin1() ); - Output_LB->insertItem( S ); - Output_LB->setCurrentItem( Output_LB->count()-1 ); - Output_LB->ensureCurrentVisible(); + Output_TV->setText( Output_TV->text() + S + "\n" ); + + QScrollBar *scroll = Output_TV->verticalScrollBar(); + scroll->setValue(scroll->maxValue()); + //Output_LB->insertItem( S ); + //Output_LB->setCurrentItem( Output_LB->count()-1 ); + //Output_LB->ensureCurrentVisible(); } void OTSniffing::SLOT_ProcessExited( MyProcess * ) { printf( "Exited\n" ); delete HciDump; HciDump = 0; @@ -225,18 +239,20 @@ void OTSniffing::SLOT_Load( void ) { ); return; } QTextStream TS ( &F ); SLOT_ClearLog(); S = TS.read(); - Output_LB->insertStringList( QStringList::split( "\n", S ) ); + // Output_LB->insertStringList( QStringList::split( "\n", S ) ); + Output_TV->setText( S ); } } void OTSniffing::SLOT_ClearLog( void ) { - Output_LB->clear(); + // Output_LB->clear(); + Output_TV->setText( "" ); } // // // // |