summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/dialer.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/dialer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/dialer.cpp14
1 files changed, 1 insertions, 13 deletions
diff --git a/noncore/apps/opie-console/dialer.cpp b/noncore/apps/opie-console/dialer.cpp
index 7010594..8883b83 100644
--- a/noncore/apps/opie-console/dialer.cpp
+++ b/noncore/apps/opie-console/dialer.cpp
@@ -1,11 +1,7 @@
1#include "dialer.h" 1#include "dialer.h"
2#include "io_modem.h" 2#include "io_modem.h"
3 3
4/* OPIE */
5#include <opie2/odebug.h>
6using namespace Opie::Core;
7
8/* QT */ 4/* QT */
9#include <qlayout.h> 5#include <qlayout.h>
10#include <qprogressbar.h> 6#include <qprogressbar.h>
11#include <qlabel.h> 7#include <qlabel.h>
@@ -108,9 +104,8 @@ void Dialer::slotCancel()
108} 104}
109 105
110void Dialer::reset() 106void Dialer::reset()
111{ 107{
112 owarn << "reset" << oendl;
113 switchState(state_cancel); 108 switchState(state_cancel);
114} 109}
115 110
116void Dialer::slotAutostart() 111void Dialer::slotAutostart()
@@ -140,20 +135,17 @@ void Dialer::dial(const QString& number)
140} 135}
141 136
142void Dialer::trydial(const QString& number) 137void Dialer::trydial(const QString& number)
143{ 138{
144 owarn << "TryDial:" << number.latin1() << "" << oendl;
145 if(state != state_cancel) switchState(state_preinit); 139 if(state != state_cancel) switchState(state_preinit);
146 if(cleanshutdown) 140 if(cleanshutdown)
147 { 141 {
148 owarn << "HangupString " << m_profile.readEntry("HangupString") << oendl;
149 send(m_profile.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) + "\r"); 142 send(m_profile.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) + "\r");
150 } 143 }
151 144
152 if(state != state_cancel) 145 if(state != state_cancel)
153 { 146 {
154 switchState(state_init); 147 switchState(state_init);
155// owarn << "Init String " + m_profile.readEntry("InitString") << oendl;
156 send(m_profile.readEntry("InitString",MODEM_DEFAULT_INIT_STRING ) + "\r"); 148 send(m_profile.readEntry("InitString",MODEM_DEFAULT_INIT_STRING ) + "\r");
157 QString response2 = receive(); 149 QString response2 = receive();
158 if(!response2.contains("\nOK\r")) 150 if(!response2.contains("\nOK\r"))
159 reset(); 151 reset();
@@ -182,9 +174,8 @@ void Dialer::trydial(const QString& number)
182 } 174 }
183 175
184 if(state != state_cancel) 176 if(state != state_cancel)
185 { 177 {
186 owarn << "progress" << oendl;
187 switchState(state_dialing); 178 switchState(state_dialing);
188 179
189 // send(QString("ATDT %1\r").arg(number)); 180 // send(QString("ATDT %1\r").arg(number));
190 send(QString("%1 %2\r").arg(m_profile.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 )) 181 send(QString("%1 %2\r").arg(m_profile.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ))
@@ -198,9 +189,9 @@ void Dialer::trydial(const QString& number)
198 else 189 else
199 { 190 {
200 QMessageBox::warning(this, 191 QMessageBox::warning(this,
201 QObject::tr("Failure"), 192 QObject::tr("Failure"),
202 QObject::tr("Dialing the number failed.")); 193 QObject::tr("<qt>Dialing the number failed.</qt>"));
203 slotCancel(); 194 slotCancel();
204 } 195 }
205 } 196 }
206 } 197 }
@@ -218,9 +209,8 @@ void Dialer::send(const QString& msg)
218 QString m = msg; 209 QString m = msg;
219 int bytes; 210 int bytes;
220 QString termination; 211 QString termination;
221 212
222 owarn << "Sending: " << m.latin1() << "" << oendl;
223 213
224 /*termination = "\r"; 214 /*termination = "\r";
225 //termination = m_profile.readEntry("Termination"); 215 //termination = m_profile.readEntry("Termination");
226 if(termination == "\n") m = m + "\n"; 216 if(termination == "\n") m = m + "\n";
@@ -251,13 +241,11 @@ QString Dialer::receive()
251 { 241 {
252 for(int i = 0; i < ret; i++) 242 for(int i = 0; i < ret; i++)
253 buffer[i] = buffer[i] & 0x7F; 243 buffer[i] = buffer[i] & 0x7F;
254 buffer[ret] = 0; 244 buffer[ret] = 0;
255 owarn << "Got: " << buffer << "" << oendl;
256 buf.append(QString(buffer)); 245 buf.append(QString(buffer));
257 if(buf.contains("OK") || buf.contains("ERROR") || buf.contains("CONNECT") || (buf.contains("BUSY"))) 246 if(buf.contains("OK") || buf.contains("ERROR") || buf.contains("CONNECT") || (buf.contains("BUSY")))
258 { 247 {
259 //owarn << "Receiving: '" << buf.latin1() << "'" << oendl;
260 cleanshutdown = 1; 248 cleanshutdown = 1;
261 return buf; 249 return buf;
262 }else if (buf.contains("NO CARRIER") || buf.contains("NO DIALTONE") ) { 250 }else if (buf.contains("NO CARRIER") || buf.contains("NO DIALTONE") ) {
263 cleanshutdown = 1; 251 cleanshutdown = 1;