-rw-r--r-- | noncore/net/opietooth/lib/device.cc | 12 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/device.h | 12 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/manager.cc | 22 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/manager.h | 26 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/startdunconnection.cpp | 6 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/startdunconnection.h | 8 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/startpanconnection.cpp | 10 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/startpanconnection.h | 8 |
8 files changed, 56 insertions, 48 deletions
diff --git a/noncore/net/opietooth/lib/device.cc b/noncore/net/opietooth/lib/device.cc index bae1c47..d913853 100644 --- a/noncore/net/opietooth/lib/device.cc +++ b/noncore/net/opietooth/lib/device.cc | |||
@@ -1,21 +1,23 @@ | |||
1 | 1 | ||
2 | #include <signal.h> | 2 | #include <signal.h> |
3 | 3 | ||
4 | #include <opie/oprocess.h> | 4 | #include <opie2/oprocess.h> |
5 | 5 | ||
6 | #include "device.h" | 6 | #include "device.h" |
7 | 7 | ||
8 | using namespace OpieTooth; | 8 | using namespace OpieTooth; |
9 | 9 | ||
10 | using namespace Opie::Core; | ||
11 | using namespace Opie::Core; | ||
10 | namespace { | 12 | namespace { |
11 | int parsePid( const QCString& par ){ | 13 | int parsePid( const QCString& par ){ |
12 | int id=0; | 14 | int id=0; |
13 | QString string( par ); | 15 | QString string( par ); |
14 | QStringList list = QStringList::split( '\n', string ); | 16 | QStringList list = QStringList::split( '\n', string ); |
15 | for( QStringList::Iterator it = list.begin(); it != list.end(); ++it ){ | 17 | for( QStringList::Iterator it = list.begin(); it != list.end(); ++it ){ |
16 | qWarning("parsePID: %s", (*it).latin1() ); | 18 | qWarning("parsePID: %s", (*it).latin1() ); |
17 | if( !(*it).startsWith("CSR") ){ | 19 | if( !(*it).startsWith("CSR") ){ |
18 | id = (*it).toInt(); | 20 | id = (*it).toInt(); |
19 | break; | 21 | break; |
20 | } | 22 | } |
21 | } | 23 | } |
@@ -38,29 +40,29 @@ Device::Device(const QString &device, const QString &mode, const QString &speed | |||
38 | Device::~Device(){ | 40 | Device::~Device(){ |
39 | detach(); | 41 | detach(); |
40 | } | 42 | } |
41 | void Device::attach(){ | 43 | void Device::attach(){ |
42 | qWarning("attaching %s %s %s", m_device.latin1(), m_mode.latin1(), m_speed.latin1() ); | 44 | qWarning("attaching %s %s %s", m_device.latin1(), m_mode.latin1(), m_speed.latin1() ); |
43 | if(m_process == 0 ){ | 45 | if(m_process == 0 ){ |
44 | m_output.resize(0); | 46 | m_output.resize(0); |
45 | qWarning("new process to create" ); | 47 | qWarning("new process to create" ); |
46 | m_process = new OProcess(); | 48 | m_process = new OProcess(); |
47 | *m_process << "hciattach"; | 49 | *m_process << "hciattach"; |
48 | *m_process << "-p"; | 50 | *m_process << "-p"; |
49 | *m_process << m_device << m_mode << m_speed; | 51 | *m_process << m_device << m_mode << m_speed; |
50 | connect(m_process, SIGNAL( processExited(OProcess*) ), | 52 | connect(m_process, SIGNAL( processExited(Opie::Core::OProcess*) ), |
51 | this, SLOT( slotExited(OProcess* ) ) ); | 53 | this, SLOT( slotExited(OProcess* ) ) ); |
52 | connect(m_process, SIGNAL( receivedStdout(OProcess*, char*, int) ), | 54 | connect(m_process, SIGNAL( receivedStdout(Opie::Core::OProcess*, char*, int) ), |
53 | this, SLOT(slotStdOut(OProcess*,char*,int ) ) ); | 55 | this, SLOT(slotStdOut(OProcess*,char*,int ) ) ); |
54 | connect(m_process, SIGNAL(receivedStderr(OProcess*, char*, int ) ), | 56 | connect(m_process, SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int ) ), |
55 | this, SLOT(slotStdErr(OProcess*,char*,int) ) ); | 57 | this, SLOT(slotStdErr(OProcess*,char*,int) ) ); |
56 | if(!m_process->start(OProcess::NotifyOnExit, OProcess::AllOutput ) ){ | 58 | if(!m_process->start(OProcess::NotifyOnExit, OProcess::AllOutput ) ){ |
57 | qWarning("Could not start" ); | 59 | qWarning("Could not start" ); |
58 | delete m_process; | 60 | delete m_process; |
59 | m_process = 0; | 61 | m_process = 0; |
60 | } | 62 | } |
61 | }; | 63 | }; |
62 | } | 64 | } |
63 | void Device::detach(){ | 65 | void Device::detach(){ |
64 | delete m_hci; | 66 | delete m_hci; |
65 | delete m_process; | 67 | delete m_process; |
66 | // kill the pid we got | 68 | // kill the pid we got |
@@ -87,25 +89,25 @@ void Device::slotExited( OProcess* proc) | |||
87 | int ret = m_process->exitStatus(); | 89 | int ret = m_process->exitStatus(); |
88 | if( ret == 0 ){ // attached | 90 | if( ret == 0 ){ // attached |
89 | qWarning("attached" ); | 91 | qWarning("attached" ); |
90 | qWarning("Output: %s", m_output.data() ); | 92 | qWarning("Output: %s", m_output.data() ); |
91 | pid = parsePid( m_output ); | 93 | pid = parsePid( m_output ); |
92 | qWarning("Pid = %d", pid ); | 94 | qWarning("Pid = %d", pid ); |
93 | // now hciconfig hci0 up ( determine hciX FIXME) | 95 | // now hciconfig hci0 up ( determine hciX FIXME) |
94 | // and call hciconfig hci0 up | 96 | // and call hciconfig hci0 up |
95 | // FIXME hardcoded to hci0 now :( | 97 | // FIXME hardcoded to hci0 now :( |
96 | m_hci = new OProcess( ); | 98 | m_hci = new OProcess( ); |
97 | *m_hci << "hciconfig"; | 99 | *m_hci << "hciconfig"; |
98 | *m_hci << "hci0 up"; | 100 | *m_hci << "hci0 up"; |
99 | connect(m_hci, SIGNAL( processExited(OProcess*) ), | 101 | connect(m_hci, SIGNAL( processExited(Opie::Core::OProcess*) ), |
100 | this, SLOT( slotExited(OProcess* ) ) ); | 102 | this, SLOT( slotExited(OProcess* ) ) ); |
101 | if(!m_hci->start() ){ | 103 | if(!m_hci->start() ){ |
102 | qWarning("could not start" ); | 104 | qWarning("could not start" ); |
103 | m_attached = false; | 105 | m_attached = false; |
104 | emit device("hci0", false ); | 106 | emit device("hci0", false ); |
105 | } | 107 | } |
106 | }else{ | 108 | }else{ |
107 | qWarning("crass" ); | 109 | qWarning("crass" ); |
108 | m_attached = false; | 110 | m_attached = false; |
109 | emit device("hci0", false ); | 111 | emit device("hci0", false ); |
110 | 112 | ||
111 | } | 113 | } |
diff --git a/noncore/net/opietooth/lib/device.h b/noncore/net/opietooth/lib/device.h index ce7fccc..f3339fc 100644 --- a/noncore/net/opietooth/lib/device.h +++ b/noncore/net/opietooth/lib/device.h | |||
@@ -1,23 +1,23 @@ | |||
1 | 1 | ||
2 | #ifndef OpieToothDevice_H | 2 | #ifndef OpieToothDevice_H |
3 | #define OpieToothDevice_H | 3 | #define OpieToothDevice_H |
4 | 4 | ||
5 | #include <qobject.h> | 5 | #include <qobject.h> |
6 | #include <qstring.h> | 6 | #include <qstring.h> |
7 | #include <qvaluelist.h> | 7 | #include <qvaluelist.h> |
8 | 8 | ||
9 | #include <sys/types.h> | 9 | #include <sys/types.h> |
10 | 10 | ||
11 | class OProcess; | 11 | namespace Opie {namespace Core {class Opie::Core::OProcess;}} |
12 | namespace OpieTooth { | 12 | namespace OpieTooth { |
13 | /** | 13 | /** |
14 | * Device takes care of attaching serial | 14 | * Device takes care of attaching serial |
15 | * devices to the blueZ stack. | 15 | * devices to the blueZ stack. |
16 | * After attaching it hciconfig ups it | 16 | * After attaching it hciconfig ups it |
17 | */ | 17 | */ |
18 | class Device : public QObject { | 18 | class Device : public QObject { |
19 | 19 | ||
20 | Q_OBJECT | 20 | Q_OBJECT |
21 | 21 | ||
22 | public: | 22 | public: |
23 | 23 | ||
@@ -58,31 +58,31 @@ namespace OpieTooth { | |||
58 | */ | 58 | */ |
59 | QString devName()const ; // hci0 | 59 | QString devName()const ; // hci0 |
60 | 60 | ||
61 | signals: | 61 | signals: |
62 | 62 | ||
63 | /** | 63 | /** |
64 | * Signals devicename and up status | 64 | * Signals devicename and up status |
65 | * @return &device QString, Devicename | 65 | * @return &device QString, Devicename |
66 | * @return up bool, if the device is up or not. | 66 | * @return up bool, if the device is up or not. |
67 | */ | 67 | */ |
68 | void device(const QString& device, bool up ); | 68 | void device(const QString& device, bool up ); |
69 | private slots: | 69 | private slots: |
70 | virtual void slotExited( OProcess* ); | 70 | virtual void slotExited( Opie::Core::OProcess* ); |
71 | virtual void slotStdOut(OProcess*, char*, int ); | 71 | virtual void slotStdOut(Opie::Core::OProcess*, char*, int ); |
72 | virtual void slotStdErr(OProcess*, char*, int ); | 72 | virtual void slotStdErr(Opie::Core::OProcess*, char*, int ); |
73 | private: | 73 | private: |
74 | class Private; | 74 | class Private; |
75 | Private *d; | 75 | Private *d; |
76 | QString m_device; | 76 | QString m_device; |
77 | bool m_attached:1; | 77 | bool m_attached:1; |
78 | OProcess* m_hci; | 78 | Opie::Core::OProcess* m_hci; |
79 | OProcess* m_process; | 79 | Opie::Core::OProcess* m_process; |
80 | QString m_devId; | 80 | QString m_devId; |
81 | QString m_mode; | 81 | QString m_mode; |
82 | QString m_speed; | 82 | QString m_speed; |
83 | pid_t pid; | 83 | pid_t pid; |
84 | QCString m_output; | 84 | QCString m_output; |
85 | }; | 85 | }; |
86 | }; | 86 | }; |
87 | 87 | ||
88 | #endif | 88 | #endif |
diff --git a/noncore/net/opietooth/lib/manager.cc b/noncore/net/opietooth/lib/manager.cc index c89d325..56156a8 100644 --- a/noncore/net/opietooth/lib/manager.cc +++ b/noncore/net/opietooth/lib/manager.cc | |||
@@ -1,22 +1,24 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #include <opie/oprocess.h> | 3 | #include <opie2/oprocess.h> |
4 | 4 | ||
5 | #include "parser.h" | 5 | #include "parser.h" |
6 | #include "manager.h" | 6 | #include "manager.h" |
7 | 7 | ||
8 | 8 | ||
9 | using namespace OpieTooth; | 9 | using namespace OpieTooth; |
10 | 10 | ||
11 | using namespace Opie::Core; | ||
12 | using namespace Opie::Core; | ||
11 | Manager::Manager( const QString& dev ) | 13 | Manager::Manager( const QString& dev ) |
12 | : QObject() | 14 | : QObject() |
13 | { | 15 | { |
14 | qWarning("created"); | 16 | qWarning("created"); |
15 | m_device = dev; | 17 | m_device = dev; |
16 | m_hcitool = 0; | 18 | m_hcitool = 0; |
17 | m_sdp = 0; | 19 | m_sdp = 0; |
18 | } | 20 | } |
19 | Manager::Manager( Device* /*dev*/ ) | 21 | Manager::Manager( Device* /*dev*/ ) |
20 | : QObject() | 22 | : QObject() |
21 | { | 23 | { |
22 | m_hcitool = 0; | 24 | m_hcitool = 0; |
@@ -33,45 +35,45 @@ Manager::~Manager(){ | |||
33 | delete m_sdp; | 35 | delete m_sdp; |
34 | } | 36 | } |
35 | void Manager::setDevice( const QString& dev ){ | 37 | void Manager::setDevice( const QString& dev ){ |
36 | m_device = dev; | 38 | m_device = dev; |
37 | } | 39 | } |
38 | void Manager::setDevice( Device* /*dev*/ ){ | 40 | void Manager::setDevice( Device* /*dev*/ ){ |
39 | 41 | ||
40 | } | 42 | } |
41 | void Manager::isAvailable( const QString& device ){ | 43 | void Manager::isAvailable( const QString& device ){ |
42 | OProcess* l2ping = new OProcess(); | 44 | OProcess* l2ping = new OProcess(); |
43 | l2ping->setName( device.latin1() ); | 45 | l2ping->setName( device.latin1() ); |
44 | *l2ping << "l2ping" << "-c1" << device; | 46 | *l2ping << "l2ping" << "-c1" << device; |
45 | connect(l2ping, SIGNAL(processExited(OProcess* ) ), | 47 | connect(l2ping, SIGNAL(processExited(Opie::Core::OProcess* ) ), |
46 | this, SLOT(slotProcessExited(OProcess*) ) ); | 48 | this, SLOT(slotProcessExited(OProcess*) ) ); |
47 | if (!l2ping->start() ) { | 49 | if (!l2ping->start() ) { |
48 | emit available( device, false ); | 50 | emit available( device, false ); |
49 | delete l2ping; | 51 | delete l2ping; |
50 | } | 52 | } |
51 | 53 | ||
52 | } | 54 | } |
53 | 55 | ||
54 | void Manager::isAvailable( Device* /*dev*/ ){ | 56 | void Manager::isAvailable( Device* /*dev*/ ){ |
55 | 57 | ||
56 | 58 | ||
57 | } | 59 | } |
58 | void Manager::searchDevices( const QString& device ){ | 60 | void Manager::searchDevices( const QString& device ){ |
59 | qWarning("search devices"); | 61 | qWarning("search devices"); |
60 | OProcess* hcitool = new OProcess(); | 62 | OProcess* hcitool = new OProcess(); |
61 | hcitool->setName( device.isEmpty() ? "hci0" : device.latin1() ); | 63 | hcitool->setName( device.isEmpty() ? "hci0" : device.latin1() ); |
62 | *hcitool << "hcitool" << "scan"; | 64 | *hcitool << "hcitool" << "scan"; |
63 | connect( hcitool, SIGNAL(processExited(OProcess*) ) , | 65 | connect( hcitool, SIGNAL(processExited(Opie::Core::OProcess*) ) , |
64 | this, SLOT(slotHCIExited(OProcess* ) ) ); | 66 | this, SLOT(slotHCIExited(OProcess* ) ) ); |
65 | connect( hcitool, SIGNAL(receivedStdout(OProcess*, char*, int ) ), | 67 | connect( hcitool, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ), |
66 | this, SLOT(slotHCIOut(OProcess*, char*, int ) ) ); | 68 | this, SLOT(slotHCIOut(OProcess*, char*, int ) ) ); |
67 | if (!hcitool->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 69 | if (!hcitool->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
68 | qWarning("could not start"); | 70 | qWarning("could not start"); |
69 | RemoteDevice::ValueList list; | 71 | RemoteDevice::ValueList list; |
70 | emit foundDevices( device, list ); | 72 | emit foundDevices( device, list ); |
71 | delete hcitool; | 73 | delete hcitool; |
72 | } | 74 | } |
73 | } | 75 | } |
74 | 76 | ||
75 | void Manager::searchDevices(Device* /*d*/ ){ | 77 | void Manager::searchDevices(Device* /*d*/ ){ |
76 | 78 | ||
77 | 79 | ||
@@ -98,27 +100,27 @@ void Manager::removeService( const QString& name ){ | |||
98 | emit removedService( name, bo ); | 100 | emit removedService( name, bo ); |
99 | } | 101 | } |
100 | void Manager::removeServices( const QStringList& list){ | 102 | void Manager::removeServices( const QStringList& list){ |
101 | QStringList::ConstIterator it; | 103 | QStringList::ConstIterator it; |
102 | for (it = list.begin(); it != list.end(); ++it ) | 104 | for (it = list.begin(); it != list.end(); ++it ) |
103 | removeService( (*it) ); | 105 | removeService( (*it) ); |
104 | } | 106 | } |
105 | void Manager::searchServices( const QString& remDevice ){ | 107 | void Manager::searchServices( const QString& remDevice ){ |
106 | OProcess *m_sdp =new OProcess(); | 108 | OProcess *m_sdp =new OProcess(); |
107 | *m_sdp << "sdptool" << "browse" << remDevice; | 109 | *m_sdp << "sdptool" << "browse" << remDevice; |
108 | m_sdp->setName( remDevice.latin1() ); | 110 | m_sdp->setName( remDevice.latin1() ); |
109 | qWarning("search Services for %s", remDevice.latin1() ); | 111 | qWarning("search Services for %s", remDevice.latin1() ); |
110 | connect(m_sdp, SIGNAL(processExited(OProcess*) ), | 112 | connect(m_sdp, SIGNAL(processExited(Opie::Core::OProcess*) ), |
111 | this, SLOT(slotSDPExited(OProcess* ) ) ); | 113 | this, SLOT(slotSDPExited(OProcess* ) ) ); |
112 | connect(m_sdp, SIGNAL(receivedStdout(OProcess*, char*, int ) ), | 114 | connect(m_sdp, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ), |
113 | this, SLOT(slotSDPOut(OProcess*, char*, int) ) ); | 115 | this, SLOT(slotSDPOut(OProcess*, char*, int) ) ); |
114 | if (!m_sdp->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 116 | if (!m_sdp->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
115 | qWarning("could not start sdptool" ); | 117 | qWarning("could not start sdptool" ); |
116 | delete m_sdp; | 118 | delete m_sdp; |
117 | Services::ValueList list; | 119 | Services::ValueList list; |
118 | emit foundServices( remDevice, list ); | 120 | emit foundServices( remDevice, list ); |
119 | } | 121 | } |
120 | } | 122 | } |
121 | void Manager::searchServices( const RemoteDevice& dev){ | 123 | void Manager::searchServices( const RemoteDevice& dev){ |
122 | searchServices( dev.mac() ); | 124 | searchServices( dev.mac() ); |
123 | } | 125 | } |
124 | QString Manager::toDevice( const QString& /*mac*/ ){ | 126 | QString Manager::toDevice( const QString& /*mac*/ ){ |
@@ -237,27 +239,27 @@ void Manager::connectTo( const QString& mac) { | |||
237 | proc << "hcitool"; | 239 | proc << "hcitool"; |
238 | proc << "cc"; | 240 | proc << "cc"; |
239 | proc << mac; | 241 | proc << mac; |
240 | proc.start(OProcess::DontCare); // the lib does not care at this point | 242 | proc.start(OProcess::DontCare); // the lib does not care at this point |
241 | } | 243 | } |
242 | 244 | ||
243 | 245 | ||
244 | void Manager::searchConnections() { | 246 | void Manager::searchConnections() { |
245 | qWarning("searching connections?"); | 247 | qWarning("searching connections?"); |
246 | OProcess* proc = new OProcess(); | 248 | OProcess* proc = new OProcess(); |
247 | m_hcitoolCon = QString::null; | 249 | m_hcitoolCon = QString::null; |
248 | 250 | ||
249 | connect(proc, SIGNAL(processExited(OProcess*) ), | 251 | connect(proc, SIGNAL(processExited(Opie::Core::OProcess*) ), |
250 | this, SLOT(slotConnectionExited( OProcess*) ) ); | 252 | this, SLOT(slotConnectionExited( OProcess*) ) ); |
251 | connect(proc, SIGNAL(receivedStdout(OProcess*, char*, int) ), | 253 | connect(proc, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int) ), |
252 | this, SLOT(slotConnectionOutput(OProcess*, char*, int) ) ); | 254 | this, SLOT(slotConnectionOutput(OProcess*, char*, int) ) ); |
253 | *proc << "hcitool"; | 255 | *proc << "hcitool"; |
254 | *proc << "con"; | 256 | *proc << "con"; |
255 | 257 | ||
256 | if (!proc->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 258 | if (!proc->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
257 | ConnectionState::ValueList list; | 259 | ConnectionState::ValueList list; |
258 | emit connections( list ); | 260 | emit connections( list ); |
259 | delete proc; | 261 | delete proc; |
260 | } | 262 | } |
261 | } | 263 | } |
262 | void Manager::slotConnectionExited( OProcess* proc ) { | 264 | void Manager::slotConnectionExited( OProcess* proc ) { |
263 | ConnectionState::ValueList list; | 265 | ConnectionState::ValueList list; |
@@ -296,27 +298,27 @@ ConnectionState::ValueList Manager::parseConnections( const QString& out ) { | |||
296 | con.setHandle( value[4].toInt() ); | 298 | con.setHandle( value[4].toInt() ); |
297 | con.setState( value[6].toInt() ); | 299 | con.setState( value[6].toInt() ); |
298 | con.setLinkMode( value[8] == QString::fromLatin1("MASTER") ? Master : Client ); | 300 | con.setLinkMode( value[8] == QString::fromLatin1("MASTER") ? Master : Client ); |
299 | list2.append( con ); | 301 | list2.append( con ); |
300 | } | 302 | } |
301 | return list2; | 303 | return list2; |
302 | } | 304 | } |
303 | 305 | ||
304 | void Manager::signalStrength( const QString &mac ) { | 306 | void Manager::signalStrength( const QString &mac ) { |
305 | 307 | ||
306 | OProcess* sig_proc = new OProcess(); | 308 | OProcess* sig_proc = new OProcess(); |
307 | 309 | ||
308 | connect(sig_proc, SIGNAL(processExited(OProcess*) ), | 310 | connect(sig_proc, SIGNAL(processExited(Opie::Core::OProcess*) ), |
309 | this, SLOT(slotSignalStrengthExited( OProcess*) ) ); | 311 | this, SLOT(slotSignalStrengthExited( OProcess*) ) ); |
310 | connect(sig_proc, SIGNAL(receivedStdout(OProcess*, char*, int) ), | 312 | connect(sig_proc, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int) ), |
311 | this, SLOT(slotSignalStrengthOutput(OProcess*, char*, int) ) ); | 313 | this, SLOT(slotSignalStrengthOutput(OProcess*, char*, int) ) ); |
312 | *sig_proc << "hcitool"; | 314 | *sig_proc << "hcitool"; |
313 | *sig_proc << "lq"; | 315 | *sig_proc << "lq"; |
314 | *sig_proc << mac; | 316 | *sig_proc << mac; |
315 | 317 | ||
316 | sig_proc->setName( mac.latin1() ); | 318 | sig_proc->setName( mac.latin1() ); |
317 | 319 | ||
318 | if (!sig_proc->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 320 | if (!sig_proc->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
319 | emit signalStrength( mac, "-1" ); | 321 | emit signalStrength( mac, "-1" ); |
320 | delete sig_proc; | 322 | delete sig_proc; |
321 | } | 323 | } |
322 | } | 324 | } |
diff --git a/noncore/net/opietooth/lib/manager.h b/noncore/net/opietooth/lib/manager.h index abc8ba1..9b1c714 100644 --- a/noncore/net/opietooth/lib/manager.h +++ b/noncore/net/opietooth/lib/manager.h | |||
@@ -2,25 +2,25 @@ | |||
2 | #ifndef OpieToothManager_H | 2 | #ifndef OpieToothManager_H |
3 | #define OpieToothManager_H | 3 | #define OpieToothManager_H |
4 | 4 | ||
5 | #include <qobject.h> | 5 | #include <qobject.h> |
6 | #include <qstring.h> | 6 | #include <qstring.h> |
7 | #include <qmap.h> | 7 | #include <qmap.h> |
8 | #include <qvaluelist.h> | 8 | #include <qvaluelist.h> |
9 | 9 | ||
10 | #include "connection.h" | 10 | #include "connection.h" |
11 | #include "remotedevice.h" | 11 | #include "remotedevice.h" |
12 | #include "services.h" | 12 | #include "services.h" |
13 | 13 | ||
14 | class OProcess; | 14 | namespace Opie {namespace Core {class Opie::Core::OProcess;}} |
15 | namespace OpieTooth { | 15 | namespace OpieTooth { |
16 | class Device; | 16 | class Device; |
17 | /** Manager manages a blueZ device (hci0 for example) | 17 | /** Manager manages a blueZ device (hci0 for example) |
18 | * without Manager you can control the things you | 18 | * without Manager you can control the things you |
19 | * could do from command line in a OO and asynchronus | 19 | * could do from command line in a OO and asynchronus |
20 | * way. | 20 | * way. |
21 | */ | 21 | */ |
22 | class Manager : public QObject { | 22 | class Manager : public QObject { |
23 | Q_OBJECT | 23 | Q_OBJECT |
24 | public: | 24 | public: |
25 | /** c'tor whichs create a new Manager | 25 | /** c'tor whichs create a new Manager |
26 | * @param device is the device to use. Either a mac or blueZ device name | 26 | * @param device is the device to use. Either a mac or blueZ device name |
@@ -133,41 +133,41 @@ namespace OpieTooth { | |||
133 | signals: | 133 | signals: |
134 | // device either mac or dev name | 134 | // device either mac or dev name |
135 | // the first device is the device which you access | 135 | // the first device is the device which you access |
136 | void available( const QString& device, bool connected ); | 136 | void available( const QString& device, bool connected ); |
137 | void addedService( const QString& service, bool added ); | 137 | void addedService( const QString& service, bool added ); |
138 | void removedService( const QString& service, bool removed ); | 138 | void removedService( const QString& service, bool removed ); |
139 | void foundServices( const QString& device, Services::ValueList ); | 139 | void foundServices( const QString& device, Services::ValueList ); |
140 | void foundDevices( const QString& device, RemoteDevice::ValueList ); | 140 | void foundDevices( const QString& device, RemoteDevice::ValueList ); |
141 | void connections( ConnectionState::ValueList ); | 141 | void connections( ConnectionState::ValueList ); |
142 | void signalStrength( const QString& mac, const QString& strengh ); | 142 | void signalStrength( const QString& mac, const QString& strengh ); |
143 | 143 | ||
144 | private slots: | 144 | private slots: |
145 | void slotProcessExited(OProcess* ); | 145 | void slotProcessExited(Opie::Core::OProcess* ); |
146 | 146 | ||
147 | void slotSDPExited(OProcess*); | 147 | void slotSDPExited(Opie::Core::OProcess*); |
148 | void slotSDPOut(OProcess*, char*, int); | 148 | void slotSDPOut(Opie::Core::OProcess*, char*, int); |
149 | 149 | ||
150 | void slotHCIExited(OProcess* ); | 150 | void slotHCIExited(Opie::Core::OProcess* ); |
151 | void slotHCIOut(OProcess*, char*, int ); | 151 | void slotHCIOut(Opie::Core::OProcess*, char*, int ); |
152 | 152 | ||
153 | void slotConnectionExited(OProcess* ); | 153 | void slotConnectionExited(Opie::Core::OProcess* ); |
154 | void slotConnectionOutput(OProcess*, char*, int ); | 154 | void slotConnectionOutput(Opie::Core::OProcess*, char*, int ); |
155 | 155 | ||
156 | void slotSignalStrengthOutput( OProcess*, char*, int ); | 156 | void slotSignalStrengthOutput( Opie::Core::OProcess*, char*, int ); |
157 | void slotSignalStrengthExited( OProcess* ); | 157 | void slotSignalStrengthExited( Opie::Core::OProcess* ); |
158 | private: | 158 | private: |
159 | Services::ValueList parseSDPOutput( const QString& ); | 159 | Services::ValueList parseSDPOutput( const QString& ); |
160 | RemoteDevice::ValueList parseHCIOutput( const QString& ); | 160 | RemoteDevice::ValueList parseHCIOutput( const QString& ); |
161 | ConnectionState::ValueList parseConnections( const QString& ); | 161 | ConnectionState::ValueList parseConnections( const QString& ); |
162 | OProcess *m_hcitool; | 162 | Opie::Core::OProcess *m_hcitool; |
163 | OProcess *m_sdp; // not only one | 163 | Opie::Core::OProcess *m_sdp; // not only one |
164 | QString m_device; | 164 | QString m_device; |
165 | QMap<QString, int> m_signalStrength; | 165 | QMap<QString, int> m_signalStrength; |
166 | QMap<QString, QString> m_out; | 166 | QMap<QString, QString> m_out; |
167 | QMap<QString, QString> m_devices; | 167 | QMap<QString, QString> m_devices; |
168 | QMap<OProcess*, QString> m_signalMac; | 168 | QMap<Opie::Core::OProcess*, QString> m_signalMac; |
169 | QString m_hcitoolCon; | 169 | QString m_hcitoolCon; |
170 | }; | 170 | }; |
171 | }; | 171 | }; |
172 | 172 | ||
173 | #endif | 173 | #endif |
diff --git a/noncore/net/opietooth/lib/startdunconnection.cpp b/noncore/net/opietooth/lib/startdunconnection.cpp index c3850eb..90ef04a 100644 --- a/noncore/net/opietooth/lib/startdunconnection.cpp +++ b/noncore/net/opietooth/lib/startdunconnection.cpp | |||
@@ -1,18 +1,20 @@ | |||
1 | 1 | ||
2 | #include "startdunconnection.h" | 2 | #include "startdunconnection.h" |
3 | 3 | ||
4 | using namespace OpieTooth; | 4 | using namespace OpieTooth; |
5 | 5 | ||
6 | 6 | ||
7 | using namespace Opie::Core; | ||
8 | using namespace Opie::Core; | ||
7 | StartDunConnection::StartDunConnection() { | 9 | StartDunConnection::StartDunConnection() { |
8 | m_dunConnect = 0l; | 10 | m_dunConnect = 0l; |
9 | setConnectionType(); | 11 | setConnectionType(); |
10 | } | 12 | } |
11 | 13 | ||
12 | StartDunConnection::~StartDunConnection() { | 14 | StartDunConnection::~StartDunConnection() { |
13 | delete m_dunConnect; | 15 | delete m_dunConnect; |
14 | } | 16 | } |
15 | 17 | ||
16 | StartDunConnection::StartDunConnection( QString mac ) { | 18 | StartDunConnection::StartDunConnection( QString mac ) { |
17 | m_dunConnect = 0l; | 19 | m_dunConnect = 0l; |
18 | m_mac = mac; | 20 | m_mac = mac; |
@@ -30,27 +32,27 @@ QString StartDunConnection::name() { | |||
30 | void StartDunConnection::setConnectionType() { | 32 | void StartDunConnection::setConnectionType() { |
31 | m_connectionType = Pan; | 33 | m_connectionType = Pan; |
32 | } | 34 | } |
33 | 35 | ||
34 | StartConnection::ConnectionType StartDunConnection::type() { | 36 | StartConnection::ConnectionType StartDunConnection::type() { |
35 | return m_connectionType; | 37 | return m_connectionType; |
36 | } | 38 | } |
37 | 39 | ||
38 | void StartDunConnection::start() { | 40 | void StartDunConnection::start() { |
39 | m_dunConnect = new OProcess(); | 41 | m_dunConnect = new OProcess(); |
40 | *m_dunConnect << "dund" << "--listen" << "--connect" << m_mac; | 42 | *m_dunConnect << "dund" << "--listen" << "--connect" << m_mac; |
41 | 43 | ||
42 | connect( m_dunConnect, SIGNAL( processExited(OProcess*) ) , | 44 | connect( m_dunConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , |
43 | this, SLOT( slotExited(OProcess*) ) ); | 45 | this, SLOT( slotExited(OProcess*) ) ); |
44 | connect( m_dunConnect, SIGNAL( receivedStdout(OProcess*,char*,int) ), | 46 | connect( m_dunConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), |
45 | this, SLOT( slotStdOut(OProcess*,char*,int) ) ); | 47 | this, SLOT( slotStdOut(OProcess*,char*,int) ) ); |
46 | if (!m_dunConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 48 | if (!m_dunConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
47 | qWarning( "could not start" ); | 49 | qWarning( "could not start" ); |
48 | delete m_dunConnect; | 50 | delete m_dunConnect; |
49 | } | 51 | } |
50 | } | 52 | } |
51 | 53 | ||
52 | 54 | ||
53 | void StartDunConnection::slotExited( OProcess* proc ) { | 55 | void StartDunConnection::slotExited( OProcess* proc ) { |
54 | delete m_dunConnect; | 56 | delete m_dunConnect; |
55 | } | 57 | } |
56 | 58 | ||
diff --git a/noncore/net/opietooth/lib/startdunconnection.h b/noncore/net/opietooth/lib/startdunconnection.h index 43a852a..f6107f6 100644 --- a/noncore/net/opietooth/lib/startdunconnection.h +++ b/noncore/net/opietooth/lib/startdunconnection.h | |||
@@ -1,40 +1,40 @@ | |||
1 | #ifndef startdunconnection_h | 1 | #ifndef startdunconnection_h |
2 | #define startdunconnection_h | 2 | #define startdunconnection_h |
3 | 3 | ||
4 | #include <qobject.h> | 4 | #include <qobject.h> |
5 | #include "connection.h" | 5 | #include "connection.h" |
6 | #include <opie/oprocess.h> | 6 | #include <opie2/oprocess.h> |
7 | 7 | ||
8 | namespace OpieTooth { | 8 | namespace OpieTooth { |
9 | 9 | ||
10 | class StartDunConnection : StartConnection { | 10 | class StartDunConnection : StartConnection { |
11 | 11 | ||
12 | Q_OBJECT | 12 | Q_OBJECT |
13 | 13 | ||
14 | public: | 14 | public: |
15 | StartDunConnection(); | 15 | StartDunConnection(); |
16 | StartDunConnection( QString mac ); | 16 | StartDunConnection( QString mac ); |
17 | ~StartDunConnection(); | 17 | ~StartDunConnection(); |
18 | 18 | ||
19 | QString name(); | 19 | QString name(); |
20 | void setName( QString name ); | 20 | void setName( QString name ); |
21 | StartConnection::ConnectionType type(); | 21 | StartConnection::ConnectionType type(); |
22 | void setConnectionType( ); | 22 | void setConnectionType( ); |
23 | void start(); | 23 | void start(); |
24 | void stop(); | 24 | void stop(); |
25 | 25 | ||
26 | private: | 26 | private: |
27 | QString m_name; | 27 | QString m_name; |
28 | QString m_mac; | 28 | QString m_mac; |
29 | ConnectionType m_connectionType; | 29 | ConnectionType m_connectionType; |
30 | OProcess* m_dunConnect; | 30 | Opie::Core::OProcess* m_dunConnect; |
31 | 31 | ||
32 | private slots: | 32 | private slots: |
33 | void slotExited( OProcess* proc ); | 33 | void slotExited( Opie::Core::OProcess* proc ); |
34 | void slotStdOut( OProcess* proc, char* chars, int len ); | 34 | void slotStdOut( Opie::Core::OProcess* proc, char* chars, int len ); |
35 | }; | 35 | }; |
36 | 36 | ||
37 | 37 | ||
38 | } | 38 | } |
39 | 39 | ||
40 | #endif | 40 | #endif |
diff --git a/noncore/net/opietooth/lib/startpanconnection.cpp b/noncore/net/opietooth/lib/startpanconnection.cpp index a42b407..fef35d9 100644 --- a/noncore/net/opietooth/lib/startpanconnection.cpp +++ b/noncore/net/opietooth/lib/startpanconnection.cpp | |||
@@ -1,18 +1,20 @@ | |||
1 | 1 | ||
2 | #include "startpanconnection.h" | 2 | #include "startpanconnection.h" |
3 | 3 | ||
4 | using namespace OpieTooth; | 4 | using namespace OpieTooth; |
5 | 5 | ||
6 | 6 | ||
7 | using namespace Opie::Core; | ||
8 | using namespace Opie::Core; | ||
7 | StartPanConnection::StartPanConnection() { | 9 | StartPanConnection::StartPanConnection() { |
8 | m_panConnect = 0l; | 10 | m_panConnect = 0l; |
9 | setConnectionType(); | 11 | setConnectionType(); |
10 | } | 12 | } |
11 | 13 | ||
12 | StartPanConnection::~StartPanConnection() { | 14 | StartPanConnection::~StartPanConnection() { |
13 | delete m_panConnect; | 15 | delete m_panConnect; |
14 | } | 16 | } |
15 | 17 | ||
16 | StartPanConnection::StartPanConnection( QString mac ) { | 18 | StartPanConnection::StartPanConnection( QString mac ) { |
17 | m_panConnect = 0l; | 19 | m_panConnect = 0l; |
18 | m_mac = mac; | 20 | m_mac = mac; |
@@ -31,27 +33,27 @@ void StartPanConnection::setConnectionType() { | |||
31 | m_connectionType = Pan; | 33 | m_connectionType = Pan; |
32 | } | 34 | } |
33 | 35 | ||
34 | StartConnection::ConnectionType StartPanConnection::type() { | 36 | StartConnection::ConnectionType StartPanConnection::type() { |
35 | return m_connectionType; | 37 | return m_connectionType; |
36 | } | 38 | } |
37 | 39 | ||
38 | void StartPanConnection::start() { | 40 | void StartPanConnection::start() { |
39 | m_panConnect = new OProcess(); | 41 | m_panConnect = new OProcess(); |
40 | qDebug( "IM START " + m_mac ); | 42 | qDebug( "IM START " + m_mac ); |
41 | *m_panConnect << "pand" << "--connect" << m_mac; | 43 | *m_panConnect << "pand" << "--connect" << m_mac; |
42 | 44 | ||
43 | connect( m_panConnect, SIGNAL( processExited(OProcess*) ) , | 45 | connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , |
44 | this, SLOT( slotExited(OProcess*) ) ); | 46 | this, SLOT( slotExited(OProcess*) ) ); |
45 | connect( m_panConnect, SIGNAL( receivedStdout(OProcess*,char*,int) ), | 47 | connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), |
46 | this, SLOT( slotStdOut(OProcess*,char*,int) ) ); | 48 | this, SLOT( slotStdOut(OProcess*,char*,int) ) ); |
47 | if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 49 | if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
48 | qWarning( "could not start" ); | 50 | qWarning( "could not start" ); |
49 | delete m_panConnect; | 51 | delete m_panConnect; |
50 | } | 52 | } |
51 | } | 53 | } |
52 | 54 | ||
53 | 55 | ||
54 | void StartPanConnection::slotExited( OProcess* proc ) { | 56 | void StartPanConnection::slotExited( OProcess* proc ) { |
55 | delete m_panConnect; | 57 | delete m_panConnect; |
56 | m_panConnect = 0l; | 58 | m_panConnect = 0l; |
57 | } | 59 | } |
@@ -61,22 +63,22 @@ void StartPanConnection::slotStdOut(OProcess* proc, char* chars, int len) | |||
61 | 63 | ||
62 | 64 | ||
63 | void StartPanConnection::stop() { | 65 | void StartPanConnection::stop() { |
64 | if ( m_panConnect ) { | 66 | if ( m_panConnect ) { |
65 | delete m_panConnect; | 67 | delete m_panConnect; |
66 | m_panConnect = 0l; | 68 | m_panConnect = 0l; |
67 | } | 69 | } |
68 | m_panConnect = new OProcess(); | 70 | m_panConnect = new OProcess(); |
69 | qDebug("IM STOP " + m_mac); | 71 | qDebug("IM STOP " + m_mac); |
70 | 72 | ||
71 | *m_panConnect << "pand" << "--kill" << m_mac; | 73 | *m_panConnect << "pand" << "--kill" << m_mac; |
72 | 74 | ||
73 | connect( m_panConnect, SIGNAL( processExited(OProcess*) ) , | 75 | connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , |
74 | this, SLOT( slotExited(OProcess*) ) ); | 76 | this, SLOT( slotExited(OProcess*) ) ); |
75 | connect( m_panConnect, SIGNAL( receivedStdout(OProcess*,char*,int) ), | 77 | connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), |
76 | this, SLOT( slotStdOut(OProcess*,char*,int) ) ); | 78 | this, SLOT( slotStdOut(OProcess*,char*,int) ) ); |
77 | if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 79 | if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
78 | qWarning( "could not stop" ); | 80 | qWarning( "could not stop" ); |
79 | delete m_panConnect; | 81 | delete m_panConnect; |
80 | } | 82 | } |
81 | } | 83 | } |
82 | 84 | ||
diff --git a/noncore/net/opietooth/lib/startpanconnection.h b/noncore/net/opietooth/lib/startpanconnection.h index 7e5bd95..e12dad0 100644 --- a/noncore/net/opietooth/lib/startpanconnection.h +++ b/noncore/net/opietooth/lib/startpanconnection.h | |||
@@ -1,40 +1,40 @@ | |||
1 | #ifndef startpanconnection_h | 1 | #ifndef startpanconnection_h |
2 | #define startpanconnection_h | 2 | #define startpanconnection_h |
3 | 3 | ||
4 | #include <qobject.h> | 4 | #include <qobject.h> |
5 | #include "connection.h" | 5 | #include "connection.h" |
6 | #include <opie/oprocess.h> | 6 | #include <opie2/oprocess.h> |
7 | 7 | ||
8 | namespace OpieTooth { | 8 | namespace OpieTooth { |
9 | 9 | ||
10 | class StartPanConnection : StartConnection { | 10 | class StartPanConnection : StartConnection { |
11 | 11 | ||
12 | Q_OBJECT | 12 | Q_OBJECT |
13 | 13 | ||
14 | public: | 14 | public: |
15 | StartPanConnection(); | 15 | StartPanConnection(); |
16 | StartPanConnection( QString mac ); | 16 | StartPanConnection( QString mac ); |
17 | ~StartPanConnection(); | 17 | ~StartPanConnection(); |
18 | 18 | ||
19 | QString name(); | 19 | QString name(); |
20 | void setName( QString name ); | 20 | void setName( QString name ); |
21 | StartConnection::ConnectionType type(); | 21 | StartConnection::ConnectionType type(); |
22 | void setConnectionType( ); | 22 | void setConnectionType( ); |
23 | void start(); | 23 | void start(); |
24 | void stop(); | 24 | void stop(); |
25 | 25 | ||
26 | private: | 26 | private: |
27 | QString m_name; | 27 | QString m_name; |
28 | QString m_mac; | 28 | QString m_mac; |
29 | ConnectionType m_connectionType; | 29 | ConnectionType m_connectionType; |
30 | OProcess* m_panConnect; | 30 | Opie::Core::OProcess* m_panConnect; |
31 | 31 | ||
32 | private slots: | 32 | private slots: |
33 | void slotExited( OProcess* proc ); | 33 | void slotExited( Opie::Core::OProcess* proc ); |
34 | void slotStdOut( OProcess* proc, char* chars, int len ); | 34 | void slotStdOut( Opie::Core::OProcess* proc, char* chars, int len ); |
35 | }; | 35 | }; |
36 | 36 | ||
37 | 37 | ||
38 | } | 38 | } |
39 | 39 | ||
40 | #endif | 40 | #endif |