summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/lib
authorar <ar>2004-05-31 15:26:50 (UTC)
committer ar <ar>2004-05-31 15:26:50 (UTC)
commit27dfc34d411dee76f09f5e516c60b0a64eb35948 (patch) (side-by-side diff)
treeb7f7259497630390e352a1257cac5dc59f5399a6 /noncore/net/opietooth/lib
parent27b09fe4f930b96e82cea9fb0eb1a9b87f7ec062 (diff)
downloadopie-27dfc34d411dee76f09f5e516c60b0a64eb35948.zip
opie-27dfc34d411dee76f09f5e516c60b0a64eb35948.tar.gz
opie-27dfc34d411dee76f09f5e516c60b0a64eb35948.tar.bz2
- convert qWarning to owarn
Diffstat (limited to 'noncore/net/opietooth/lib') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/lib/device.cc95
-rw-r--r--noncore/net/opietooth/lib/manager.cc65
-rw-r--r--noncore/net/opietooth/lib/parser.cc60
3 files changed, 116 insertions, 104 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,9 +1,14 @@
-#include <signal.h>
+#include "device.h"
+/* OPIE */
#include <opie2/oprocess.h>
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
+/* STD */
+#include <signal.h>
-#include "device.h"
using namespace OpieTooth;
@@ -14,10 +19,10 @@ namespace {
QString string( par );
QStringList list = QStringList::split( '\n', string );
for( QStringList::Iterator it = list.begin(); it != list.end(); ++it ){
- qWarning("parsePID: %s", (*it).latin1() );
+ owarn << "parsePID: " << (*it).latin1() << oendl;
if( !(*it).startsWith("CSR") ){
- id = (*it).toInt();
- break;
+ id = (*it).toInt();
+ break;
}
}
return id;
@@ -27,7 +32,7 @@ namespace {
Device::Device(const QString &device, const QString &mode, const QString &speed )
: QObject(0, "device") {
- qWarning("OpieTooth::Device create" );
+ owarn << "OpieTooth::Device create" << oendl;
m_hci = 0;
m_process = 0;
m_attached = false;
@@ -40,10 +45,10 @@ Device::~Device(){
detach();
}
void Device::attach(){
- qWarning("attaching %s %s %s", m_device.latin1(), m_mode.latin1(), m_speed.latin1() );
+ owarn << "attaching " << m_device.latin1() << " " << m_mode.latin1() << " " << m_speed.latin1() << oendl;
if(m_process == 0 ){
m_output.resize(0);
- qWarning("new process to create" );
+ owarn << "new process to create" << oendl;
m_process = new OProcess();
*m_process << "hciattach";
*m_process << "-p";
@@ -55,7 +60,7 @@ void Device::attach(){
connect(m_process, SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int ) ),
this, SLOT(slotStdErr(Opie::Core::OProcess*,char*,int) ) );
if(!m_process->start(OProcess::NotifyOnExit, OProcess::AllOutput ) ){
- qWarning("Could not start" );
+ owarn << "Could not start" << oendl;
delete m_process;
m_process = 0;
}
@@ -67,10 +72,10 @@ void Device::detach(){
// kill the pid we got
if(m_attached ){
//kill the pid
- qWarning( "killing" );
+ warn << "killing" << oendl;
kill(pid, 9);
}
- qWarning("detached" );
+ owarn << "detached" << oendl;
}
bool Device::isLoaded()const{
return m_attached;
@@ -80,52 +85,52 @@ QString Device::devName()const {
};
void Device::slotExited( OProcess* proc)
{
- qWarning("prcess exited" );
+ owarn << "prcess exited" << oendl;
if(proc== m_process ){
- qWarning("proc == m_process" );
+ owarn << "proc == m_process" << oendl;
if( m_process->normalExit() ){ // normal exit
- qWarning("normalExit" );
+ owarn << "normalExit" << oendl;
int ret = m_process->exitStatus();
if( ret == 0 ){ // attached
- qWarning("attached" );
- qWarning("Output: %s", m_output.data() );
- pid = parsePid( m_output );
- qWarning("Pid = %d", pid );
- // now hciconfig hci0 up ( determine hciX FIXME)
- // and call hciconfig hci0 up
- // FIXME hardcoded to hci0 now :(
- m_hci = new OProcess( );
- *m_hci << "hciconfig";
- *m_hci << "hci0 up";
- connect(m_hci, SIGNAL( processExited(Opie::Core::OProcess*) ),
+ owarn << "attached" << oendl;
+ owarn << "Output: " << m_output.data() << oendl;
+ pid = parsePid( m_output );
+ owarn << "Pid = " << pid << oendl;
+ // now hciconfig hci0 up ( determine hciX FIXME)
+ // and call hciconfig hci0 up
+ // FIXME hardcoded to hci0 now :(
+ m_hci = new OProcess( );
+ *m_hci << "hciconfig";
+ *m_hci << "hci0 up";
+ connect(m_hci, SIGNAL( processExited(Opie::Core::OProcess*) ),
this, SLOT( slotExited(Opie::Core::OProcess* ) ) );
- if(!m_hci->start() ){
- qWarning("could not start" );
- m_attached = false;
- emit device("hci0", false );
- }
+ if(!m_hci->start() ){
+ owarn << "could not start" << oendl;
+ m_attached = false;
+ emit device("hci0", false );
+ }
}else{
- qWarning("crass" );
- m_attached = false;
- emit device("hci0", false );
+ owarn << "crass" << oendl;
+ m_attached = false;
+ emit device("hci0", false );
}
}
delete m_process;
m_process = 0;
}else if(proc== m_hci ){
- qWarning("M HCI exited" );
+ owarn << "M HCI exited" << oendl;
if( m_hci->normalExit() ){
- qWarning("normal exit" );
+ owarn << "normal exit" << oendl;
int ret = m_hci->exitStatus();
if( ret == 0 ){
- qWarning("attached really really attached" );
- m_attached = true;
- emit device("hci0", true );
+ owarn << "attached really really attached" << oendl;
+ m_attached = true;
+ emit device("hci0", true );
}else{
- qWarning( "failed" );
- emit device("hci0", false );
- m_attached = false;
+ owarn << "failed" << oendl;
+ emit device("hci0", false );
+ m_attached = false;
}
}// normal exit
delete m_hci;
@@ -134,19 +139,19 @@ void Device::slotExited( OProcess* proc)
}
void Device::slotStdOut(OProcess* proc, char* chars, int len)
{
- qWarning("std out" );
+ owarn << "std out" << oendl;
if( len <1 ){
- qWarning( "len < 1 " );
+ owarn << "len < 1 " << oendl;
return;
}
if(proc == m_process ){
QCString string( chars, len+1 ); // \0 == +1
- qWarning("output: %s", string.data() );
+ owarn << "output: " << string.data() << oendl;
m_output.append( string.data() );
}
}
void Device::slotStdErr(OProcess* proc, char* chars, int len)
{
- qWarning("std err" );
+ owarn << "std err" << oendl;
slotStdOut( proc, chars, len );
}
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,10 +1,11 @@
-
-#include <opie2/oprocess.h>
-
#include "parser.h"
#include "manager.h"
+#include <opie2/oprocess.h>
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
using namespace OpieTooth;
@@ -12,7 +13,7 @@ using Opie::Core::OProcess;
Manager::Manager( const QString& dev )
: QObject()
{
- qWarning("created");
+ owarn << "created" << oendl;
m_device = dev;
m_hcitool = 0;
m_sdp = 0;
@@ -57,7 +58,7 @@ void Manager::isAvailable( Device* /*dev*/ ){
}
void Manager::searchDevices( const QString& device ){
- qWarning("search devices");
+ owarn << "search devices" << oendl;
OProcess* hcitool = new OProcess();
hcitool->setName( device.isEmpty() ? "hci0" : device.latin1() );
*hcitool << "hcitool" << "scan";
@@ -66,7 +67,7 @@ void Manager::searchDevices( const QString& device ){
connect( hcitool, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ),
this, SLOT(slotHCIOut(Opie::Core::OProcess*, char*, int ) ) );
if (!hcitool->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
- qWarning("could not start");
+ owarn << "could not start" << oendl;
RemoteDevice::ValueList list;
emit foundDevices( device, list );
delete hcitool;
@@ -107,13 +108,13 @@ void Manager::searchServices( const QString& remDevice ){
OProcess *m_sdp =new OProcess();
*m_sdp << "sdptool" << "browse" << remDevice;
m_sdp->setName( remDevice.latin1() );
- qWarning("search Services for %s", remDevice.latin1() );
+ owarn << "search Services for " << remDevice.latin1() << oendl;
connect(m_sdp, SIGNAL(processExited(Opie::Core::OProcess*) ),
this, SLOT(slotSDPExited(Opie::Core::OProcess* ) ) );
connect(m_sdp, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ),
this, SLOT(slotSDPOut(Opie::Core::OProcess*, char*, int) ) );
if (!m_sdp->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
- qWarning("could not start sdptool" );
+ owarn << "could not start sdptool" << oendl;
delete m_sdp;
Services::ValueList list;
emit foundServices( remDevice, list );
@@ -140,7 +141,7 @@ void Manager::slotProcessExited(OProcess* proc ) {
void Manager::slotSDPOut(OProcess* proc, char* ch, int len)
{
QCString str(ch, len+1 );
- qWarning("SDP:%s", str.data() );
+ owarn << "SDP:" << str.data() << oendl;
QMap<QString, QString>::Iterator it;
it = m_out.find(proc->name() );
QString string;
@@ -153,12 +154,12 @@ void Manager::slotSDPOut(OProcess* proc, char* ch, int len)
}
void Manager::slotSDPExited( OProcess* proc)
{
- qWarning("proc name %s", proc->name() );
+ owarn << "proc name " << proc->name() << oendl;
Services::ValueList list;
if (proc->normalExit() ) {
QMap<QString, QString>::Iterator it = m_out.find( proc->name() );
if ( it != m_out.end() ) {
- qWarning("found process" );
+ owarn << "found process" << oendl;
list = parseSDPOutput( it.data() );
m_out.remove( it );
}
@@ -168,20 +169,20 @@ void Manager::slotSDPExited( OProcess* proc)
}
Services::ValueList Manager::parseSDPOutput( const QString& out ) {
Services::ValueList list;
- qWarning("parsing output" );
+ owarn << "parsing output" << oendl;
Parser parser( out );
list = parser.services();
return list;
}
void Manager::slotHCIExited(OProcess* proc ) {
- qWarning("process exited");
+ owarn << "process exited" << oendl;
RemoteDevice::ValueList list;
if (proc->normalExit() ) {
- qWarning("normalExit %s", proc->name() );
+ owarn << "normalExit " << proc->name() << oendl;
QMap<QString, QString>::Iterator it = m_devices.find(proc->name() );
if (it != m_devices.end() ) {
- qWarning("!= end ;)");
+ owarn << "!= end ;)" << oendl;
list = parseHCIOutput( it.data() );
m_devices.remove( it );
}
@@ -191,13 +192,13 @@ void Manager::slotHCIExited(OProcess* proc ) {
}
void Manager::slotHCIOut(OProcess* proc, char* ch, int len) {
QCString str( ch, len+1 );
- qWarning("hci: %s", str.data() );
+ owarn << "hci: " << str.data() oendl;
QMap<QString, QString>::Iterator it;
it = m_devices.find( proc->name() );
- qWarning("proc->name %s", proc->name() );
+ owarn << "proc->name " << proc->name() << oendl;
QString string;
if (it != m_devices.end() ) {
- qWarning("slotHCIOut ");
+ owarn << "slotHCIOut " << oendl;
string = it.data();
}
string.append( str );
@@ -205,20 +206,20 @@ void Manager::slotHCIOut(OProcess* proc, char* ch, int len) {
m_devices.replace( proc->name(), string );
}
RemoteDevice::ValueList Manager::parseHCIOutput(const QString& output ) {
- qWarning("parseHCI %s", output.latin1() );
+ owarn << "parseHCI " << output.latin1() << oendl;
RemoteDevice::ValueList list;
QStringList strList = QStringList::split('\n', output );
QStringList::Iterator it;
QString str;
for ( it = strList.begin(); it != strList.end(); ++it ) {
str = (*it).stripWhiteSpace();
- qWarning("OpieTooth %s", str.latin1() );
+ owarn << "OpieTooth " << str.latin1() << oendl;
int pos = str.findRev(':' );
if ( pos > 0 ) {
QString mac = str.left(17 );
str.remove( 0, 17 );
- qWarning("mac %s", mac.latin1() );
- qWarning("rest:%s", str.latin1() );
+ owarn << "mac " << mac.latin1() << oendl;
+ owarn << "rest: " << str.latin1() << oendl;
RemoteDevice rem( mac , str.stripWhiteSpace() );
list.append( rem );
}
@@ -243,7 +244,7 @@ void Manager::connectTo( const QString& mac) {
void Manager::searchConnections() {
- qWarning("searching connections?");
+ owarn << "searching connections?" << oendl;
OProcess* proc = new OProcess();
m_hcitoolCon = QString::null;
@@ -281,15 +282,15 @@ ConnectionState::ValueList Manager::parseConnections( const QString& out ) {
for (; it != list.end(); ++it ) {
QString row = (*it).stripWhiteSpace();
QStringList value = QStringList::split(' ', row );
- qWarning("0: %s", value[0].latin1() );
- qWarning("1: %s", value[1].latin1() );
- qWarning("2: %s", value[2].latin1() );
- qWarning("3: %s", value[3].latin1() );
- qWarning("4: %s", value[4].latin1() );
- qWarning("5: %s", value[5].latin1() );
- qWarning("6: %s", value[6].latin1() );
- qWarning("7: %s", value[7].latin1() );
- qWarning("8: %s", value[8].latin1() );
+ owan << "0: %s" << value[0].latin1() << oendl;
+ owan << "1: %s" << value[1].latin1() << oendl;
+ owan << "2: %s" << value[2].latin1() << oendl;
+ owan << "3: %s" << value[3].latin1() << oendl;
+ owan << "4: %s" << value[4].latin1() << oendl;
+ owan << "5: %s" << value[5].latin1() << oendl;
+ owan << "6: %s" << value[6].latin1() << oendl;
+ owan << "7: %s" << value[7].latin1() << oendl;
+ owan << "8: %s" << value[8].latin1() << oendl;
ConnectionState con;
con.setDirection( value[0] == QString::fromLatin1("<") ? Outgoing : Incoming );
con.setConnectionMode( value[1] );
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,7 +1,13 @@
+#include "parser.h"
+
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
+/* QT */
#include <qstringlist.h>
-#include "parser.h"
using namespace OpieTooth;
@@ -13,29 +19,29 @@ namespace {
// @eturn 13398
// tactic find " (
int convert( const QString& line, QString& ret ) {
-// qWarning("called");
+// owarn << "called" << oendl;
ret = QString::null;
int i = 0;
int pos = line.findRev("\" (");
if ( pos > 0 ) { // it shouldn't be at pos 0
ret = line.left(pos ).stripWhiteSpace();
- // qWarning("ret: %s", ret.latin1() );
+ // owarn << "ret: " << ret.latin1() << oendl;
ret = ret.replace(QRegExp("[\"]"), "");
- //qWarning("ret: %s", ret.latin1() );
+ //owarn << "ret: " << ret.latin1() << oendl;
QString dummy = line.mid(pos + 5 );
- //qWarning("dummy: %s", dummy.latin1() );
+ //owarn << "dummy: " << dummy.latin1() << oendl;
dummy = dummy.replace(QRegExp("[)]"), "");
- //qWarning("dummy: %s", dummy.latin1() );
+ //owarn << "dummy: " << dummy.latin1() << oendl;
// dummy = dummy.remove( dummy.length() -2, 1 ); // remove the )
bool ok;
i = dummy.toInt(&ok, 16 );
//if (ok ) {
- // qWarning("converted %d", i);
- //}else qWarning("failed" );
- //qWarning("exiting");
+ // owarn << "converted " << i << oendl;
+ //}else owarn << "failed" << oendl;
+ //owarn << "exiting" << oendl;
return i;
}
- //qWarning("output %d", i );
+ //owarn << "output " << i << oendl;
return i;
}
@@ -57,11 +63,11 @@ void Parser::parse( const QString& string) {
QStringList list = QStringList::split('\n', string,TRUE );
QStringList::Iterator it;
for (it = list.begin(); it != list.end(); ++it ) {
- //qWarning("line:%s:line", (*it).latin1() );
+ //owarn << "line:" << (*it).latin1() << oendl;
if ( (*it).startsWith("Browsing") ) continue;
if ( (*it).stripWhiteSpace().isEmpty() ) { // line is empty because a new Service begins
- qWarning("could add");
+ owarn << "could add" << oendl;
// now see if complete and add
if (m_complete ) {
if (!m_item.serviceName().isEmpty() )
@@ -80,22 +86,22 @@ void Parser::parse( const QString& string) {
}
// missed the last one
if (m_complete) {
-// qWarning("adding");
+// owarn << "adding" << oendl;
if (!m_item.serviceName().isEmpty() )
m_list.append(m_item );
}
QValueList<Services>::Iterator it2;
if (m_list.isEmpty() )
- qWarning("m_list is empty");
+ owarn << "m_list is empty" << oendl;
for (it2 = m_list.begin(); it2 != m_list.end(); ++it2 ) {
- qWarning("name %s", (*it2).serviceName().latin1() );
+ owarn << "name " << (*it2).serviceName().latin1() << oendl;
}
}
bool Parser::parseName( const QString& str) {
if (str.startsWith("Service Name:") ) {
m_item.setServiceName( str.mid(13).stripWhiteSpace() );
- qWarning(m_item.serviceName() );
+ owarn << m_item.serviceName() << oendl;
return true;
}
return false;
@@ -103,13 +109,13 @@ bool Parser::parseName( const QString& str) {
bool Parser::parseRecHandle( const QString& str) {
if (str.startsWith("Service RecHandle:" ) ) {
QString out = str.mid(18 ).stripWhiteSpace();
- qWarning("out %s", out.latin1() );
+ owarn << "out " << out.latin1() << oendl;
int value = out.mid(2).toInt(&m_ok, 16 );
if (m_ok && (value != -1) )
m_complete = true;
else
m_complete = false;
- qWarning("rec handle %d", value);
+ owarn << "rec handle " << value << oendl;
m_item.setRecHandle( value );
return true;
@@ -118,13 +124,13 @@ bool Parser::parseRecHandle( const QString& str) {
}
bool Parser::parseClassId( const QString& str) {
if (str.startsWith("Service Class ID List:") ) {
- qWarning("found class id" );
- qWarning("line:%s", str.latin1() );
+ owarn << "found class id" << oendl;
+ owarn << "line: " << str.latin1() << oendl;
m_classOver = true;
return true;
}else if ( m_classOver && str.startsWith(" " ) ){ // ok now are the informations in place
- qWarning("line with class id" );
- qWarning("%s",str.latin1() );
+ owarn << "line with class id" << oendl;
+ owarn << str.latin1() << oendl;
// "Obex Object Push" (0x1105)
// find backwards the " and the from 0 to pos and the mid pos+1
@@ -133,12 +139,12 @@ bool Parser::parseClassId( const QString& str) {
QString classes;
int ids;
ids = convert( str, classes );
- qWarning("ids %d", ids );
+ owarn << "ids " << ids << oendl;
m_item.insertClassId( ids, classes );
return true;
}else{
- qWarning("Else %d", m_classOver );
+ owarn << "Else " << m_classOver << oendl;
m_classOver = false;
}
return false;
@@ -150,7 +156,7 @@ bool Parser::parseProtocol( const QString& str) {
return true;
}else if (m_protocolOver && str.startsWith(" ") ) { // "L2CAP" (0x0100)
- qWarning("double protocol filter");
+ owarn << "double protocol filter" << oendl;
if (!m_protocolAdded ) { // the protocol does neither supply a channel nor port so add it now
Services::ProtocolDescriptor desc( m_protName, m_protId );
@@ -162,7 +168,7 @@ bool Parser::parseProtocol( const QString& str) {
}
return true;
}else if (m_protocolOver && str.startsWith(" ") ) {
- qWarning("tripple protocol filter");
+ owarn << "tripple protocol filter" << oendl;
m_protocolAdded = true;
QString dummy = str.stripWhiteSpace();
int pos = dummy.findRev(':');
@@ -187,7 +193,7 @@ bool Parser::parseProfile( const QString& str) {
int pos = str.findRev(':');
if ( pos > 0 ) {
int dummy = str.mid(pos+1 ).stripWhiteSpace().toInt();
- qWarning("dummyInt:%d", dummy );
+ owarn << "dummyInt: " << dummy << oendl;
Services::ProfileDescriptor desc( m_profName, m_profId, dummy );
m_item.insertProfileDescriptor(desc);
}