--- smsdaemon/SmsDaemon.cpp 2008/06/16 11:30:20 92 +++ smsdaemon/SmsDaemon.cpp 2008/12/07 15:51:02 142 @@ -3,6 +3,8 @@ #include #include +#include + #include "common.h" #include "GsmModem.h" @@ -15,13 +17,14 @@ #include "TaskManager.h" #include "PluginManager.h" -using namespace std; +#include "version.h" +using namespace std; void SmsDaemon::CreateLogMessage(SMS& sms,bool hasPlugin) { ostringstream os; - os << "Recieved sms from " << sms.sender << " ; command=" << GetSmsCommand(sms); + os << "Recieved sms from " << sms.GetSender() << " ; command=" << sms.ExtractCommand(); if (!hasPlugin) os << " -- PLUGIN NOT FOUND"; @@ -31,6 +34,14 @@ void SmsDaemon::CheckSms() { + const int INTERVAL = 1000; //no of milliseconds between sms checks + timeval now = Util::GetTimeOfDay(); + + if ( Util::mTimeDiff(_lastSmsCheck,now) < INTERVAL) + return; + + _lastSmsCheck = now; + Common* cmn = Common::instance(); PluginManager* manager = cmn->GetPluginManager(); @@ -38,7 +49,7 @@ for (unsigned int i=0; ismsCounter.incomming++; } } @@ -79,7 +90,7 @@ if (cmn->isDebug && kbhit()) break; - Util::Sleep(10); + Util::Sleep(100); } } @@ -88,10 +99,14 @@ { Common* cmn = Common::instance(); + srand(time(0)); cmn->daemonStart = time(0); + _lastSmsCheck = Util::GetTimeOfDay(); cmn->logMessage("--------------------------------"); + cmn->logMessage( VERSION ); + cmn->logMessage( SVNVERSION ); cmn->GetTaskManager()->LoadTasks(); cmn->GetPluginManager()->LoadPlugins();