smsSource.h
1 #pragma once
2 
3 #include "iSmsSource.h"
4 #include "sms.h"
5 
6 #ifdef TESTING
7 #include "gtest/gtest.h"
8 #endif
9 
14 class SmsSource: public ISmsSource , public SmsObserver
15 {
16 protected:
17  std::list<boost::shared_ptr<Sms>> mSmsList;
19 private:
20 
29  virtual void createSms(const std::string& remoteId,const std::string& content,const dpySms::SmsDirection& dir,const struct tm creationDate, boost::shared_ptr<Sms>& sms) = 0;
30 
31 public:
36  explicit SmsSource(const std::string& id);
40  virtual ~SmsSource();
41 
45  virtual void start() = 0;
46 
50  virtual void stop() = 0;
51 
56  virtual std::list<boost::shared_ptr<ISms>> getSmsList() const;
57 
64  virtual boost::system::error_code getSmsInfo(const std::string& smsid, dpySms::SmsInformation& info) const;
65 
73  virtual boost::system::error_code sendSms(const std::string& destination, const std::string& content, std::string& smsid) = 0;
74 
80  virtual boost::system::error_code deleteSms(const std::string& smsid) = 0;
81 
82 #ifdef TESTING
83 public:
84  FRIEND_TEST(Create_sms_Tests,New_sms_created_locally);
85  FRIEND_TEST(Create_sms_Tests,New_sms_received_externally);
86 
87 #endif //TESTING
88 };
virtual boost::system::error_code getSmsInfo(const std::string &smsid, dpySms::SmsInformation &info) const
Retrieve sms related information.
virtual void stop()=0
Stop Source operations.
Sms Source interface including service logic.
Definition: smsSource.h:14
virtual std::list< boost::shared_ptr< ISms > > getSmsList() const
Retrieve sms list from the sms source.
virtual boost::system::error_code sendSms(const std::string &destination, const std::string &content, std::string &smsid)=0
Sends a sms to a specified phone number or address.
SmsSource(const std::string &id)
Constructor.
virtual void start()=0
Start Source operations.
virtual boost::system::error_code deleteSms(const std::string &smsid)=0
Delete a specific sms from the sms list.
virtual ~SmsSource()
Destructor.
std::list< boost::shared_ptr< Sms > > mSmsList
Definition: smsSource.h:17