/[projects]/smsdaemon/SmsDaemon.cpp
ViewVC logotype

Diff of /smsdaemon/SmsDaemon.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 126 by torben, Sat Dec 6 14:25:53 2008 UTC revision 132 by torben, Sun Dec 7 00:59:05 2008 UTC
# Line 3  Line 3 
3  #include <string>  #include <string>
4    
5  #include <sstream>  #include <sstream>
6    #include <stdlib.h>
7    
8  #include "common.h"  #include "common.h"
9    
10  #include "GsmModem.h"  #include "GsmModem.h"
# Line 32  void SmsDaemon::CreateLogMessage(SMS& sm Line 34  void SmsDaemon::CreateLogMessage(SMS& sm
34    
35  void SmsDaemon::CheckSms()  void SmsDaemon::CheckSms()
36  {  {
37          const int INTERVAL = 250; //no of milliseconds between sms checks          const int INTERVAL = 1000; //no of milliseconds between sms checks
38          timeval now = Util::GetTimeOfDay();          timeval now = Util::GetTimeOfDay();
39    
40          if ( Util::mTimeDiff(_lastSmsCheck,now) < INTERVAL)          if ( Util::mTimeDiff(_lastSmsCheck,now) < INTERVAL)
# Line 78  void SmsDaemon::MainLoop() Line 80  void SmsDaemon::MainLoop()
80    
81          mainContinue = true;          mainContinue = true;
82    
         int loopcount = 0;  
83          while (mainContinue)          while (mainContinue)
84          {          {
                 if (loopcount > 100 )  
                 {  
                         CheckSms();  
85    
86                          cmn->GetTaskManager()->ExecuteTasks(_modem);                  CheckSms();
87    
88                          loopcount = 0;                  cmn->GetTaskManager()->ExecuteTasks(_modem);
                 }  
89    
90                  if (cmn->isDebug && kbhit())                  if (cmn->isDebug && kbhit())
91                          break;                          break;
92    
93                  loopcount++;                  Util::Sleep(100);
                 Util::Sleep(10);  
94    
95          }          }
96  }  }
# Line 103  void SmsDaemon::Start() Line 99  void SmsDaemon::Start()
99  {  {
100          Common* cmn = Common::instance();          Common* cmn = Common::instance();
101    
102            srand(time(0));
103    
104          cmn->daemonStart = time(0);          cmn->daemonStart = time(0);
105          _lastSmsCheck = Util::GetTimeOfDay();          _lastSmsCheck = Util::GetTimeOfDay();

Legend:
Removed from v.126  
changed lines
  Added in v.132

  ViewVC Help
Powered by ViewVC 1.1.20