--- smsdaemon/GsmModem.h 2008/06/12 15:23:11 67 +++ smsdaemon/GsmModem.h 2008/12/07 16:27:34 144 @@ -4,6 +4,7 @@ /* using http://sourceforge.net/projects/libserial/ */ +#include "IGsmModem.h" #include #include @@ -12,12 +13,6 @@ class SerialPort; -class IGsmModem -{ -public: - virtual void SendSms(std::string to, std::string message, bool allowMultipart) = 0; - virtual ~IGsmModem() {} -}; class GsmModem : public IGsmModem { @@ -30,13 +25,17 @@ virtual void SendSms(std::string to, std::string message, bool allowMultipart); void SendSmsPdu(std::string pdu, int len); - std::vector ReadSms(bool readAll=false); - void DeleteSms(std::string smsIndex); - int DeleteAllSms(); + virtual std::vector ReadSms(bool readAll=false); + + virtual void DeleteSms(std::string smsIndex); + virtual int DeleteAllSms(); private: std::string GetResponse(); std::string Command(std::string command, std::string term = "OK\r\n"); + void HandlePincode(); + void WaitForSimcard(); + bool _timeout; SerialPort& m_port; }; @@ -48,8 +47,14 @@ DebugGsmModem(bool print) : _print(print) {} + virtual std::vector ReadSms(bool readAll=false); virtual void SendSms(std::string to, std::string message, bool allowMultipart); + virtual void DeleteSms(std::string smsIndex) {} + virtual int DeleteAllSms() { return 0;} + + + std::string GetTo() {return _to;} std::string GetMessage() {return _message;} bool GetMultipart() {return _multipart;}