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.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/noncore/apps/opie-console/dialer.cpp b/noncore/apps/opie-console/dialer.cpp
index 67ad10e..7010594 100644
--- a/noncore/apps/opie-console/dialer.cpp
+++ b/noncore/apps/opie-console/dialer.cpp
@@ -1,5 +1,11 @@
1#include "dialer.h" 1#include "dialer.h"
2#include "io_modem.h"
3
4/* OPIE */
5#include <opie2/odebug.h>
6using namespace Opie::Core;
2 7
8/* QT */
3#include <qlayout.h> 9#include <qlayout.h>
4#include <qprogressbar.h> 10#include <qprogressbar.h>
5#include <qlabel.h> 11#include <qlabel.h>
@@ -8,13 +14,12 @@
8#include <qtimer.h> 14#include <qtimer.h>
9#include <qmessagebox.h> 15#include <qmessagebox.h>
10 16
17/* STD */
11#include <unistd.h> 18#include <unistd.h>
12#include <string.h> 19#include <string.h>
13#include <fcntl.h> 20#include <fcntl.h>
14#include <errno.h> 21#include <errno.h>
15 22
16#include "io_modem.h"
17
18// State machine: | When an error occurs, we don't have to 23// State machine: | When an error occurs, we don't have to
19// | reset everything. 24// | reset everything.
20// (init) <------+ | But if the user wants to reset, 25// (init) <------+ | But if the user wants to reset,
@@ -104,7 +109,7 @@ void Dialer::slotCancel()
104 109
105void Dialer::reset() 110void Dialer::reset()
106{ 111{
107 qWarning("reset"); 112 owarn << "reset" << oendl;
108 switchState(state_cancel); 113 switchState(state_cancel);
109} 114}
110 115
@@ -136,18 +141,18 @@ void Dialer::dial(const QString& number)
136 141
137void Dialer::trydial(const QString& number) 142void Dialer::trydial(const QString& number)
138{ 143{
139 qWarning("TryDial:%s", number.latin1() ); 144 owarn << "TryDial:" << number.latin1() << "" << oendl;
140 if(state != state_cancel) switchState(state_preinit); 145 if(state != state_cancel) switchState(state_preinit);
141 if(cleanshutdown) 146 if(cleanshutdown)
142 { 147 {
143 qWarning("HangupString " + m_profile.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING)); 148 owarn << "HangupString " << m_profile.readEntry("HangupString") << oendl;
144 send(m_profile.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) + "\r"); 149 send(m_profile.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) + "\r");
145 } 150 }
146 151
147 if(state != state_cancel) 152 if(state != state_cancel)
148 { 153 {
149 switchState(state_init); 154 switchState(state_init);
150// qWarning("Init String " + m_profile.readEntry("InitString") ); 155// owarn << "Init String " + m_profile.readEntry("InitString") << oendl;
151 send(m_profile.readEntry("InitString",MODEM_DEFAULT_INIT_STRING ) + "\r"); 156 send(m_profile.readEntry("InitString",MODEM_DEFAULT_INIT_STRING ) + "\r");
152 QString response2 = receive(); 157 QString response2 = receive();
153 if(!response2.contains("\nOK\r")) 158 if(!response2.contains("\nOK\r"))
@@ -158,7 +163,7 @@ void Dialer::trydial(const QString& number)
158 { 163 {
159 switchState(state_options); 164 switchState(state_options);
160 165
161 qWarning("ATM3l3"); 166 owarn << "ATM3l3" << oendl;
162 send("ATM3L3\r"); 167 send("ATM3L3\r");
163 QString response3 = receive(); 168 QString response3 = receive();
164 if(!response3.contains("\nOK\r")) 169 if(!response3.contains("\nOK\r"))
@@ -178,7 +183,7 @@ void Dialer::trydial(const QString& number)
178 183
179 if(state != state_cancel) 184 if(state != state_cancel)
180 { 185 {
181 qWarning("progress"); 186 owarn << "progress" << oendl;
182 switchState(state_dialing); 187 switchState(state_dialing);
183 188
184 // send(QString("ATDT %1\r").arg(number)); 189 // send(QString("ATDT %1\r").arg(number));
@@ -214,7 +219,7 @@ void Dialer::send(const QString& msg)
214 int bytes; 219 int bytes;
215 QString termination; 220 QString termination;
216 221
217 qWarning("Sending: %s", m.latin1()); 222 owarn << "Sending: " << m.latin1() << "" << oendl;
218 223
219 /*termination = "\r"; 224 /*termination = "\r";
220 //termination = m_profile.readEntry("Termination"); 225 //termination = m_profile.readEntry("Termination");
@@ -247,11 +252,11 @@ QString Dialer::receive()
247 for(int i = 0; i < ret; i++) 252 for(int i = 0; i < ret; i++)
248 buffer[i] = buffer[i] & 0x7F; 253 buffer[i] = buffer[i] & 0x7F;
249 buffer[ret] = 0; 254 buffer[ret] = 0;
250 qWarning("Got: %s", buffer); 255 owarn << "Got: " << buffer << "" << oendl;
251 buf.append(QString(buffer)); 256 buf.append(QString(buffer));
252 if(buf.contains("OK") || buf.contains("ERROR") || buf.contains("CONNECT") || (buf.contains("BUSY"))) 257 if(buf.contains("OK") || buf.contains("ERROR") || buf.contains("CONNECT") || (buf.contains("BUSY")))
253 { 258 {
254 //qWarning("Receiving: '%s'", buf.latin1()); 259 //owarn << "Receiving: '" << buf.latin1() << "'" << oendl;
255 cleanshutdown = 1; 260 cleanshutdown = 1;
256 return buf; 261 return buf;
257 }else if (buf.contains("NO CARRIER") || buf.contains("NO DIALTONE") ) { 262 }else if (buf.contains("NO CARRIER") || buf.contains("NO DIALTONE") ) {