summaryrefslogtreecommitdiff
path: root/noncore
authorjosef <josef>2002-10-18 09:31:09 (UTC)
committer josef <josef>2002-10-18 09:31:09 (UTC)
commit997c466fd91843699280a770cbf34e6917dcee8a (patch) (side-by-side diff)
tree5de950d62700508673b5d79e7bf6b402a3ba49f0 /noncore
parent07a1cb4baaf544e0e594040bbe8e5872ccb34c0f (diff)
downloadopie-997c466fd91843699280a770cbf34e6917dcee8a.zip
opie-997c466fd91843699280a770cbf34e6917dcee8a.tar.gz
opie-997c466fd91843699280a770cbf34e6917dcee8a.tar.bz2
- improve dialer
It works now correctly for me :) But a few details must be changed (i.e. no hardcoded values)
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/dialer.cpp41
1 files changed, 27 insertions, 14 deletions
diff --git a/noncore/apps/opie-console/dialer.cpp b/noncore/apps/opie-console/dialer.cpp
index 10c16ef..bd6b50f 100644
--- a/noncore/apps/opie-console/dialer.cpp
+++ b/noncore/apps/opie-console/dialer.cpp
@@ -121,2 +121,4 @@ void Dialer::dial(const QString& number)
{
+ // modem hangup
+ trydial(QString::null);
reject();
@@ -127,5 +129,5 @@ void Dialer::trydial(const QString& number)
{
- if(state != state_cancel)
- {
- switchState(state_preinit);
+ //if(state != state_cancel)
+ //{
+ if(state != state_cancel) switchState(state_preinit);
send("+++ATH");
@@ -133,3 +135,3 @@ void Dialer::trydial(const QString& number)
//QString response = receive();
- }
+ //}
@@ -149,3 +151,3 @@ void Dialer::trydial(const QString& number)
- send("ATM0L0");
+ send("ATM3L3");
QString response3 = receive();
@@ -172,8 +174,13 @@ void Dialer::trydial(const QString& number)
QString response5 = receive();
- if(!response5.contains("\nOK\r"))
+ if(!response5.contains("\nCONNECT"))
{
- QMessageBox::warning(this,
- QObject::tr("Failure"),
- QObject::tr("Dialing the number failed."));
- slotCancel();
+ if(response5.contains("BUSY"))
+ switchState(state_dialing);
+ else
+ {
+ QMessageBox::warning(this,
+ QObject::tr("Failure"),
+ QObject::tr("Dialing the number failed."));
+ slotCancel();
+ }
}
@@ -210,2 +217,3 @@ QString Dialer::receive()
{
+ QString buf;
char buffer[1024];
@@ -213,2 +221,4 @@ QString Dialer::receive()
+ qApp->processEvents();
+
while(1)
@@ -222,4 +232,9 @@ QString Dialer::receive()
buffer[ret] = 0;
- qWarning("Receiving: '%s'", buffer);
- return QString(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());
+ return buf;
+}
}
@@ -231,4 +246,2 @@ QString Dialer::receive()
- //for(int i = 0; i < 200000;i++)
- // qApp->processEvents();
return QString::null;