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

Diff of /smsdaemon/ModemTransceiver.cpp

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

revision 33 by torben, Tue Jun 10 12:58:30 2008 UTC revision 34 by torben, Tue Jun 10 13:29:19 2008 UTC
# Line 44  string GsmModem::GetResponse() Line 44  string GsmModem::GetResponse()
44          return str;          return str;
45  }  }
46    
47    
48  string GsmModem::Command(string command, string term)  string GsmModem::Command(string command, string term)
49  {  {
50          time_t  start,now;          time_t  start,now;
51          start = time(0);          start = time(0);
52    
53          command.append("\r");          if (term != "> ")
54                    command.append("\r"); //Dont append CarriageReturn if sending SMS
55    
56          m_port.Write(command);          m_port.Write(command);
57    
58          Util::Sleep(25);          Util::Sleep(1);
59          string response = GetResponse();          string response = GetResponse();
60    
   
61          unsigned int tlen = term.length();          unsigned int tlen = term.length();
62          while ( 1 )          while ( 1 )
63          {          {
# Line 66  string GsmModem::Command(string command, Line 68  string GsmModem::Command(string command,
68                  }                  }
69    
70                  response += GetResponse();                  response += GetResponse();
71                  Util::Sleep(25);                  Util::Sleep(1);
72    
73          now = time(0);          now = time(0);
74          if ( (now-start) > 10 )          if ( (now-start) > 10 )
# Line 74  string GsmModem::Command(string command, Line 76  string GsmModem::Command(string command,
76                  Common::instance()->logMessage( string("GsmModem::Command time out --") + command);                  Common::instance()->logMessage( string("GsmModem::Command time out --") + command);
77              break;              break;
78          }          }
   
   
79          }          }
80    
81          Util::Sleep(5);          Util::Sleep(5);
# Line 133  void GsmModem::SendSms(string to, string Line 133  void GsmModem::SendSms(string to, string
133          Command(line1,"> ");          Command(line1,"> ");
134    
135    
136          message.append("\032\r"); // \032 == Ctrl+Z          message.append("\032"); // \032 == Ctrl+Z
137    
138          Command(message);          Command(message);
139          Util::Sleep(50); //Give the modem some time to send the sms and be ready again          Util::Sleep(50); //Give the modem some time to send the sms and be ready again

Legend:
Removed from v.33  
changed lines
  Added in v.34

  ViewVC Help
Powered by ViewVC 1.1.20