--- smsdaemon/GsmModem.h 2008/06/09 18:15:53 26 +++ smsdaemon/GsmModem.h 2008/06/12 15:23:11 67 @@ -8,28 +8,56 @@ #include #include -#include "SerialPort.h" #include "Sms.h" -class GsmModem +class SerialPort; + +class IGsmModem +{ +public: + virtual void SendSms(std::string to, std::string message, bool allowMultipart) = 0; + virtual ~IGsmModem() {} +}; + +class GsmModem : public IGsmModem { public: GsmModem(SerialPort& serialport); virtual ~GsmModem() {} + void Init(); + + virtual void SendSms(std::string to, std::string message, bool allowMultipart); + void SendSmsPdu(std::string pdu, int len); - void SendSms(std::string to, std::string message); std::vector ReadSms(bool readAll=false); void DeleteSms(std::string smsIndex); int DeleteAllSms(); private: - void Init(); std::string GetResponse(); std::string Command(std::string command, std::string term = "OK\r\n"); - + bool _timeout; SerialPort& m_port; }; +class DebugGsmModem : public IGsmModem +{ +public: + DebugGsmModem() : _print(false) {} + DebugGsmModem(bool print) : _print(print) {} + + + virtual void SendSms(std::string to, std::string message, bool allowMultipart); + + std::string GetTo() {return _to;} + std::string GetMessage() {return _message;} + bool GetMultipart() {return _multipart;} +private: + std::string _to; + std::string _message; + bool _multipart; + bool _print; +}; #endif // __GSMMODEM_H__