summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-console/dialer.cpp22
-rw-r--r--noncore/apps/opie-console/io_modem.cpp10
-rw-r--r--noncore/apps/opie-console/io_serial.cpp7
3 files changed, 28 insertions, 11 deletions
diff --git a/noncore/apps/opie-console/dialer.cpp b/noncore/apps/opie-console/dialer.cpp
index ce2b688..8524422 100644
--- a/noncore/apps/opie-console/dialer.cpp
+++ b/noncore/apps/opie-console/dialer.cpp
@@ -89,6 +89,7 @@ void Dialer::setHangupOnly()
{
state = state_cancel;
usercancel = 1;
+ send("+++ATH\r");
}
void Dialer::slotCancel()
@@ -98,7 +99,9 @@ void Dialer::slotCancel()
usercancel = 1;
reset();
}
- else accept();
+ else {
+ accept();
+ }
}
void Dialer::reset()
@@ -140,9 +143,9 @@ void Dialer::trydial(const QString& number)
if(cleanshutdown)
{
qWarning("HangupString " + m_profile.readEntry("HangupString"));
- send(m_profile.readEntry("HangupString"));
- //send("+++ATH");
- send("");
+ //send(m_profile.readEntry("HangupString"));
+ send("+++ATH\r");
+ //send("");
}
if(state != state_cancel)
@@ -187,7 +190,7 @@ void Dialer::trydial(const QString& number)
send(QString("ATDT %1\r").arg(number));
// send(QString("%1 %2").arg(m_profile.readEntry("DialPrefix1")).arg(number));
QString response5 = receive();
- if(!response5.contains("\n" + m_profile.readEntry("DefaultConnect")))
+ if(!response5.contains("CONNECT") )
{
if(response5.contains("BUSY"))
switchState(state_dialing);
@@ -201,9 +204,11 @@ void Dialer::trydial(const QString& number)
}
}
+
if(state != state_cancel)
{
- switchState(state_online);
+ state = state_online;
+ slotCancel();
}
}
@@ -246,13 +251,16 @@ QString Dialer::receive()
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());
cleanshutdown = 1;
return buf;
+ }else if (buf.contains("NO CARRIER") || buf.contains("NO DIALTONE") ) {
+ cleanshutdown = 1;
+ return QString::null;
}
}
else if(ret < 0)
diff --git a/noncore/apps/opie-console/io_modem.cpp b/noncore/apps/opie-console/io_modem.cpp
index b7901b9..896c24f 100644
--- a/noncore/apps/opie-console/io_modem.cpp
+++ b/noncore/apps/opie-console/io_modem.cpp
@@ -16,11 +16,13 @@ IOModem::~IOModem() {
void IOModem::close() {
// Hangup, discarding result
- int fd = rawIO();
- Dialer d(m_profile, fd);
+// int fd = rawIO();
+ internDetach();
+ Dialer d(m_profile, m_fd);
d.setHangupOnly();
- d.exec();
- closeRawIO(fd);
+ //d.exec();
+ internAttach();
+// closeRawIO(fd);
IOSerial::close();
}
diff --git a/noncore/apps/opie-console/io_serial.cpp b/noncore/apps/opie-console/io_serial.cpp
index 0540d9e..03e92dd 100644
--- a/noncore/apps/opie-console/io_serial.cpp
+++ b/noncore/apps/opie-console/io_serial.cpp
@@ -3,6 +3,8 @@
#include <termios.h>
#include <errno.h>
#include <unistd.h>
+#include <stdio.h>
+
#include "io_serial.h"
IOSerial::IOSerial(const Profile &config) : IOLayer(config) {
@@ -164,6 +166,11 @@ void IOSerial::dataArrived() {
close();
if (len < 0)
return;
+ qWarning("got from layer");
+ for (int i = 0; i < len; i++ ) {
+ printf("%c", array[i] );
+ }
+ printf("\n");
array.resize( len );
emit received(array);
}