--- smsdaemon/main.cpp 2008/06/10 15:34:19 36 +++ smsdaemon/main.cpp 2008/06/13 10:10:06 75 @@ -1,4 +1,3 @@ -#include #include #include @@ -58,7 +57,7 @@ } else { - modem.SendSms(sms[i].sender, "Unknown command!"); + modem.SendSms(sms[i].sender, "Unknown command!", false); } modem.DeleteSms(sms[i].sms_index); @@ -74,6 +73,13 @@ } } +bool sms_exit(int exitcode) +{ + if (Common::instance()->isDaemon) + daemonCleanup(); + + exit(exitcode); +} int main(int argc, char* argv[]) { @@ -115,11 +121,21 @@ catch(std::exception &e) { cmn->logMessage( string("PortOpen Exception: ") + e.what() ); - exit(1); + sms_exit(1); } GsmModem modem(port); + try + { + modem.Init(); + } + catch (std::exception& e) + { + cmn->logMessage( string("GsmModem Exception: ") + e.what() ); + sms_exit(2); + } + //////////////////////////////////