14 |
|
|
15 |
#include "util.h" |
#include "util.h" |
16 |
#include "common.h" |
#include "common.h" |
17 |
|
#include "Logger.h" |
18 |
|
|
19 |
#include "SmsPdu.h" |
#include "SmsPdu.h" |
20 |
#include "SmsHelper.h" |
#include "SmsHelper.h" |
73 |
now = time(0); |
now = time(0); |
74 |
if ( (now-start) > 10 ) |
if ( (now-start) > 10 ) |
75 |
{ |
{ |
76 |
Common::instance()->logMessage( string("ModemTransceiver::Command time out --") + command); |
Logger::logMessage( string("ModemTransceiver::Command time out --") + command); |
77 |
Common::instance()->logMessage( string("Modem responded: ") + Util::str_trim(response) ); |
Logger::logMessage( string("Modem responded: ") + Util::str_trim(response) ); |
78 |
_timeout = true; |
_timeout = true; |
79 |
break; |
break; |
80 |
} |
} |
125 |
|
|
126 |
void ModemTransceiver::SendSmsPdu(std::string pdu, int len) //pdu inclussive leading "00" |
void ModemTransceiver::SendSmsPdu(std::string pdu, int len) //pdu inclussive leading "00" |
127 |
{ |
{ |
128 |
Common::instance()->logMessage( string("SMS pdu send") ); |
Logger::logMessage( string("SMS pdu send") ); |
129 |
|
|
130 |
Command("AT+CMGF=0"); |
Command("AT+CMGF=0"); |
131 |
Util::Sleep(2); |
Util::Sleep(2); |
145 |
|
|
146 |
void ModemTransceiver::SendSms(string to, string message, bool allowMultipart) |
void ModemTransceiver::SendSms(string to, string message, bool allowMultipart) |
147 |
{ |
{ |
148 |
Common::instance()->logMessage( string("SMS send to ") + to); |
Logger::logMessage( string("SMS send to ") + to); |
149 |
|
|
150 |
if (to.at(0) == '+') |
if (to.at(0) == '+') |
151 |
to.erase(0,0); |
to.erase(0,0); |
158 |
|
|
159 |
SendSmsPdu(pdu.pdu, pdu.len); |
SendSmsPdu(pdu.pdu, pdu.len); |
160 |
} |
} |
161 |
Common::instance()->logMessage( "All PDU's send"); |
Logger::logMessage( "All PDU's send"); |
162 |
|
|
163 |
} |
} |
164 |
|
|