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

Annotation of /smsdaemon/ModemTransceiver.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 144 - (hide annotations) (download)
Sun Dec 7 16:27:34 2008 UTC (15 years, 5 months ago) by torben
Original Path: smsdaemon/GsmModem.h
File MIME type: text/plain
File size: 1383 byte(s)
Refactor IGsmModem, in order to ease adding another sms transceiver

1 torben 26 #ifndef __GSMMODEM_H__
2     #define __GSMMODEM_H__
3    
4     /* using http://sourceforge.net/projects/libserial/
5     */
6    
7 torben 90 #include "IGsmModem.h"
8 torben 26
9     #include <string>
10     #include <vector>
11    
12     #include "Sms.h"
13    
14 torben 53 class SerialPort;
15 torben 44
16    
17     class GsmModem : public IGsmModem
18     {
19     public:
20 torben 26 GsmModem(SerialPort& serialport);
21     virtual ~GsmModem() {}
22    
23 torben 57 void Init();
24 torben 26
25 torben 63 virtual void SendSms(std::string to, std::string message, bool allowMultipart);
26 torben 59 void SendSmsPdu(std::string pdu, int len);
27    
28 torben 144 virtual std::vector<SMS> ReadSms(bool readAll=false);
29    
30     virtual void DeleteSms(std::string smsIndex);
31     virtual int DeleteAllSms();
32 torben 26 private:
33     std::string GetResponse();
34     std::string Command(std::string command, std::string term = "OK\r\n");
35    
36 torben 105 void HandlePincode();
37     void WaitForSimcard();
38    
39 torben 57 bool _timeout;
40 torben 26 SerialPort& m_port;
41     };
42    
43 torben 44 class DebugGsmModem : public IGsmModem
44     {
45     public:
46 torben 67 DebugGsmModem() : _print(false) {}
47     DebugGsmModem(bool print) : _print(print) {}
48 torben 26
49 torben 67
50 torben 144 virtual std::vector<SMS> ReadSms(bool readAll=false);
51 torben 67 virtual void SendSms(std::string to, std::string message, bool allowMultipart);
52    
53 torben 144 virtual void DeleteSms(std::string smsIndex) {}
54     virtual int DeleteAllSms() { return 0;}
55    
56    
57    
58 torben 44 std::string GetTo() {return _to;}
59     std::string GetMessage() {return _message;}
60 torben 63 bool GetMultipart() {return _multipart;}
61 torben 44 private:
62     std::string _to;
63     std::string _message;
64 torben 63 bool _multipart;
65 torben 67 bool _print;
66 torben 44 };
67    
68 torben 26 #endif // __GSMMODEM_H__

  ViewVC Help
Powered by ViewVC 1.1.20