-rw-r--r-- | noncore/apps/opie-console/atconfigdialog.cpp | 16 | ||||
-rw-r--r-- | noncore/apps/opie-console/atconfigdialog.h | 19 | ||||
-rw-r--r-- | noncore/apps/opie-console/dialer.cpp | 37 | ||||
-rw-r--r-- | noncore/apps/opie-console/dialer.h | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_modem.h | 18 |
5 files changed, 47 insertions, 44 deletions
diff --git a/noncore/apps/opie-console/atconfigdialog.cpp b/noncore/apps/opie-console/atconfigdialog.cpp index 87a08f6..5c02692 100644 --- a/noncore/apps/opie-console/atconfigdialog.cpp +++ b/noncore/apps/opie-console/atconfigdialog.cpp @@ -1,199 +1,215 @@ #include <qlineedit.h> #include <qspinbox.h> #include <qlayout.h> #include <qcombobox.h> #include <qtabwidget.h> #include <qlabel.h> #include <qcombobox.h> #include <qscrollview.h> #include "atconfigdialog.h" +#include "io_modem.h" ATConfigDialog::ATConfigDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { setCaption( tr( "Dialing parameter setup" ) ); QVBoxLayout *layout = new QVBoxLayout( this ); QTabWidget *tabWidget = new QTabWidget( this ); tabWidget->addTab( tab0( this ), tr("Settings1") ); tabWidget->addTab( tab1( this ), tr("Settings2") ); layout->addWidget( tabWidget ); } QWidget* ATConfigDialog::tab0( QWidget* parent) { QScrollView* sv = new QScrollView( parent ); QWidget *returnWidget = new QWidget( sv->viewport() ); sv->setResizePolicy( QScrollView::AutoOneFit ); // sv->setHScrollBarMode( QScrollView::AlwaysOff ); // sv->setFrameShape( QFrame::NoFrame ); QGridLayout *layout = new QGridLayout( returnWidget, 10, 2 ); QLabel *initStringLabel = new QLabel( tr("Init string "), returnWidget ); initStringLine = new QLineEdit( returnWidget ); layout->addWidget( initStringLabel, 0, 0 ); layout->addWidget( initStringLine, 0, 1 ); QLabel *resetStringLabel = new QLabel( tr("Reset string "), returnWidget ); resetStringLine = new QLineEdit( returnWidget ); layout->addWidget( resetStringLabel, 1, 0 ); layout->addWidget( resetStringLine, 1, 1 ); QLabel *dialPref1Label = new QLabel( tr("Dialing prefix #1 " ), returnWidget ); dialPref1Line = new QLineEdit( returnWidget ); layout->addWidget( dialPref1Label, 2, 0 ); layout->addWidget( dialPref1Line, 2, 1 ); QLabel *dialSuf1Label = new QLabel( tr("Dialing suffix #1 " ), returnWidget ); dialSuf1Line = new QLineEdit( returnWidget ); layout->addWidget( dialSuf1Label, 3, 0 ); layout->addWidget( dialSuf1Line, 3, 1 ); QLabel *dialPref2Label = new QLabel( tr("Dialing prefix #2 " ), returnWidget ); dialPref2Line = new QLineEdit( returnWidget ); layout->addWidget( dialPref2Label, 4, 0 ); layout->addWidget( dialPref2Line, 4, 1 ); QLabel *dialSuf2Label = new QLabel( tr("Dialing suffix #2 " ), returnWidget ); dialSuf2Line = new QLineEdit( returnWidget ); layout->addWidget( dialSuf2Label, 5, 0 ); layout->addWidget( dialSuf2Line, 5, 1 ); QLabel *dialPref3Label = new QLabel( tr("Dialing prefix #3 " ), returnWidget ); dialPref3Line = new QLineEdit( returnWidget ); layout->addWidget( dialPref3Label, 6, 0 ); layout->addWidget( dialPref3Line, 6, 1 ); QLabel *dialSuf3Label = new QLabel( tr("Dialing suffix #3 " ), returnWidget ); dialSuf3Line = new QLineEdit( returnWidget ); layout->addWidget( dialSuf3Label, 7, 0 ); layout->addWidget( dialSuf3Line, 7, 1 ); QLabel *connectLabel = new QLabel( tr("Connect string " ), returnWidget ); connectLine = new QLineEdit( returnWidget ); layout->addWidget( connectLabel, 8, 0 ); layout->addWidget( connectLine, 8, 1 ); QLabel *hangupLabel = new QLabel( tr("Hang-up string " ), returnWidget ); hangupLine = new QLineEdit( returnWidget ); layout->addWidget( hangupLabel, 9, 0 ); layout->addWidget( hangupLine, 9, 1 ); sv->addChild( returnWidget ); return sv; } QWidget* ATConfigDialog::tab1( QWidget* parent ) { QWidget *returnWidget = new QWidget( parent ); QGridLayout *layout = new QGridLayout( returnWidget, 8, 2 ); QLabel *dialTimeLabel = new QLabel( tr("Dial time " ), returnWidget ); dialTimeSpin = new QSpinBox( returnWidget ); layout->addWidget( dialTimeLabel, 0, 0 ); layout->addWidget( dialTimeSpin, 0, 1 ); QLabel *delayRedialLabel = new QLabel( tr("Delay before redial " ), returnWidget ); delayRedialSpin = new QSpinBox( returnWidget ); layout->addWidget( delayRedialLabel, 1, 0 ); layout->addWidget( delayRedialSpin, 1, 1 ); QLabel *numberTriesLabel = new QLabel( tr("Number of tries " ), returnWidget ); numberTriesSpin = new QSpinBox( returnWidget ); layout->addWidget( numberTriesLabel, 2, 0 ); layout->addWidget( numberTriesSpin, 2, 1 ); QLabel *dtrDropTimeLabel = new QLabel( tr("DTR drop time (0=no) " ), returnWidget ); dtrDropTimeSpin = new QSpinBox( returnWidget ); layout->addWidget( dtrDropTimeLabel, 3, 0 ); layout->addWidget( dtrDropTimeSpin, 3, 1 ); QLabel *bpsDetectLabel = new QLabel( tr("Auto bps detect " ), returnWidget ); bpsDetectBox = new QComboBox( returnWidget ); layout->addWidget( bpsDetectLabel, 4, 0 ); layout->addWidget( bpsDetectBox, 4, 1 ); bpsDetectBox->insertItem( tr("No") ); bpsDetectBox->insertItem( tr("Yes") ); QLabel *dcdLinesLabel = new QLabel( tr("Modem has DCD line " ), returnWidget ); dcdLinesBox = new QComboBox( returnWidget ); layout->addWidget( dcdLinesLabel, 5, 0 ); layout->addWidget( dcdLinesBox, 5, 1 ); dcdLinesBox->insertItem( tr("No") ); dcdLinesBox->insertItem( tr("Yes") ); QLabel *multiLineUntagLabel = new QLabel( tr("Multi-line untag " ), returnWidget ); multiLineUntagBox = new QComboBox( returnWidget ); layout->addWidget( multiLineUntagLabel, 6, 0 ); layout->addWidget( multiLineUntagBox, 6, 1 ); multiLineUntagBox->insertItem( tr("No") ); multiLineUntagBox->insertItem( tr("Yes") ); return returnWidget; } void ATConfigDialog::readConfig( const Profile& config ) { initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) ); resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) ); dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) ); dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) ); dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) ); dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); connectLine->setText( config.readEntry("DefaultConnect", MODEM_DEFAULT_CONNECT_STRING ) ); hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) ); dialTimeSpin->setValue( config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ) ); delayRedialSpin->setValue( config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ) ); numberTriesSpin->setValue( config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ) ); dtrDropTimeSpin->setValue( config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ) ); bpsDetectBox->setCurrentItem( config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ) ); dcdLinesBox->setCurrentItem( config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ) ); multiLineUntagBox->setCurrentItem( config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ) ); + + // Not implemented yet + resetStringLine->setEnabled(false); + dialSuf1Line->setEnabled(false); + dialPref2Line->setEnabled(false); + dialSuf2Line->setEnabled(false); + dialPref3Line->setEnabled(false); + dialSuf3Line->setEnabled(false); + dialTimeSpin->setEnabled(false); + delayRedialSpin->setEnabled(false); + numberTriesSpin->setEnabled(false); + dtrDropTimeSpin->setEnabled(false); + bpsDetectBox->setEnabled(false); + dcdLinesBox->setEnabled(false); + multiLineUntagBox->setEnabled(false); } void ATConfigDialog::writeConfig( Profile& config ) { config.writeEntry( "InitString", initStringLine->text() ); config.writeEntry( "ResetString", resetStringLine->text() ); config.writeEntry( "DialPrefix1", dialPref1Line->text() ); config.writeEntry( "DialSuffix1", dialSuf1Line->text() ); config.writeEntry( "DialPrefix2", dialPref2Line->text() ); config.writeEntry( "DialSuffix2", dialSuf2Line->text() ); config.writeEntry( "DialPrefix3", dialPref3Line->text() ); config.writeEntry( "DialSuffix3", dialSuf3Line->text() ); config.writeEntry( "DefaultConnect", connectLine->text() ); config.writeEntry( "HangupString", hangupLine->text() ); config.writeEntry( "DialTime", dialTimeSpin->value() ); config.writeEntry( "DelayRedial", delayRedialSpin->value() ); config.writeEntry( "NumberTries", numberTriesSpin->value() ); config.writeEntry( "DTRDRopTime", dtrDropTimeSpin->value() ); config.writeEntry( "BPSDetect", bpsDetectBox->currentItem() ); config.writeEntry( "DCDLines", dcdLinesBox->currentItem() ); config.writeEntry( "MultiLineUntag", multiLineUntagBox->currentItem() ); } ATConfigDialog::~ATConfigDialog() { } diff --git a/noncore/apps/opie-console/atconfigdialog.h b/noncore/apps/opie-console/atconfigdialog.h index 4dd033b..8cb044e 100644 --- a/noncore/apps/opie-console/atconfigdialog.h +++ b/noncore/apps/opie-console/atconfigdialog.h @@ -1,69 +1,50 @@ #ifndef ATCONFIGDIALOG_H #define ATCONFIGDIALOG_H #include <qdialog.h> #include "profile.h" -#define MODEM_DEFAULT_INIT_STRING "~^M~ATZ^M~" -#define MODEM_DEFAULT_RESET_STRING "~^M~ATZ^M~" -#define MODEM_DEFAULT_DIAL_PREFIX1 "ATDT" -#define MODEM_DEFAULT_DIAL_SUFFIX1 "^M" -#define MODEM_DEFAULT_DIAL_PREFIX2 "ATDP" -#define MODEM_DEFAULT_DIAL_SUFFIX2 "^M" -#define MODEM_DEFAULT_DIAL_PREFIX3 "ATX1DT" -#define MODEM_DEFAULT_DIAL_SUFFIX3 ";X4D^M" -#define MODEM_DEFAULT_CONNECT_STRING "CONNECT" -#define MODEM_DEFAULT_HANGUP_STRING "~~+++~~ATH^M" -#define MODEM_DEFAULT_CANCEL_STRING "^M" -#define MODEM_DEFAULT_DIAL_TIME 45 -#define MODEM_DEFAULT_DELAY_REDIAL 2 -#define MODEM_DEFAULT_NUMBER_TRIES 10 -#define MODEM_DEFAULT_DTR_DROP_TIME 1 -#define MODEM_DEFAULT_BPS_DETECT 0 // bool -#define MODEM_DEFAULT_DCD_LINES 1 //bool -#define MODEM_DEFAULT_MULTI_LINE_UNTAG 0 // bool - class QLineEdit; class QSpinBox; class QComboBox; class ATConfigDialog : public QDialog { Q_OBJECT public: ATConfigDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~ATConfigDialog(); void readConfig( const Profile& ); void writeConfig( Profile& ); private: QWidget *tab0( QWidget* parent); QWidget *tab1( QWidget* parent); private: QLineEdit *initStringLine; QLineEdit *resetStringLine; QLineEdit *dialPref1Line; QLineEdit *dialSuf1Line; QLineEdit *dialPref2Line; QLineEdit *dialSuf2Line; QLineEdit *dialPref3Line; QLineEdit *dialSuf3Line; QLineEdit *connectLine; QLineEdit *hangupLine; QSpinBox *dialTimeSpin; QSpinBox *delayRedialSpin; QSpinBox *numberTriesSpin; QSpinBox *dtrDropTimeSpin; QComboBox *bpsDetectBox; QComboBox *dcdLinesBox; QComboBox *multiLineUntagBox; }; #endif diff --git a/noncore/apps/opie-console/dialer.cpp b/noncore/apps/opie-console/dialer.cpp index 51d4093..d37e406 100644 --- a/noncore/apps/opie-console/dialer.cpp +++ b/noncore/apps/opie-console/dialer.cpp @@ -1,296 +1,301 @@ #include "dialer.h" #include <qlayout.h> #include <qprogressbar.h> #include <qlabel.h> #include <qpushbutton.h> #include <qapp.h> #include <qtimer.h> #include <qmessagebox.h> #include <unistd.h> #include <string.h> #include <fcntl.h> #include <errno.h> // State machine: | When an error occurs, we don't have to // | reset everything. // (init) <------+ | But if the user wants to reset, // | | | we stop dialing immediately. // v | | // (options) ----+ | Following the state machine is necessary // | \ | to get determinable results. // v ^ | // (dial) ----+ | // | ^ | // v | | // (online) --+ | // | | // v | // from atconfigdialog //initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) ); //resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) ); //dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) ); //dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); //dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) ); //dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); //dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) ); //dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); //connectLine->setText( config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ) ); //hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) ); // from modemconfigwidget //int rad_flow = prof.readNumEntry("Flow"); //int rad_parity = prof.readNumEntry("Parity"); //int speed = prof.readNumEntry("Speed"); //QString number = prof.readEntry("Number"); Dialer::Dialer(const Profile& profile, int fd, QWidget *parent, const char *name) : QDialog(parent, name, true), m_fd(fd), m_profile(profile) { QVBoxLayout *vbox; QLabel *desc; //m_profile.writeEntry("InitString", "ATZ"); //m_profile.writeEntry("DialPrefix1", "ATDT"); //m_profile.writeEntry("Termination", "\n"); usercancel = 0; + cleanshutdown = 0; fcntl(m_fd, F_SETFL, O_NONBLOCK); desc = new QLabel(QObject::tr("Dialing number: %1").arg(m_profile.readEntry("Number")), this); progress = new QProgressBar(this); status = new QLabel("", this); status->setFrameStyle(QFrame::Panel | QFrame::Sunken); cancel = new QPushButton(QObject::tr("Cancel"), this); vbox = new QVBoxLayout(this, 2); vbox->add(desc); vbox->add(progress); vbox->add(status); vbox->add(cancel); connect(cancel, SIGNAL(clicked()), SLOT(slotCancel())); show(); QTimer::singleShot(500, this, SLOT(slotAutostart())); } Dialer::~Dialer() { } void Dialer::setHangupOnly() { state = state_cancel; usercancel = 1; } void Dialer::slotCancel() { if(state != state_online) { usercancel = 1; reset(); } else accept(); } void Dialer::reset() { switchState(state_cancel); } void Dialer::slotAutostart() { //state = state_preinit; dial(m_profile.readEntry("Number")); } void Dialer::dial(const QString& number) { while(state != state_online) { if(!usercancel) { state = state_preinit; trydial(number); } else break; } if(usercancel) { // modem hangup trydial(QString::null); reject(); } } void Dialer::trydial(const QString& number) { - //if(state != state_cancel) - //{ - if(state != state_cancel) switchState(state_preinit); - send("+++ATH"); + if(state != state_cancel) switchState(state_preinit); + if(cleanshutdown) + { + send(m_profile.readEntry("HangupString")); + //send("+++ATH"); send(""); - //QString response = receive(); - //} + } if(state != state_cancel) { switchState(state_init); - send("ATZ"); - //send(m_profile.readEntry("InitString")); + //send("ATZ"); + send(m_profile.readEntry("InitString")); QString response2 = receive(); if(!response2.contains("\nOK\r")) reset(); } if(state != state_cancel) { switchState(state_options); send("ATM3L3"); QString response3 = receive(); if(!response3.contains("\nOK\r")) reset(); } if(state != state_cancel) { switchState(state_dialtone); send("ATX1"); QString response4 = receive(); if(!response4.contains("\nOK\r")) reset(); } if(state != state_cancel) { switchState(state_dialing); - send(QString("ATDT %1").arg(number)); - //send(QString("%1 %2").arg(m_profile.readEntry("DialPrefix1")).arg(number)); + //send(QString("ATDT %1").arg(number)); + send(QString("%1 %2").arg(m_profile.readEntry("DialPrefix1")).arg(number)); QString response5 = receive(); - if(!response5.contains("\nCONNECT")) + if(!response5.contains("\n" + m_profile.readEntry("DefaultConnect"))) { if(response5.contains("BUSY")) switchState(state_dialing); else { QMessageBox::warning(this, QObject::tr("Failure"), QObject::tr("Dialing the number failed.")); slotCancel(); } } } if(state != state_cancel) { switchState(state_online); } } void Dialer::send(const QString& msg) { QString m = msg; int bytes; QString termination; -qWarning("Sending: '%s'", m.latin1()); + //qWarning("Sending: '%s'", m.latin1()); 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"; bytes = ::write(m_fd, m.local8Bit(), strlen(m.local8Bit())); if(bytes < 0) { reset(); } } QString Dialer::receive() { QString buf; char buffer[1024]; int ret; int counter; 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; -qWarning("Got: '%s'", buffer); + //qWarning("Got: '%s'", buffer); buf.append(QString(buffer)); if(buf.contains("OK") || buf.contains("ERROR") || buf.contains("CONNECT") || (buf.contains("BUSY"))) -{ -qWarning("Receiving: '%s'", buf.latin1()); + { + //qWarning("Receiving: '%s'", buf.latin1()); + cleanshutdown = 1; return buf; -} + } } else if(ret < 0) { if(errno != EAGAIN) reset(); else if(!(counter++ % 100)) qApp->processEvents(); } else if(!(counter++ % 100)) qApp->processEvents(); + + if(usercancel) return QString::null; } + cleanshutdown = 1; return QString::null; } void Dialer::switchState(int newstate) { int oldstate = state; state = newstate; switch(state) { case state_cancel: status->setText(QObject::tr("Cancelling...")); progress->setProgress(0); break; case state_preinit: status->setText(QObject::tr("Searching modem")); progress->setProgress(10); break; case state_init: status->setText(QObject::tr("Initializing...")); progress->setProgress(20); break; case state_options: status->setText(QObject::tr("Reset speakers")); progress->setProgress(30); break; case state_dialtone: status->setText(QObject::tr("Turning off dialtone")); progress->setProgress(40); break; case state_dialing: if(oldstate != state_dialing) status->setText(QObject::tr("Dial number")); else status->setText(QObject::tr("Line busy, redialing number")); progress->setProgress(50); break; case state_online: status->setText(QObject::tr("Connection established")); progress->setProgress(100); cancel->setText(QObject::tr("Dismiss")); break; } } diff --git a/noncore/apps/opie-console/dialer.h b/noncore/apps/opie-console/dialer.h index 84444b9..28303f3 100644 --- a/noncore/apps/opie-console/dialer.h +++ b/noncore/apps/opie-console/dialer.h @@ -1,53 +1,54 @@ #ifndef DIALER_H #define DIALER_H #include <qdialog.h> #include "profile.h" class QLabel; class QProgressBar; class Dialer : public QDialog { Q_OBJECT public: Dialer(const Profile& profile, int fd, QWidget *parent = NULL, const char *name = NULL); ~Dialer(); void setHangupOnly(); public slots: void slotCancel(); void slotAutostart(); private: void switchState(int newstate); void reset(); void dial(const QString& number); void trydial(const QString& number); void send(const QString& msg); QString receive(); enum States { state_cancel, state_preinit, state_init, state_options, state_dialtone, state_dialing, state_online }; QLabel *status; QProgressBar *progress; QPushButton *cancel; int state; int usercancel; const Profile& m_profile; int m_fd; + int cleanshutdown; }; #endif diff --git a/noncore/apps/opie-console/io_modem.h b/noncore/apps/opie-console/io_modem.h index 8453b95..1328706 100644 --- a/noncore/apps/opie-console/io_modem.h +++ b/noncore/apps/opie-console/io_modem.h @@ -1,71 +1,71 @@ #ifndef OPIE_IO_MODEM #define OPIE_IO_MODEM #include <opie/oprocess.h> #include "io_serial.h" #include "profile.h" /* Default values to be used if the profile information is incomplete */ #define MODEM_DEFAULT_DEVICE "/dev/ttyS0" #define MODEM_DEFAULT_BAUD 9600 #define MODEM_DEFAULT_PARITY 0 #define MODEM_DEFAULT_DBITS 8 #define MODEM_DEFAULT_SBITS 1 #define MODEM_DEFAULT_FLOW 0 -#define MODEM_DEFAULT_INIT_STRING "~^M~ATZ^M~" -#define MODEM_DEFAULT_RESET_STRING "~^M~ATZ^M~" +#define MODEM_DEFAULT_INIT_STRING "ATZ" +#define MODEM_DEFAULT_RESET_STRING "ATZ~" #define MODEM_DEFAULT_DIAL_PREFIX1 "ATDT" -#define MODEM_DEFAULT_DIAL_SUFFIX1 "^M" -#define MODEM_DEFAULT_DIAL_PREFIX2 "ATDP" -#define MODEM_DEFAULT_DIAL_SUFFIX2 "^M" -#define MODEM_DEFAULT_DIAL_PREFIX3 "ATX1DT" -#define MODEM_DEFAULT_DIAL_SUFFIX3 ";X4D^M" +#define MODEM_DEFAULT_DIAL_SUFFIX1 "" +#define MODEM_DEFAULT_DIAL_PREFIX2 "" +#define MODEM_DEFAULT_DIAL_SUFFIX2 "" +#define MODEM_DEFAULT_DIAL_PREFIX3 "" +#define MODEM_DEFAULT_DIAL_SUFFIX3 "" #define MODEM_DEFAULT_CONNECT_STRING "CONNECT" -#define MODEM_DEFAULT_HANGUP_STRING "~~+++~~ATH^M" -#define MODEM_DEFAULT_CANCEL_STRING "^M" +#define MODEM_DEFAULT_HANGUP_STRING "+++ATH" +#define MODEM_DEFAULT_CANCEL_STRING "" #define MODEM_DEFAULT_DIAL_TIME 45 #define MODEM_DEFAULT_DELAY_REDIAL 2 #define MODEM_DEFAULT_NUMBER_TRIES 10 #define MODEM_DEFAULT_DTR_DROP_TIME 1 #define MODEM_DEFAULT_BPS_DETECT 0 // bool #define MODEM_DEFAULT_DCD_LINES 1 //bool #define MODEM_DEFAULT_MULTI_LINE_UNTAG 0 // bool /* IOSerial implements a RS232 IO Layer */ class IOModem : public IOSerial { Q_OBJECT public: IOModem(const Profile &); ~IOModem(); QString identifier() const; QString name() const; signals: void received(const QByteArray &); void error(int, const QString &); public slots: bool open(); void close(); void reload(const Profile &); private: QString m_initString, m_resetString, m_dialPref1, m_dialSuf1, m_dialPref2, m_dialSuf2, m_dialPref3, m_dialSuf3, m_connect, m_hangup, m_cancel; int m_dialTime, m_delayRedial, m_numberTries, m_dtrDropTime, m_bpsDetect, m_dcdLines, m_multiLineUntag; Profile m_profile; private slots: void slotExited(OProcess* proc); }; #endif |