Diffstat (limited to 'noncore/settings/networksettings/ppp/modem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/modem.cpp | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/noncore/settings/networksettings/ppp/modem.cpp b/noncore/settings/networksettings/ppp/modem.cpp index 5139482..002c8e7 100644 --- a/noncore/settings/networksettings/ppp/modem.cpp +++ b/noncore/settings/networksettings/ppp/modem.cpp | |||
@@ -64,3 +64,3 @@ static sigjmp_buf jmp_buffer; | |||
64 | 64 | ||
65 | Modem *Modem::modem = 0; | 65 | //Modem *Modem::modem = 0; |
66 | 66 | ||
@@ -93,5 +93,5 @@ const char* pppdPath() { | |||
93 | 93 | ||
94 | Modem::Modem() | 94 | Modem::Modem( PPPData* pd ) |
95 | { | 95 | { |
96 | if (Modem::modem != 0) return; //CORRECT? | 96 | _pppdata = pd; |
97 | modemfd = -1; | 97 | modemfd = -1; |
@@ -104,3 +104,2 @@ Modem::Modem() | |||
104 | device = "/dev/modem"; | 104 | device = "/dev/modem"; |
105 | modem = this; | ||
106 | } | 105 | } |
@@ -108,4 +107,4 @@ Modem::Modem() | |||
108 | 107 | ||
109 | Modem::~Modem() { | 108 | Modem::~Modem() |
110 | modem = 0; | 109 | { |
111 | } | 110 | } |
@@ -117,3 +116,3 @@ speed_t Modem::modemspeed() { | |||
117 | // other systems may not have them | 116 | // other systems may not have them |
118 | int i = PPPData::data()->speed().toInt()/100; | 117 | int i = _pppdata->speed().toInt()/100; |
119 | 118 | ||
@@ -167,3 +166,3 @@ bool Modem::opentty() { | |||
167 | close(modemfd); | 166 | close(modemfd); |
168 | device = PPPData::data()->modemDevice(); | 167 | device = _pppdata->modemDevice(); |
169 | if ((modemfd = open(device, O_RDWR|O_NDELAY|O_NOCTTY)) == -1) { | 168 | if ((modemfd = open(device, O_RDWR|O_NDELAY|O_NOCTTY)) == -1) { |
@@ -177,3 +176,3 @@ bool Modem::opentty() { | |||
177 | #if 0 | 176 | #if 0 |
178 | if(PPPData::data()->UseCDLine()) { | 177 | if(_pppdata->UseCDLine()) { |
179 | if(ioctl(modemfd, TIOCMGET, &flags) == -1) { | 178 | if(ioctl(modemfd, TIOCMGET, &flags) == -1) { |
@@ -225,4 +224,4 @@ bool Modem::opentty() { | |||
225 | 224 | ||
226 | if(PPPData::data()->flowcontrol() != "None") { | 225 | if(_pppdata->flowcontrol() != "None") { |
227 | if(PPPData::data()->flowcontrol() == "CRTSCTS") { | 226 | if(_pppdata->flowcontrol() == "CRTSCTS") { |
228 | tty.c_cflag |= CRTSCTS; | 227 | tty.c_cflag |= CRTSCTS; |
@@ -355,3 +354,3 @@ bool Modem::writeLine(const char *buf) { | |||
355 | // different modems seem to need different line terminations | 354 | // different modems seem to need different line terminations |
356 | QString term = PPPData::data()->enter(); | 355 | QString term = _pppdata->enter(); |
357 | if(term == "LF") | 356 | if(term == "LF") |
@@ -395,5 +394,5 @@ bool Modem::hangup() { | |||
395 | // Then hangup command | 394 | // Then hangup command |
396 | writeLine(PPPData::data()->modemHangupStr().local8Bit()); | 395 | writeLine(_pppdata->modemHangupStr().local8Bit()); |
397 | 396 | ||
398 | usleep(PPPData::data()->modemInitDelay() * 10000); // 0.01 - 3.0 sec | 397 | usleep(_pppdata->modemInitDelay() * 10000); // 0.01 - 3.0 sec |
399 | 398 | ||
@@ -433,3 +432,3 @@ bool Modem::hangup() { | |||
433 | 432 | ||
434 | usleep(PPPData::data()->modemInitDelay() * 10000); // 0.01 - 3.0 secs | 433 | usleep(_pppdata->modemInitDelay() * 10000); // 0.01 - 3.0 secs |
435 | 434 | ||
@@ -456,7 +455,7 @@ void Modem::escape_to_command_mode() { | |||
456 | // +3 because quiet time must be greater than guard time. | 455 | // +3 because quiet time must be greater than guard time. |
457 | usleep((PPPData::data()->modemEscapeGuardTime()+3)*20000); | 456 | usleep((_pppdata->modemEscapeGuardTime()+3)*20000); |
458 | QCString tmp = PPPData::data()->modemEscapeStr().local8Bit(); | 457 | QCString tmp = _pppdata->modemEscapeStr().local8Bit(); |
459 | write(modemfd, tmp.data(), tmp.length()); | 458 | write(modemfd, tmp.data(), tmp.length()); |
460 | tcflush(modemfd, TCIOFLUSH); | 459 | tcflush(modemfd, TCIOFLUSH); |
461 | usleep((PPPData::data()->modemEscapeGuardTime()+3)*20000); | 460 | usleep((_pppdata->modemEscapeGuardTime()+3)*20000); |
462 | 461 | ||
@@ -576,3 +575,3 @@ int Modem::lockdevice() { | |||
576 | 575 | ||
577 | if(!PPPData::data()->modemLockFile()) { | 576 | if(!_pppdata->modemLockFile()) { |
578 | qDebug("The user doesn't want a lockfile."); | 577 | qDebug("The user doesn't want a lockfile."); |
@@ -585,3 +584,3 @@ int Modem::lockdevice() { | |||
585 | QString lockfile = LOCK_DIR"/LCK.."; | 584 | QString lockfile = LOCK_DIR"/LCK.."; |
586 | lockfile += PPPData::data()->modemDevice().mid(5); // append everything after /dev/ | 585 | lockfile += _pppdata->modemDevice().mid(5); // append everything after /dev/ |
587 | 586 | ||
@@ -616,3 +615,3 @@ if ((fd = openLockfile(QFile::encodeName(lockfile), O_RDONLY)) >= 0) { | |||
616 | 615 | ||
617 | fd = openLockfile(PPPData::data()->modemDevice(),O_WRONLY|O_TRUNC|O_CREAT); | 616 | fd = openLockfile(_pppdata->modemDevice(),O_WRONLY|O_TRUNC|O_CREAT); |
618 | if(fd >= 0) { | 617 | if(fd >= 0) { |
@@ -990,3 +989,3 @@ bool Modem::execPPPDaemon(const QString & arguments) | |||
990 | if(execpppd(arguments)==0) { | 989 | if(execpppd(arguments)==0) { |
991 | PPPData::data()->setpppdRunning(true); | 990 | _pppdata->setpppdRunning(true); |
992 | return true; | 991 | return true; |
@@ -998,3 +997,3 @@ void Modem::killPPPDaemon() | |||
998 | { | 997 | { |
999 | PPPData::data()->setpppdRunning(false); | 998 | _pppdata->setpppdRunning(false); |
1000 | killpppd(); | 999 | killpppd(); |