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

Diff of /smsdaemon/ModemTransceiver.h

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

smsdaemon/GsmModem.h revision 44 by torben, Wed Jun 11 08:25:34 2008 UTC smsdaemon/ModemTransceiver.h revision 678 by torben, Tue Apr 27 21:06:53 2010 UTC
# Line 1  Line 1 
1  #ifndef __GSMMODEM_H__  #ifndef __MODEMTRANSCEIVER_H__
2  #define __GSMMODEM_H__  #define __MODEMTRANSCEIVER_H__
3    
 /* using http://sourceforge.net/projects/libserial/  
  */  
4    
5    
6    #include "ISmsTransceiver.h"
7    
8  #include <string>  #include <string>
9  #include <vector>  #include <vector>
10    
 #include "SerialPort.h"  
11  #include "Sms.h"  #include "Sms.h"
12    
13    class SerialPort;
14    
 class IGsmModem  
 {  
 public:  
         virtual void SendSms(std::string to, std::string message) = 0;  
         virtual ~IGsmModem() {}  
 };  
15    
16  class GsmModem : public IGsmModem  class ModemTransceiver : public ISmsTransceiver
17  {  {
18  public:  public:
19          GsmModem(SerialPort& serialport);          ModemTransceiver(SerialPort& serialport);
20          virtual ~GsmModem() {}          virtual ~ModemTransceiver() {}
21    
22            void Init();
23    
24            virtual void SendSms(std::string to, std::string message, bool allowMultipart);
25            void SendSmsPdu(std::string pdu, int len);
26    
27            virtual std::vector<SMS> ReadSms(bool readAll=false);
28    
         virtual void SendSms(std::string to, std::string message);  
         std::vector<SMS> ReadSms(bool readAll=false);  
29          void DeleteSms(std::string smsIndex);          void DeleteSms(std::string smsIndex);
         int DeleteAllSms();  
30  private:  private:
         void Init();  
31          std::string GetResponse();          std::string GetResponse();
32          std::string Command(std::string command, std::string term = "OK\r\n");          std::string Command(std::string command, std::string term = "OK\r\n");
33    
34            //decode an CMGF=1 text string
35            SMS FromRawString(const std::string& input);
36            SMS FromPduString(const std::string& input);
37    
38            void HandlePincode();
39            void WaitForSimcard();
40    
41            bool _timeout;
42          SerialPort& m_port;          SerialPort& m_port;
43  };  };
44    
 class DebugGsmModem : public IGsmModem  
 {  
 public:  
         virtual void SendSms(std::string to, std::string message)  
                 {_to=to; _message = message;}  
   
         std::string GetTo() {return _to;}  
         std::string GetMessage() {return _message;}  
 private:  
         std::string _to;  
         std::string _message;  
 };  
45    
46  #endif // __GSMMODEM_H__  #endif // __MODEMTRANSCEIVER_H__

Legend:
Removed from v.44  
changed lines
  Added in v.678

  ViewVC Help
Powered by ViewVC 1.1.20