From 006091cfc3bb54286fd4dd74773fe5c09048077b Mon Sep 17 00:00:00 2001 From: wimpie Date: Thu, 06 Jan 2005 17:59:54 +0000 Subject: Forgot networktemplate files HCIdump seems to work -> bt sniffing is possible --- (limited to 'noncore/settings/networksettings2/opietooth2') 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 @@ -12,7 +12,7 @@ 0 0 274 - 160 + 173 @@ -22,6 +22,9 @@ layoutMargin + + layoutSpacing + margin @@ -29,7 +32,7 @@ spacing - 6 + 2 QLayoutWidget @@ -124,14 +127,10 @@ - QListBox + QTextView name - Output_LB - - - selectionMode - NoSelection + Output_TV 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 @@ -21,7 +21,9 @@ using namespace Opie::Ui; #include #include #include +#include #include +#include #include #include @@ -120,23 +122,27 @@ OTSniffing::OTSniffing( QWidget * parent ) : OTSniffGUI( parent ) { OT = OTGateway::getOTGateway(); HciDump = 0; - Sys = new System(); } OTSniffing::~OTSniffing() { - printf( "CLOSE \n" ); - if ( HciDump ) { - HciDump->process().kill(); - delete HciDump; - } - delete Sys; + SLOT_Trace( 0 ); } -void OTSniffing::SLOT_Trace( bool ) { +void OTSniffing::SLOT_Trace( bool Run ) { + + if( ! Run ) { + if ( HciDump ) { + HciDump->process().kill(); + delete HciDump; + } + HciDump = 0; + return; + } + HciDump = new MyProcess(); QStringList SL; - SL << "hcidump"; + SL << "/usr/sbin/hcidump"; switch( DataFormat_CB->currentItem() ) { case 0 : // Hex SL << "-x"; @@ -162,7 +168,11 @@ void OTSniffing::SLOT_Trace( bool ) { 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(" ")) @@ -175,9 +185,13 @@ void OTSniffing::SLOT_Trace( bool ) { 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 * ) { @@ -228,12 +242,14 @@ void OTSniffing::SLOT_Load( void ) { 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( "" ); } // 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 @@ -4,7 +4,6 @@ #include class MyProcess; -class System; namespace Opie { @@ -51,7 +50,6 @@ private : OTGateway * OT; MyProcess * HciDump; - System * Sys; }; }; -- cgit v0.9.0.2