12 |
|
|
13 |
#include "ModemTransceiver.h" |
#include "ModemTransceiver.h" |
14 |
|
|
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" |
203 |
|
|
204 |
void ModemTransceiver::HandlePincode() |
void ModemTransceiver::HandlePincode() |
205 |
{ |
{ |
206 |
|
string pin = Common::instance()->GetConfigfile()->GetValue("gsmmodem","pin"); |
207 |
|
|
208 |
string result = Command("AT+CPIN?"); |
string result = Command("AT+CPIN?"); |
209 |
result = Util::str_trim(result); |
result = Util::str_trim(result); |
210 |
result.erase(result.length() -2, 2); //remove trailing ok |
result.erase(result.length() -2, 2); //remove trailing ok |
214 |
if (result == "+CPIN: SIM PIN") |
if (result == "+CPIN: SIM PIN") |
215 |
{ |
{ |
216 |
Command("AT^SSET=1"); |
Command("AT^SSET=1"); |
217 |
result = Command("AT+CPIN=0067"); |
result = Command( string("AT+CPIN=")+pin ); |
218 |
if ( result.substr(result.length()-4, 4) != "OK\r\n") |
if ( result.substr(result.length()-4, 4) != "OK\r\n") |
219 |
throw std::runtime_error(string("Illegal pincode: ") + result); |
throw std::runtime_error(string("Illegal pincode: ") + result); |
220 |
|
|