summaryrefslogtreecommitdiff
authorwimpie <wimpie>2005-01-06 17:59:54 (UTC)
committer wimpie <wimpie>2005-01-06 17:59:54 (UTC)
commit006091cfc3bb54286fd4dd74773fe5c09048077b (patch) (side-by-side diff)
tree23075790a300998a674dafe104fdc05bb6d19789
parentfab28788f055b998803df9a6e8cfe2a4f9122351 (diff)
downloadopie-006091cfc3bb54286fd4dd74773fe5c09048077b.zip
opie-006091cfc3bb54286fd4dd74773fe5c09048077b.tar.gz
opie-006091cfc3bb54286fd4dd74773fe5c09048077b.tar.bz2
Forgot networktemplate files
HCIdump seems to work -> bt sniffing is possible
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/networksettings2/system.cpp7
-rw-r--r--noncore/settings/networksettings2/opie-networksettings2.control2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTSniffGUI.ui15
-rw-r--r--noncore/settings/networksettings2/opietooth2/Opietooth.cpp46
-rw-r--r--noncore/settings/networksettings2/opietooth2/Opietooth.h2
5 files changed, 43 insertions, 29 deletions
diff --git a/noncore/settings/networksettings2/networksettings2/system.cpp b/noncore/settings/networksettings2/networksettings2/system.cpp
index 9512579..e642c08 100644
--- a/noncore/settings/networksettings2/networksettings2/system.cpp
+++ b/noncore/settings/networksettings2/networksettings2/system.cpp
@@ -35,24 +35,25 @@ static char Dig2Hex[] = {
'0', '1', '2', '3',
'4', '5', '6', '7',
'8', '9', 'A', 'B',
'C', 'D', 'E', 'F'
};
// get HIGH nibble of byte
#define HN(x) Dig2Hex[(((x)&0xf0)>>4)]
// get LOW nibble of byte
#define LN(x) Dig2Hex[((x)&0x0f)]
System::System( void ) : QObject(), ProbedInterfaces() {
+ ProcDevNet = 0;
}
System::~System( void ) {
if( ProcDevNet )
delete ProcDevNet;
}
QDict<InterfaceInfo> & System::interfaces( void ) {
if( ProbedInterfaces.count() == 0 ) {
probeInterfaces();
}
return ProbedInterfaces;
@@ -100,31 +101,31 @@ int System::runAsRoot( QStringList & S, MyProcess * Prc ) {
}
P->process() << S;
Log(("Executing %s\n", S.join( " " ).latin1() ));
if( ! P->process().start( OProcess::DontCare,
OProcess::AllOutput ) ) {
owarn << "Error starting " << S << oendl;
if( ! Prc )
delete P;
// error starting app
- return 1;
+ return 0;
}
owarn << "Started " << S << oendl;
}
// all is fine
- return 0;
+ return 1;
}
int System::execAsUser( QStringList & SL ) {
MyProcess * P = new MyProcess();
CurrentQPEUser CU = NSResources->currentUser();
char * usr = getenv("USER");
if( strcmp( usr, "root" ) == 0 ) {
// find user running qpe
if( CU.UserName.isEmpty() ) {
// if we come here, the exec was not successfull
Log(("User not known \n" ));
@@ -152,25 +153,25 @@ int System::execAsUser( QStringList & SL ) {
CU.UserName.latin1(),
SL.join( " " ).latin1() ));
int rv = ( P->process().start( OProcess::DontCare,
OProcess::NoCommunication ) );
delete P;
if( rv ) {
// if we come here, the exec was not successfull
Log(("Could not exec : %d\n", errno ));
}
- return rv;
+ return ! rv;
}
void System::SLOT_ProcessExited( MyProcess * P ) {
QString R;
for( QValueListConstIterator<QCString> it = P->process().args().begin();
it != P->process().args().end();
++it ) {
R += (*it);
R += " ";
}
diff --git a/noncore/settings/networksettings2/opie-networksettings2.control b/noncore/settings/networksettings2/opie-networksettings2.control
index e4bd29c..874833c 100644
--- a/noncore/settings/networksettings2/opie-networksettings2.control
+++ b/noncore/settings/networksettings2/opie-networksettings2.control
@@ -1,10 +1,10 @@
Package: opie-networksettings2
-Files: bin/networksettings2 apps/Settings/networksettings2.desktop pics/networksettings2/*.png lib/libnetworksettings2.so* pics/networksettings2/Devices/*.png
+Files: bin/networksettings2 apps/Settings/networksettings2.desktop pics/networksettings2/*.png lib/libnetworksettings2.so* pics/networksettings2/Devices/*.png etc/NS2templates/* etc/NS2templates/*/*
Priority: optional
Section: opie/settings
Maintainer: wim delvaux <wimpie@handhelds.org>
Architecture: arm
Depends: task-opie-minimal, libopietooth2
Description: Network settings.
Replaces: opie-networksetup
Version: $QPE_VERSION$EXTRAVERSION
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
@@ -3,42 +3,45 @@
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>OTSniffGUI</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
<width>274</width>
- <height>160</height>
+ <height>173</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Bluetooth Sniffing</string>
</property>
<property>
<name>layoutMargin</name>
</property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>3</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>6</number>
+ <number>2</number>
</property>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout3</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
@@ -115,32 +118,28 @@
<property stdset="1">
<name>name</name>
<cstring>EnableTrace_CB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Trace</string>
</property>
</widget>
</hbox>
</widget>
<widget>
- <class>QListBox</class>
+ <class>QTextView</class>
<property stdset="1">
<name>name</name>
- <cstring>Output_LB</cstring>
- </property>
- <property stdset="1">
- <name>selectionMode</name>
- <enum>NoSelection</enum>
+ <cstring>Output_TV</cstring>
</property>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout3</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
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
@@ -12,25 +12,27 @@ using namespace Opie::Ui;
#include <qdialog.h>
#include <qdir.h>
#include <qfile.h>
#include <qgroupbox.h>
#include <qheader.h>
#include <qlabel.h>
#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>
#include <OTSDPService.h>
#include <OTInquiry.h>
#include <system.h>
using namespace Opietooth2;
@@ -111,41 +113,45 @@ private :
};
//
//
//
//
//
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";
break;
case 1 : // Ascii
SL << "-a";
break;
case 2 : // both
SL << "-X";
break;
}
@@ -153,40 +159,48 @@ void OTSniffing::SLOT_Trace( bool ) {
SL << OT->scanWith()->devname();
connect( HciDump,
SIGNAL( stdoutLine( const QString & ) ),
this,
SLOT( SLOT_Show( const QString & ) ) );
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;
}
void OTSniffing::SLOT_Save( void ) {
QString S = OFileDialog::getSaveFileName(
OFileSelector::Extended,
QDir::home().path(),
@@ -219,30 +233,32 @@ void OTSniffing::SLOT_Load( void ) {
if( ! S.isEmpty() ) {
QFile F( S );
if( ! F.open( IO_ReadOnly ) ) {
QMessageBox::warning(0,
tr("Save log"),
tr("Cannot open %1").arg(S)
);
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( "" );
}
//
//
//
//
//
OTPairing::OTPairing( QWidget * parent, OTIcons * _IC ) :
OTPairingGUI( parent ) {
OT = OTGateway::getOTGateway();
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,19 +1,18 @@
#ifndef OPIETOOTH_H
#define OPIETOOTH_H
#include <OTIcons.h>
class MyProcess;
-class System;
namespace Opie {
namespace Ui {
class OLedBox;
};
};
#include <OTSniffGUI.h>
@@ -42,25 +41,24 @@ private slots :
void SLOT_Save( void );
void SLOT_ProcessExited( MyProcess * );
void SLOT_Show( const QString & );
signals :
protected :
private :
OTGateway * OT;
MyProcess * HciDump;
- System * Sys;
};
};
#include <OTPairingGUI.h>
namespace Opietooth2 {
class OTPairing : public OTPairingGUI {
Q_OBJECT
public :