summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/dialer.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-console/dialer.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-console/dialer.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/noncore/apps/opie-console/dialer.cpp b/noncore/apps/opie-console/dialer.cpp
index 8524422..67ad10e 100644
--- a/noncore/apps/opie-console/dialer.cpp
+++ b/noncore/apps/opie-console/dialer.cpp
@@ -10,12 +10,14 @@
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
+#include "io_modem.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
@@ -50,20 +52,16 @@
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);
@@ -86,13 +84,13 @@ Dialer::~Dialer()
}
void Dialer::setHangupOnly()
{
state = state_cancel;
usercancel = 1;
- send("+++ATH\r");
+ send( m_profile.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING )+"\r" );
}
void Dialer::slotCancel()
{
if(state != state_online)
{
@@ -139,25 +137,21 @@ void Dialer::dial(const QString& number)
void Dialer::trydial(const QString& number)
{
qWarning("TryDial:%s", number.latin1() );
if(state != state_cancel) switchState(state_preinit);
if(cleanshutdown)
{
- qWarning("HangupString " + m_profile.readEntry("HangupString"));
- //send(m_profile.readEntry("HangupString"));
- send("+++ATH\r");
- //send("");
+ qWarning("HangupString " + m_profile.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING));
+ send(m_profile.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) + "\r");
}
if(state != state_cancel)
{
switchState(state_init);
- //send("ATZ");
- qWarning("Init String " + m_profile.readEntry("InitString") );
-// send(m_profile.readEntry("InitString", "AT"));
- send("AT\r");
+// qWarning("Init String " + m_profile.readEntry("InitString") );
+ send(m_profile.readEntry("InitString",MODEM_DEFAULT_INIT_STRING ) + "\r");
QString response2 = receive();
if(!response2.contains("\nOK\r"))
reset();
}
/* if(state != state_cancel)
@@ -184,14 +178,16 @@ void Dialer::trydial(const QString& number)
if(state != state_cancel)
{
qWarning("progress");
switchState(state_dialing);
- send(QString("ATDT %1\r").arg(number));
-// send(QString("%1 %2").arg(m_profile.readEntry("DialPrefix1")).arg(number));
+// 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