4 |
/* using http://sourceforge.net/projects/libserial/ |
/* using http://sourceforge.net/projects/libserial/ |
5 |
*/ |
*/ |
6 |
|
|
7 |
|
#include "IGsmModem.h" |
8 |
|
|
9 |
#include <string> |
#include <string> |
10 |
#include <vector> |
#include <vector> |
13 |
|
|
14 |
class SerialPort; |
class SerialPort; |
15 |
|
|
|
class IGsmModem |
|
|
{ |
|
|
public: |
|
|
virtual void SendSms(std::string to, std::string message, bool allowMultipart) = 0; |
|
|
virtual ~IGsmModem() {} |
|
|
}; |
|
16 |
|
|
17 |
class GsmModem : public IGsmModem |
class GsmModem : public IGsmModem |
18 |
{ |
{ |
32 |
std::string GetResponse(); |
std::string GetResponse(); |
33 |
std::string Command(std::string command, std::string term = "OK\r\n"); |
std::string Command(std::string command, std::string term = "OK\r\n"); |
34 |
|
|
35 |
|
void HandlePincode(); |
36 |
|
void WaitForSimcard(); |
37 |
|
|
38 |
bool _timeout; |
bool _timeout; |
39 |
SerialPort& m_port; |
SerialPort& m_port; |
40 |
}; |
}; |
42 |
class DebugGsmModem : public IGsmModem |
class DebugGsmModem : public IGsmModem |
43 |
{ |
{ |
44 |
public: |
public: |
45 |
virtual void SendSms(std::string to, std::string message, bool allowMultipart) |
DebugGsmModem() : _print(false) {} |
46 |
{_to=to; _message = message; _multipart = allowMultipart;} |
DebugGsmModem(bool print) : _print(print) {} |
47 |
|
|
48 |
|
|
49 |
|
virtual void SendSms(std::string to, std::string message, bool allowMultipart); |
50 |
|
|
51 |
std::string GetTo() {return _to;} |
std::string GetTo() {return _to;} |
52 |
std::string GetMessage() {return _message;} |
std::string GetMessage() {return _message;} |
55 |
std::string _to; |
std::string _to; |
56 |
std::string _message; |
std::string _message; |
57 |
bool _multipart; |
bool _multipart; |
58 |
|
bool _print; |
59 |
}; |
}; |
60 |
|
|
61 |
#endif // __GSMMODEM_H__ |
#endif // __GSMMODEM_H__ |