summaryrefslogtreecommitdiff
authorzecke <zecke>2002-10-24 20:11:15 (UTC)
committer zecke <zecke>2002-10-24 20:11:15 (UTC)
commit56c10d4383d5de607727ca8bd1ef1b9c8e2e3047 (patch) (side-by-side diff)
treee484aa872b706c665f5e8ea756cc4754df887c33
parent91e3749c56ce2fd1280ff2114ba3dc9301181b6d (diff)
downloadopie-56c10d4383d5de607727ca8bd1ef1b9c8e2e3047.zip
opie-56c10d4383d5de607727ca8bd1ef1b9c8e2e3047.tar.gz
opie-56c10d4383d5de607727ca8bd1ef1b9c8e2e3047.tar.bz2
intent to fix modem
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-console/dialer.cpp28
-rw-r--r--noncore/apps/opie-console/io_modem.cpp8
-rw-r--r--noncore/apps/opie-console/io_serial.cpp22
-rw-r--r--noncore/apps/opie-console/io_serial.h2
-rw-r--r--noncore/apps/opie-console/test/senderui.cpp8
5 files changed, 53 insertions, 15 deletions
diff --git a/noncore/apps/opie-console/dialer.cpp b/noncore/apps/opie-console/dialer.cpp
index 5056040..ce2b688 100644
--- a/noncore/apps/opie-console/dialer.cpp
+++ b/noncore/apps/opie-console/dialer.cpp
@@ -62,3 +62,3 @@ Dialer::Dialer(const Profile& profile, int fd, QWidget *parent, const char *name
- fcntl(m_fd, F_SETFL, O_NONBLOCK);
+// fcntl(m_fd, F_SETFL, O_NONBLOCK);
@@ -105,2 +105,3 @@ void Dialer::reset()
{
+ qWarning("reset");
switchState(state_cancel);
@@ -136,2 +137,3 @@ void Dialer::trydial(const QString& number)
{
+ qWarning("TryDial:%s", number.latin1() );
if(state != state_cancel) switchState(state_preinit);
@@ -139,2 +141,3 @@ void Dialer::trydial(const QString& number)
{
+ qWarning("HangupString " + m_profile.readEntry("HangupString"));
send(m_profile.readEntry("HangupString"));
@@ -148,3 +151,5 @@ void Dialer::trydial(const QString& number)
//send("ATZ");
- send(m_profile.readEntry("InitString"));
+ qWarning("Init String " + m_profile.readEntry("InitString") );
+// send(m_profile.readEntry("InitString", "AT"));
+ send("AT\r");
QString response2 = receive();
@@ -154,3 +159,3 @@ void Dialer::trydial(const QString& number)
- if(state != state_cancel)
+/* if(state != state_cancel)
{
@@ -158,3 +163,4 @@ void Dialer::trydial(const QString& number)
- send("ATM3L3");
+ qWarning("ATM3l3");
+ send("ATM3L3\r");
QString response3 = receive();
@@ -163,2 +169,3 @@ void Dialer::trydial(const QString& number)
}
+*/
@@ -168,3 +175,3 @@ void Dialer::trydial(const QString& number)
- send("ATX1");
+ send("ATX1\r");
QString response4 = receive();
@@ -176,6 +183,7 @@ void Dialer::trydial(const QString& number)
{
+ qWarning("progress");
switchState(state_dialing);
- //send(QString("ATDT %1").arg(number));
- send(QString("%1 %2").arg(m_profile.readEntry("DialPrefix1")).arg(number));
+ send(QString("ATDT %1\r").arg(number));
+// send(QString("%1 %2").arg(m_profile.readEntry("DialPrefix1")).arg(number));
QString response5 = receive();
@@ -207,5 +215,5 @@ void Dialer::send(const QString& msg)
- //qWarning("Sending: '%s'", m.latin1());
+ qWarning("Sending: %s", m.latin1());
- termination = "\r";
+/* termination = "\r";
//termination = m_profile.readEntry("Termination");
@@ -214,2 +222,4 @@ void Dialer::send(const QString& msg)
else m = m + "\r\n";
+*/
+ m = m.replace(QRegExp("\n"), "\r");
diff --git a/noncore/apps/opie-console/io_modem.cpp b/noncore/apps/opie-console/io_modem.cpp
index d4ea0b2..b7901b9 100644
--- a/noncore/apps/opie-console/io_modem.cpp
+++ b/noncore/apps/opie-console/io_modem.cpp
@@ -31,7 +31,9 @@ bool IOModem::open() {
- int fd = rawIO();
- Dialer d(m_profile, fd);
+// int fd = rawIO();
+ internDetach();
+ Dialer d(m_profile, m_fd);
int result = d.exec();
- closeRawIO(fd);
+ internAttach();
+// closeRawIO(fd);
if(result == QDialog::Accepted)
diff --git a/noncore/apps/opie-console/io_serial.cpp b/noncore/apps/opie-console/io_serial.cpp
index e6d1688..0540d9e 100644
--- a/noncore/apps/opie-console/io_serial.cpp
+++ b/noncore/apps/opie-console/io_serial.cpp
@@ -206 +206,23 @@ bool IOSerial::isConnected() {
}
+
+/*
+ * this is used to give the
+ * class below IOSerial
+ * the possibility of
+ * exclusive usage
+ */
+void IOSerial::internDetach() {
+ if (m_read )
+ disconnect(m_read, SIGNAL(activated(int)), this, SLOT(dataArrived()));
+ if (m_error )
+ disconnect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured()));
+}
+/*
+ * give power back
+ */
+void IOSerial::internAttach() {
+ if (m_read )
+ connect(m_read, SIGNAL(activated(int)), this, SLOT(dataArrived()));
+ if (m_error )
+ connect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured()));
+}
diff --git a/noncore/apps/opie-console/io_serial.h b/noncore/apps/opie-console/io_serial.h
index 7a1ea1d..edceac6 100644
--- a/noncore/apps/opie-console/io_serial.h
+++ b/noncore/apps/opie-console/io_serial.h
@@ -52,2 +52,4 @@ protected:
int baud(int baud) const;
+ void internDetach();
+ void internAttach();
protected slots:
diff --git a/noncore/apps/opie-console/test/senderui.cpp b/noncore/apps/opie-console/test/senderui.cpp
index 2ce3f6d..4026808 100644
--- a/noncore/apps/opie-console/test/senderui.cpp
+++ b/noncore/apps/opie-console/test/senderui.cpp
@@ -22,5 +22,5 @@ SenderUI::SenderUI()
Profile prof;
- QString str = "/dev/ttyS0";
+ QString str = "/dev/bty0";
prof.writeEntry("Device",str );
- prof.writeEntry("Baud", 115200 );
+ prof.writeEntry("Baud", 19200 );
@@ -53,2 +53,3 @@ void SenderUI::slotSend() {
qWarning("sending: %s", str.data() );
+ str = str.replace( QRegExp("\n"), "\r");
ser->send( str );
@@ -56,2 +57,3 @@ void SenderUI::slotSend() {
void SenderUI::got(const QByteArray& ar) {
+ qWarning("got:");
for ( uint i = 0; i < ar.count(); i++ ) {
@@ -59,3 +61,3 @@ void SenderUI::got(const QByteArray& ar) {
}
- //printf("\n");
+ printf("\n");
}