Diffstat (limited to 'noncore/apps/opie-console/dialer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/dialer.cpp | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/noncore/apps/opie-console/dialer.cpp b/noncore/apps/opie-console/dialer.cpp index 7010594..8883b83 100644 --- a/noncore/apps/opie-console/dialer.cpp +++ b/noncore/apps/opie-console/dialer.cpp @@ -1,19 +1,15 @@ #include "dialer.h" #include "io_modem.h" -/* OPIE */ -#include <opie2/odebug.h> -using namespace Opie::Core; - /* QT */ #include <qlayout.h> #include <qprogressbar.h> #include <qlabel.h> #include <qpushbutton.h> #include <qapp.h> #include <qtimer.h> #include <qmessagebox.h> /* STD */ #include <unistd.h> #include <string.h> @@ -100,25 +96,24 @@ void Dialer::slotCancel() if(state != state_online) { usercancel = 1; reset(); } else { accept(); } } void Dialer::reset() { - owarn << "reset" << oendl; switchState(state_cancel); } void Dialer::slotAutostart() { //state = state_preinit; dial(m_profile.readEntry("Number")); } void Dialer::dial(const QString& number) { while(state != state_online) @@ -132,36 +127,33 @@ void Dialer::dial(const QString& number) } if(usercancel) { // modem hangup trydial(QString::null); reject(); } } void Dialer::trydial(const QString& number) { - owarn << "TryDial:" << number.latin1() << "" << oendl; if(state != state_cancel) switchState(state_preinit); if(cleanshutdown) { - owarn << "HangupString " << m_profile.readEntry("HangupString") << oendl; send(m_profile.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) + "\r"); } if(state != state_cancel) { switchState(state_init); -// owarn << "Init String " + m_profile.readEntry("InitString") << oendl; send(m_profile.readEntry("InitString",MODEM_DEFAULT_INIT_STRING ) + "\r"); QString response2 = receive(); if(!response2.contains("\nOK\r")) reset(); } /* if(state != state_cancel) { switchState(state_options); owarn << "ATM3l3" << oendl; send("ATM3L3\r"); @@ -174,61 +166,59 @@ void Dialer::trydial(const QString& number) if(state != state_cancel) { switchState(state_dialtone); send("ATX1\r"); QString response4 = receive(); if(!response4.contains("\nOK\r")) reset(); } if(state != state_cancel) { - owarn << "progress" << oendl; switchState(state_dialing); // send(QString("ATDT %1\r").arg(number)); send(QString("%1 %2\r").arg(m_profile.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 )) .arg(number)); QString response5 = receive(); if(!response5.contains("CONNECT") ) { if(response5.contains("BUSY")) switchState(state_dialing); else { QMessageBox::warning(this, QObject::tr("Failure"), - QObject::tr("Dialing the number failed.")); + QObject::tr("<qt>Dialing the number failed.</qt>")); slotCancel(); } } } if(state != state_cancel) { state = state_online; slotCancel(); } } void Dialer::send(const QString& msg) { QString m = msg; int bytes; QString termination; - owarn << "Sending: " << m.latin1() << "" << oendl; /* termination = "\r"; //termination = m_profile.readEntry("Termination"); if(termination == "\n") m = m + "\n"; else if(termination == "\r") m = m + "\r"; else m = m + "\r\n"; */ m = m.replace(QRegExp("\n"), "\r"); bytes = ::write(m_fd, m.local8Bit(), strlen(m.local8Bit())); if(bytes < 0) { @@ -243,29 +233,27 @@ QString Dialer::receive() int ret; int counter = 0; while(1) { ret = ::read(m_fd, buffer, sizeof(buffer)); if(ret > 0) { for(int i = 0; i < ret; i++) buffer[i] = buffer[i] & 0x7F; buffer[ret] = 0; - owarn << "Got: " << buffer << "" << oendl; buf.append(QString(buffer)); if(buf.contains("OK") || buf.contains("ERROR") || buf.contains("CONNECT") || (buf.contains("BUSY"))) { - //owarn << "Receiving: '" << buf.latin1() << "'" << oendl; cleanshutdown = 1; return buf; }else if (buf.contains("NO CARRIER") || buf.contains("NO DIALTONE") ) { cleanshutdown = 1; return QString::null; } } else if(ret < 0) { if(errno != EAGAIN) reset(); else if(!(counter++ % 100)) qApp->processEvents(); } |