7 files changed, 185 insertions, 42 deletions
diff --git a/noncore/settings/networksettings2/gprs/opie-networksettings2plugin-network.control b/noncore/settings/networksettings2/gprs/opie-networksettings2plugin-network.control index 902ebff..7e904bb 100644 --- a/noncore/settings/networksettings2/gprs/opie-networksettings2plugin-network.control +++ b/noncore/settings/networksettings2/gprs/opie-networksettings2plugin-network.control | |||
@@ -1,9 +1,9 @@ | |||
1 | Package: opie-networksettings2plugin-GPRS | 1 | Package: opie-networksettings2plugin-gprs |
2 | Files: plugins/networksettings2/libGPRS.so* | 2 | Files: plugins/networksettings2/libGPRS.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Maintainer: Wim Delvaux <wimpie@handhelds.org> | 5 | Maintainer: Wim Delvaux <wimpie@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: opie-networksettings2, libopiecore2, libopienet2 | 7 | Depends: opie-networksettings2, libopiecore2, libopienet2 |
8 | Description: Setup GPRS network | 8 | Description: Setup GPRS network |
9 | Version: $QPE_VERSION$EXTRAVERSION | 9 | Version: $QPE_VERSION$EXTRAVERSION |
diff --git a/noncore/settings/networksettings2/networksettings2/system.cpp b/noncore/settings/networksettings2/networksettings2/system.cpp index 141484c..9512579 100644 --- a/noncore/settings/networksettings2/networksettings2/system.cpp +++ b/noncore/settings/networksettings2/networksettings2/system.cpp | |||
@@ -23,99 +23,112 @@ | |||
23 | #include <qapplication.h> | 23 | #include <qapplication.h> |
24 | 24 | ||
25 | #include "resources.h" | 25 | #include "resources.h" |
26 | #include "system.h" | 26 | #include "system.h" |
27 | 27 | ||
28 | #define PROCNETDEV "/proc/net/dev" | 28 | #define PROCNETDEV "/proc/net/dev" |
29 | 29 | ||
30 | #ifndef ARPHRD_IEEE80211 | 30 | #ifndef ARPHRD_IEEE80211 |
31 | #define ARPHRD_IEEE80211 801 | 31 | #define ARPHRD_IEEE80211 801 |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | static char Dig2Hex[] = { | 34 | static char Dig2Hex[] = { |
35 | '0', '1', '2', '3', | 35 | '0', '1', '2', '3', |
36 | '4', '5', '6', '7', | 36 | '4', '5', '6', '7', |
37 | '8', '9', 'A', 'B', | 37 | '8', '9', 'A', 'B', |
38 | 'C', 'D', 'E', 'F' | 38 | 'C', 'D', 'E', 'F' |
39 | }; | 39 | }; |
40 | 40 | ||
41 | // get HIGH nibble of byte | 41 | // get HIGH nibble of byte |
42 | #define HN(x) Dig2Hex[(((x)&0xf0)>>4)] | 42 | #define HN(x) Dig2Hex[(((x)&0xf0)>>4)] |
43 | // get LOW nibble of byte | 43 | // get LOW nibble of byte |
44 | #define LN(x) Dig2Hex[((x)&0x0f)] | 44 | #define LN(x) Dig2Hex[((x)&0x0f)] |
45 | 45 | ||
46 | System::System( void ) : QObject(), ProbedInterfaces() { | 46 | System::System( void ) : QObject(), ProbedInterfaces() { |
47 | probeInterfaces(); | ||
48 | } | 47 | } |
49 | 48 | ||
50 | System::~System( void ) { | 49 | System::~System( void ) { |
51 | if( ProcDevNet ) | 50 | if( ProcDevNet ) |
52 | delete ProcDevNet; | 51 | delete ProcDevNet; |
53 | } | 52 | } |
54 | 53 | ||
55 | int System::runAsRoot( QStringList & S ) { | 54 | QDict<InterfaceInfo> & System::interfaces( void ) { |
55 | if( ProbedInterfaces.count() == 0 ) { | ||
56 | probeInterfaces(); | ||
57 | } | ||
58 | return ProbedInterfaces; | ||
59 | } | ||
60 | |||
61 | int System::runAsRoot( QStringList & S, MyProcess * Prc ) { | ||
56 | char * usr = getenv("USER"); | 62 | char * usr = getenv("USER"); |
57 | 63 | ||
58 | if( S.count() == 0 ) { | 64 | if( S.count() == 0 ) { |
59 | // loophole to start shell | 65 | // loophole to start shell |
60 | return 8888; | 66 | return 8888; |
61 | } | 67 | } |
62 | if( usr == 0 || strcmp( usr, "root" ) ) { | 68 | if( usr == 0 || strcmp( usr, "root" ) ) { |
63 | // unknown or non-root user -> use SUDO | 69 | // unknown or non-root user -> use SUDO |
64 | S.prepend( "sudo" ); | 70 | S.prepend( "sudo" ); |
65 | } | 71 | } |
66 | 72 | ||
67 | if( getenv( "NS2TESTMODE" ) ) { | 73 | if( getenv( "NS2TESTMODE" ) ) { |
68 | owarn << "TESTMODE !!! execute " | 74 | owarn << "TESTMODE !!! execute " |
69 | << S.join( " ") | 75 | << S.join( " ") |
70 | << oendl; | 76 | << oendl; |
71 | } else { | 77 | } else { |
72 | MyProcess * P = new MyProcess(); | 78 | MyProcess * P; |
73 | emit processEvent( tr("Command : ") + S.join( " " ) ); | ||
74 | 79 | ||
75 | P->process() << S; | 80 | if( Prc ) { |
76 | 81 | P = Prc; | |
77 | connect( P, | 82 | } else { |
78 | SIGNAL( stdoutLine( const QString & ) ), | 83 | P = new MyProcess(); |
79 | this, | 84 | emit processEvent( tr("Command : ") + S.join( " " ) ); |
80 | SIGNAL( stdoutLine( const QString & ) ) ); | 85 | |
81 | 86 | connect( P, | |
82 | connect( P, | 87 | SIGNAL( stdoutLine( const QString & ) ), |
83 | SIGNAL( stderrLine( const QString & ) ), | 88 | this, |
84 | this, | 89 | SIGNAL( stdoutLine( const QString & ) ) ); |
85 | SIGNAL( stderrLine( const QString & ) ) ); | 90 | |
91 | connect( P, | ||
92 | SIGNAL( stderrLine( const QString & ) ), | ||
93 | this, | ||
94 | SIGNAL( stderrLine( const QString & ) ) ); | ||
95 | |||
96 | connect( P, | ||
97 | SIGNAL(processExited(MyProcess*) ), | ||
98 | this, SLOT | ||
99 | (SLOT_ProcessExited(MyProcess*) ) ); | ||
100 | } | ||
86 | 101 | ||
87 | connect( P, | 102 | P->process() << S; |
88 | SIGNAL(processExited(MyProcess*) ), | ||
89 | this, SLOT | ||
90 | (SLOT_ProcessExited(MyProcess*) ) ); | ||
91 | 103 | ||
92 | Log(("Executing %s\n", S.join( " " ).latin1() )); | 104 | Log(("Executing %s\n", S.join( " " ).latin1() )); |
93 | 105 | ||
94 | if( ! P->process().start( OProcess::DontCare, | 106 | if( ! P->process().start( OProcess::DontCare, |
95 | OProcess::AllOutput ) ) { | 107 | OProcess::AllOutput ) ) { |
96 | owarn << "Error starting " << S << oendl; | 108 | owarn << "Error starting " << S << oendl; |
97 | delete P; | 109 | if( ! Prc ) |
110 | delete P; | ||
98 | // error starting app | 111 | // error starting app |
99 | return 1; | 112 | return 1; |
100 | } | 113 | } |
101 | owarn << "Started " << S << oendl; | 114 | owarn << "Started " << S << oendl; |
102 | } | 115 | } |
103 | 116 | ||
104 | // all is fine | 117 | // all is fine |
105 | return 0; | 118 | return 0; |
106 | } | 119 | } |
107 | 120 | ||
108 | int System::execAsUser( QStringList & SL ) { | 121 | int System::execAsUser( QStringList & SL ) { |
109 | MyProcess * P = new MyProcess(); | 122 | MyProcess * P = new MyProcess(); |
110 | CurrentQPEUser CU = NSResources->currentUser(); | 123 | CurrentQPEUser CU = NSResources->currentUser(); |
111 | char * usr = getenv("USER"); | 124 | char * usr = getenv("USER"); |
112 | 125 | ||
113 | if( strcmp( usr, "root" ) == 0 ) { | 126 | if( strcmp( usr, "root" ) == 0 ) { |
114 | // find user running qpe | 127 | // find user running qpe |
115 | if( CU.UserName.isEmpty() ) { | 128 | if( CU.UserName.isEmpty() ) { |
116 | // if we come here, the exec was not successfull | 129 | // if we come here, the exec was not successfull |
117 | Log(("User not known \n" )); | 130 | Log(("User not known \n" )); |
118 | return 0; | 131 | return 0; |
119 | } | 132 | } |
120 | } | 133 | } |
121 | 134 | ||
diff --git a/noncore/settings/networksettings2/networksettings2/system.h b/noncore/settings/networksettings2/networksettings2/system.h index e67d695..f7a7274 100644 --- a/noncore/settings/networksettings2/networksettings2/system.h +++ b/noncore/settings/networksettings2/networksettings2/system.h | |||
@@ -75,55 +75,54 @@ public : | |||
75 | QString Netmask; // Netmask | 75 | QString Netmask; // Netmask |
76 | QString DstAddress; // Peer address (if P-t-P) | 76 | QString DstAddress; // Peer address (if P-t-P) |
77 | bool IsUp; // interface is UP | 77 | bool IsUp; // interface is UP |
78 | bool HasMulticast; // Supports Multicast | 78 | bool HasMulticast; // Supports Multicast |
79 | bool IsPointToPoint; // IsPointToPoint card | 79 | bool IsPointToPoint; // IsPointToPoint card |
80 | 80 | ||
81 | QString RcvBytes; | 81 | QString RcvBytes; |
82 | QString SndBytes; | 82 | QString SndBytes; |
83 | QString RcvErrors; | 83 | QString RcvErrors; |
84 | QString SndErrors; | 84 | QString SndErrors; |
85 | QString RcvDropped; | 85 | QString RcvDropped; |
86 | QString SndDropped; | 86 | QString SndDropped; |
87 | QString Collisions; | 87 | QString Collisions; |
88 | }; | 88 | }; |
89 | 89 | ||
90 | class System : public QObject { | 90 | class System : public QObject { |
91 | 91 | ||
92 | Q_OBJECT | 92 | Q_OBJECT |
93 | 93 | ||
94 | public : | 94 | public : |
95 | 95 | ||
96 | System( void ); | 96 | System( void ); |
97 | ~System( void ); | 97 | ~System( void ); |
98 | 98 | ||
99 | QDict<InterfaceInfo> & interfaces( void ) | 99 | QDict<InterfaceInfo> & interfaces( void ); |
100 | { return ProbedInterfaces; } | ||
101 | InterfaceInfo * interface( const QString& N ) | 100 | InterfaceInfo * interface( const QString& N ) |
102 | { return ProbedInterfaces[N]; } | 101 | { return interfaces()[N]; } |
103 | 102 | ||
104 | // exec command as root | 103 | // exec command as root |
105 | int runAsRoot( QStringList & S ); | 104 | int runAsRoot( QStringList & S, MyProcess * Prc = 0 ); |
106 | 105 | ||
107 | // exec command as user | 106 | // exec command as user |
108 | int execAsUser( QStringList & Cmd ); | 107 | int execAsUser( QStringList & Cmd ); |
109 | 108 | ||
110 | // refresh stats for this interface | 109 | // refresh stats for this interface |
111 | void refreshStatistics( InterfaceInfo & ); | 110 | void refreshStatistics( InterfaceInfo & ); |
112 | 111 | ||
113 | // reloads interfaces | 112 | // reloads interfaces |
114 | void probeInterfaces( void ); | 113 | void probeInterfaces( void ); |
115 | 114 | ||
116 | InterfaceInfo * findInterface( const QString & DevName ); | 115 | InterfaceInfo * findInterface( const QString & DevName ); |
117 | 116 | ||
118 | private slots : | 117 | private slots : |
119 | 118 | ||
120 | void SLOT_ProcessExited( MyProcess * ); | 119 | void SLOT_ProcessExited( MyProcess * ); |
121 | 120 | ||
122 | signals : | 121 | signals : |
123 | 122 | ||
124 | void stdoutLine( const QString & ); | 123 | void stdoutLine( const QString & ); |
125 | void stderrLine( const QString & ); | 124 | void stderrLine( const QString & ); |
126 | void processEvent( const QString & ); | 125 | void processEvent( const QString & ); |
127 | 126 | ||
128 | private : | 127 | private : |
129 | 128 | ||
diff --git a/noncore/settings/networksettings2/opietooth2/Opietooth.cpp b/noncore/settings/networksettings2/opietooth2/Opietooth.cpp index 2d4885c..5a890da 100644 --- a/noncore/settings/networksettings2/opietooth2/Opietooth.cpp +++ b/noncore/settings/networksettings2/opietooth2/Opietooth.cpp | |||
@@ -1,53 +1,59 @@ | |||
1 | #include <opie2/odebug.h> | 1 | #include <opie2/odebug.h> |
2 | #include <opie2/oledbox.h> | 2 | #include <opie2/oledbox.h> |
3 | #include <opie2/ofiledialog.h> | ||
4 | |||
3 | using namespace Opie::Core; | 5 | using namespace Opie::Core; |
4 | using namespace Opie::Ui; | 6 | using namespace Opie::Ui; |
5 | 7 | ||
6 | #include <qpe/resource.h> | 8 | #include <qpe/resource.h> |
9 | #include <qapplication.h> | ||
7 | #include <qcheckbox.h> | 10 | #include <qcheckbox.h> |
11 | #include <qcombobox.h> | ||
12 | #include <qdialog.h> | ||
13 | #include <qdir.h> | ||
14 | #include <qfile.h> | ||
8 | #include <qgroupbox.h> | 15 | #include <qgroupbox.h> |
9 | #include <qlabel.h> | ||
10 | #include <qprogressbar.h> | ||
11 | #include <qheader.h> | 16 | #include <qheader.h> |
12 | #include <qmessagebox.h> | ||
13 | #include <qapplication.h> | ||
14 | #include <qlistbox.h> | ||
15 | #include <qdialog.h> | ||
16 | #include <qlayout.h> | ||
17 | #include <qcombobox.h> | ||
18 | #include <qlabel.h> | 17 | #include <qlabel.h> |
18 | #include <qlayout.h> | ||
19 | #include <qlistbox.h> | ||
19 | #include <qlistview.h> | 20 | #include <qlistview.h> |
21 | #include <qmessagebox.h> | ||
22 | #include <qprogressbar.h> | ||
20 | #include <qpushbutton.h> | 23 | #include <qpushbutton.h> |
24 | #include <qtextstream.h> | ||
21 | 25 | ||
22 | #include <Opietooth.h> | 26 | #include <Opietooth.h> |
23 | #include <OTDriver.h> | 27 | #include <OTDriver.h> |
24 | #include <OTPeer.h> | 28 | #include <OTPeer.h> |
25 | #include <OTGateway.h> | 29 | #include <OTGateway.h> |
26 | #include <OTSDPAttribute.h> | 30 | #include <OTSDPAttribute.h> |
27 | #include <OTSDPService.h> | 31 | #include <OTSDPService.h> |
28 | #include <OTInquiry.h> | 32 | #include <OTInquiry.h> |
29 | 33 | ||
34 | #include <system.h> | ||
35 | |||
30 | using namespace Opietooth2; | 36 | using namespace Opietooth2; |
31 | 37 | ||
32 | namespace Opietooth2 { | 38 | namespace Opietooth2 { |
33 | 39 | ||
34 | class PeerLVI : public QListViewItem { | 40 | class PeerLVI : public QListViewItem { |
35 | 41 | ||
36 | public : | 42 | public : |
37 | 43 | ||
38 | PeerLVI( OTPeer * P, QListView * it ) : QListViewItem (it) { | 44 | PeerLVI( OTPeer * P, QListView * it ) : QListViewItem (it) { |
39 | Peer = P; | 45 | Peer = P; |
40 | } | 46 | } |
41 | ~PeerLVI( void ) { | 47 | ~PeerLVI( void ) { |
42 | } | 48 | } |
43 | 49 | ||
44 | inline OTPeer * peer( void ) | 50 | inline OTPeer * peer( void ) |
45 | { return Peer; } | 51 | { return Peer; } |
46 | 52 | ||
47 | private : | 53 | private : |
48 | 54 | ||
49 | OTPeer * Peer; | 55 | OTPeer * Peer; |
50 | }; | 56 | }; |
51 | 57 | ||
52 | class ChannelLVI : public QListViewItem { | 58 | class ChannelLVI : public QListViewItem { |
53 | 59 | ||
@@ -92,58 +98,163 @@ public : | |||
92 | LinkKeyLVI( int Ch, QListView * it ) : QListViewItem (it) { | 98 | LinkKeyLVI( int Ch, QListView * it ) : QListViewItem (it) { |
93 | LinkKey = Ch; | 99 | LinkKey = Ch; |
94 | } | 100 | } |
95 | ~LinkKeyLVI( void ) { | 101 | ~LinkKeyLVI( void ) { |
96 | } | 102 | } |
97 | 103 | ||
98 | inline int index( void ) | 104 | inline int index( void ) |
99 | { return LinkKey; } | 105 | { return LinkKey; } |
100 | 106 | ||
101 | private : | 107 | private : |
102 | 108 | ||
103 | int LinkKey; | 109 | int LinkKey; |
104 | }; | 110 | }; |
105 | }; | 111 | }; |
106 | 112 | ||
107 | // | 113 | // |
108 | // | 114 | // |
109 | // | 115 | // |
110 | // | 116 | // |
111 | // | 117 | // |
112 | 118 | ||
113 | OTSniffing::OTSniffing( QWidget * parent ) : OTSniffGUI( parent ) { | 119 | OTSniffing::OTSniffing( QWidget * parent ) : OTSniffGUI( parent ) { |
114 | 120 | ||
115 | OT = OTGateway::getOTGateway(); | 121 | OT = OTGateway::getOTGateway(); |
116 | 122 | HciDump = 0; | |
123 | Sys = new System(); | ||
117 | } | 124 | } |
118 | 125 | ||
119 | OTSniffing::~OTSniffing() { | 126 | OTSniffing::~OTSniffing() { |
127 | printf( "CLOSE \n" ); | ||
128 | if ( HciDump ) { | ||
129 | HciDump->process().kill(); | ||
130 | delete HciDump; | ||
131 | } | ||
132 | delete Sys; | ||
120 | } | 133 | } |
121 | 134 | ||
122 | void OTSniffing::SLOT_Trace( void ) { | 135 | void OTSniffing::SLOT_Trace( bool ) { |
136 | HciDump = new MyProcess(); | ||
137 | QStringList SL; | ||
138 | |||
139 | SL << "hcidump"; | ||
140 | switch( DataFormat_CB->currentItem() ) { | ||
141 | case 0 : // Hex | ||
142 | SL << "-x"; | ||
143 | break; | ||
144 | case 1 : // Ascii | ||
145 | SL << "-a"; | ||
146 | break; | ||
147 | case 2 : // both | ||
148 | SL << "-X"; | ||
149 | break; | ||
150 | } | ||
151 | |||
152 | SL << "-i"; | ||
153 | SL << OT->scanWith()->devname(); | ||
154 | |||
155 | connect( HciDump, | ||
156 | SIGNAL( stdoutLine( const QString & ) ), | ||
157 | this, | ||
158 | SLOT( SLOT_Show( const QString & ) ) ); | ||
159 | |||
160 | connect( HciDump, | ||
161 | SIGNAL(processExited(MyProcess*) ), | ||
162 | this, | ||
163 | SLOT( SLOT_ProcessExited(MyProcess*) ) ); | ||
164 | |||
165 | if( ! Sys->runAsRoot( SL, HciDump ) ) { | ||
166 | QMessageBox::warning(0, | ||
167 | tr("Run hcidump"), | ||
168 | tr("Cannot start %1").arg(SL.join(" ")) | ||
169 | ); | ||
170 | delete HciDump; | ||
171 | HciDump = 0; | ||
172 | } | ||
173 | |||
174 | } | ||
175 | |||
176 | void OTSniffing::SLOT_Show( const QString & S ) { | ||
177 | printf( "%s\n", S.latin1() ); | ||
178 | Output_LB->insertItem( S ); | ||
179 | Output_LB->setCurrentItem( Output_LB->count()-1 ); | ||
180 | Output_LB->ensureCurrentVisible(); | ||
181 | } | ||
182 | |||
183 | void OTSniffing::SLOT_ProcessExited( MyProcess * ) { | ||
184 | printf( "Exited\n" ); | ||
185 | delete HciDump; | ||
186 | HciDump = 0; | ||
187 | } | ||
188 | |||
189 | void OTSniffing::SLOT_Save( void ) { | ||
190 | QString S = OFileDialog::getSaveFileName( | ||
191 | OFileSelector::Extended, | ||
192 | QDir::home().path(), | ||
193 | QString::null, | ||
194 | MimeTypes(), | ||
195 | this ); | ||
196 | |||
197 | if( ! S.isEmpty() ) { | ||
198 | QFile F( S ); | ||
199 | if( ! F.open( IO_WriteOnly ) ) { | ||
200 | QMessageBox::warning(0, | ||
201 | tr("Save log"), | ||
202 | tr("Cannot open %1").arg(S) | ||
203 | ); | ||
204 | return; | ||
205 | } | ||
206 | QTextStream TS( &F ); | ||
207 | TS << S << endl; | ||
208 | } | ||
209 | } | ||
210 | |||
211 | void OTSniffing::SLOT_Load( void ) { | ||
212 | QString S = OFileDialog::getOpenFileName( | ||
213 | OFileSelector::Extended, | ||
214 | QDir::home().path(), | ||
215 | QString::null, | ||
216 | MimeTypes(), | ||
217 | this ); | ||
218 | |||
219 | if( ! S.isEmpty() ) { | ||
220 | QFile F( S ); | ||
221 | if( ! F.open( IO_ReadOnly ) ) { | ||
222 | QMessageBox::warning(0, | ||
223 | tr("Save log"), | ||
224 | tr("Cannot open %1").arg(S) | ||
225 | ); | ||
226 | return; | ||
227 | } | ||
228 | QTextStream TS ( &F ); | ||
229 | SLOT_ClearLog(); | ||
230 | S = TS.read(); | ||
231 | Output_LB->insertStringList( QStringList::split( "\n", S ) ); | ||
232 | } | ||
123 | } | 233 | } |
124 | 234 | ||
125 | void OTSniffing::SLOT_ClearLog( void ) { | 235 | void OTSniffing::SLOT_ClearLog( void ) { |
236 | Output_LB->clear(); | ||
126 | } | 237 | } |
127 | 238 | ||
128 | // | 239 | // |
129 | // | 240 | // |
130 | // | 241 | // |
131 | // | 242 | // |
132 | // | 243 | // |
133 | 244 | ||
134 | OTPairing::OTPairing( QWidget * parent, OTIcons * _IC ) : | 245 | OTPairing::OTPairing( QWidget * parent, OTIcons * _IC ) : |
135 | OTPairingGUI( parent ) { | 246 | OTPairingGUI( parent ) { |
136 | 247 | ||
137 | OT = OTGateway::getOTGateway(); | 248 | OT = OTGateway::getOTGateway(); |
138 | Icons = (_IC ) ? _IC : new OTIcons(); | 249 | Icons = (_IC ) ? _IC : new OTIcons(); |
139 | MyIcons = (_IC == 0 ); | 250 | MyIcons = (_IC == 0 ); |
140 | 251 | ||
141 | // unpairing can only be done if bluetooth is disabled | 252 | // unpairing can only be done if bluetooth is disabled |
142 | Unpair_But->setEnabled( ! OT->isEnabled() ); | 253 | Unpair_But->setEnabled( ! OT->isEnabled() ); |
143 | if( ! OT->isEnabled() ) { | 254 | if( ! OT->isEnabled() ) { |
144 | Unpair_LBL->hide(); | 255 | Unpair_LBL->hide(); |
145 | } else { | 256 | } else { |
146 | Unpair_LBL->show(); | 257 | Unpair_LBL->show(); |
147 | } | 258 | } |
148 | 259 | ||
149 | // open linkkey file and load pairs | 260 | // open linkkey file and load pairs |
@@ -1008,30 +1119,33 @@ void OTMain::SLOT_StateChange( OTDriver * D, bool Up ) { | |||
1008 | Icons->loadPixmap( (Up) ? "bluezon" : "bluezoff" ), | 1119 | Icons->loadPixmap( (Up) ? "bluezon" : "bluezoff" ), |
1009 | D->devname(), | 1120 | D->devname(), |
1010 | i ); | 1121 | i ); |
1011 | return; | 1122 | return; |
1012 | } | 1123 | } |
1013 | } | 1124 | } |
1014 | } | 1125 | } |
1015 | 1126 | ||
1016 | void OTMain::SLOT_Pairing( void ) { | 1127 | void OTMain::SLOT_Pairing( void ) { |
1017 | QDialog * Dlg = new QDialog( this, 0, TRUE ); | 1128 | QDialog * Dlg = new QDialog( this, 0, TRUE ); |
1018 | QVBoxLayout * V = new QVBoxLayout( Dlg ); | 1129 | QVBoxLayout * V = new QVBoxLayout( Dlg ); |
1019 | OTPairing * Pair = new OTPairing( Dlg, Icons ); | 1130 | OTPairing * Pair = new OTPairing( Dlg, Icons ); |
1020 | 1131 | ||
1021 | V->addWidget( Pair ); | 1132 | V->addWidget( Pair ); |
1022 | Dlg->showMaximized(); | 1133 | Dlg->showMaximized(); |
1023 | Dlg->setCaption( tr("Manage pairing" ) ); | 1134 | Dlg->setCaption( tr("Manage pairing" ) ); |
1024 | Dlg->exec(); | 1135 | Dlg->exec(); |
1025 | 1136 | ||
1026 | delete Dlg; | 1137 | delete Dlg; |
1027 | } | 1138 | } |
1028 | 1139 | ||
1029 | void OTMain::SLOT_Sniffing( void ) { | 1140 | void OTMain::SLOT_Sniffing( void ) { |
1030 | 1141 | ||
1031 | if( SnifWindow == 0 ) { | 1142 | if( SnifWindow == 0 ) { |
1032 | SnifWindow = new OTSniffing( this ); | 1143 | SnifWindow = new QDialog( this, 0, FALSE ); |
1144 | QVBoxLayout * V = new QVBoxLayout( SnifWindow ); | ||
1145 | OTSniffing * SN = new OTSniffing( SnifWindow ); | ||
1146 | V->addWidget( SN ); | ||
1033 | } | 1147 | } |
1034 | 1148 | ||
1035 | SnifWindow->showMaximized(); | 1149 | SnifWindow->showMaximized(); |
1036 | SnifWindow->show(); | 1150 | SnifWindow->show(); |
1037 | } | 1151 | } |
diff --git a/noncore/settings/networksettings2/opietooth2/Opietooth.h b/noncore/settings/networksettings2/opietooth2/Opietooth.h index 211ae65..2b20975 100644 --- a/noncore/settings/networksettings2/opietooth2/Opietooth.h +++ b/noncore/settings/networksettings2/opietooth2/Opietooth.h | |||
@@ -1,61 +1,78 @@ | |||
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 | namespace Opie { namespace Ui { class OLedBox; }; }; | 6 | class MyProcess; |
7 | class System; | ||
8 | |||
9 | namespace Opie { | ||
10 | |||
11 | namespace Ui { | ||
12 | |||
13 | class OLedBox; | ||
14 | |||
15 | }; | ||
16 | |||
17 | }; | ||
7 | 18 | ||
8 | #include <OTSniffGUI.h> | 19 | #include <OTSniffGUI.h> |
9 | namespace Opietooth2 { | 20 | namespace Opietooth2 { |
10 | 21 | ||
11 | class OTGateway; | 22 | class OTGateway; |
12 | class OTDriver; | 23 | class OTDriver; |
13 | class OTInquiry; | 24 | class OTInquiry; |
14 | class OTPeer; | 25 | class OTPeer; |
15 | class PeerLVI; | 26 | class PeerLVI; |
16 | 27 | ||
17 | class OTSniffing : public OTSniffGUI { | 28 | class OTSniffing : public OTSniffGUI { |
18 | 29 | ||
19 | Q_OBJECT | 30 | Q_OBJECT |
20 | 31 | ||
21 | public : | 32 | public : |
22 | 33 | ||
23 | OTSniffing( QWidget * parent ); | 34 | OTSniffing( QWidget * parent ); |
24 | ~OTSniffing(); | 35 | ~OTSniffing(); |
25 | 36 | ||
26 | private slots : | 37 | private slots : |
27 | 38 | ||
28 | void SLOT_Trace( void ); | 39 | void SLOT_Trace( bool ); |
29 | void SLOT_ClearLog( void ); | 40 | void SLOT_ClearLog( void ); |
41 | void SLOT_Load( void ); | ||
42 | void SLOT_Save( void ); | ||
43 | void SLOT_ProcessExited( MyProcess * ); | ||
44 | void SLOT_Show( const QString & ); | ||
30 | 45 | ||
31 | signals : | 46 | signals : |
32 | 47 | ||
33 | protected : | 48 | protected : |
34 | 49 | ||
35 | private : | 50 | private : |
36 | 51 | ||
37 | OTGateway * OT; | 52 | OTGateway * OT; |
53 | MyProcess * HciDump; | ||
54 | System * Sys; | ||
38 | }; | 55 | }; |
39 | }; | 56 | }; |
40 | 57 | ||
41 | #include <OTPairingGUI.h> | 58 | #include <OTPairingGUI.h> |
42 | 59 | ||
43 | namespace Opietooth2 { | 60 | namespace Opietooth2 { |
44 | class OTPairing : public OTPairingGUI { | 61 | class OTPairing : public OTPairingGUI { |
45 | 62 | ||
46 | Q_OBJECT | 63 | Q_OBJECT |
47 | 64 | ||
48 | public : | 65 | public : |
49 | 66 | ||
50 | OTPairing( QWidget * parent, | 67 | OTPairing( QWidget * parent, |
51 | OTIcons * _Ic = 0 ); | 68 | OTIcons * _Ic = 0 ); |
52 | ~OTPairing(); | 69 | ~OTPairing(); |
53 | 70 | ||
54 | private slots : | 71 | private slots : |
55 | 72 | ||
56 | void SLOT_Unpair( void ); | 73 | void SLOT_Unpair( void ); |
57 | 74 | ||
58 | signals : | 75 | signals : |
59 | 76 | ||
60 | protected : | 77 | protected : |
61 | 78 | ||
@@ -196,28 +213,28 @@ public : | |||
196 | ~OTMain(); | 213 | ~OTMain(); |
197 | 214 | ||
198 | public slots : | 215 | public slots : |
199 | 216 | ||
200 | private slots : | 217 | private slots : |
201 | 218 | ||
202 | void SLOT_Pairing( void ); | 219 | void SLOT_Pairing( void ); |
203 | void SLOT_Manage( void ); | 220 | void SLOT_Manage( void ); |
204 | void SLOT_Sniffing( void ); | 221 | void SLOT_Sniffing( void ); |
205 | void SLOT_Scan( void ); | 222 | void SLOT_Scan( void ); |
206 | void SLOT_EnableBluetooth( bool ); | 223 | void SLOT_EnableBluetooth( bool ); |
207 | void SLOT_DriverListChanged(); | 224 | void SLOT_DriverListChanged(); |
208 | void SLOT_DeviceIsEnabled( bool ); | 225 | void SLOT_DeviceIsEnabled( bool ); |
209 | void SLOT_StateChange( OTDriver * , bool ); | 226 | void SLOT_StateChange( OTDriver * , bool ); |
210 | 227 | ||
211 | signals : | 228 | signals : |
212 | 229 | ||
213 | protected : | 230 | protected : |
214 | 231 | ||
215 | private : | 232 | private : |
216 | 233 | ||
217 | // load scanned devices | 234 | // load scanned devices |
218 | OTIcons * Icons; | 235 | OTIcons * Icons; |
219 | OTGateway * OT; | 236 | OTGateway * OT; |
220 | OTSniffing * SnifWindow; | 237 | QDialog * SnifWindow; |
221 | }; | 238 | }; |
222 | }; | 239 | }; |
223 | #endif | 240 | #endif |
diff --git a/noncore/settings/networksettings2/opietooth2/libopietooth2.control b/noncore/settings/networksettings2/opietooth2/libopietooth2.control index fd01fb5..c2c8eb8 100644 --- a/noncore/settings/networksettings2/opietooth2/libopietooth2.control +++ b/noncore/settings/networksettings2/opietooth2/libopietooth2.control | |||
@@ -1,9 +1,9 @@ | |||
1 | Package: libopietooth2 | 1 | Package: libopietooth2 |
2 | Files: lib/libopietooth2.so.* apps/Settings/opietooth-manager.desktop pics/opietooth/*.png pics/opietooth/icons/*.png | 2 | Files: lib/libopietooth2.so.* apps/Settings/opietooth-manager.desktop pics/opietooth/*.png pics/opietooth/icons/*.png |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/system | 4 | Section: opie/system |
5 | Maintainer: wim delvaux <wim.delvaux@handhelds.org> | 5 | Maintainer: wim delvaux <wim.delvaux@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: $QPE_VERSION$EXTRAVERSION | 7 | Version: $QPE_VERSION$EXTRAVERSION |
8 | Depends: task-opie-minimal, libbluetooth1, opie-bluepin | opie-multiauth-bluepingplugin, bluez-utils-nodbus | 8 | Depends: task-opie-minimal, opie-networksettings2, libbluetooth1, opie-bluepin | opie-multiauth-bluepingplugin, bluez-utils-nodbus |
9 | Description: Opie bluetooth support library version 2 | 9 | Description: Opie bluetooth support library version 2 |
diff --git a/noncore/settings/networksettings2/opietooth2/opietooth2.pro b/noncore/settings/networksettings2/opietooth2/opietooth2.pro index cfb527d..e0057a9 100644 --- a/noncore/settings/networksettings2/opietooth2/opietooth2.pro +++ b/noncore/settings/networksettings2/opietooth2/opietooth2.pro | |||
@@ -6,32 +6,32 @@ HEADERS = OTDevice.h \ | |||
6 | OTDriver.h \ | 6 | OTDriver.h \ |
7 | OTGateway.h \ | 7 | OTGateway.h \ |
8 | OTHCISocket.h \ | 8 | OTHCISocket.h \ |
9 | OTInquiry.h \ | 9 | OTInquiry.h \ |
10 | OTDeviceAddress.h \ | 10 | OTDeviceAddress.h \ |
11 | OTIcons.h \ | 11 | OTIcons.h \ |
12 | OTUUID.h \ | 12 | OTUUID.h \ |
13 | OTSDPAttribute.h \ | 13 | OTSDPAttribute.h \ |
14 | OTSDPService.h \ | 14 | OTSDPService.h \ |
15 | OTPeer.h \ | 15 | OTPeer.h \ |
16 | Opietooth.h | 16 | Opietooth.h |
17 | SOURCES = OTDevice.cpp \ | 17 | SOURCES = OTDevice.cpp \ |
18 | OTDriver.cpp \ | 18 | OTDriver.cpp \ |
19 | OTDriverList.cpp \ | 19 | OTDriverList.cpp \ |
20 | OTHCISocket.cpp \ | 20 | OTHCISocket.cpp \ |
21 | OTInquiry.cpp \ | 21 | OTInquiry.cpp \ |
22 | OTDeviceAddress.cpp \ | 22 | OTDeviceAddress.cpp \ |
23 | OTUUID.cpp \ | 23 | OTUUID.cpp \ |
24 | OTSDPAttribute.cpp \ | 24 | OTSDPAttribute.cpp \ |
25 | OTSDPService.cpp \ | 25 | OTSDPService.cpp \ |
26 | OTIcons.cpp \ | 26 | OTIcons.cpp \ |
27 | OTPeer.cpp \ | 27 | OTPeer.cpp \ |
28 | OTGateway.cpp \ | 28 | OTGateway.cpp \ |
29 | Opietooth.cpp | 29 | Opietooth.cpp |
30 | INCLUDEPATH+= $(OPIEDIR)/include | 30 | INCLUDEPATH+= $(OPIEDIR)/include ../networksettings2 |
31 | DEPENDPATH+= $(OPIEDIR)/include | 31 | DEPENDPATH+= $(OPIEDIR)/include |
32 | LIBS += -lqpe -lopiecore2 -lbluetooth | 32 | LIBS += -lqpe -lopiecore2 -lbluetooth -lnetworksettings2 |
33 | INTERFACES= OTMainGUI.ui OTSniffGUI.ui OTScanGUI.ui OTManageGUI.ui OTPairingGUI.ui | 33 | INTERFACES= OTMainGUI.ui OTSniffGUI.ui OTScanGUI.ui OTManageGUI.ui OTPairingGUI.ui |
34 | TARGET = opietooth2 | 34 | TARGET = opietooth2 |
35 | VERSION = 1.0.0 | 35 | VERSION = 1.0.0 |
36 | 36 | ||
37 | include ( $(OPIEDIR)/include.pro ) | 37 | include ( $(OPIEDIR)/include.pro ) |