smsApi.h
Go to the documentation of this file.
1 
3 #pragma once
4 
5 #include <boost/function.hpp>
6 #include <boost/system/error_code.hpp>
7 #include <boost/shared_ptr.hpp>
8 #include <map>
9 #include <vector>
10 
11 #include "iSmsSource.h"
12 
13 
14 class SmsClient;
15 
21 namespace dpySms {
22 
28 typedef boost::function<void(boost::system::error_code, std::list<std::string> sources)> sms_sources_list_handler_function;
29 
36 typedef boost::function<void(boost::system::error_code, std::string sourceid, ListEvent event)> source_list_event_handler_function;
37 
42 typedef boost::function<void(const bool &available)> service_availability_handler;
43 
44 typedef boost::function<void(boost::system::error_code& ec, dpySms::SmsNotifications notif,const std::string& sms_identifier, const std::string& sms_source)> sms_notif_handler;
45 typedef boost::function<
46  void(boost::system::error_code& error_code, const std::string& smsid, const dpySms::SmsInformation& smsinfo)> sms_info_handler;
47 typedef boost::function<
48  void(boost::system::error_code& ec, std::map<std::string, dpySms::SmsInformation>& smsList)> sms_list_handler;
49 typedef boost::function<void(boost::system::error_code& error_code)> result_handler_function;
50 typedef boost::function<void(boost::system::error_code& error_code)> command_request_handler;
51 
57 typedef boost::function<void(boost::system::error_code& error_code, const std::string& smsid)> send_sms_handler_function;
58 
65 typedef boost::function<void(boost::system::error_code, std::string smssourceid, SourceStatus event)> source_status_handler_function;
66 
67 } // namespace dpySms
68 
74 class Sms
75 {
76 private:
77  boost::shared_ptr<SmsClient> mClient;
78 
79 public:
80  explicit Sms(std::string ip = "127.0.0.1");
81  ~Sms();
82  bool isAlive();
83  void monitorServiceAvailability_S(dpySms::service_availability_handler handler);
84  void monitorServiceAvailability_U();
89  void monitorSourcesStatusEvents_S(dpySms::source_status_handler_function handler);
93  void monitorSourcesStatusEvents_U();
98  void asyncGetSmsSources(dpySms::sms_sources_list_handler_function handler);
104  void asyncGetSmsSourceStatus(std::string sourceid, dpySms::source_status_handler_function handler);
105 
110  void smsSourceListEvent_S(dpySms::source_list_event_handler_function handler);
111 
112  void getSmsNotifications_S(dpySms::sms_notif_handler handler);
113  void getSmsNotifications_U();
114 
115  void asyncGetSmsInfo(const std::string& smsid, dpySms::sms_info_handler handler);
116  void asyncGetSmsList(dpySms::sms_list_handler handler);
117 
118  void asyncSendSms(const std::string& sourceid,const std::string& content, const std::string& destination, dpySms::send_sms_handler_function handler);
119  void asyncDeleteSms(const int& sms_id, dpySms::command_request_handler handler);
120  void asyncDeleteSms(const std::string& smsid, dpySms::result_handler_function handler);
121 };
boost::function< void(const bool &available)> service_availability_handler
Prototype of the handler function used to monitor service availability.
Definition: smsApi.h:42
boost::function< void(boost::system::error_code &error_code)> command_request_handler
Prototype of the handler function to obtain a single SMS.
Definition: smsApi.h:50
boost::function< void(boost::system::error_code, std::list< std::string > sources)> sms_sources_list_handler_function
Prototype of the handler function for getting available sms sources.
Definition: smsApi.h:28
boost::function< void(boost::system::error_code &error_code)> result_handler_function
Prototype of the handler function to obtain a single SMS.
Definition: smsApi.h:49
boost::function< void(boost::system::error_code &ec, std::map< std::string, dpySms::SmsInformation > &smsList)> sms_list_handler
Prototype of the handler function to obtain SMS list.
Definition: smsApi.h:48
Allows to interact with the SMS service.
Definition: smsClient.h:13
Allows to interact with the SMS service.
Definition: smsApi.h:74
Deepsy SMS namespace that includes the different enums, structs or method signatures that should be u...
Definition: smsApi.h:14
boost::function< void(boost::system::error_code, std::string sourceid, ListEvent event)> source_list_event_handler_function
Prototype of the handler function for subscribing to list events.
Definition: smsApi.h:36
boost::function< void(boost::system::error_code &error_code, const std::string &smsid, const dpySms::SmsInformation &smsinfo)> sms_info_handler
Prototype of the handler function to obtain a single SMS.
Definition: smsApi.h:46
boost::function< void(boost::system::error_code, std::string smssourceid, SourceStatus event)> source_status_handler_function
Prototype of the handler function for subscribing to source status events.
Definition: smsApi.h:65
boost::function< void(boost::system::error_code &error_code, const std::string &smsid)> send_sms_handler_function
Callback handler used when sending sms.
Definition: smsApi.h:57
boost::function< void(boost::system::error_code &ec, dpySms::SmsNotifications notif, const std::string &sms_identifier, const std::string &sms_source)> sms_notif_handler
Prototype of the handler function for SMS notifications method.
Definition: smsApi.h:44