author | ar <ar> | 2004-05-31 15:26:50 (UTC) |
---|---|---|
committer | ar <ar> | 2004-05-31 15:26:50 (UTC) |
commit | 27dfc34d411dee76f09f5e516c60b0a64eb35948 (patch) (unidiff) | |
tree | b7f7259497630390e352a1257cac5dc59f5399a6 /noncore/net/opietooth | |
parent | 27b09fe4f930b96e82cea9fb0eb1a9b87f7ec062 (diff) | |
download | opie-27dfc34d411dee76f09f5e516c60b0a64eb35948.zip opie-27dfc34d411dee76f09f5e516c60b0a64eb35948.tar.gz opie-27dfc34d411dee76f09f5e516c60b0a64eb35948.tar.bz2 |
- convert qWarning to owarn
-rw-r--r-- | noncore/net/opietooth/lib/device.cc | 55 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/manager.cc | 65 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/parser.cc | 60 |
3 files changed, 96 insertions, 84 deletions
diff --git a/noncore/net/opietooth/lib/device.cc b/noncore/net/opietooth/lib/device.cc index 04c50d9..f81066e 100644 --- a/noncore/net/opietooth/lib/device.cc +++ b/noncore/net/opietooth/lib/device.cc | |||
@@ -1,152 +1,157 @@ | |||
1 | 1 | ||
2 | #include <signal.h> | 2 | #include "device.h" |
3 | 3 | ||
4 | /* OPIE */ | ||
4 | #include <opie2/oprocess.h> | 5 | #include <opie2/oprocess.h> |
6 | #include <opie2/odebug.h> | ||
7 | using namespace Opie::Core; | ||
8 | |||
9 | /* STD */ | ||
10 | #include <signal.h> | ||
5 | 11 | ||
6 | #include "device.h" | ||
7 | 12 | ||
8 | using namespace OpieTooth; | 13 | using namespace OpieTooth; |
9 | 14 | ||
10 | using Opie::Core::OProcess; | 15 | using Opie::Core::OProcess; |
11 | namespace { | 16 | namespace { |
12 | int parsePid( const QCString& par ){ | 17 | int parsePid( const QCString& par ){ |
13 | int id=0; | 18 | int id=0; |
14 | QString string( par ); | 19 | QString string( par ); |
15 | QStringList list = QStringList::split( '\n', string ); | 20 | QStringList list = QStringList::split( '\n', string ); |
16 | for( QStringList::Iterator it = list.begin(); it != list.end(); ++it ){ | 21 | for( QStringList::Iterator it = list.begin(); it != list.end(); ++it ){ |
17 | qWarning("parsePID: %s", (*it).latin1() ); | 22 | owarn << "parsePID: " << (*it).latin1() << oendl; |
18 | if( !(*it).startsWith("CSR") ){ | 23 | if( !(*it).startsWith("CSR") ){ |
19 | id = (*it).toInt(); | 24 | id = (*it).toInt(); |
20 | break; | 25 | break; |
21 | } | 26 | } |
22 | } | 27 | } |
23 | return id; | 28 | return id; |
24 | } | 29 | } |
25 | } | 30 | } |
26 | 31 | ||
27 | Device::Device(const QString &device, const QString &mode, const QString &speed ) | 32 | Device::Device(const QString &device, const QString &mode, const QString &speed ) |
28 | : QObject(0, "device") { | 33 | : QObject(0, "device") { |
29 | 34 | ||
30 | qWarning("OpieTooth::Device create" ); | 35 | owarn << "OpieTooth::Device create" << oendl; |
31 | m_hci = 0; | 36 | m_hci = 0; |
32 | m_process = 0; | 37 | m_process = 0; |
33 | m_attached = false; | 38 | m_attached = false; |
34 | m_device = device; | 39 | m_device = device; |
35 | m_mode = mode; | 40 | m_mode = mode; |
36 | m_speed = speed; | 41 | m_speed = speed; |
37 | attach(); | 42 | attach(); |
38 | } | 43 | } |
39 | Device::~Device(){ | 44 | Device::~Device(){ |
40 | detach(); | 45 | detach(); |
41 | } | 46 | } |
42 | void Device::attach(){ | 47 | void Device::attach(){ |
43 | qWarning("attaching %s %s %s", m_device.latin1(), m_mode.latin1(), m_speed.latin1() ); | 48 | owarn << "attaching " << m_device.latin1() << " " << m_mode.latin1() << " " << m_speed.latin1() << oendl; |
44 | if(m_process == 0 ){ | 49 | if(m_process == 0 ){ |
45 | m_output.resize(0); | 50 | m_output.resize(0); |
46 | qWarning("new process to create" ); | 51 | owarn << "new process to create" << oendl; |
47 | m_process = new OProcess(); | 52 | m_process = new OProcess(); |
48 | *m_process << "hciattach"; | 53 | *m_process << "hciattach"; |
49 | *m_process << "-p"; | 54 | *m_process << "-p"; |
50 | *m_process << m_device << m_mode << m_speed; | 55 | *m_process << m_device << m_mode << m_speed; |
51 | connect(m_process, SIGNAL( processExited(Opie::Core::OProcess*) ), | 56 | connect(m_process, SIGNAL( processExited(Opie::Core::OProcess*) ), |
52 | this, SLOT( slotExited(Opie::Core::OProcess* ) ) ); | 57 | this, SLOT( slotExited(Opie::Core::OProcess* ) ) ); |
53 | connect(m_process, SIGNAL( receivedStdout(Opie::Core::OProcess*, char*, int) ), | 58 | connect(m_process, SIGNAL( receivedStdout(Opie::Core::OProcess*, char*, int) ), |
54 | this, SLOT(slotStdOut(Opie::Core::OProcess*,char*,int ) ) ); | 59 | this, SLOT(slotStdOut(Opie::Core::OProcess*,char*,int ) ) ); |
55 | connect(m_process, SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int ) ), | 60 | connect(m_process, SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int ) ), |
56 | this, SLOT(slotStdErr(Opie::Core::OProcess*,char*,int) ) ); | 61 | this, SLOT(slotStdErr(Opie::Core::OProcess*,char*,int) ) ); |
57 | if(!m_process->start(OProcess::NotifyOnExit, OProcess::AllOutput ) ){ | 62 | if(!m_process->start(OProcess::NotifyOnExit, OProcess::AllOutput ) ){ |
58 | qWarning("Could not start" ); | 63 | owarn << "Could not start" << oendl; |
59 | delete m_process; | 64 | delete m_process; |
60 | m_process = 0; | 65 | m_process = 0; |
61 | } | 66 | } |
62 | }; | 67 | }; |
63 | } | 68 | } |
64 | void Device::detach(){ | 69 | void Device::detach(){ |
65 | delete m_hci; | 70 | delete m_hci; |
66 | delete m_process; | 71 | delete m_process; |
67 | // kill the pid we got | 72 | // kill the pid we got |
68 | if(m_attached ){ | 73 | if(m_attached ){ |
69 | //kill the pid | 74 | //kill the pid |
70 | qWarning( "killing" ); | 75 | warn << "killing" << oendl; |
71 | kill(pid, 9); | 76 | kill(pid, 9); |
72 | } | 77 | } |
73 | qWarning("detached" ); | 78 | owarn << "detached" << oendl; |
74 | } | 79 | } |
75 | bool Device::isLoaded()const{ | 80 | bool Device::isLoaded()const{ |
76 | return m_attached; | 81 | return m_attached; |
77 | } | 82 | } |
78 | QString Device::devName()const { | 83 | QString Device::devName()const { |
79 | return QString::fromLatin1("hci0"); | 84 | return QString::fromLatin1("hci0"); |
80 | }; | 85 | }; |
81 | void Device::slotExited( OProcess* proc) | 86 | void Device::slotExited( OProcess* proc) |
82 | { | 87 | { |
83 | qWarning("prcess exited" ); | 88 | owarn << "prcess exited" << oendl; |
84 | if(proc== m_process ){ | 89 | if(proc== m_process ){ |
85 | qWarning("proc == m_process" ); | 90 | owarn << "proc == m_process" << oendl; |
86 | if( m_process->normalExit() ){ // normal exit | 91 | if( m_process->normalExit() ){ // normal exit |
87 | qWarning("normalExit" ); | 92 | owarn << "normalExit" << oendl; |
88 | int ret = m_process->exitStatus(); | 93 | int ret = m_process->exitStatus(); |
89 | if( ret == 0 ){ // attached | 94 | if( ret == 0 ){ // attached |
90 | qWarning("attached" ); | 95 | owarn << "attached" << oendl; |
91 | qWarning("Output: %s", m_output.data() ); | 96 | owarn << "Output: " << m_output.data() << oendl; |
92 | pid = parsePid( m_output ); | 97 | pid = parsePid( m_output ); |
93 | qWarning("Pid = %d", pid ); | 98 | owarn << "Pid = " << pid << oendl; |
94 | // now hciconfig hci0 up ( determine hciX FIXME) | 99 | // now hciconfig hci0 up ( determine hciX FIXME) |
95 | // and call hciconfig hci0 up | 100 | // and call hciconfig hci0 up |
96 | // FIXME hardcoded to hci0 now :( | 101 | // FIXME hardcoded to hci0 now :( |
97 | m_hci = new OProcess( ); | 102 | m_hci = new OProcess( ); |
98 | *m_hci << "hciconfig"; | 103 | *m_hci << "hciconfig"; |
99 | *m_hci << "hci0 up"; | 104 | *m_hci << "hci0 up"; |
100 | connect(m_hci, SIGNAL( processExited(Opie::Core::OProcess*) ), | 105 | connect(m_hci, SIGNAL( processExited(Opie::Core::OProcess*) ), |
101 | this, SLOT( slotExited(Opie::Core::OProcess* ) ) ); | 106 | this, SLOT( slotExited(Opie::Core::OProcess* ) ) ); |
102 | if(!m_hci->start() ){ | 107 | if(!m_hci->start() ){ |
103 | qWarning("could not start" ); | 108 | owarn << "could not start" << oendl; |
104 | m_attached = false; | 109 | m_attached = false; |
105 | emit device("hci0", false ); | 110 | emit device("hci0", false ); |
106 | } | 111 | } |
107 | }else{ | 112 | }else{ |
108 | qWarning("crass" ); | 113 | owarn << "crass" << oendl; |
109 | m_attached = false; | 114 | m_attached = false; |
110 | emit device("hci0", false ); | 115 | emit device("hci0", false ); |
111 | 116 | ||
112 | } | 117 | } |
113 | } | 118 | } |
114 | delete m_process; | 119 | delete m_process; |
115 | m_process = 0; | 120 | m_process = 0; |
116 | }else if(proc== m_hci ){ | 121 | }else if(proc== m_hci ){ |
117 | qWarning("M HCI exited" ); | 122 | owarn << "M HCI exited" << oendl; |
118 | if( m_hci->normalExit() ){ | 123 | if( m_hci->normalExit() ){ |
119 | qWarning("normal exit" ); | 124 | owarn << "normal exit" << oendl; |
120 | int ret = m_hci->exitStatus(); | 125 | int ret = m_hci->exitStatus(); |
121 | if( ret == 0 ){ | 126 | if( ret == 0 ){ |
122 | qWarning("attached really really attached" ); | 127 | owarn << "attached really really attached" << oendl; |
123 | m_attached = true; | 128 | m_attached = true; |
124 | emit device("hci0", true ); | 129 | emit device("hci0", true ); |
125 | }else{ | 130 | }else{ |
126 | qWarning( "failed" ); | 131 | owarn << "failed" << oendl; |
127 | emit device("hci0", false ); | 132 | emit device("hci0", false ); |
128 | m_attached = false; | 133 | m_attached = false; |
129 | } | 134 | } |
130 | }// normal exit | 135 | }// normal exit |
131 | delete m_hci; | 136 | delete m_hci; |
132 | m_hci = 0; | 137 | m_hci = 0; |
133 | } | 138 | } |
134 | } | 139 | } |
135 | void Device::slotStdOut(OProcess* proc, char* chars, int len) | 140 | void Device::slotStdOut(OProcess* proc, char* chars, int len) |
136 | { | 141 | { |
137 | qWarning("std out" ); | 142 | owarn << "std out" << oendl; |
138 | if( len <1 ){ | 143 | if( len <1 ){ |
139 | qWarning( "len < 1 " ); | 144 | owarn << "len < 1 " << oendl; |
140 | return; | 145 | return; |
141 | } | 146 | } |
142 | if(proc == m_process ){ | 147 | if(proc == m_process ){ |
143 | QCString string( chars, len+1 ); // \0 == +1 | 148 | QCString string( chars, len+1 ); // \0 == +1 |
144 | qWarning("output: %s", string.data() ); | 149 | owarn << "output: " << string.data() << oendl; |
145 | m_output.append( string.data() ); | 150 | m_output.append( string.data() ); |
146 | } | 151 | } |
147 | } | 152 | } |
148 | void Device::slotStdErr(OProcess* proc, char* chars, int len) | 153 | void Device::slotStdErr(OProcess* proc, char* chars, int len) |
149 | { | 154 | { |
150 | qWarning("std err" ); | 155 | owarn << "std err" << oendl; |
151 | slotStdOut( proc, chars, len ); | 156 | slotStdOut( proc, chars, len ); |
152 | } | 157 | } |
diff --git a/noncore/net/opietooth/lib/manager.cc b/noncore/net/opietooth/lib/manager.cc index 18e1df9..76d9127 100644 --- a/noncore/net/opietooth/lib/manager.cc +++ b/noncore/net/opietooth/lib/manager.cc | |||
@@ -1,27 +1,28 @@ | |||
1 | 1 | ||
2 | |||
3 | #include <opie2/oprocess.h> | ||
4 | |||
5 | #include "parser.h" | 2 | #include "parser.h" |
6 | #include "manager.h" | 3 | #include "manager.h" |
7 | 4 | ||
5 | #include <opie2/oprocess.h> | ||
6 | #include <opie2/odebug.h> | ||
7 | using namespace Opie::Core; | ||
8 | |||
8 | 9 | ||
9 | using namespace OpieTooth; | 10 | using namespace OpieTooth; |
10 | 11 | ||
11 | using Opie::Core::OProcess; | 12 | using Opie::Core::OProcess; |
12 | Manager::Manager( const QString& dev ) | 13 | Manager::Manager( const QString& dev ) |
13 | : QObject() | 14 | : QObject() |
14 | { | 15 | { |
15 | qWarning("created"); | 16 | owarn << "created" << oendl; |
16 | m_device = dev; | 17 | m_device = dev; |
17 | m_hcitool = 0; | 18 | m_hcitool = 0; |
18 | m_sdp = 0; | 19 | m_sdp = 0; |
19 | } | 20 | } |
20 | Manager::Manager( Device* /*dev*/ ) | 21 | Manager::Manager( Device* /*dev*/ ) |
21 | : QObject() | 22 | : QObject() |
22 | { | 23 | { |
23 | m_hcitool = 0; | 24 | m_hcitool = 0; |
24 | m_sdp = 0; | 25 | m_sdp = 0; |
25 | } | 26 | } |
26 | Manager::Manager() | 27 | Manager::Manager() |
27 | : QObject() | 28 | : QObject() |
@@ -48,34 +49,34 @@ void Manager::isAvailable( const QString& device ){ | |||
48 | if (!l2ping->start() ) { | 49 | if (!l2ping->start() ) { |
49 | emit available( device, false ); | 50 | emit available( device, false ); |
50 | delete l2ping; | 51 | delete l2ping; |
51 | } | 52 | } |
52 | 53 | ||
53 | } | 54 | } |
54 | 55 | ||
55 | void Manager::isAvailable( Device* /*dev*/ ){ | 56 | void Manager::isAvailable( Device* /*dev*/ ){ |
56 | 57 | ||
57 | 58 | ||
58 | } | 59 | } |
59 | void Manager::searchDevices( const QString& device ){ | 60 | void Manager::searchDevices( const QString& device ){ |
60 | qWarning("search devices"); | 61 | owarn << "search devices" << oendl; |
61 | OProcess* hcitool = new OProcess(); | 62 | OProcess* hcitool = new OProcess(); |
62 | hcitool->setName( device.isEmpty() ? "hci0" : device.latin1() ); | 63 | hcitool->setName( device.isEmpty() ? "hci0" : device.latin1() ); |
63 | *hcitool << "hcitool" << "scan"; | 64 | *hcitool << "hcitool" << "scan"; |
64 | connect( hcitool, SIGNAL(processExited(Opie::Core::OProcess*) ) , | 65 | connect( hcitool, SIGNAL(processExited(Opie::Core::OProcess*) ) , |
65 | this, SLOT(slotHCIExited(Opie::Core::OProcess* ) ) ); | 66 | this, SLOT(slotHCIExited(Opie::Core::OProcess* ) ) ); |
66 | connect( hcitool, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ), | 67 | connect( hcitool, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ), |
67 | this, SLOT(slotHCIOut(Opie::Core::OProcess*, char*, int ) ) ); | 68 | this, SLOT(slotHCIOut(Opie::Core::OProcess*, char*, int ) ) ); |
68 | if (!hcitool->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 69 | if (!hcitool->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
69 | qWarning("could not start"); | 70 | owarn << "could not start" << oendl; |
70 | RemoteDevice::ValueList list; | 71 | RemoteDevice::ValueList list; |
71 | emit foundDevices( device, list ); | 72 | emit foundDevices( device, list ); |
72 | delete hcitool; | 73 | delete hcitool; |
73 | } | 74 | } |
74 | } | 75 | } |
75 | 76 | ||
76 | void Manager::searchDevices(Device* /*d*/ ){ | 77 | void Manager::searchDevices(Device* /*d*/ ){ |
77 | 78 | ||
78 | 79 | ||
79 | } | 80 | } |
80 | void Manager::addService(const QString& name ){ | 81 | void Manager::addService(const QString& name ){ |
81 | OProcess proc; | 82 | OProcess proc; |
@@ -98,31 +99,31 @@ void Manager::removeService( const QString& name ){ | |||
98 | bo = false; | 99 | bo = false; |
99 | emit removedService( name, bo ); | 100 | emit removedService( name, bo ); |
100 | } | 101 | } |
101 | void Manager::removeServices( const QStringList& list){ | 102 | void Manager::removeServices( const QStringList& list){ |
102 | QStringList::ConstIterator it; | 103 | QStringList::ConstIterator it; |
103 | for (it = list.begin(); it != list.end(); ++it ) | 104 | for (it = list.begin(); it != list.end(); ++it ) |
104 | removeService( (*it) ); | 105 | removeService( (*it) ); |
105 | } | 106 | } |
106 | void Manager::searchServices( const QString& remDevice ){ | 107 | void Manager::searchServices( const QString& remDevice ){ |
107 | OProcess *m_sdp =new OProcess(); | 108 | OProcess *m_sdp =new OProcess(); |
108 | *m_sdp << "sdptool" << "browse" << remDevice; | 109 | *m_sdp << "sdptool" << "browse" << remDevice; |
109 | m_sdp->setName( remDevice.latin1() ); | 110 | m_sdp->setName( remDevice.latin1() ); |
110 | qWarning("search Services for %s", remDevice.latin1() ); | 111 | owarn << "search Services for " << remDevice.latin1() << oendl; |
111 | connect(m_sdp, SIGNAL(processExited(Opie::Core::OProcess*) ), | 112 | connect(m_sdp, SIGNAL(processExited(Opie::Core::OProcess*) ), |
112 | this, SLOT(slotSDPExited(Opie::Core::OProcess* ) ) ); | 113 | this, SLOT(slotSDPExited(Opie::Core::OProcess* ) ) ); |
113 | connect(m_sdp, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ), | 114 | connect(m_sdp, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ), |
114 | this, SLOT(slotSDPOut(Opie::Core::OProcess*, char*, int) ) ); | 115 | this, SLOT(slotSDPOut(Opie::Core::OProcess*, char*, int) ) ); |
115 | if (!m_sdp->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 116 | if (!m_sdp->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
116 | qWarning("could not start sdptool" ); | 117 | owarn << "could not start sdptool" << oendl; |
117 | delete m_sdp; | 118 | delete m_sdp; |
118 | Services::ValueList list; | 119 | Services::ValueList list; |
119 | emit foundServices( remDevice, list ); | 120 | emit foundServices( remDevice, list ); |
120 | } | 121 | } |
121 | } | 122 | } |
122 | void Manager::searchServices( const RemoteDevice& dev){ | 123 | void Manager::searchServices( const RemoteDevice& dev){ |
123 | searchServices( dev.mac() ); | 124 | searchServices( dev.mac() ); |
124 | } | 125 | } |
125 | QString Manager::toDevice( const QString& /*mac*/ ){ | 126 | QString Manager::toDevice( const QString& /*mac*/ ){ |
126 | return QString::null; | 127 | return QString::null; |
127 | } | 128 | } |
128 | QString Manager::toMac( const QString &/*device*/ ){ | 129 | QString Manager::toMac( const QString &/*device*/ ){ |
@@ -131,128 +132,128 @@ QString Manager::toMac( const QString &/*device*/ ){ | |||
131 | void Manager::slotProcessExited(OProcess* proc ) { | 132 | void Manager::slotProcessExited(OProcess* proc ) { |
132 | bool conn= false; | 133 | bool conn= false; |
133 | if (proc->normalExit() && proc->exitStatus() == 0 ) | 134 | if (proc->normalExit() && proc->exitStatus() == 0 ) |
134 | conn = true; | 135 | conn = true; |
135 | 136 | ||
136 | QString name = QString::fromLatin1(proc->name() ); | 137 | QString name = QString::fromLatin1(proc->name() ); |
137 | emit available( name, conn ); | 138 | emit available( name, conn ); |
138 | delete proc; | 139 | delete proc; |
139 | } | 140 | } |
140 | void Manager::slotSDPOut(OProcess* proc, char* ch, int len) | 141 | void Manager::slotSDPOut(OProcess* proc, char* ch, int len) |
141 | { | 142 | { |
142 | QCString str(ch, len+1 ); | 143 | QCString str(ch, len+1 ); |
143 | qWarning("SDP:%s", str.data() ); | 144 | owarn << "SDP:" << str.data() << oendl; |
144 | QMap<QString, QString>::Iterator it; | 145 | QMap<QString, QString>::Iterator it; |
145 | it = m_out.find(proc->name() ); | 146 | it = m_out.find(proc->name() ); |
146 | QString string; | 147 | QString string; |
147 | if ( it != m_out.end() ) { | 148 | if ( it != m_out.end() ) { |
148 | string = it.data(); | 149 | string = it.data(); |
149 | } | 150 | } |
150 | string.append( str ); | 151 | string.append( str ); |
151 | m_out.replace( proc->name(), string ); | 152 | m_out.replace( proc->name(), string ); |
152 | 153 | ||
153 | } | 154 | } |
154 | void Manager::slotSDPExited( OProcess* proc) | 155 | void Manager::slotSDPExited( OProcess* proc) |
155 | { | 156 | { |
156 | qWarning("proc name %s", proc->name() ); | 157 | owarn << "proc name " << proc->name() << oendl; |
157 | Services::ValueList list; | 158 | Services::ValueList list; |
158 | if (proc->normalExit() ) { | 159 | if (proc->normalExit() ) { |
159 | QMap<QString, QString>::Iterator it = m_out.find( proc->name() ); | 160 | QMap<QString, QString>::Iterator it = m_out.find( proc->name() ); |
160 | if ( it != m_out.end() ) { | 161 | if ( it != m_out.end() ) { |
161 | qWarning("found process" ); | 162 | owarn << "found process" << oendl; |
162 | list = parseSDPOutput( it.data() ); | 163 | list = parseSDPOutput( it.data() ); |
163 | m_out.remove( it ); | 164 | m_out.remove( it ); |
164 | } | 165 | } |
165 | } | 166 | } |
166 | emit foundServices( proc->name(), list ); | 167 | emit foundServices( proc->name(), list ); |
167 | delete proc; | 168 | delete proc; |
168 | } | 169 | } |
169 | Services::ValueList Manager::parseSDPOutput( const QString& out ) { | 170 | Services::ValueList Manager::parseSDPOutput( const QString& out ) { |
170 | Services::ValueList list; | 171 | Services::ValueList list; |
171 | qWarning("parsing output" ); | 172 | owarn << "parsing output" << oendl; |
172 | Parser parser( out ); | 173 | Parser parser( out ); |
173 | list = parser.services(); | 174 | list = parser.services(); |
174 | return list; | 175 | return list; |
175 | } | 176 | } |
176 | 177 | ||
177 | void Manager::slotHCIExited(OProcess* proc ) { | 178 | void Manager::slotHCIExited(OProcess* proc ) { |
178 | qWarning("process exited"); | 179 | owarn << "process exited" << oendl; |
179 | RemoteDevice::ValueList list; | 180 | RemoteDevice::ValueList list; |
180 | if (proc->normalExit() ) { | 181 | if (proc->normalExit() ) { |
181 | qWarning("normalExit %s", proc->name() ); | 182 | owarn << "normalExit " << proc->name() << oendl; |
182 | QMap<QString, QString>::Iterator it = m_devices.find(proc->name() ); | 183 | QMap<QString, QString>::Iterator it = m_devices.find(proc->name() ); |
183 | if (it != m_devices.end() ) { | 184 | if (it != m_devices.end() ) { |
184 | qWarning("!= end ;)"); | 185 | owarn << "!= end ;)" << oendl; |
185 | list = parseHCIOutput( it.data() ); | 186 | list = parseHCIOutput( it.data() ); |
186 | m_devices.remove( it ); | 187 | m_devices.remove( it ); |
187 | } | 188 | } |
188 | } | 189 | } |
189 | emit foundDevices( proc->name(), list ); | 190 | emit foundDevices( proc->name(), list ); |
190 | delete proc; | 191 | delete proc; |
191 | } | 192 | } |
192 | void Manager::slotHCIOut(OProcess* proc, char* ch, int len) { | 193 | void Manager::slotHCIOut(OProcess* proc, char* ch, int len) { |
193 | QCString str( ch, len+1 ); | 194 | QCString str( ch, len+1 ); |
194 | qWarning("hci: %s", str.data() ); | 195 | owarn << "hci: " << str.data() oendl; |
195 | QMap<QString, QString>::Iterator it; | 196 | QMap<QString, QString>::Iterator it; |
196 | it = m_devices.find( proc->name() ); | 197 | it = m_devices.find( proc->name() ); |
197 | qWarning("proc->name %s", proc->name() ); | 198 | owarn << "proc->name " << proc->name() << oendl; |
198 | QString string; | 199 | QString string; |
199 | if (it != m_devices.end() ) { | 200 | if (it != m_devices.end() ) { |
200 | qWarning("slotHCIOut "); | 201 | owarn << "slotHCIOut " << oendl; |
201 | string = it.data(); | 202 | string = it.data(); |
202 | } | 203 | } |
203 | string.append( str ); | 204 | string.append( str ); |
204 | 205 | ||
205 | m_devices.replace( proc->name(), string ); | 206 | m_devices.replace( proc->name(), string ); |
206 | } | 207 | } |
207 | RemoteDevice::ValueList Manager::parseHCIOutput(const QString& output ) { | 208 | RemoteDevice::ValueList Manager::parseHCIOutput(const QString& output ) { |
208 | qWarning("parseHCI %s", output.latin1() ); | 209 | owarn << "parseHCI " << output.latin1() << oendl; |
209 | RemoteDevice::ValueList list; | 210 | RemoteDevice::ValueList list; |
210 | QStringList strList = QStringList::split('\n', output ); | 211 | QStringList strList = QStringList::split('\n', output ); |
211 | QStringList::Iterator it; | 212 | QStringList::Iterator it; |
212 | QString str; | 213 | QString str; |
213 | for ( it = strList.begin(); it != strList.end(); ++it ) { | 214 | for ( it = strList.begin(); it != strList.end(); ++it ) { |
214 | str = (*it).stripWhiteSpace(); | 215 | str = (*it).stripWhiteSpace(); |
215 | qWarning("OpieTooth %s", str.latin1() ); | 216 | owarn << "OpieTooth " << str.latin1() << oendl; |
216 | int pos = str.findRev(':' ); | 217 | int pos = str.findRev(':' ); |
217 | if ( pos > 0 ) { | 218 | if ( pos > 0 ) { |
218 | QString mac = str.left(17 ); | 219 | QString mac = str.left(17 ); |
219 | str.remove( 0, 17 ); | 220 | str.remove( 0, 17 ); |
220 | qWarning("mac %s", mac.latin1() ); | 221 | owarn << "mac " << mac.latin1() << oendl; |
221 | qWarning("rest:%s", str.latin1() ); | 222 | owarn << "rest: " << str.latin1() << oendl; |
222 | RemoteDevice rem( mac , str.stripWhiteSpace() ); | 223 | RemoteDevice rem( mac , str.stripWhiteSpace() ); |
223 | list.append( rem ); | 224 | list.append( rem ); |
224 | } | 225 | } |
225 | } | 226 | } |
226 | return list; | 227 | return list; |
227 | } | 228 | } |
228 | 229 | ||
229 | ////// hcitool cc and hcitool con | 230 | ////// hcitool cc and hcitool con |
230 | 231 | ||
231 | /** | 232 | /** |
232 | * Create it on the stack as don't care | 233 | * Create it on the stack as don't care |
233 | * so we don't need to care for it | 234 | * so we don't need to care for it |
234 | * cause hcitool gets reparented | 235 | * cause hcitool gets reparented |
235 | */ | 236 | */ |
236 | void Manager::connectTo( const QString& mac) { | 237 | void Manager::connectTo( const QString& mac) { |
237 | OProcess proc; | 238 | OProcess proc; |
238 | proc << "hcitool"; | 239 | proc << "hcitool"; |
239 | proc << "cc"; | 240 | proc << "cc"; |
240 | proc << mac; | 241 | proc << mac; |
241 | 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 |
242 | } | 243 | } |
243 | 244 | ||
244 | 245 | ||
245 | void Manager::searchConnections() { | 246 | void Manager::searchConnections() { |
246 | qWarning("searching connections?"); | 247 | owarn << "searching connections?" << oendl; |
247 | OProcess* proc = new OProcess(); | 248 | OProcess* proc = new OProcess(); |
248 | m_hcitoolCon = QString::null; | 249 | m_hcitoolCon = QString::null; |
249 | 250 | ||
250 | connect(proc, SIGNAL(processExited(Opie::Core::OProcess*) ), | 251 | connect(proc, SIGNAL(processExited(Opie::Core::OProcess*) ), |
251 | this, SLOT(slotConnectionExited( Opie::Core::OProcess*) ) ); | 252 | this, SLOT(slotConnectionExited( Opie::Core::OProcess*) ) ); |
252 | connect(proc, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int) ), | 253 | connect(proc, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int) ), |
253 | this, SLOT(slotConnectionOutput(Opie::Core::OProcess*, char*, int) ) ); | 254 | this, SLOT(slotConnectionOutput(Opie::Core::OProcess*, char*, int) ) ); |
254 | *proc << "hcitool"; | 255 | *proc << "hcitool"; |
255 | *proc << "con"; | 256 | *proc << "con"; |
256 | 257 | ||
257 | if (!proc->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 258 | if (!proc->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
258 | ConnectionState::ValueList list; | 259 | ConnectionState::ValueList list; |
@@ -272,33 +273,33 @@ void Manager::slotConnectionOutput(OProcess* /*proc*/, char* cha, int len) { | |||
272 | //delete proc; | 273 | //delete proc; |
273 | } | 274 | } |
274 | ConnectionState::ValueList Manager::parseConnections( const QString& out ) { | 275 | ConnectionState::ValueList Manager::parseConnections( const QString& out ) { |
275 | ConnectionState::ValueList list2; | 276 | ConnectionState::ValueList list2; |
276 | QStringList list = QStringList::split('\n', out ); | 277 | QStringList list = QStringList::split('\n', out ); |
277 | QStringList::Iterator it; | 278 | QStringList::Iterator it; |
278 | // remove the first line ( "Connections:") | 279 | // remove the first line ( "Connections:") |
279 | it = list.begin(); | 280 | it = list.begin(); |
280 | it = list.remove( it ); | 281 | it = list.remove( it ); |
281 | for (; it != list.end(); ++it ) { | 282 | for (; it != list.end(); ++it ) { |
282 | QString row = (*it).stripWhiteSpace(); | 283 | QString row = (*it).stripWhiteSpace(); |
283 | QStringList value = QStringList::split(' ', row ); | 284 | QStringList value = QStringList::split(' ', row ); |
284 | qWarning("0: %s", value[0].latin1() ); | 285 | owan << "0: %s" << value[0].latin1() << oendl; |
285 | qWarning("1: %s", value[1].latin1() ); | 286 | owan << "1: %s" << value[1].latin1() << oendl; |
286 | qWarning("2: %s", value[2].latin1() ); | 287 | owan << "2: %s" << value[2].latin1() << oendl; |
287 | qWarning("3: %s", value[3].latin1() ); | 288 | owan << "3: %s" << value[3].latin1() << oendl; |
288 | qWarning("4: %s", value[4].latin1() ); | 289 | owan << "4: %s" << value[4].latin1() << oendl; |
289 | qWarning("5: %s", value[5].latin1() ); | 290 | owan << "5: %s" << value[5].latin1() << oendl; |
290 | qWarning("6: %s", value[6].latin1() ); | 291 | owan << "6: %s" << value[6].latin1() << oendl; |
291 | qWarning("7: %s", value[7].latin1() ); | 292 | owan << "7: %s" << value[7].latin1() << oendl; |
292 | qWarning("8: %s", value[8].latin1() ); | 293 | owan << "8: %s" << value[8].latin1() << oendl; |
293 | ConnectionState con; | 294 | ConnectionState con; |
294 | con.setDirection( value[0] == QString::fromLatin1("<") ? Outgoing : Incoming ); | 295 | con.setDirection( value[0] == QString::fromLatin1("<") ? Outgoing : Incoming ); |
295 | con.setConnectionMode( value[1] ); | 296 | con.setConnectionMode( value[1] ); |
296 | con.setMac( value[2] ); | 297 | con.setMac( value[2] ); |
297 | con.setHandle( value[4].toInt() ); | 298 | con.setHandle( value[4].toInt() ); |
298 | con.setState( value[6].toInt() ); | 299 | con.setState( value[6].toInt() ); |
299 | con.setLinkMode( value[8] == QString::fromLatin1("MASTER") ? Master : Client ); | 300 | con.setLinkMode( value[8] == QString::fromLatin1("MASTER") ? Master : Client ); |
300 | list2.append( con ); | 301 | list2.append( con ); |
301 | } | 302 | } |
302 | return list2; | 303 | return list2; |
303 | } | 304 | } |
304 | 305 | ||
diff --git a/noncore/net/opietooth/lib/parser.cc b/noncore/net/opietooth/lib/parser.cc index 8baf284..7e95907 100644 --- a/noncore/net/opietooth/lib/parser.cc +++ b/noncore/net/opietooth/lib/parser.cc | |||
@@ -1,199 +1,205 @@ | |||
1 | 1 | ||
2 | #include "parser.h" | ||
3 | |||
4 | /* OPIE */ | ||
5 | #include <opie2/odebug.h> | ||
6 | using namespace Opie::Core; | ||
7 | |||
8 | /* QT */ | ||
2 | #include <qstringlist.h> | 9 | #include <qstringlist.h> |
3 | 10 | ||
4 | #include "parser.h" | ||
5 | 11 | ||
6 | using namespace OpieTooth; | 12 | using namespace OpieTooth; |
7 | 13 | ||
8 | namespace { | 14 | namespace { |
9 | 15 | ||
10 | 16 | ||
11 | // "Test Foo Bar" (0x3456) | 17 | // "Test Foo Bar" (0x3456) |
12 | // @param ret Test Foo Bar | 18 | // @param ret Test Foo Bar |
13 | // @eturn 13398 | 19 | // @eturn 13398 |
14 | // tactic find " ( | 20 | // tactic find " ( |
15 | int convert( const QString& line, QString& ret ) { | 21 | int convert( const QString& line, QString& ret ) { |
16 | // qWarning("called"); | 22 | // owarn << "called" << oendl; |
17 | ret = QString::null; | 23 | ret = QString::null; |
18 | int i = 0; | 24 | int i = 0; |
19 | int pos = line.findRev("\" ("); | 25 | int pos = line.findRev("\" ("); |
20 | if ( pos > 0 ) { // it shouldn't be at pos 0 | 26 | if ( pos > 0 ) { // it shouldn't be at pos 0 |
21 | ret = line.left(pos ).stripWhiteSpace(); | 27 | ret = line.left(pos ).stripWhiteSpace(); |
22 | // qWarning("ret: %s", ret.latin1() ); | 28 | // owarn << "ret: " << ret.latin1() << oendl; |
23 | ret = ret.replace(QRegExp("[\"]"), ""); | 29 | ret = ret.replace(QRegExp("[\"]"), ""); |
24 | //qWarning("ret: %s", ret.latin1() ); | 30 | //owarn << "ret: " << ret.latin1() << oendl; |
25 | QString dummy = line.mid(pos + 5 ); | 31 | QString dummy = line.mid(pos + 5 ); |
26 | //qWarning("dummy: %s", dummy.latin1() ); | 32 | //owarn << "dummy: " << dummy.latin1() << oendl; |
27 | dummy = dummy.replace(QRegExp("[)]"), ""); | 33 | dummy = dummy.replace(QRegExp("[)]"), ""); |
28 | //qWarning("dummy: %s", dummy.latin1() ); | 34 | //owarn << "dummy: " << dummy.latin1() << oendl; |
29 | // dummy = dummy.remove( dummy.length() -2, 1 ); // remove the ) | 35 | // dummy = dummy.remove( dummy.length() -2, 1 ); // remove the ) |
30 | bool ok; | 36 | bool ok; |
31 | i = dummy.toInt(&ok, 16 ); | 37 | i = dummy.toInt(&ok, 16 ); |
32 | //if (ok ) { | 38 | //if (ok ) { |
33 | // qWarning("converted %d", i); | 39 | // owarn << "converted " << i << oendl; |
34 | //}else qWarning("failed" ); | 40 | //}else owarn << "failed" << oendl; |
35 | //qWarning("exiting"); | 41 | //owarn << "exiting" << oendl; |
36 | return i; | 42 | return i; |
37 | } | 43 | } |
38 | //qWarning("output %d", i ); | 44 | //owarn << "output " << i << oendl; |
39 | return i; | 45 | return i; |
40 | } | 46 | } |
41 | 47 | ||
42 | }; | 48 | }; |
43 | 49 | ||
44 | 50 | ||
45 | Parser::Parser(const QString& output ) { | 51 | Parser::Parser(const QString& output ) { |
46 | parse( output ); | 52 | parse( output ); |
47 | } | 53 | } |
48 | void Parser::setText(const QString& output) { | 54 | void Parser::setText(const QString& output) { |
49 | parse( output ); | 55 | parse( output ); |
50 | } | 56 | } |
51 | Services::ValueList Parser::services() const { | 57 | Services::ValueList Parser::services() const { |
52 | return m_list; | 58 | return m_list; |
53 | } | 59 | } |
54 | void Parser::parse( const QString& string) { | 60 | void Parser::parse( const QString& string) { |
55 | m_list.clear(); | 61 | m_list.clear(); |
56 | m_complete = true; | 62 | m_complete = true; |
57 | QStringList list = QStringList::split('\n', string,TRUE ); | 63 | QStringList list = QStringList::split('\n', string,TRUE ); |
58 | QStringList::Iterator it; | 64 | QStringList::Iterator it; |
59 | for (it = list.begin(); it != list.end(); ++it ) { | 65 | for (it = list.begin(); it != list.end(); ++it ) { |
60 | //qWarning("line:%s:line", (*it).latin1() ); | 66 | //owarn << "line:" << (*it).latin1() << oendl; |
61 | if ( (*it).startsWith("Browsing") ) continue; | 67 | if ( (*it).startsWith("Browsing") ) continue; |
62 | 68 | ||
63 | if ( (*it).stripWhiteSpace().isEmpty() ) { // line is empty because a new Service begins | 69 | if ( (*it).stripWhiteSpace().isEmpty() ) { // line is empty because a new Service begins |
64 | qWarning("could add"); | 70 | owarn << "could add" << oendl; |
65 | // now see if complete and add | 71 | // now see if complete and add |
66 | if (m_complete ) { | 72 | if (m_complete ) { |
67 | if (!m_item.serviceName().isEmpty() ) | 73 | if (!m_item.serviceName().isEmpty() ) |
68 | m_list.append( m_item ); | 74 | m_list.append( m_item ); |
69 | Services serv; | 75 | Services serv; |
70 | m_item = serv; | 76 | m_item = serv; |
71 | m_complete = true; | 77 | m_complete = true; |
72 | continue; | 78 | continue; |
73 | } | 79 | } |
74 | } | 80 | } |
75 | if (parseName( (*it) ) ) ;//continue; | 81 | if (parseName( (*it) ) ) ;//continue; |
76 | if (parseRecHandle( (*it) ) ) ;//continue; | 82 | if (parseRecHandle( (*it) ) ) ;//continue; |
77 | if (parseClassId( (*it) ) ) ;//continue; | 83 | if (parseClassId( (*it) ) ) ;//continue; |
78 | if (parseProtocol( (*it) ) ) ;//continue; | 84 | if (parseProtocol( (*it) ) ) ;//continue; |
79 | if (parseProfile( (*it) ) ) ;//continue; | 85 | if (parseProfile( (*it) ) ) ;//continue; |
80 | } | 86 | } |
81 | // missed the last one | 87 | // missed the last one |
82 | if (m_complete) { | 88 | if (m_complete) { |
83 | // qWarning("adding"); | 89 | // owarn << "adding" << oendl; |
84 | if (!m_item.serviceName().isEmpty() ) | 90 | if (!m_item.serviceName().isEmpty() ) |
85 | m_list.append(m_item ); | 91 | m_list.append(m_item ); |
86 | } | 92 | } |
87 | QValueList<Services>::Iterator it2; | 93 | QValueList<Services>::Iterator it2; |
88 | 94 | ||
89 | if (m_list.isEmpty() ) | 95 | if (m_list.isEmpty() ) |
90 | qWarning("m_list is empty"); | 96 | owarn << "m_list is empty" << oendl; |
91 | for (it2 = m_list.begin(); it2 != m_list.end(); ++it2 ) { | 97 | for (it2 = m_list.begin(); it2 != m_list.end(); ++it2 ) { |
92 | qWarning("name %s", (*it2).serviceName().latin1() ); | 98 | owarn << "name " << (*it2).serviceName().latin1() << oendl; |
93 | } | 99 | } |
94 | } | 100 | } |
95 | bool Parser::parseName( const QString& str) { | 101 | bool Parser::parseName( const QString& str) { |
96 | if (str.startsWith("Service Name:") ) { | 102 | if (str.startsWith("Service Name:") ) { |
97 | m_item.setServiceName( str.mid(13).stripWhiteSpace() ); | 103 | m_item.setServiceName( str.mid(13).stripWhiteSpace() ); |
98 | qWarning(m_item.serviceName() ); | 104 | owarn << m_item.serviceName() << oendl; |
99 | return true; | 105 | return true; |
100 | } | 106 | } |
101 | return false; | 107 | return false; |
102 | } | 108 | } |
103 | bool Parser::parseRecHandle( const QString& str) { | 109 | bool Parser::parseRecHandle( const QString& str) { |
104 | if (str.startsWith("Service RecHandle:" ) ) { | 110 | if (str.startsWith("Service RecHandle:" ) ) { |
105 | QString out = str.mid(18 ).stripWhiteSpace(); | 111 | QString out = str.mid(18 ).stripWhiteSpace(); |
106 | qWarning("out %s", out.latin1() ); | 112 | owarn << "out " << out.latin1() << oendl; |
107 | int value = out.mid(2).toInt(&m_ok, 16 ); | 113 | int value = out.mid(2).toInt(&m_ok, 16 ); |
108 | if (m_ok && (value != -1) ) | 114 | if (m_ok && (value != -1) ) |
109 | m_complete = true; | 115 | m_complete = true; |
110 | else | 116 | else |
111 | m_complete = false; | 117 | m_complete = false; |
112 | qWarning("rec handle %d", value); | 118 | owarn << "rec handle " << value << oendl; |
113 | m_item.setRecHandle( value ); | 119 | m_item.setRecHandle( value ); |
114 | return true; | 120 | return true; |
115 | 121 | ||
116 | } | 122 | } |
117 | return false; | 123 | return false; |
118 | } | 124 | } |
119 | bool Parser::parseClassId( const QString& str) { | 125 | bool Parser::parseClassId( const QString& str) { |
120 | if (str.startsWith("Service Class ID List:") ) { | 126 | if (str.startsWith("Service Class ID List:") ) { |
121 | qWarning("found class id" ); | 127 | owarn << "found class id" << oendl; |
122 | qWarning("line:%s", str.latin1() ); | 128 | owarn << "line: " << str.latin1() << oendl; |
123 | m_classOver = true; | 129 | m_classOver = true; |
124 | return true; | 130 | return true; |
125 | }else if ( m_classOver && str.startsWith(" " ) ){ // ok now are the informations in place | 131 | }else if ( m_classOver && str.startsWith(" " ) ){ // ok now are the informations in place |
126 | qWarning("line with class id" ); | 132 | owarn << "line with class id" << oendl; |
127 | qWarning("%s",str.latin1() ); | 133 | owarn << str.latin1() << oendl; |
128 | 134 | ||
129 | // "Obex Object Push" (0x1105) | 135 | // "Obex Object Push" (0x1105) |
130 | // find backwards the " and the from 0 to pos and the mid pos+1 | 136 | // find backwards the " and the from 0 to pos and the mid pos+1 |
131 | // then stripWhiteSpace add name replace '"' with "" | 137 | // then stripWhiteSpace add name replace '"' with "" |
132 | // and then convert 0x1105 toInt() | 138 | // and then convert 0x1105 toInt() |
133 | QString classes; | 139 | QString classes; |
134 | int ids; | 140 | int ids; |
135 | ids = convert( str, classes ); | 141 | ids = convert( str, classes ); |
136 | qWarning("ids %d", ids ); | 142 | owarn << "ids " << ids << oendl; |
137 | m_item.insertClassId( ids, classes ); | 143 | m_item.insertClassId( ids, classes ); |
138 | 144 | ||
139 | return true; | 145 | return true; |
140 | }else{ | 146 | }else{ |
141 | qWarning("Else %d", m_classOver ); | 147 | owarn << "Else " << m_classOver << oendl; |
142 | m_classOver = false; | 148 | m_classOver = false; |
143 | } | 149 | } |
144 | return false; | 150 | return false; |
145 | } | 151 | } |
146 | bool Parser::parseProtocol( const QString& str) { | 152 | bool Parser::parseProtocol( const QString& str) { |
147 | if (str.startsWith("Protocol Descriptor List:") ) { | 153 | if (str.startsWith("Protocol Descriptor List:") ) { |
148 | m_protocolOver = true; | 154 | m_protocolOver = true; |
149 | m_protocolAdded = false; | 155 | m_protocolAdded = false; |
150 | return true; | 156 | return true; |
151 | 157 | ||
152 | }else if (m_protocolOver && str.startsWith(" ") ) { // "L2CAP" (0x0100) | 158 | }else if (m_protocolOver && str.startsWith(" ") ) { // "L2CAP" (0x0100) |
153 | qWarning("double protocol filter"); | 159 | owarn << "double protocol filter" << oendl; |
154 | 160 | ||
155 | if (!m_protocolAdded ) { // the protocol does neither supply a channel nor port so add it now | 161 | if (!m_protocolAdded ) { // the protocol does neither supply a channel nor port so add it now |
156 | Services::ProtocolDescriptor desc( m_protName, m_protId ); | 162 | Services::ProtocolDescriptor desc( m_protName, m_protId ); |
157 | m_item.insertProtocolDescriptor( desc ); | 163 | m_item.insertProtocolDescriptor( desc ); |
158 | } | 164 | } |
159 | m_protocolAdded = false; | 165 | m_protocolAdded = false; |
160 | { // the find function | 166 | { // the find function |
161 | m_protId = convert(str, m_protName ); | 167 | m_protId = convert(str, m_protName ); |
162 | } | 168 | } |
163 | return true; | 169 | return true; |
164 | }else if (m_protocolOver && str.startsWith(" ") ) { | 170 | }else if (m_protocolOver && str.startsWith(" ") ) { |
165 | qWarning("tripple protocol filter"); | 171 | owarn << "tripple protocol filter" << oendl; |
166 | m_protocolAdded = true; | 172 | m_protocolAdded = true; |
167 | QString dummy = str.stripWhiteSpace(); | 173 | QString dummy = str.stripWhiteSpace(); |
168 | int pos = dummy.findRev(':'); | 174 | int pos = dummy.findRev(':'); |
169 | if ( pos > -1 ) { | 175 | if ( pos > -1 ) { |
170 | int port = dummy.mid(pos+1 ).stripWhiteSpace().toInt(); | 176 | int port = dummy.mid(pos+1 ).stripWhiteSpace().toInt(); |
171 | Services::ProtocolDescriptor desc( m_protName, m_protId, port ); | 177 | Services::ProtocolDescriptor desc( m_protName, m_protId, port ); |
172 | m_item.insertProtocolDescriptor( desc ); | 178 | m_item.insertProtocolDescriptor( desc ); |
173 | } | 179 | } |
174 | return true; | 180 | return true; |
175 | }else if (m_protocolOver ) { | 181 | }else if (m_protocolOver ) { |
176 | m_protocolOver = false; | 182 | m_protocolOver = false; |
177 | } | 183 | } |
178 | return false; | 184 | return false; |
179 | } | 185 | } |
180 | bool Parser::parseProfile( const QString& str) { | 186 | bool Parser::parseProfile( const QString& str) { |
181 | if (str.startsWith("Profile Descriptor List:") ) { | 187 | if (str.startsWith("Profile Descriptor List:") ) { |
182 | m_profOver = true; | 188 | m_profOver = true; |
183 | }else if ( m_profOver && str.startsWith(" ") ) { | 189 | }else if ( m_profOver && str.startsWith(" ") ) { |
184 | m_profId = convert( str, m_profName ); | 190 | m_profId = convert( str, m_profName ); |
185 | }else if ( m_profOver && str.startsWith(" ") ) { | 191 | }else if ( m_profOver && str.startsWith(" ") ) { |
186 | // now find | 192 | // now find |
187 | int pos = str.findRev(':'); | 193 | int pos = str.findRev(':'); |
188 | if ( pos > 0 ) { | 194 | if ( pos > 0 ) { |
189 | int dummy = str.mid(pos+1 ).stripWhiteSpace().toInt(); | 195 | int dummy = str.mid(pos+1 ).stripWhiteSpace().toInt(); |
190 | qWarning("dummyInt:%d", dummy ); | 196 | owarn << "dummyInt: " << dummy << oendl; |
191 | Services::ProfileDescriptor desc( m_profName, m_profId, dummy ); | 197 | Services::ProfileDescriptor desc( m_profName, m_profId, dummy ); |
192 | m_item.insertProfileDescriptor(desc); | 198 | m_item.insertProfileDescriptor(desc); |
193 | } | 199 | } |
194 | }else | 200 | }else |
195 | m_profOver = false; | 201 | m_profOver = false; |
196 | 202 | ||
197 | 203 | ||
198 | return false; | 204 | return false; |
199 | } | 205 | } |