Diffstat (limited to 'noncore/apps/opie-console/dialer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/dialer.cpp | 28 |
1 files changed, 19 insertions, 9 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 | |||
@@ -60,7 +60,7 @@ Dialer::Dialer(const Profile& profile, int fd, QWidget *parent, const char *name | |||
60 | usercancel = 0; | 60 | usercancel = 0; |
61 | cleanshutdown = 0; | 61 | cleanshutdown = 0; |
62 | 62 | ||
63 | fcntl(m_fd, F_SETFL, O_NONBLOCK); | 63 | //fcntl(m_fd, F_SETFL, O_NONBLOCK); |
64 | 64 | ||
65 | desc = new QLabel(QObject::tr("Dialing number: %1").arg(m_profile.readEntry("Number")), this); | 65 | desc = new QLabel(QObject::tr("Dialing number: %1").arg(m_profile.readEntry("Number")), this); |
66 | progress = new QProgressBar(this); | 66 | progress = new QProgressBar(this); |
@@ -103,6 +103,7 @@ void Dialer::slotCancel() | |||
103 | 103 | ||
104 | void Dialer::reset() | 104 | void Dialer::reset() |
105 | { | 105 | { |
106 | qWarning("reset"); | ||
106 | switchState(state_cancel); | 107 | switchState(state_cancel); |
107 | } | 108 | } |
108 | 109 | ||
@@ -134,9 +135,11 @@ void Dialer::dial(const QString& number) | |||
134 | 135 | ||
135 | void Dialer::trydial(const QString& number) | 136 | 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); |
138 | if(cleanshutdown) | 140 | if(cleanshutdown) |
139 | { | 141 | { |
142 | qWarning("HangupString " + m_profile.readEntry("HangupString")); | ||
140 | send(m_profile.readEntry("HangupString")); | 143 | send(m_profile.readEntry("HangupString")); |
141 | //send("+++ATH"); | 144 | //send("+++ATH"); |
142 | send(""); | 145 | send(""); |
@@ -146,27 +149,31 @@ void Dialer::trydial(const QString& number) | |||
146 | { | 149 | { |
147 | switchState(state_init); | 150 | switchState(state_init); |
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(); |
151 | if(!response2.contains("\nOK\r")) | 156 | if(!response2.contains("\nOK\r")) |
152 | reset(); | 157 | reset(); |
153 | } | 158 | } |
154 | 159 | ||
155 | if(state != state_cancel) | 160 | /*if(state != state_cancel) |
156 | { | 161 | { |
157 | switchState(state_options); | 162 | switchState(state_options); |
158 | 163 | ||
159 | send("ATM3L3"); | 164 | qWarning("ATM3l3"); |
165 | send("ATM3L3\r"); | ||
160 | QString response3 = receive(); | 166 | QString response3 = receive(); |
161 | if(!response3.contains("\nOK\r")) | 167 | if(!response3.contains("\nOK\r")) |
162 | reset(); | 168 | reset(); |
163 | } | 169 | } |
170 | */ | ||
164 | 171 | ||
165 | if(state != state_cancel) | 172 | if(state != state_cancel) |
166 | { | 173 | { |
167 | switchState(state_dialtone); | 174 | switchState(state_dialtone); |
168 | 175 | ||
169 | send("ATX1"); | 176 | send("ATX1\r"); |
170 | QString response4 = receive(); | 177 | QString response4 = receive(); |
171 | if(!response4.contains("\nOK\r")) | 178 | if(!response4.contains("\nOK\r")) |
172 | reset(); | 179 | reset(); |
@@ -174,10 +181,11 @@ void Dialer::trydial(const QString& number) | |||
174 | 181 | ||
175 | if(state != state_cancel) | 182 | if(state != state_cancel) |
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(); |
182 | if(!response5.contains("\n" + m_profile.readEntry("DefaultConnect"))) | 190 | if(!response5.contains("\n" + m_profile.readEntry("DefaultConnect"))) |
183 | { | 191 | { |
@@ -205,13 +213,15 @@ void Dialer::send(const QString& msg) | |||
205 | int bytes; | 213 | int bytes; |
206 | QString termination; | 214 | QString termination; |
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"); |
212 | if(termination == "\n") m = m + "\n"; | 220 | if(termination == "\n") m = m + "\n"; |
213 | else if(termination == "\r") m = m + "\r"; | 221 | else if(termination == "\r") m = m + "\r"; |
214 | else m = m + "\r\n"; | 222 | else m = m + "\r\n"; |
223 | */ | ||
224 | m = m.replace(QRegExp("\n"), "\r"); | ||
215 | 225 | ||
216 | bytes = ::write(m_fd, m.local8Bit(), strlen(m.local8Bit())); | 226 | bytes = ::write(m_fd, m.local8Bit(), strlen(m.local8Bit())); |
217 | if(bytes < 0) | 227 | if(bytes < 0) |