summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/lib/manager.cc
Unidiff
Diffstat (limited to 'noncore/net/opietooth/lib/manager.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/lib/manager.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/noncore/net/opietooth/lib/manager.cc b/noncore/net/opietooth/lib/manager.cc
index 177c94e..23506b3 100644
--- a/noncore/net/opietooth/lib/manager.cc
+++ b/noncore/net/opietooth/lib/manager.cc
@@ -103,17 +103,19 @@ void Manager::removeServices( const QStringList& list){
103 removeService( (*it) ); 103 removeService( (*it) );
104} 104}
105void Manager::searchServices( const QString& remDevice ){ 105void Manager::searchServices( const QString& remDevice ){
106 OProcess *m_sdp =new OProcess(); 106 OProcess *m_sdp =new OProcess();
107 *m_sdp << "sdptool" << "browse" << remDevice; 107 *m_sdp << "sdptool" << "browse" << remDevice;
108 m_sdp->setName( remDevice.latin1() ); 108 m_sdp->setName( remDevice.latin1() );
109 qWarning("search Services for %s", remDevice.latin1() );
109 connect(m_sdp, SIGNAL(processExited(OProcess*) ), 110 connect(m_sdp, SIGNAL(processExited(OProcess*) ),
110 this, SLOT(slotSDPExited(OProcess* ) ) ); 111 this, SLOT(slotSDPExited(OProcess* ) ) );
111 connect(m_sdp, SIGNAL(receivedStdout(OProcess*, char*, int ) ), 112 connect(m_sdp, SIGNAL(receivedStdout(OProcess*, char*, int ) ),
112 this, SLOT(slotSDPOut(OProcess*, char*, int) ) ); 113 this, SLOT(slotSDPOut(OProcess*, char*, int) ) );
113 if (!m_sdp->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { 114 if (!m_sdp->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
115 qWarning("could not start sdptool" );
114 delete m_sdp; 116 delete m_sdp;
115 Services::ValueList list; 117 Services::ValueList list;
116 emit foundServices( remDevice, list ); 118 emit foundServices( remDevice, list );
117 } 119 }
118} 120}
119void Manager::searchServices( const RemoteDevice& dev){ 121void Manager::searchServices( const RemoteDevice& dev){
@@ -134,36 +136,41 @@ void Manager::slotProcessExited(OProcess* proc ) {
134 emit available( name, conn ); 136 emit available( name, conn );
135 delete proc; 137 delete proc;
136} 138}
137void Manager::slotSDPOut(OProcess* proc, char* ch, int len) 139void Manager::slotSDPOut(OProcess* proc, char* ch, int len)
138{ 140{
139 QCString str(ch, len+1 ); 141 QCString str(ch, len+1 );
142 qWarning("SDP:%s", str.data() );
140 QMap<QString, QString>::Iterator it; 143 QMap<QString, QString>::Iterator it;
141 it = m_out.find(proc->name() ); 144 it = m_out.find(proc->name() );
145 QString string;
142 if ( it != m_out.end() ) { 146 if ( it != m_out.end() ) {
143 QString string = it.data(); 147 string = it.data();
144 string.append( str );
145 m_out.replace( proc->name(), string );
146 } 148 }
149 string.append( str );
150 m_out.replace( proc->name(), string );
147 151
148} 152}
149void Manager::slotSDPExited( OProcess* proc) 153void Manager::slotSDPExited( OProcess* proc)
150{ 154{
155 qWarning("proc name %s", proc->name() );
151 Services::ValueList list; 156 Services::ValueList list;
152 if (proc->normalExit() ) { 157 if (proc->normalExit() ) {
153 QMap<QString, QString>::Iterator it = m_out.find( proc->name() ); 158 QMap<QString, QString>::Iterator it = m_out.find( proc->name() );
154 if ( it != m_out.end() ) { 159 if ( it != m_out.end() ) {
160 qWarning("found process" );
155 list = parseSDPOutput( it.data() ); 161 list = parseSDPOutput( it.data() );
156 m_out.remove( it ); 162 m_out.remove( it );
157 } 163 }
158 } 164 }
159 emit foundServices( proc->name(), list ); 165 emit foundServices( proc->name(), list );
160 delete proc; 166 delete proc;
161} 167}
162Services::ValueList Manager::parseSDPOutput( const QString& out ) { 168Services::ValueList Manager::parseSDPOutput( const QString& out ) {
163 Services::ValueList list; 169 Services::ValueList list;
170 qWarning("parsing output" );
164 Parser parser( out ); 171 Parser parser( out );
165 list = parser.services(); 172 list = parser.services();
166 return list; 173 return list;
167} 174}
168 175
169void Manager::slotHCIExited(OProcess* proc ) { 176void Manager::slotHCIExited(OProcess* proc ) {