#ifndef __GSMMODEM_H__ #define __GSMMODEM_H__ /* using http://sourceforge.net/projects/libserial/ */ #include #include #include "Sms.h" class SerialPort; class IGsmModem { public: virtual void SendSms(std::string to, std::string message) = 0; virtual ~IGsmModem() {} }; class GsmModem : public IGsmModem { public: GsmModem(SerialPort& serialport); virtual ~GsmModem() {} void Init(); virtual void SendSms(std::string to, std::string message); std::vector ReadSms(bool readAll=false); void DeleteSms(std::string smsIndex); int DeleteAllSms(); private: 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: 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; }; #endif // __GSMMODEM_H__