--- smsdaemon/ModemTransceiver.cpp 2008/12/08 21:28:40 157 +++ smsdaemon/ModemTransceiver.cpp 2008/12/12 12:13:05 178 @@ -12,12 +12,14 @@ #include "ModemTransceiver.h" -#include "util.h" -#include "common.h" +#include "Util.h" +#include "Common.h" #include "Logger.h" +#include "ConfigFile.h" #include "SmsPdu.h" #include "SmsHelper.h" +#include "Exceptions.h" using namespace std; @@ -111,7 +113,16 @@ string sms_entry = result.substr(0,endpos); - retval.push_back( SmsHelper::FromPduString(sms_entry) );; + + try + { + SMS sms = SmsHelper::FromPduString(sms_entry); + + retval.push_back( sms ); + } + catch (smsnotfoundexception& e) //do nothing + { + } if (endpos == string::npos) break; @@ -202,6 +213,8 @@ void ModemTransceiver::HandlePincode() { + string pin = Common::instance()->GetConfigfile()->GetValue("gsmmodem","pin"); + string result = Command("AT+CPIN?"); result = Util::str_trim(result); result.erase(result.length() -2, 2); //remove trailing ok @@ -211,7 +224,7 @@ if (result == "+CPIN: SIM PIN") { Command("AT^SSET=1"); - result = Command("AT+CPIN=0067"); + result = Command( string("AT+CPIN=")+pin ); if ( result.substr(result.length()-4, 4) != "OK\r\n") throw std::runtime_error(string("Illegal pincode: ") + result);