-rw-r--r-- | noncore/apps/opie-console/dialer.cpp | 28 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_modem.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_serial.cpp | 22 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_serial.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/test/senderui.cpp | 10 |
5 files changed, 54 insertions, 16 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 | |||
62 | 62 | ||
63 | fcntl(m_fd, F_SETFL, O_NONBLOCK); | 63 | //fcntl(m_fd, F_SETFL, O_NONBLOCK); |
64 | 64 | ||
@@ -105,2 +105,3 @@ void Dialer::reset() | |||
105 | { | 105 | { |
106 | qWarning("reset"); | ||
106 | switchState(state_cancel); | 107 | switchState(state_cancel); |
@@ -136,2 +137,3 @@ void Dialer::trydial(const QString& number) | |||
136 | { | 137 | { |
138 | qWarning("TryDial:%s", number.latin1() ); | ||
137 | if(state != state_cancel) switchState(state_preinit); | 139 | if(state != state_cancel) switchState(state_preinit); |
@@ -139,2 +141,3 @@ void Dialer::trydial(const QString& number) | |||
139 | { | 141 | { |
142 | qWarning("HangupString " + m_profile.readEntry("HangupString")); | ||
140 | send(m_profile.readEntry("HangupString")); | 143 | send(m_profile.readEntry("HangupString")); |
@@ -148,3 +151,5 @@ void Dialer::trydial(const QString& number) | |||
148 | //send("ATZ"); | 151 | //send("ATZ"); |
149 | send(m_profile.readEntry("InitString")); | 152 | qWarning("Init String " + m_profile.readEntry("InitString") ); |
153 | // send(m_profile.readEntry("InitString", "AT")); | ||
154 | send("AT\r"); | ||
150 | QString response2 = receive(); | 155 | QString response2 = receive(); |
@@ -154,3 +159,3 @@ void Dialer::trydial(const QString& number) | |||
154 | 159 | ||
155 | if(state != state_cancel) | 160 | /*if(state != state_cancel) |
156 | { | 161 | { |
@@ -158,3 +163,4 @@ void Dialer::trydial(const QString& number) | |||
158 | 163 | ||
159 | send("ATM3L3"); | 164 | qWarning("ATM3l3"); |
165 | send("ATM3L3\r"); | ||
160 | QString response3 = receive(); | 166 | QString response3 = receive(); |
@@ -163,2 +169,3 @@ void Dialer::trydial(const QString& number) | |||
163 | } | 169 | } |
170 | */ | ||
164 | 171 | ||
@@ -168,3 +175,3 @@ void Dialer::trydial(const QString& number) | |||
168 | 175 | ||
169 | send("ATX1"); | 176 | send("ATX1\r"); |
170 | QString response4 = receive(); | 177 | QString response4 = receive(); |
@@ -176,6 +183,7 @@ void Dialer::trydial(const QString& number) | |||
176 | { | 183 | { |
184 | qWarning("progress"); | ||
177 | switchState(state_dialing); | 185 | switchState(state_dialing); |
178 | 186 | ||
179 | //send(QString("ATDT %1").arg(number)); | 187 | send(QString("ATDT %1\r").arg(number)); |
180 | send(QString("%1 %2").arg(m_profile.readEntry("DialPrefix1")).arg(number)); | 188 | // send(QString("%1 %2").arg(m_profile.readEntry("DialPrefix1")).arg(number)); |
181 | QString response5 = receive(); | 189 | QString response5 = receive(); |
@@ -207,5 +215,5 @@ void Dialer::send(const QString& msg) | |||
207 | 215 | ||
208 | //qWarning("Sending: '%s'", m.latin1()); | 216 | qWarning("Sending: %s", m.latin1()); |
209 | 217 | ||
210 | termination = "\r"; | 218 | /*termination = "\r"; |
211 | //termination = m_profile.readEntry("Termination"); | 219 | //termination = m_profile.readEntry("Termination"); |
@@ -214,2 +222,4 @@ void Dialer::send(const QString& msg) | |||
214 | else m = m + "\r\n"; | 222 | else m = m + "\r\n"; |
223 | */ | ||
224 | m = m.replace(QRegExp("\n"), "\r"); | ||
215 | 225 | ||
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() { | |||
31 | 31 | ||
32 | int fd = rawIO(); | 32 | //int fd = rawIO(); |
33 | Dialer d(m_profile, fd); | 33 | internDetach(); |
34 | Dialer d(m_profile, m_fd); | ||
34 | 35 | ||
35 | int result = d.exec(); | 36 | int result = d.exec(); |
36 | closeRawIO(fd); | 37 | internAttach(); |
38 | //closeRawIO(fd); | ||
37 | if(result == QDialog::Accepted) | 39 | 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() { | |||
206 | } | 206 | } |
207 | |||
208 | /* | ||
209 | * this is used to give the | ||
210 | * class below IOSerial | ||
211 | * the possibility of | ||
212 | * exclusive usage | ||
213 | */ | ||
214 | void IOSerial::internDetach() { | ||
215 | if (m_read ) | ||
216 | disconnect(m_read, SIGNAL(activated(int)), this, SLOT(dataArrived())); | ||
217 | if (m_error ) | ||
218 | disconnect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured())); | ||
219 | } | ||
220 | /* | ||
221 | * give power back | ||
222 | */ | ||
223 | void IOSerial::internAttach() { | ||
224 | if (m_read ) | ||
225 | connect(m_read, SIGNAL(activated(int)), this, SLOT(dataArrived())); | ||
226 | if (m_error ) | ||
227 | connect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured())); | ||
228 | } | ||
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: | |||
52 | int baud(int baud) const; | 52 | int baud(int baud) const; |
53 | void internDetach(); | ||
54 | void internAttach(); | ||
53 | protected slots: | 55 | 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() | |||
22 | Profile prof; | 22 | Profile prof; |
23 | QString str = "/dev/ttyS0"; | 23 | QString str = "/dev/bty0"; |
24 | prof.writeEntry("Device",str ); | 24 | prof.writeEntry("Device",str ); |
25 | prof.writeEntry("Baud", 115200 ); | 25 | prof.writeEntry("Baud", 19200 ); |
26 | 26 | ||
@@ -53,2 +53,3 @@ void SenderUI::slotSend() { | |||
53 | qWarning("sending: %s", str.data() ); | 53 | qWarning("sending: %s", str.data() ); |
54 | str = str.replace( QRegExp("\n"), "\r"); | ||
54 | ser->send( str ); | 55 | ser->send( str ); |
@@ -56,2 +57,3 @@ void SenderUI::slotSend() { | |||
56 | void SenderUI::got(const QByteArray& ar) { | 57 | void SenderUI::got(const QByteArray& ar) { |
58 | qWarning("got:"); | ||
57 | for ( uint i = 0; i < ar.count(); i++ ) { | 59 | for ( uint i = 0; i < ar.count(); i++ ) { |
@@ -59,3 +61,3 @@ void SenderUI::got(const QByteArray& ar) { | |||
59 | } | 61 | } |
60 | //printf("\n"); | 62 | printf("\n"); |
61 | } | 63 | } |
@@ -74,2 +76,2 @@ rev->receive(); | |||
74 | 76 | ||
75 | } \ No newline at end of file | 77 | } |