author | josef <josef> | 2002-10-13 15:52:00 (UTC) |
---|---|---|
committer | josef <josef> | 2002-10-13 15:52:00 (UTC) |
commit | cb816d85c54242f8958ff77fba334b43be0dcb3d (patch) (unidiff) | |
tree | 6764b80acf8789c410cdc59cb308f3f91fcd9083 | |
parent | 6a9726437a59cf3b18bf57d6e20fb2dfaaa2fc34 (diff) | |
download | opie-cb816d85c54242f8958ff77fba334b43be0dcb3d.zip opie-cb816d85c54242f8958ff77fba334b43be0dcb3d.tar.gz opie-cb816d85c54242f8958ff77fba334b43be0dcb3d.tar.bz2 |
- make dialer accessible transparently when opening a modem session
- implement sending data (currently written to stdout for debug purpose)
-rw-r--r-- | noncore/apps/opie-console/dialer.cpp | 50 | ||||
-rw-r--r-- | noncore/apps/opie-console/dialer.h | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_modem.cpp | 13 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_modem.h | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/opie-console.pro | 6 |
5 files changed, 63 insertions, 13 deletions
diff --git a/noncore/apps/opie-console/dialer.cpp b/noncore/apps/opie-console/dialer.cpp index 8589d14..d20965a 100644 --- a/noncore/apps/opie-console/dialer.cpp +++ b/noncore/apps/opie-console/dialer.cpp | |||
@@ -1,189 +1,227 @@ | |||
1 | #include "dialer.h" | 1 | #include "dialer.h" |
2 | 2 | ||
3 | #include <qlayout.h> | 3 | #include <qlayout.h> |
4 | #include <qprogressbar.h> | 4 | #include <qprogressbar.h> |
5 | #include <qlabel.h> | 5 | #include <qlabel.h> |
6 | #include <qpushbutton.h> | 6 | #include <qpushbutton.h> |
7 | #include <qapp.h> | 7 | #include <qapp.h> |
8 | #include <qtimer.h> | 8 | #include <qtimer.h> |
9 | 9 | ||
10 | #include <unistd.h> | ||
11 | #include <string.h> | ||
12 | |||
10 | // State machine: | When an error occurs, we don't have to | 13 | // State machine: | When an error occurs, we don't have to |
11 | // | reset everything. | 14 | // | reset everything. |
12 | // (init) <------+ | But if the user wants to reset, | 15 | // (init) <------+ | But if the user wants to reset, |
13 | // | | | we stop dialing immediately. | 16 | // | | | we stop dialing immediately. |
14 | // v | | | 17 | // v | | |
15 | // (options) ----+ | Following the state machine is necessary | 18 | // (options) ----+ | Following the state machine is necessary |
16 | // | \ | to get determinable results. | 19 | // | \ | to get determinable results. |
17 | // v ^ | | 20 | // v ^ | |
18 | // (dial) ----+ | | 21 | // (dial) ----+ | |
19 | // | ^ | | 22 | // | ^ | |
20 | // v | | | 23 | // v | | |
21 | // (online) --+ | | 24 | // (online) --+ | |
22 | // | | | 25 | // | | |
23 | // v | | 26 | // v | |
24 | 27 | ||
25 | Dialer::Dialer(const QString& number, QWidget *parent, const char *name) | 28 | |
29 | // from atconfigdialog | ||
30 | //initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) ); | ||
31 | //resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) ); | ||
32 | //dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) ); | ||
33 | //dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); | ||
34 | //dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) ); | ||
35 | //dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); | ||
36 | //dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) ); | ||
37 | //dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); | ||
38 | //connectLine->setText( config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ) ); | ||
39 | //hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) ); | ||
40 | |||
41 | // from modemconfigwidget | ||
42 | //int rad_flow = prof.readNumEntry("Flow"); | ||
43 | //int rad_parity = prof.readNumEntry("Parity"); | ||
44 | //int speed = prof.readNumEntry("Speed"); | ||
45 | //QString number = prof.readEntry("Number"); | ||
46 | |||
47 | Dialer::Dialer(const Profile& profile, QWidget *parent, const char *name) | ||
26 | : QDialog(parent, name, true) | 48 | : QDialog(parent, name, true) |
27 | { | 49 | { |
28 | QVBoxLayout *vbox; | 50 | QVBoxLayout *vbox; |
29 | QLabel *desc; | 51 | QLabel *desc; |
30 | 52 | ||
31 | usercancel = 0; | 53 | usercancel = 0; |
32 | m_number = number; | 54 | m_profile = profile; |
33 | 55 | ||
34 | desc = new QLabel(QObject::tr("Dialing number: %1").arg(number), this); | 56 | desc = new QLabel(QObject::tr("Dialing number: %1").arg(m_profile.readEntry("Number")), this); |
35 | progress = new QProgressBar(this); | 57 | progress = new QProgressBar(this); |
36 | status = new QLabel("", this); | 58 | status = new QLabel("", this); |
37 | status->setFrameStyle(QFrame::Panel | QFrame::Sunken); | 59 | status->setFrameStyle(QFrame::Panel | QFrame::Sunken); |
38 | cancel = new QPushButton(QObject::tr("Cancel"), this); | 60 | cancel = new QPushButton(QObject::tr("Cancel"), this); |
39 | 61 | ||
40 | vbox = new QVBoxLayout(this, 2); | 62 | vbox = new QVBoxLayout(this, 2); |
41 | vbox->add(desc); | 63 | vbox->add(desc); |
42 | vbox->add(progress); | 64 | vbox->add(progress); |
43 | vbox->add(status); | 65 | vbox->add(status); |
44 | vbox->add(cancel); | 66 | vbox->add(cancel); |
45 | 67 | ||
46 | connect(cancel, SIGNAL(clicked()), SLOT(slotCancel())); | 68 | connect(cancel, SIGNAL(clicked()), SLOT(slotCancel())); |
47 | 69 | ||
48 | show(); | 70 | show(); |
49 | 71 | ||
50 | QTimer::singleShot(500, this, SLOT(slotAutostart())); | 72 | QTimer::singleShot(500, this, SLOT(slotAutostart())); |
51 | } | 73 | } |
52 | 74 | ||
53 | Dialer::~Dialer() | 75 | Dialer::~Dialer() |
54 | { | 76 | { |
55 | } | 77 | } |
56 | 78 | ||
57 | void Dialer::slotCancel() | 79 | void Dialer::slotCancel() |
58 | { | 80 | { |
59 | if(state != state_online) reset(); | 81 | if(state != state_online) |
82 | { | ||
83 | usercancel = 1; | ||
84 | reset(); | ||
85 | } | ||
60 | else accept(); | 86 | else accept(); |
61 | } | 87 | } |
62 | 88 | ||
63 | void Dialer::reset() | 89 | void Dialer::reset() |
64 | { | 90 | { |
65 | switchState(state_cancel); | 91 | switchState(state_cancel); |
66 | usercancel = 1; | ||
67 | } | 92 | } |
68 | 93 | ||
69 | void Dialer::slotAutostart() | 94 | void Dialer::slotAutostart() |
70 | { | 95 | { |
71 | state = state_preinit; | 96 | state = state_preinit; |
72 | dial(m_number); | 97 | dial(m_profile.readEntry("Number")); |
73 | } | 98 | } |
74 | 99 | ||
75 | void Dialer::dial(const QString& number) | 100 | void Dialer::dial(const QString& number) |
76 | { | 101 | { |
77 | while(state != state_online) | 102 | while(state != state_online) |
78 | { | 103 | { |
79 | if(!usercancel) | 104 | if(!usercancel) |
80 | { | 105 | { |
81 | trydial(number); | 106 | trydial(number); |
82 | } | 107 | } |
83 | else break; | 108 | else break; |
84 | } | 109 | } |
85 | 110 | ||
86 | if(usercancel) | 111 | if(usercancel) |
87 | { | 112 | { |
88 | reject(); | 113 | reject(); |
89 | } | 114 | } |
90 | } | 115 | } |
91 | 116 | ||
92 | void Dialer::trydial(const QString& number) | 117 | void Dialer::trydial(const QString& number) |
93 | { | 118 | { |
94 | if(state != state_cancel) | 119 | if(state != state_cancel) |
95 | { | 120 | { |
96 | switchState(state_preinit); | 121 | switchState(state_preinit); |
97 | // ... | 122 | // ... |
98 | QString response = receive(); | 123 | QString response = receive(); |
99 | } | 124 | } |
100 | 125 | ||
101 | if(state != state_cancel) | 126 | if(state != state_cancel) |
102 | { | 127 | { |
103 | switchState(state_init); | 128 | switchState(state_init); |
104 | send("ATZ"); | 129 | send("ATZ"); |
105 | QString response2 = receive(); | 130 | QString response2 = receive(); |
106 | } | 131 | } |
107 | 132 | ||
108 | if(state != state_cancel) | 133 | if(state != state_cancel) |
109 | { | 134 | { |
110 | switchState(state_options); | 135 | switchState(state_options); |
111 | 136 | ||
112 | send("ATM0L0"); | 137 | send("ATM0L0"); |
113 | QString response3 = receive(); | 138 | QString response3 = receive(); |
114 | } | 139 | } |
115 | 140 | ||
116 | if(state != state_cancel) | 141 | if(state != state_cancel) |
117 | { | 142 | { |
118 | switchState(state_dialtone); | 143 | switchState(state_dialtone); |
119 | 144 | ||
120 | send("ATX1"); | 145 | send("ATX1"); |
121 | QString response4 = receive(); | 146 | QString response4 = receive(); |
122 | } | 147 | } |
123 | 148 | ||
124 | if(state != state_cancel) | 149 | if(state != state_cancel) |
125 | { | 150 | { |
126 | switchState(state_dialing); | 151 | switchState(state_dialing); |
127 | 152 | ||
128 | send(QString("ATDT %1").arg(number)); | 153 | send(QString("ATDT %1").arg(number)); |
129 | QString response5 = receive(); | 154 | QString response5 = receive(); |
130 | } | 155 | } |
131 | 156 | ||
132 | if(state != state_cancel) | 157 | if(state != state_cancel) |
133 | { | 158 | { |
134 | switchState(state_online); | 159 | switchState(state_online); |
135 | } | 160 | } |
136 | } | 161 | } |
137 | 162 | ||
138 | void Dialer::send(const QString& msg) | 163 | void Dialer::send(const QString& msg) |
139 | { | 164 | { |
165 | QString m = msg; | ||
166 | int bytes; | ||
167 | QString termination; | ||
140 | 168 | ||
169 | termination = m_profile.readEntry("Termination"); | ||
170 | if(termination == "\n") m = m + "\n"; | ||
171 | else if(termination == "\r") m = m + "\r"; | ||
172 | else m = m + "\r\n"; | ||
173 | |||
174 | bytes = write(0, m.local8Bit(), strlen(m.local8Bit())); | ||
175 | if(bytes < 0) | ||
176 | { | ||
177 | reset(); | ||
178 | } | ||
141 | } | 179 | } |
142 | 180 | ||
143 | QString Dialer::receive() | 181 | QString Dialer::receive() |
144 | { | 182 | { |
145 | for(int i = 0; i < 200000;i++) | 183 | for(int i = 0; i < 200000;i++) |
146 | qApp->processEvents(); | 184 | qApp->processEvents(); |
147 | return QString::null; | 185 | return QString::null; |
148 | } | 186 | } |
149 | 187 | ||
150 | void Dialer::switchState(int newstate) | 188 | void Dialer::switchState(int newstate) |
151 | { | 189 | { |
152 | int oldstate = state; | 190 | int oldstate = state; |
153 | state = newstate; | 191 | state = newstate; |
154 | 192 | ||
155 | switch(state) | 193 | switch(state) |
156 | { | 194 | { |
157 | case state_cancel: | 195 | case state_cancel: |
158 | status->setText(QObject::tr("Cancelling...")); | 196 | status->setText(QObject::tr("Cancelling...")); |
159 | progress->setProgress(0); | 197 | progress->setProgress(0); |
160 | break; | 198 | break; |
161 | case state_preinit: | 199 | case state_preinit: |
162 | status->setText(QObject::tr("Searching modem")); | 200 | status->setText(QObject::tr("Searching modem")); |
163 | progress->setProgress(10); | 201 | progress->setProgress(10); |
164 | break; | 202 | break; |
165 | case state_init: | 203 | case state_init: |
166 | status->setText(QObject::tr("Initializing...")); | 204 | status->setText(QObject::tr("Initializing...")); |
167 | progress->setProgress(20); | 205 | progress->setProgress(20); |
168 | break; | 206 | break; |
169 | case state_options: | 207 | case state_options: |
170 | status->setText(QObject::tr("Reset speakers")); | 208 | status->setText(QObject::tr("Reset speakers")); |
171 | progress->setProgress(30); | 209 | progress->setProgress(30); |
172 | break; | 210 | break; |
173 | case state_dialtone: | 211 | case state_dialtone: |
174 | status->setText(QObject::tr("Turning off dialtone")); | 212 | status->setText(QObject::tr("Turning off dialtone")); |
175 | progress->setProgress(40); | 213 | progress->setProgress(40); |
176 | break; | 214 | break; |
177 | case state_dialing: | 215 | case state_dialing: |
178 | if(oldstate != state_dialing) status->setText(QObject::tr("Dial number")); | 216 | if(oldstate != state_dialing) status->setText(QObject::tr("Dial number")); |
179 | else status->setText(QObject::tr("Line busy, redialing number")); | 217 | else status->setText(QObject::tr("Line busy, redialing number")); |
180 | progress->setProgress(50); | 218 | progress->setProgress(50); |
181 | break; | 219 | break; |
182 | case state_online: | 220 | case state_online: |
183 | status->setText(QObject::tr("Connection established")); | 221 | status->setText(QObject::tr("Connection established")); |
184 | progress->setProgress(100); | 222 | progress->setProgress(100); |
185 | cancel->setText(QObject::tr("Dismiss")); | 223 | cancel->setText(QObject::tr("Dismiss")); |
186 | break; | 224 | break; |
187 | } | 225 | } |
188 | } | 226 | } |
189 | 227 | ||
diff --git a/noncore/apps/opie-console/dialer.h b/noncore/apps/opie-console/dialer.h index 20fb3c3..8c83bb6 100644 --- a/noncore/apps/opie-console/dialer.h +++ b/noncore/apps/opie-console/dialer.h | |||
@@ -1,49 +1,51 @@ | |||
1 | #ifndef DIALER_H | 1 | #ifndef DIALER_H |
2 | #define DIALER_H | 2 | #define DIALER_H |
3 | 3 | ||
4 | #include <qdialog.h> | 4 | #include <qdialog.h> |
5 | 5 | ||
6 | #include "profile.h" | ||
7 | |||
6 | class QLabel; | 8 | class QLabel; |
7 | class QProgressBar; | 9 | class QProgressBar; |
8 | 10 | ||
9 | class Dialer : public QDialog | 11 | class Dialer : public QDialog |
10 | { | 12 | { |
11 | Q_OBJECT | 13 | Q_OBJECT |
12 | public: | 14 | public: |
13 | Dialer(const QString& number, QWidget *parent = NULL, const char *name = NULL); | 15 | Dialer(const Profile& profile, QWidget *parent = NULL, const char *name = NULL); |
14 | ~Dialer(); | 16 | ~Dialer(); |
15 | 17 | ||
16 | public slots: | 18 | public slots: |
17 | void slotCancel(); | 19 | void slotCancel(); |
18 | void slotAutostart(); | 20 | void slotAutostart(); |
19 | 21 | ||
20 | private: | 22 | private: |
21 | void switchState(int newstate); | 23 | void switchState(int newstate); |
22 | void reset(); | 24 | void reset(); |
23 | void dial(const QString& number); | 25 | void dial(const QString& number); |
24 | void trydial(const QString& number); | 26 | void trydial(const QString& number); |
25 | 27 | ||
26 | void send(const QString& msg); | 28 | void send(const QString& msg); |
27 | QString receive(); | 29 | QString receive(); |
28 | 30 | ||
29 | enum States | 31 | enum States |
30 | { | 32 | { |
31 | state_cancel, | 33 | state_cancel, |
32 | state_preinit, | 34 | state_preinit, |
33 | state_init, | 35 | state_init, |
34 | state_options, | 36 | state_options, |
35 | state_dialtone, | 37 | state_dialtone, |
36 | state_dialing, | 38 | state_dialing, |
37 | state_online | 39 | state_online |
38 | }; | 40 | }; |
39 | 41 | ||
40 | QLabel *status; | 42 | QLabel *status; |
41 | QProgressBar *progress; | 43 | QProgressBar *progress; |
42 | QPushButton *cancel; | 44 | QPushButton *cancel; |
43 | int state; | 45 | int state; |
44 | int usercancel; | 46 | int usercancel; |
45 | QString m_number; | 47 | Profile m_profile; |
46 | }; | 48 | }; |
47 | 49 | ||
48 | #endif | 50 | #endif |
49 | 51 | ||
diff --git a/noncore/apps/opie-console/io_modem.cpp b/noncore/apps/opie-console/io_modem.cpp index 4d6035d..41febfb 100644 --- a/noncore/apps/opie-console/io_modem.cpp +++ b/noncore/apps/opie-console/io_modem.cpp | |||
@@ -1,66 +1,73 @@ | |||
1 | 1 | ||
2 | #include "io_modem.h" | 2 | #include "io_modem.h" |
3 | 3 | ||
4 | IOModem:IOModem( const Profile &config ) : IOSerial( config ) { | 4 | #include "dialer.h" |
5 | 5 | ||
6 | IOModem:IOModem( const Profile &config ) : IOSerial( config ) { | ||
7 | m_config = config; | ||
6 | } | 8 | } |
7 | 9 | ||
8 | 10 | ||
9 | IOModem::~IOModem() { | 11 | IOModem::~IOModem() { |
10 | 12 | ||
11 | } | 13 | } |
12 | 14 | ||
13 | 15 | ||
14 | void IOModem::close() { | 16 | void IOModem::close() { |
15 | 17 | ||
16 | IOSerial::close(); | 18 | IOSerial::close(); |
17 | 19 | ||
18 | } | 20 | } |
19 | 21 | ||
20 | bool IOModem::open() { | 22 | bool IOModem::open() { |
21 | |||
22 | |||
23 | IOSerial::open(); | 23 | IOSerial::open(); |
24 | 24 | ||
25 | Dialer d(m_profile); | ||
26 | int result = d.exec(); | ||
27 | if(result == QDialog::Accepted) | ||
28 | { | ||
29 | return true; | ||
30 | } | ||
31 | else return false; | ||
25 | } | 32 | } |
26 | 33 | ||
27 | void IOModem::reload( const Profile &config ) { | 34 | void IOModem::reload( const Profile &config ) { |
28 | m_device = config.readEntry("Device", MODEM_DEFAULT_DEVICE); | 35 | m_device = config.readEntry("Device", MODEM_DEFAULT_DEVICE); |
29 | m_baud = config.readNumEntry("Baud", MODEM_DEFAULT_BAUD); | 36 | m_baud = config.readNumEntry("Baud", MODEM_DEFAULT_BAUD); |
30 | m_parity = config.readNumEntry("Parity", MODEM_DEFAULT_PARITY); | 37 | m_parity = config.readNumEntry("Parity", MODEM_DEFAULT_PARITY); |
31 | m_dbits = config.readNumEntry("DataBits", MODEM_DEFAULT_DBITS); | 38 | m_dbits = config.readNumEntry("DataBits", MODEM_DEFAULT_DBITS); |
32 | m_sbits = config.readNumEntry("StopBits", MODEM_DEFAULT_SBITS); | 39 | m_sbits = config.readNumEntry("StopBits", MODEM_DEFAULT_SBITS); |
33 | m_flow = config.readNumEntry("Flow", MODEM_DEFAULT_FLOW); | 40 | m_flow = config.readNumEntry("Flow", MODEM_DEFAULT_FLOW); |
34 | 41 | ||
35 | m_initString = config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ); | 42 | m_initString = config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ); |
36 | m_resetString = config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ); | 43 | m_resetString = config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ); |
37 | m_dialPref1 = config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ); | 44 | m_dialPref1 = config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ); |
38 | m_dialSuf1 = config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ); | 45 | m_dialSuf1 = config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ); |
39 | m_dialPref2 = config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ); | 46 | m_dialPref2 = config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ); |
40 | m_dialSuf2 = config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ); | 47 | m_dialSuf2 = config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ); |
41 | m_dialPref3 = config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ); | 48 | m_dialPref3 = config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ); |
42 | m_dialSuf3 = config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ); | 49 | m_dialSuf3 = config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ); |
43 | m_connect = config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ); | 50 | m_connect = config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ); |
44 | m_hangup = config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ); | 51 | m_hangup = config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ); |
45 | m_cancel = config.readEntry("CancelString" MODEM_DEFAULT_CANCEL_STRING ); | 52 | m_cancel = config.readEntry("CancelString" MODEM_DEFAULT_CANCEL_STRING ); |
46 | m_dialTime = config.readEntry("DialTime" MODEM_DEFAULT_DIAL_TIME ); | 53 | m_dialTime = config.readEntry("DialTime" MODEM_DEFAULT_DIAL_TIME ); |
47 | m_delayRedial = config.readEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ); | 54 | m_delayRedial = config.readEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ); |
48 | m_numberTries = config.readEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ); | 55 | m_numberTries = config.readEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ); |
49 | m_dtrDropTime = config.readEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ); | 56 | m_dtrDropTime = config.readEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ); |
50 | m_bpsDetect = config.readEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ); | 57 | m_bpsDetect = config.readEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ); |
51 | m_dcdLines = config.readEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ); | 58 | m_dcdLines = config.readEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ); |
52 | m_multiLineUntag = config.readEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ); | 59 | m_multiLineUntag = config.readEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ); |
53 | } | 60 | } |
54 | 61 | ||
55 | 62 | ||
56 | QString IOModem::identifier() const { | 63 | QString IOModem::identifier() const { |
57 | return "modem"; | 64 | return "modem"; |
58 | } | 65 | } |
59 | 66 | ||
60 | QString IOModem::name() const { | 67 | QString IOModem::name() const { |
61 | return "Modem IO Layer"; | 68 | return "Modem IO Layer"; |
62 | } | 69 | } |
63 | 70 | ||
64 | void IOIrda::slotExited(OProcess* proc ){ | 71 | void IOIrda::slotExited(OProcess* proc ){ |
65 | close(); | 72 | close(); |
66 | } | 73 | } |
diff --git a/noncore/apps/opie-console/io_modem.h b/noncore/apps/opie-console/io_modem.h index f155eb1..6d44349 100644 --- a/noncore/apps/opie-console/io_modem.h +++ b/noncore/apps/opie-console/io_modem.h | |||
@@ -1,69 +1,70 @@ | |||
1 | #ifndef OPIE_IO_MODEM | 1 | #ifndef OPIE_IO_MODEM |
2 | #define OPIE_IO_MODEM | 2 | #define OPIE_IO_MODEM |
3 | 3 | ||
4 | #include <opie/oprocess.h> | 4 | #include <opie/oprocess.h> |
5 | #include "io_serial.h" | 5 | #include "io_serial.h" |
6 | 6 | ||
7 | /* Default values to be used if the profile information is incomplete */ | 7 | /* Default values to be used if the profile information is incomplete */ |
8 | #define MODEM_DEFAULT_DEVICE "/dev/ttyS0" | 8 | #define MODEM_DEFAULT_DEVICE "/dev/ttyS0" |
9 | #define MODEM_DEFAULT_BAUD 9600 | 9 | #define MODEM_DEFAULT_BAUD 9600 |
10 | #define MODEM_DEFAULT_PARITY 0 | 10 | #define MODEM_DEFAULT_PARITY 0 |
11 | #define MODEM_DEFAULT_DBITS 8 | 11 | #define MODEM_DEFAULT_DBITS 8 |
12 | #define MODEM_DEFAULT_SBITS 1 | 12 | #define MODEM_DEFAULT_SBITS 1 |
13 | #define MODEM_DEFAULT_FLOW 0 | 13 | #define MODEM_DEFAULT_FLOW 0 |
14 | 14 | ||
15 | #define MODEM_DEFAULT_INIT_STRING "~^M~ATZ^M~" | 15 | #define MODEM_DEFAULT_INIT_STRING "~^M~ATZ^M~" |
16 | #define MODEM_DEFAULT_RESET_STRING "~^M~ATZ^M~" | 16 | #define MODEM_DEFAULT_RESET_STRING "~^M~ATZ^M~" |
17 | #define MODEM_DEFAULT_DIAL_PREFIX1 "ATDT" | 17 | #define MODEM_DEFAULT_DIAL_PREFIX1 "ATDT" |
18 | #define MODEM_DEFAULT_DIAL_SUFFIX1 "^M" | 18 | #define MODEM_DEFAULT_DIAL_SUFFIX1 "^M" |
19 | #define MODEM_DEFAULT_DIAL_PREFIX2 "ATDP" | 19 | #define MODEM_DEFAULT_DIAL_PREFIX2 "ATDP" |
20 | #define MODEM_DEFAULT_DIAL_SUFFIX2 "^M" | 20 | #define MODEM_DEFAULT_DIAL_SUFFIX2 "^M" |
21 | #define MODEM_DEFAULT_DIAL_PREFIX3 "ATX1DT" | 21 | #define MODEM_DEFAULT_DIAL_PREFIX3 "ATX1DT" |
22 | #define MODEM_DEFAULT_DIAL_SUFFIX3 ";X4D^M" | 22 | #define MODEM_DEFAULT_DIAL_SUFFIX3 ";X4D^M" |
23 | #define MODEM_DEFAULT_CONNECT_STRING "CONNECT" | 23 | #define MODEM_DEFAULT_CONNECT_STRING "CONNECT" |
24 | #define MODEM_DEFAULT_HANGUP_STRING "~~+++~~ATH^M" | 24 | #define MODEM_DEFAULT_HANGUP_STRING "~~+++~~ATH^M" |
25 | #define MODEM_DEFAULT_CANCEL_STRING "^M" | 25 | #define MODEM_DEFAULT_CANCEL_STRING "^M" |
26 | #define MODEM_DEFAULT_DIAL_TIME 45 | 26 | #define MODEM_DEFAULT_DIAL_TIME 45 |
27 | #define MODEM_DEFAULT_DELAY_REDIAL 2 | 27 | #define MODEM_DEFAULT_DELAY_REDIAL 2 |
28 | #define MODEM_DEFAULT_NUMBER_TRIES 10 | 28 | #define MODEM_DEFAULT_NUMBER_TRIES 10 |
29 | #define MODEM_DEFAULT_DTR_DROP_TIME 1 | 29 | #define MODEM_DEFAULT_DTR_DROP_TIME 1 |
30 | #define MODEM_DEFAULT_BPS_DETECT 0 // bool | 30 | #define MODEM_DEFAULT_BPS_DETECT 0 // bool |
31 | #define MODEM_DEFAULT_DCD_LINES 1 //bool | 31 | #define MODEM_DEFAULT_DCD_LINES 1 //bool |
32 | #define MODEM_DEFAULT_MULTI_LINE_UNTAG 0 // bool | 32 | #define MODEM_DEFAULT_MULTI_LINE_UNTAG 0 // bool |
33 | 33 | ||
34 | /* IOSerial implements a RS232 IO Layer */ | 34 | /* IOSerial implements a RS232 IO Layer */ |
35 | 35 | ||
36 | class IOModem : public IOSerial { | 36 | class IOModem : public IOSerial { |
37 | 37 | ||
38 | Q_OBJECT | 38 | Q_OBJECT |
39 | 39 | ||
40 | public: | 40 | public: |
41 | 41 | ||
42 | IOModem(const Profile &); | 42 | IOModem(const Profile &); |
43 | ~IOModem(); | 43 | ~IOModem(); |
44 | 44 | ||
45 | QString identifier() const; | 45 | QString identifier() const; |
46 | QString name() const; | 46 | QString name() const; |
47 | 47 | ||
48 | signals: | 48 | signals: |
49 | void received(const QByteArray &); | 49 | void received(const QByteArray &); |
50 | void error(int, const QString &); | 50 | void error(int, const QString &); |
51 | 51 | ||
52 | public slots: | 52 | public slots: |
53 | bool open(); | 53 | bool open(); |
54 | void close(); | 54 | void close(); |
55 | void reload(const Profile &); | 55 | void reload(const Profile &); |
56 | 56 | ||
57 | private: | 57 | private: |
58 | 58 | ||
59 | QString m_initString, m_resetString, m_dialPref1, m_dialSuf1, m_dialPref2, | 59 | QString m_initString, m_resetString, m_dialPref1, m_dialSuf1, m_dialPref2, |
60 | m_dialSuf2, dialPref3, m_dialSuf3, m_connect, m_hangup, m_cancel; | 60 | m_dialSuf2, dialPref3, m_dialSuf3, m_connect, m_hangup, m_cancel; |
61 | int m_dialTime, m_delayRedial, m_numberTries, m_dtrDropTime, | 61 | int m_dialTime, m_delayRedial, m_numberTries, m_dtrDropTime, |
62 | m_bpsDetect, m_dcdLines, m_multiLineUntag; | 62 | m_bpsDetect, m_dcdLines, m_multiLineUntag; |
63 | const Profile& m_profile; | ||
63 | 64 | ||
64 | private slots: | 65 | private slots: |
65 | void slotExited(OProcess* proc); | 66 | void slotExited(OProcess* proc); |
66 | 67 | ||
67 | }; | 68 | }; |
68 | 69 | ||
69 | #endif | 70 | #endif |
diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro index 0b4676b..ef6bc21 100644 --- a/noncore/apps/opie-console/opie-console.pro +++ b/noncore/apps/opie-console/opie-console.pro | |||
@@ -1,72 +1,74 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | #CONFIG = qt warn_on release | 2 | #CONFIG = qt warn_on release |
3 | CONFIG = qt debug | 3 | CONFIG = qt debug |
4 | DESTDIR = $(OPIEDIR)/bin | 4 | DESTDIR = $(OPIEDIR)/bin |
5 | HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h\ | 5 | HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h\ |
6 | file_layer.h filetransfer.h \ | 6 | file_layer.h filetransfer.h \ |
7 | metafactory.h \ | 7 | metafactory.h \ |
8 | session.h \ | 8 | session.h \ |
9 | mainwindow.h \ | 9 | mainwindow.h \ |
10 | profile.h \ | 10 | profile.h \ |
11 | profileconfig.h \ | 11 | profileconfig.h \ |
12 | profilemanager.h \ | 12 | profilemanager.h \ |
13 | configwidget.h \ | 13 | configwidget.h \ |
14 | tabwidget.h \ | 14 | tabwidget.h \ |
15 | configdialog.h \ | 15 | configdialog.h \ |
16 | emulation_layer.h \ | 16 | emulation_layer.h \ |
17 | vt102emulation.h \ | 17 | vt102emulation.h \ |
18 | common.h \ | 18 | common.h \ |
19 | history.h \ | 19 | history.h \ |
20 | screen.h \ | 20 | screen.h \ |
21 | keytrans.h \ | 21 | keytrans.h \ |
22 | widget_layer.h \ | 22 | widget_layer.h \ |
23 | transferdialog.h \ | 23 | transferdialog.h \ |
24 | profiledialogwidget.h \ | 24 | profiledialogwidget.h \ |
25 | profileeditordialog.h \ | 25 | profileeditordialog.h \ |
26 | default.h \ | 26 | default.h \ |
27 | terminalwidget.h \ | 27 | terminalwidget.h \ |
28 | iolayerbase.h \ | 28 | iolayerbase.h \ |
29 | serialconfigwidget.h irdaconfigwidget.h \ | 29 | serialconfigwidget.h irdaconfigwidget.h \ |
30 | btconfigwidget.h modemconfigwidget.h \ | 30 | btconfigwidget.h modemconfigwidget.h \ |
31 | atconfigdialog.h dialdialog.h \ | 31 | atconfigdialog.h dialdialog.h \ |
32 | emulation_widget.h procctl.h \ | 32 | emulation_widget.h procctl.h \ |
33 | function_keyboard.h \ | 33 | function_keyboard.h \ |
34 | receive_layer.h filereceive.h \ | 34 | receive_layer.h filereceive.h \ |
35 | script.h | 35 | script.h \ |
36 | dialer.h | ||
36 | 37 | ||
37 | SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp \ | 38 | SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp \ |
38 | file_layer.cpp filetransfer.cpp \ | 39 | file_layer.cpp filetransfer.cpp \ |
39 | main.cpp \ | 40 | main.cpp \ |
40 | metafactory.cpp \ | 41 | metafactory.cpp \ |
41 | session.cpp \ | 42 | session.cpp \ |
42 | mainwindow.cpp \ | 43 | mainwindow.cpp \ |
43 | profile.cpp \ | 44 | profile.cpp \ |
44 | profileconfig.cpp \ | 45 | profileconfig.cpp \ |
45 | profilemanager.cpp \ | 46 | profilemanager.cpp \ |
46 | tabwidget.cpp \ | 47 | tabwidget.cpp \ |
47 | configdialog.cpp \ | 48 | configdialog.cpp \ |
48 | emulation_layer.cpp \ | 49 | emulation_layer.cpp \ |
49 | vt102emulation.cpp \ | 50 | vt102emulation.cpp \ |
50 | history.cpp \ | 51 | history.cpp \ |
51 | screen.cpp \ | 52 | screen.cpp \ |
52 | keytrans.cpp \ | 53 | keytrans.cpp \ |
53 | widget_layer.cpp \ | 54 | widget_layer.cpp \ |
54 | transferdialog.cpp \ | 55 | transferdialog.cpp \ |
55 | profiledialogwidget.cpp \ | 56 | profiledialogwidget.cpp \ |
56 | profileeditordialog.cpp \ | 57 | profileeditordialog.cpp \ |
57 | terminalwidget.cpp \ | 58 | terminalwidget.cpp \ |
58 | iolayerbase.cpp \ | 59 | iolayerbase.cpp \ |
59 | serialconfigwidget.cpp irdaconfigwidget.cpp \ | 60 | serialconfigwidget.cpp irdaconfigwidget.cpp \ |
60 | btconfigwidget.cpp modemconfigwidget.cpp \ | 61 | btconfigwidget.cpp modemconfigwidget.cpp \ |
61 | atconfigdialog.cpp dialdialog.cpp \ | 62 | atconfigdialog.cpp dialdialog.cpp \ |
62 | emulation_widget.cpp default.cpp procctl.cpp \ | 63 | emulation_widget.cpp default.cpp procctl.cpp \ |
63 | function_keyboard.cpp \ | 64 | function_keyboard.cpp \ |
64 | receive_layer.cpp filereceive.cpp \ | 65 | receive_layer.cpp filereceive.cpp \ |
65 | script.cpp | 66 | script.cpp \ |
67 | dialer.cpp | ||
66 | 68 | ||
67 | INTERFACES = configurebase.ui editbase.ui | 69 | INTERFACES = configurebase.ui editbase.ui |
68 | INCLUDEPATH += $(OPIEDIR)/include | 70 | INCLUDEPATH += $(OPIEDIR)/include |
69 | DEPENDPATH += $(OPIEDIR)/include | 71 | DEPENDPATH += $(OPIEDIR)/include |
70 | LIBS += -lqpe -lopie | 72 | LIBS += -lqpe -lopie |
71 | TARGET = opie-console | 73 | TARGET = opie-console |
72 | 74 | ||