--- smsdaemon/GsmModem.cpp 2008/12/07 20:18:20 148 +++ smsdaemon/ModemTransceiver.cpp 2008/12/07 20:58:41 149 @@ -10,7 +10,7 @@ #include "serialport/SerialPort.h" -#include "GsmModem.h" +#include "ModemTransceiver.h" #include "util.h" #include "common.h" @@ -22,14 +22,14 @@ -GsmModem::GsmModem(SerialPort& serialport) +ModemTransceiver::ModemTransceiver(SerialPort& serialport) : m_port(serialport) { } -string GsmModem::GetResponse() +string ModemTransceiver::GetResponse() { SerialPort::DataBuffer buf; @@ -43,7 +43,7 @@ } -string GsmModem::Command(string command, string term) +string ModemTransceiver::Command(string command, string term) { time_t start,now; start = time(0); @@ -72,7 +72,7 @@ now = time(0); if ( (now-start) > 10 ) { - Common::instance()->logMessage( string("GsmModem::Command time out --") + command); + Common::instance()->logMessage( string("ModemTransceiver::Command time out --") + command); Common::instance()->logMessage( string("Modem responded: ") + Util::str_trim(response) ); _timeout = true; break; @@ -85,7 +85,7 @@ return response; } -vector GsmModem::ReadSms(bool readAll) +vector ModemTransceiver::ReadSms(bool readAll) { Command( "AT+CMGF=0" ); //Set SMS format to PDU @@ -122,7 +122,7 @@ } -void GsmModem::SendSmsPdu(std::string pdu, int len) //pdu inclussive leading "00" +void ModemTransceiver::SendSmsPdu(std::string pdu, int len) //pdu inclussive leading "00" { Common::instance()->logMessage( string("SMS pdu send") ); @@ -142,7 +142,7 @@ Common::instance()->smsCounter.outgoing++; } -void GsmModem::SendSms(string to, string message, bool allowMultipart) +void ModemTransceiver::SendSms(string to, string message, bool allowMultipart) { Common::instance()->logMessage( string("SMS send to ") + to); @@ -161,14 +161,14 @@ } -void GsmModem::DeleteSms(std::string smsIndex) +void ModemTransceiver::DeleteSms(std::string smsIndex) { string cmd = "AT+CMGD="; cmd.append(smsIndex); Command(cmd); } -int GsmModem::DeleteAllSms() +int ModemTransceiver::DeleteAllSms() { vector sms = ReadSms(true); @@ -181,7 +181,7 @@ -void GsmModem::WaitForSimcard() +void ModemTransceiver::WaitForSimcard() { int start = time(0); string result; @@ -199,7 +199,7 @@ } -void GsmModem::HandlePincode() +void ModemTransceiver::HandlePincode() { string result = Command("AT+CPIN?"); result = Util::str_trim(result); @@ -224,7 +224,7 @@ } } -void GsmModem::Init() +void ModemTransceiver::Init() { Command( "AT" ); if (_timeout) @@ -246,26 +246,3 @@ } - - -void DebugGsmModem::SendSms(std::string to, std::string message, bool allowMultipart) -{ - _to=to; - _message = message; - _multipart = allowMultipart; - - if (_print) - { - cout << "DebugGsmModem::SendSms --------------" << endl; - cout << "To: " << to << endl;; - cout << "Message: " << message << endl; - cout << "Multipart: " << allowMultipart << endl; - - } -} - -std::vector DebugGsmModem::ReadSms(bool readAll) -{ - vector result; - return result; -}