15 |
#include "Util.h" |
#include "Util.h" |
16 |
#include "Common.h" |
#include "Common.h" |
17 |
#include "Logger.h" |
#include "Logger.h" |
18 |
|
#include "ConfigFile.h" |
19 |
|
|
20 |
#include "SmsPdu.h" |
#include "SmsPdu.h" |
21 |
#include "SmsHelper.h" |
#include "SmsHelper.h" |
22 |
|
#include "Exceptions.h" |
23 |
|
|
24 |
using namespace std; |
using namespace std; |
25 |
|
|
113 |
|
|
114 |
|
|
115 |
string sms_entry = result.substr(0,endpos); |
string sms_entry = result.substr(0,endpos); |
116 |
retval.push_back( SmsHelper::FromPduString(sms_entry) );; |
|
117 |
|
try |
118 |
|
{ |
119 |
|
SMS sms = SmsHelper::FromPduString(sms_entry); |
120 |
|
|
121 |
|
retval.push_back( sms ); |
122 |
|
} |
123 |
|
catch (smsnotfoundexception& e) //do nothing |
124 |
|
{ |
125 |
|
} |
126 |
|
|
127 |
if (endpos == string::npos) |
if (endpos == string::npos) |
128 |
break; |
break; |
213 |
|
|
214 |
void ModemTransceiver::HandlePincode() |
void ModemTransceiver::HandlePincode() |
215 |
{ |
{ |
216 |
|
string pin = Common::instance()->GetConfigfile()->GetValue("gsmmodem","pin"); |
217 |
|
|
218 |
string result = Command("AT+CPIN?"); |
string result = Command("AT+CPIN?"); |
219 |
result = Util::str_trim(result); |
result = Util::str_trim(result); |
220 |
result.erase(result.length() -2, 2); //remove trailing ok |
result.erase(result.length() -2, 2); //remove trailing ok |
224 |
if (result == "+CPIN: SIM PIN") |
if (result == "+CPIN: SIM PIN") |
225 |
{ |
{ |
226 |
Command("AT^SSET=1"); |
Command("AT^SSET=1"); |
227 |
result = Command("AT+CPIN=0067"); |
result = Command( string("AT+CPIN=")+pin ); |
228 |
if ( result.substr(result.length()-4, 4) != "OK\r\n") |
if ( result.substr(result.length()-4, 4) != "OK\r\n") |
229 |
throw std::runtime_error(string("Illegal pincode: ") + result); |
throw std::runtime_error(string("Illegal pincode: ") + result); |
230 |
|
|