author | josef <josef> | 2002-10-20 09:48:21 (UTC) |
---|---|---|
committer | josef <josef> | 2002-10-20 09:48:21 (UTC) |
commit | 940ba90ed4375f79b6a4934d290abf83980b77ad (patch) (unidiff) | |
tree | c455e88ce9fe99ef79048e3f228b7f4551652537 | |
parent | e2694c5aedb3697a373e363cebe72cddb3114a8f (diff) | |
download | opie-940ba90ed4375f79b6a4934d290abf83980b77ad.zip opie-940ba90ed4375f79b6a4934d290abf83980b77ad.tar.gz opie-940ba90ed4375f79b6a4934d290abf83980b77ad.tar.bz2 |
Please review!
- change modem default commands because we don't interpret ~ and friends
(minicom does AFAIK)
- disable unused AT settings for now
- when cancelling dialing, and we didn't yet get a single byte from the modem,
don't hangup
-rw-r--r-- | noncore/apps/opie-console/atconfigdialog.cpp | 16 | ||||
-rw-r--r-- | noncore/apps/opie-console/atconfigdialog.h | 19 | ||||
-rw-r--r-- | noncore/apps/opie-console/dialer.cpp | 31 | ||||
-rw-r--r-- | noncore/apps/opie-console/dialer.h | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_modem.h | 18 |
5 files changed, 44 insertions, 41 deletions
diff --git a/noncore/apps/opie-console/atconfigdialog.cpp b/noncore/apps/opie-console/atconfigdialog.cpp index 87a08f6..5c02692 100644 --- a/noncore/apps/opie-console/atconfigdialog.cpp +++ b/noncore/apps/opie-console/atconfigdialog.cpp | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <qscrollview.h> | 9 | #include <qscrollview.h> |
10 | 10 | ||
11 | #include "atconfigdialog.h" | 11 | #include "atconfigdialog.h" |
12 | #include "io_modem.h" | ||
12 | 13 | ||
13 | 14 | ||
14 | ATConfigDialog::ATConfigDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 15 | ATConfigDialog::ATConfigDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) |
@@ -170,6 +171,21 @@ void ATConfigDialog::readConfig( const Profile& config ) { | |||
170 | bpsDetectBox->setCurrentItem( config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ) ); | 171 | bpsDetectBox->setCurrentItem( config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ) ); |
171 | dcdLinesBox->setCurrentItem( config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ) ); | 172 | dcdLinesBox->setCurrentItem( config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ) ); |
172 | multiLineUntagBox->setCurrentItem( config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ) ); | 173 | multiLineUntagBox->setCurrentItem( config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ) ); |
174 | |||
175 | // Not implemented yet | ||
176 | resetStringLine->setEnabled(false); | ||
177 | dialSuf1Line->setEnabled(false); | ||
178 | dialPref2Line->setEnabled(false); | ||
179 | dialSuf2Line->setEnabled(false); | ||
180 | dialPref3Line->setEnabled(false); | ||
181 | dialSuf3Line->setEnabled(false); | ||
182 | dialTimeSpin->setEnabled(false); | ||
183 | delayRedialSpin->setEnabled(false); | ||
184 | numberTriesSpin->setEnabled(false); | ||
185 | dtrDropTimeSpin->setEnabled(false); | ||
186 | bpsDetectBox->setEnabled(false); | ||
187 | dcdLinesBox->setEnabled(false); | ||
188 | multiLineUntagBox->setEnabled(false); | ||
173 | } | 189 | } |
174 | 190 | ||
175 | void ATConfigDialog::writeConfig( Profile& config ) { | 191 | void ATConfigDialog::writeConfig( Profile& config ) { |
diff --git a/noncore/apps/opie-console/atconfigdialog.h b/noncore/apps/opie-console/atconfigdialog.h index 4dd033b..8cb044e 100644 --- a/noncore/apps/opie-console/atconfigdialog.h +++ b/noncore/apps/opie-console/atconfigdialog.h | |||
@@ -5,25 +5,6 @@ | |||
5 | #include <qdialog.h> | 5 | #include <qdialog.h> |
6 | #include "profile.h" | 6 | #include "profile.h" |
7 | 7 | ||
8 | #define MODEM_DEFAULT_INIT_STRING "~^M~ATZ^M~" | ||
9 | #define MODEM_DEFAULT_RESET_STRING "~^M~ATZ^M~" | ||
10 | #define MODEM_DEFAULT_DIAL_PREFIX1 "ATDT" | ||
11 | #define MODEM_DEFAULT_DIAL_SUFFIX1 "^M" | ||
12 | #define MODEM_DEFAULT_DIAL_PREFIX2 "ATDP" | ||
13 | #define MODEM_DEFAULT_DIAL_SUFFIX2 "^M" | ||
14 | #define MODEM_DEFAULT_DIAL_PREFIX3 "ATX1DT" | ||
15 | #define MODEM_DEFAULT_DIAL_SUFFIX3 ";X4D^M" | ||
16 | #define MODEM_DEFAULT_CONNECT_STRING "CONNECT" | ||
17 | #define MODEM_DEFAULT_HANGUP_STRING "~~+++~~ATH^M" | ||
18 | #define MODEM_DEFAULT_CANCEL_STRING "^M" | ||
19 | #define MODEM_DEFAULT_DIAL_TIME 45 | ||
20 | #define MODEM_DEFAULT_DELAY_REDIAL 2 | ||
21 | #define MODEM_DEFAULT_NUMBER_TRIES 10 | ||
22 | #define MODEM_DEFAULT_DTR_DROP_TIME 1 | ||
23 | #define MODEM_DEFAULT_BPS_DETECT 0 // bool | ||
24 | #define MODEM_DEFAULT_DCD_LINES 1 //bool | ||
25 | #define MODEM_DEFAULT_MULTI_LINE_UNTAG 0 // bool | ||
26 | |||
27 | class QLineEdit; | 8 | class QLineEdit; |
28 | class QSpinBox; | 9 | class QSpinBox; |
29 | class QComboBox; | 10 | class QComboBox; |
diff --git a/noncore/apps/opie-console/dialer.cpp b/noncore/apps/opie-console/dialer.cpp index 51d4093..d37e406 100644 --- a/noncore/apps/opie-console/dialer.cpp +++ b/noncore/apps/opie-console/dialer.cpp | |||
@@ -58,6 +58,7 @@ Dialer::Dialer(const Profile& profile, int fd, QWidget *parent, const char *name | |||
58 | //m_profile.writeEntry("Termination", "\n"); | 58 | //m_profile.writeEntry("Termination", "\n"); |
59 | 59 | ||
60 | usercancel = 0; | 60 | usercancel = 0; |
61 | cleanshutdown = 0; | ||
61 | 62 | ||
62 | fcntl(m_fd, F_SETFL, O_NONBLOCK); | 63 | fcntl(m_fd, F_SETFL, O_NONBLOCK); |
63 | 64 | ||
@@ -133,19 +134,19 @@ void Dialer::dial(const QString& number) | |||
133 | 134 | ||
134 | void Dialer::trydial(const QString& number) | 135 | void Dialer::trydial(const QString& number) |
135 | { | 136 | { |
136 | //if(state != state_cancel) | ||
137 | //{ | ||
138 | if(state != state_cancel) switchState(state_preinit); | 137 | if(state != state_cancel) switchState(state_preinit); |
139 | send("+++ATH"); | 138 | if(cleanshutdown) |
139 | { | ||
140 | send(m_profile.readEntry("HangupString")); | ||
141 | //send("+++ATH"); | ||
140 | send(""); | 142 | send(""); |
141 | //QString response = receive(); | 143 | } |
142 | //} | ||
143 | 144 | ||
144 | if(state != state_cancel) | 145 | if(state != state_cancel) |
145 | { | 146 | { |
146 | switchState(state_init); | 147 | switchState(state_init); |
147 | send("ATZ"); | 148 | //send("ATZ"); |
148 | //send(m_profile.readEntry("InitString")); | 149 | send(m_profile.readEntry("InitString")); |
149 | QString response2 = receive(); | 150 | QString response2 = receive(); |
150 | if(!response2.contains("\nOK\r")) | 151 | if(!response2.contains("\nOK\r")) |
151 | reset(); | 152 | reset(); |
@@ -175,10 +176,10 @@ void Dialer::trydial(const QString& number) | |||
175 | { | 176 | { |
176 | switchState(state_dialing); | 177 | switchState(state_dialing); |
177 | 178 | ||
178 | send(QString("ATDT %1").arg(number)); | 179 | //send(QString("ATDT %1").arg(number)); |
179 | //send(QString("%1 %2").arg(m_profile.readEntry("DialPrefix1")).arg(number)); | 180 | send(QString("%1 %2").arg(m_profile.readEntry("DialPrefix1")).arg(number)); |
180 | QString response5 = receive(); | 181 | QString response5 = receive(); |
181 | if(!response5.contains("\nCONNECT")) | 182 | if(!response5.contains("\n" + m_profile.readEntry("DefaultConnect"))) |
182 | { | 183 | { |
183 | if(response5.contains("BUSY")) | 184 | if(response5.contains("BUSY")) |
184 | switchState(state_dialing); | 185 | switchState(state_dialing); |
@@ -204,7 +205,7 @@ void Dialer::send(const QString& msg) | |||
204 | int bytes; | 205 | int bytes; |
205 | QString termination; | 206 | QString termination; |
206 | 207 | ||
207 | qWarning("Sending: '%s'", m.latin1()); | 208 | //qWarning("Sending: '%s'", m.latin1()); |
208 | 209 | ||
209 | termination = "\r"; | 210 | termination = "\r"; |
210 | //termination = m_profile.readEntry("Termination"); | 211 | //termination = m_profile.readEntry("Termination"); |
@@ -235,11 +236,12 @@ QString Dialer::receive() | |||
235 | for(int i = 0; i < ret; i++) | 236 | for(int i = 0; i < ret; i++) |
236 | buffer[i] = buffer[i] & 0x7F; | 237 | buffer[i] = buffer[i] & 0x7F; |
237 | buffer[ret] = 0; | 238 | buffer[ret] = 0; |
238 | qWarning("Got: '%s'", buffer); | 239 | //qWarning("Got: '%s'", buffer); |
239 | buf.append(QString(buffer)); | 240 | buf.append(QString(buffer)); |
240 | if(buf.contains("OK") || buf.contains("ERROR") || buf.contains("CONNECT") || (buf.contains("BUSY"))) | 241 | if(buf.contains("OK") || buf.contains("ERROR") || buf.contains("CONNECT") || (buf.contains("BUSY"))) |
241 | { | 242 | { |
242 | qWarning("Receiving: '%s'", buf.latin1()); | 243 | //qWarning("Receiving: '%s'", buf.latin1()); |
244 | cleanshutdown = 1; | ||
243 | return buf; | 245 | return buf; |
244 | } | 246 | } |
245 | } | 247 | } |
@@ -249,8 +251,11 @@ qWarning("Receiving: '%s'", buf.latin1()); | |||
249 | else if(!(counter++ % 100)) qApp->processEvents(); | 251 | else if(!(counter++ % 100)) qApp->processEvents(); |
250 | } | 252 | } |
251 | else if(!(counter++ % 100)) qApp->processEvents(); | 253 | else if(!(counter++ % 100)) qApp->processEvents(); |
254 | |||
255 | if(usercancel) return QString::null; | ||
252 | } | 256 | } |
253 | 257 | ||
258 | cleanshutdown = 1; | ||
254 | return QString::null; | 259 | return QString::null; |
255 | } | 260 | } |
256 | 261 | ||
diff --git a/noncore/apps/opie-console/dialer.h b/noncore/apps/opie-console/dialer.h index 84444b9..28303f3 100644 --- a/noncore/apps/opie-console/dialer.h +++ b/noncore/apps/opie-console/dialer.h | |||
@@ -47,6 +47,7 @@ class Dialer : public QDialog | |||
47 | int usercancel; | 47 | int usercancel; |
48 | const Profile& m_profile; | 48 | const Profile& m_profile; |
49 | int m_fd; | 49 | int m_fd; |
50 | int cleanshutdown; | ||
50 | }; | 51 | }; |
51 | 52 | ||
52 | #endif | 53 | #endif |
diff --git a/noncore/apps/opie-console/io_modem.h b/noncore/apps/opie-console/io_modem.h index 8453b95..1328706 100644 --- a/noncore/apps/opie-console/io_modem.h +++ b/noncore/apps/opie-console/io_modem.h | |||
@@ -13,17 +13,17 @@ | |||
13 | #define MODEM_DEFAULT_SBITS 1 | 13 | #define MODEM_DEFAULT_SBITS 1 |
14 | #define MODEM_DEFAULT_FLOW 0 | 14 | #define MODEM_DEFAULT_FLOW 0 |
15 | 15 | ||
16 | #define MODEM_DEFAULT_INIT_STRING "~^M~ATZ^M~" | 16 | #define MODEM_DEFAULT_INIT_STRING "ATZ" |
17 | #define MODEM_DEFAULT_RESET_STRING "~^M~ATZ^M~" | 17 | #define MODEM_DEFAULT_RESET_STRING "ATZ~" |
18 | #define MODEM_DEFAULT_DIAL_PREFIX1 "ATDT" | 18 | #define MODEM_DEFAULT_DIAL_PREFIX1 "ATDT" |
19 | #define MODEM_DEFAULT_DIAL_SUFFIX1 "^M" | 19 | #define MODEM_DEFAULT_DIAL_SUFFIX1 "" |
20 | #define MODEM_DEFAULT_DIAL_PREFIX2 "ATDP" | 20 | #define MODEM_DEFAULT_DIAL_PREFIX2 "" |
21 | #define MODEM_DEFAULT_DIAL_SUFFIX2 "^M" | 21 | #define MODEM_DEFAULT_DIAL_SUFFIX2 "" |
22 | #define MODEM_DEFAULT_DIAL_PREFIX3 "ATX1DT" | 22 | #define MODEM_DEFAULT_DIAL_PREFIX3 "" |
23 | #define MODEM_DEFAULT_DIAL_SUFFIX3 ";X4D^M" | 23 | #define MODEM_DEFAULT_DIAL_SUFFIX3 "" |
24 | #define MODEM_DEFAULT_CONNECT_STRING "CONNECT" | 24 | #define MODEM_DEFAULT_CONNECT_STRING "CONNECT" |
25 | #define MODEM_DEFAULT_HANGUP_STRING "~~+++~~ATH^M" | 25 | #define MODEM_DEFAULT_HANGUP_STRING "+++ATH" |
26 | #define MODEM_DEFAULT_CANCEL_STRING "^M" | 26 | #define MODEM_DEFAULT_CANCEL_STRING "" |
27 | #define MODEM_DEFAULT_DIAL_TIME 45 | 27 | #define MODEM_DEFAULT_DIAL_TIME 45 |
28 | #define MODEM_DEFAULT_DELAY_REDIAL 2 | 28 | #define MODEM_DEFAULT_DELAY_REDIAL 2 |
29 | #define MODEM_DEFAULT_NUMBER_TRIES 10 | 29 | #define MODEM_DEFAULT_NUMBER_TRIES 10 |