summaryrefslogtreecommitdiff
path: root/core/obex/obex.cc
Side-by-side diff
Diffstat (limited to 'core/obex/obex.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--core/obex/obex.cc28
1 files changed, 4 insertions, 24 deletions
diff --git a/core/obex/obex.cc b/core/obex/obex.cc
index 7c40b90..5dfcfb5 100644
--- a/core/obex/obex.cc
+++ b/core/obex/obex.cc
@@ -34,7 +34,6 @@ Obex::~Obex() {
void Obex::receive() {
m_receive = true;
m_outp = QString::null;
- owarn << "Receive" << oendl;
m_rec = new OProcess();
*m_rec << "irobex_palm3";
// connect to the necessary slots
@@ -45,28 +44,22 @@ void Obex::receive() {
this, SLOT(slotStdOut(Opie::Core::OProcess*, char*, int) ) );
if(!m_rec->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
- owarn << "could not start :(" oendl;
emit done( false );
delete m_rec;
m_rec = 0;
}
-// emit currentTry(m_count );
-
}
+
void Obex::send( const QString& fileName) { // if currently receiving stop it send receive
m_count = 0;
m_file = fileName;
- owarn << "send " << fileName.latin1() << oendl;
if (m_rec != 0 ) {
- owarn << "running" oendl;
if (m_rec->isRunning() ) {
emit error(-1 );
- owarn << "is running" << oendl;
delete m_rec;
m_rec = 0;
}else{
- owarn << "is not running" << oendl;
emit error( -1 ); // we did not delete yet but it's not running slotExited is pending
return;
}
@@ -74,7 +67,6 @@ void Obex::send( const QString& fileName) { // if currently receiving stop it se
sendNow();
}
void Obex::sendNow(){
- owarn << "sendNow" << oendl;
if ( m_count >= 25 ) { // could not send
emit error(-1 );
emit sent(false);
@@ -93,7 +85,6 @@ void Obex::sendNow(){
// now start it
if (!m_send->start(/*OProcess::NotifyOnExit, OProcess::AllOutput*/ ) ) {
- owarn << "could not send" << oendl;
m_count = 25;
emit error(-1 );
delete m_send;
@@ -105,17 +96,16 @@ void Obex::sendNow(){
}
void Obex::slotExited(OProcess* proc ){
- if (proc == m_rec ) { // receive process
+ if (proc == m_rec ) // receive process
received();
- }else if ( proc == m_send ) {
+ else if ( proc == m_send )
sendEnd();
- }
+
}
void Obex::slotStdOut(OProcess* proc, char* buf, int len){
if ( proc == m_rec ) { // only receive
QByteArray ar( len );
memcpy( ar.data(), buf, len );
- owarn << "parsed: " << ar.data() << oendl;
m_outp.append( ar );
}
}
@@ -124,7 +114,6 @@ void Obex::received() {
if (m_rec->normalExit() ) {
if ( m_rec->exitStatus() == 0 ) { // we got one
QString filename = parseOut();
- owarn << "ACHTUNG " << filename.latin1() << oendl;
emit receivedFile( filename );
}
}else{
@@ -140,13 +129,11 @@ void Obex::sendEnd() {
if ( m_send->exitStatus() == 0 ) {
delete m_send;
m_send=0;
- owarn << "done" << oendl;
emit sent(true);
}else if (m_send->exitStatus() == 255 ) { // it failed maybe the other side wasn't ready
// let's try it again
delete m_send;
m_send = 0;
- owarn << "try sending again" << oendl;
sendNow();
}
}else {
@@ -163,14 +150,10 @@ QString Obex::parseOut( ){
if ( (*it).startsWith("Wrote" ) ) {
int pos = (*it).findRev('(' );
if ( pos > 0 ) {
- owarn << pos << " " << (*it).mid(6 ).latin1() << oendl;
- owarn << (*it).length() << " " << (*it).length()-pos << oendl;
path = (*it).remove( pos, (*it).length() - pos );
- owarn << path.latin1() << oendl;
path = path.mid(6 );
path = path.stripWhiteSpace();
- owarn << "path " << path.latin1() << oendl;
}
}
}
@@ -180,7 +163,6 @@ QString Obex::parseOut( ){
* when sent is done slotError is called we will start receive again
*/
void Obex::slotError() {
- owarn << "slotError" << oendl;
if ( m_receive )
receive();
};
@@ -193,10 +175,8 @@ void Obex::setReceiveEnabled( bool receive ) {
void Obex::shutDownReceive() {
if (m_rec != 0 ) {
- owarn << "running" << oendl;
if (m_rec->isRunning() ) {
emit error(-1 );
- owarn << "is running" << oendl;
delete m_rec;
m_rec = 0;
}