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

Contents of /smsdaemon/GsmModem.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 67 - (show annotations) (download)
Thu Jun 12 15:23:11 2008 UTC (15 years, 11 months ago) by torben
File MIME type: text/plain
File size: 1272 byte(s)
Allow DebugGsmModem::SendSms to print directly to cout

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

  ViewVC Help
Powered by ViewVC 1.1.20