--- smsdaemon/main.cpp 2008/12/18 06:53:29 196 +++ smsdaemon/main.cpp 2008/12/22 22:22:42 214 @@ -9,6 +9,7 @@ #include "ModemTransceiver.h" #include "DebugTransceiver.h" #include "SmsToolTransceiver.h" +#include "ProxyTransceiver.h" #include "serialport/SerialPort.h" #include "SmsDaemon.h" @@ -33,7 +34,14 @@ Common* cmn = Common::instance(); ConfigFile* config = cmn->GetConfigfile(); - port = new SerialPort ( config->GetValue("gsmmodem","serialport") ); + std::string portstr = config->GetValue("gsmmodem","serialport",""); + if (portstr == "") + { + Logger::logMessage("'serialport' not defined in config file"); + sms_exit(2); + } + + port = new SerialPort ( portstr ); try { port->Open( SerialPort::BAUD_9600, @@ -94,10 +102,14 @@ ///////////////////// - string transconf = config->GetValue("smsdaemon", "transceiver"); - + string transconf = config->GetValue("smsdaemon", "transceiver", ""); - if (transconf == "internal") + if (transconf == "") + { + Logger::logMessage("No transceiver defined in config file"); + exit(1); + } + else if (transconf == "internal") { openModemPort(); closeModemPort(); @@ -135,9 +147,11 @@ transceiver = new DebugTransceiver(); } + ProxyTransceiver proxy(*transceiver); + ////////////////////////////////// - SmsDaemon daemon(*transceiver); + SmsDaemon daemon(proxy); daemon.Start(); //returns here when main-loop exits