modemApi.h
Go to the documentation of this file.
1 
5 #pragma once
6 
7 #include <boost/function.hpp>
8 #include <boost/system/error_code.hpp>
9 #include <map>
10 #include <vector>
11 
12 #include "iModemList.h"
13 #include "networking.h"
14 
15 class ModemClient;
16 
17 #ifndef MODEM_TYPES_H_
18 #define MODEM_TYPES_H_
19 
25 namespace dpyModem {
26 
29 {
33  IMEI,
38 };
39 
40 
43 {
51 };
52 
58 typedef boost::function<void(boost::system::error_code, std::list<std::string> modems)> modem_list_handler_function;
59 
65 typedef boost::function<void(boost::system::error_code, std::list<std::string> sims)> sim_list_handler_function;
66 
73 typedef boost::function<void(boost::system::error_code error_code,std::string modemid, struct ModemStatus& status)> modem_status_handler_function;
74 
75 
82 typedef boost::function<void(boost::system::error_code, std::string modemid, ListEvent event)> modem_list_event_handler_function;
83 
90 typedef boost::function<void(boost::system::error_code, std::string modemid, dpyModem::ModemWarning warning)> modem_warning_event_handler_function;
91 
98 typedef boost::function<void(boost::system::error_code error_code,std::string modemid, const bool &enabled)> modem_data_connection_status_handler_function;
99 
105 typedef boost::function<void(boost::system::error_code, ModemInfo modeminfo)> modem_info_handler_function;
106 
112 typedef boost::function<void(boost::system::error_code, SimInfo siminfo)> sim_info_handler_function;
113 
121 typedef boost::function<void(boost::system::error_code, std::string modemid, std::string simid, ListEvent event)> sim_list_event_handler_function;
122 
129 typedef boost::function<void(boost::system::error_code, std::string simid, dpyModem::SimStatus status)> simStatus_handler_function;
130 
131 
136 typedef boost::function<void(const bool &available)> service_availability_handler_function;
137 typedef boost::function<void(boost::system::error_code& ec, ModemWarning warning_notif)> warning_handler_function;
138 typedef boost::function<
139  void(boost::system::error_code error_code, MODEM_INFO type, const std::string& value)> get_info_handler_function;
140 typedef boost::function<
141  void(boost::system::error_code error_code, const AccessPointNetwork& apn_info, const bool& forced_apn)> get_apn_handler_function;
142 typedef boost::function<
143  void(boost::system::error_code error_code, const AccessPointNetwork& apn_info)> get_apn_by_imsi_handler_function;
144 typedef boost::function<void(boost::system::error_code error_code)> result_handler_function;
145 typedef boost::function<void(boost::system::error_code error_code, const bool &enabled)> data_connection_status_handler_function;
146 typedef boost::function<void(boost::system::error_code error_code, const std::string& modemId, const std::string& interfaceName, std::map<dpyNetworking::Statistics, uint32_t>statisticsValues, const std::string& interfaceIpAddress )> interface_statistics_function_handler;
147 
154 typedef boost::function<void(boost::system::error_code error_code, std::string modemid, int simSlot)> sim_slot_handler_function;
155 
161 typedef boost::function<void(boost::system::error_code error_code, dpyModem::AccessPointNetwork found_apn)> forced_apn_handler_function;
162 
163 } //dpyModem
164 
165 
166 #endif /* MODEM_TYPES_H_ */
167 
168 
175 {
176 protected:
180  boost::shared_ptr <ModemClient> mClient;
181 public:
186  explicit ModemManager(std::string ip = "127.0.0.1");
190  ~ModemManager();
191 
196  bool isAlive();
197 
202  void monitorServiceAvailability_S(dpyModem::service_availability_handler_function handler);
203 
207  void monitorServiceAvailability_U();
208 
213  void asyncGetModems(dpyModem::modem_list_handler_function handler);
214 
220  void asyncGetModemInfo(const std::string& modemid, dpyModem::modem_info_handler_function handler);
221 
227  void asyncGetModemStatus(const std::string& modemid, dpyModem::modem_status_handler_function handler);
228 
233  void getModemStatusEvents_S(dpyModem::modem_status_handler_function handler);
234 
239  void getModemListEvents_S(dpyModem::modem_list_event_handler_function handler);
240 
245  void getModemWarningEvents_S(dpyModem::modem_warning_event_handler_function handler);
246 
253  void asyncRequestModemOperation(const std::string& modemid, const dpyModem::ModemOperation& operation, dpyModem::result_handler_function handler);
254 
260  void asyncIsDataConnectionEnabled(const std::string& modemid,dpyModem::modem_data_connection_status_handler_function handler);
261 
264 
270  void asyncGetModemSims(const std::string& modemid, dpyModem::sim_list_handler_function handler);
271 
278  void asyncGetActiveSims(const std::string& modemid, dpyModem::sim_list_handler_function handler);
279 
287  void asyncSwitchCurrentSimCard(const std::string& modemid, dpyModem::result_handler_function handler);
288 
295  void getCurrentSimSlot(const std::string& modemid, dpyModem::sim_slot_handler_function handler);
296 
301  void getSimListEvents_S (dpyModem::sim_list_event_handler_function handler);
302 
307  void getSimStatusEvents_S(dpyModem::simStatus_handler_function handler);
308  void getSimStatusEvents_U();
309 
315  void asyncGetSimInfo(const std::string& simid, dpyModem::sim_info_handler_function handler);
316 
322  void asyncGetSimStatus(const std::string& simid, dpyModem::simStatus_handler_function handler);
323 
327 
335  void asyncGetApnByImsi(const std::string& imsi, dpyModem::get_apn_by_imsi_handler_function handler);
336 
348  void asyncAddNewApn(const std::string& imsi, const dpyModem::AccessPointNetwork& apn, dpyModem::result_handler_function handler);
349 
361  void asyncDeleteApnByImsi(const std::string& imsi, dpyModem::result_handler_function handler);
362 
375  void asyncModifyApnByImsi(const std::string& current_imsi, const dpyModem::AccessPointNetwork& new_apn, dpyModem::result_handler_function handler);
376 
385  [[deprecated("Do not use the IMSI parameter to configure a forced APN. Forced APN is used for all inserted SIMs")]]
386  void asyncForceCustomApn(const std::string& imsi, dpyModem::result_handler_function handler, const bool& force = false, const dpyModem::AccessPointNetwork& custom_apn = {});
389 
397  void asyncForceCustomApn(dpyModem::result_handler_function handler, const bool& force = false, const dpyModem::AccessPointNetwork& custom_apn = {});
398 
404  void asyncGetInterfaceStatistics(const std::string& modemid, dpyModem::interface_statistics_function_handler);
405 
413  void asyncForceNetworkMode(const std::string& modemid, dpyModem::NetworkMode mode,dpyModem::result_handler_function handler);
414 
419  void asyncGetForcedAPN(dpyModem::forced_apn_handler_function handler);
420 
421 };
boost::function< void(boost::system::error_code, std::string simid, dpyModem::SimStatus status)> simStatus_handler_function
Prototype of the handler function for sim status getter and events.
Definition: modemApi.h:129
APN that is being used by the SIM card to perform data connections.
Definition: modemApi.h:37
SIM card IMSI (International Mobile Subscriber Identity)
Definition: modemApi.h:34
Operation that sets the modem sleep mode.
Definition: modemApi.h:46
Operation that generates a software modem restart.
Definition: modemApi.h:47
Operation that disables the data connections performed with the modem.
Definition: modemApi.h:49
Deepsy Modem namespace that includes the different enums, structs or method signatures that should be...
ModemOperation
Defines the possible operations that can be queried to a modem.
Definition: modemApi.h:42
Operation that enables the modem (modem enabled by default)
Definition: modemApi.h:45
boost::function< void(boost::system::error_code, std::list< std::string > modems)> modem_list_handler_function
Prototype of the handler function for getting available modems.
Definition: modemApi.h:58
boost::function< void(boost::system::error_code error_code, const std::string &modemId, const std::string &interfaceName, std::map< dpyNetworking::Statistics, uint32_t >statisticsValues, const std::string &interfaceIpAddress)> interface_statistics_function_handler
Prototype of the handler function for asyncGetInterfaceStatistics method.
Definition: modemApi.h:146
NetworkMode
Defines the possible network modes.
Definition: iModem.h:97
boost::function< void(boost::system::error_code error_code, const AccessPointNetwork &apn_info, const bool &forced_apn)> get_apn_handler_function
Prototype of the handler function for obtaining apn information (getCurrentApn or getApnByImsi method...
Definition: modemApi.h:141
Current operator used by the SIM card.
Definition: modemApi.h:36
boost::function< void(boost::system::error_code error_code, std::string modemid, struct ModemStatus &status)> modem_status_handler_function
Prototype of the handler function for modem status getter and events.
Definition: modemApi.h:73
boost::function< void(boost::system::error_code error_code, MODEM_INFO type, const std::string &value)> get_info_handler_function
Prototype of the handler function for getModemInfo method.
Definition: modemApi.h:139
SIM card ICCID (Integrated Circuit Card Identifier)
Definition: modemApi.h:35
Modem Model.
Definition: modemApi.h:31
boost::function< void(boost::system::error_code &ec, ModemWarning warning_notif)> warning_handler_function
Prototype of the handler function for getModemNotifications_S method.
Definition: modemApi.h:137
MODEM_INFO
Defines the possible information that can be queried.
Definition: modemApi.h:28
boost::function< void(boost::system::error_code, std::string modemid, dpyModem::ModemWarning warning)> modem_warning_event_handler_function
Prototype of the handler function for subscribing to modem warnings.
Definition: modemApi.h:90
Operation that enables the data connections performed with the modem (modem data connection enabled b...
Definition: modemApi.h:50
Modem Client class that interacts with the modem Service.
Definition: modemClient.h:13
boost::function< void(boost::system::error_code error_code, dpyModem::AccessPointNetwork found_apn)> forced_apn_handler_function
Prototype of the handler function for get the global forced APN.
Definition: modemApi.h:161
boost::shared_ptr< ModemClient > mClient
Reference to an Client Object.
Definition: modemApi.h:180
Operation that generates a hardware modem restart.
Definition: modemApi.h:48
Modem IMEI (International Mobile Equipment Identity)
Definition: modemApi.h:33
boost::function< void(boost::system::error_code, SimInfo siminfo)> sim_info_handler_function
Prototype of the handler function used to get a specific sim information.
Definition: modemApi.h:112
boost::function< void(boost::system::error_code error_code, std::string modemid, const bool &enabled)> modem_data_connection_status_handler_function
Prototype of the handler function to receive modem data connection status.
Definition: modemApi.h:98
boost::function< void(boost::system::error_code, std::list< std::string > sims)> sim_list_handler_function
Prototype of the handler function for getting available sims.
Definition: modemApi.h:65
Allows to interact with Modem Service.
Definition: modemApi.h:174
boost::function< void(boost::system::error_code error_code, const AccessPointNetwork &apn_info)> get_apn_by_imsi_handler_function
Prototype of the handler function for obtaining apn information (getCurrentApn or getApnByImsi method...
Definition: modemApi.h:143
boost::function< void(boost::system::error_code, std::string modemid, std::string simid, ListEvent event)> sim_list_event_handler_function
Prototype of the handler function for subscribing to list events.
Definition: modemApi.h:121
Modem firmware version.
Definition: modemApi.h:32
Operation that shuts down the modem completely.
Definition: modemApi.h:44
boost::function< void(const bool &available)> service_availability_handler_function
Prototype of the handler function used to monitor service availability.
Definition: modemApi.h:136
boost::function< void(boost::system::error_code error_code, const bool &enabled)> data_connection_status_handler_function
Prototype of the handler function for isDataConnectionEnabled method.
Definition: modemApi.h:145
boost::function< void(boost::system::error_code error_code, std::string modemid, int simSlot)> sim_slot_handler_function
Prototype of the handler function for get the current sim slot.
Definition: modemApi.h:154
Definition: iSim.h:40
Modem Manufacturer.
Definition: modemApi.h:30
boost::function< void(boost::system::error_code, ModemInfo modeminfo)> modem_info_handler_function
Prototype of the handler function used to get a specific modem information.
Definition: modemApi.h:105
boost::function< void(boost::system::error_code, std::string modemid, ListEvent event)> modem_list_event_handler_function
Prototype of the handler function for subscribing to list events.
Definition: modemApi.h:82
boost::function< void(boost::system::error_code error_code)> result_handler_function
Prototype of the handler function for obtaining result of the different operations.
Definition: modemApi.h:144