iModem.h
1 #ifndef IMODEM_H_
2 #define IMODEM_H_
3 
4 #include <boost/system/error_code.hpp>
5 #include <boost/asio.hpp>
6 #include <boost/chrono.hpp>
7 
8 #include <list>
9 #include <string>
10 
11 #include "iSim.h"
12 
13 namespace dpyModem {
14 
15 typedef enum
16 {
17  ADDED = 0,
18  REMOVED = 1,
19 } ListEvent;
20 
22 typedef enum
23 {
24  MODEMMANAGERGENERIC_USB = 0,
25  MODEMMANAGER_EM7455 = 1,
26  BGS2W_PREINSTALLED = 2,
27  MODEMMANAGER_RC7620 = 3,
28  MODEMMANAGER_EC25 = 4,
29  MODEMMANAGER_WP7607 = 5,
30  MODEMMANAGER_RC7611 = 6
31 } ModemType;
32 
39 enum ModemState
42 {
55 };
56 
59 {
64 };
65 
68 {
74 };
75 
78 {
84 };
85 
88 {
94 };
95 
98 {
99  MODE_NONE = 0,
100  MODE_CS = 1,
101  MODE_2G = 2,
102  MODE_3G = 4,
103  MODE_4G = 8,
104  MODE_ANY = 16,
105 };
106 
107 
110 {
113  GSM,
122 };
123 
126 {
133 };
135 
137 struct ModemInfo
138 {
139  std::string manufacturer;
140  std::string model;
141  std::string imei;
142  std::string fw_version;
143 };
144 
145 
148 {
159 };
160 
166 {
167  int audio_mode;
168  int ringtone;
169  int volume_ringtone;
170  int volume_percent;
171  int micro_gain;
172  int micro_mult_factor;
173 };
174 
175 } //dpyModem
176 
177 class IModem;
178 
184 {
185 public:
191  virtual void updateModemState(const std::string& modemid,const dpyModem::ModemState& state) = 0;
192 
198  virtual void processModemWarningEvent(const std::string& modemid,const dpyModem::ModemWarning& warning) = 0;
199 
206  virtual void updateSimList(const std::string& modemid, const std::string& simid,const dpyModem::ListEvent& event) = 0;
207 
211  virtual ~ModemObserver()
212  {
213  }
214 };
215 
220 class IModem
221 {
222 private:
223  std::string mId;
224  std::vector<ModemObserver*> mObserversList;
225 
226 protected:
227  std::map<std::string, boost::shared_ptr<ISim>> mIdToSimMap;
228  void setId(const std::string& id);
229  void notifyModemStateUpdate(const std::string& modemid, const dpyModem::ModemState& status);
230  void notifyModemWarningEvent(const std::string& modemid, const dpyModem::ModemWarning& warning);
231  void notifySimListEvent(const std::string& modemid, const std::string& simid, const dpyModem::ListEvent& event);
232  void notifySimStatusUpdate(const std::string& simid, const dpyModem::SimStatus& status);
233 
234 public:
235 
239  virtual ~IModem();
240 
245  std::string getId() const;
246 
252  virtual boost::system::error_code getModemInfo(dpyModem::ModemInfo& info) const = 0;
253 
259  virtual boost::system::error_code getCurrentSim(boost::shared_ptr<ISim>& sim) const = 0;
260 
266  virtual boost::system::error_code getSims(std::list<boost::shared_ptr<ISim>>& list ) const = 0;
267 
273  virtual bool isSimActive(const std::string& simId) const = 0;
274 
280  virtual boost::system::error_code getActiveSims(std::list<boost::shared_ptr<ISim>>& list ) const = 0;
281 
288  virtual boost::system::error_code getSimById(const std::string& simid, boost::shared_ptr<ISim>& sim) const = 0;
289 
295  virtual boost::system::error_code getStatus(dpyModem::ModemStatus& status) = 0;
296 
302  virtual bool enableModem(boost::system::error_code& ec) = 0;
303 
309  virtual bool disableModem(boost::system::error_code& ec) = 0;
310 
317  virtual bool sleepModem(boost::system::error_code& ec) = 0;
318 
324  virtual bool softwareRestartModem(boost::system::error_code& ec) = 0;
325 
332  virtual bool hardwareRestartModem(boost::system::error_code& ec) = 0;
333 
339  virtual boost::system::error_code enableDataConnection() = 0;
340 
345  virtual boost::system::error_code disableDataConnection() = 0;
346 
351  virtual bool isDataConnectionEnabled() = 0;
352 
358  virtual boost::system::error_code forceNetworkMode(const dpyModem::NetworkMode& mode) = 0;
359 
365  boost::system::error_code subscribe(ModemObserver* observer);
366 
372  boost::system::error_code unsubscribe(ModemObserver* observer);
373 
374 };
375 
376 #endif /* IMODEM_H_ */
Defines the status information structure that is obtained after a MODEM STATUS report.
Definition: iModem.h:125
Modem searching for a operator for the GPRS mobile network.
Definition: iModem.h:90
Modem full functionality mode.
Definition: iModem.h:63
Modem functions are not available.
Definition: iModem.h:60
Modem module is back to normal temperature.
Definition: iModem.h:155
Modem Data connection system is being initiated.
Definition: iModem.h:51
4G mode
Definition: iModem.h:103
Modem Cellular network capabilities are being enabled but cellular network may not be available yet...
Definition: iModem.h:46
Modem is being restarted.
Definition: iModem.h:61
Signal quality is good enough to perform communications.
Definition: iModem.h:72
Supply voltage is close to the overvoltage threshold. If the voltage continues to increase until it c...
Definition: iModem.h:150
Modem interface class.
Definition: iModem.h:220
Modem is registered in the Cellular network : home network.
Definition: iModem.h:49
Deepsy Modem namespace that includes the different enums, structs or method signatures that should be...
std::map< std::string, boost::shared_ptr< ISim > > mIdToSimMap
Associates modem ids with the sim objects.
Definition: iModem.h:227
AccessTechnology
Defines the possible network access technologies a modem can make use of in order to communicate with...
Definition: iModem.h:109
Modem not registered in the Cellular network.
Definition: iModem.h:79
HSUPA (3G network)
Definition: iModem.h:119
Modem has not been able to register either in Home or Roaming networks.
Definition: iModem.h:93
std::string manufacturer
Modem Manufacturer.
Definition: iModem.h:139
std::string imei
Modem IMEI (International Mobile Equipment Identity)
Definition: iModem.h:141
REMOVED.
Definition: iModem.h:18
Modem has been able to register in the GPRS Home network.
Definition: iModem.h:91
Indicates that the modem restart is finished and the modem is again available.
Definition: iModem.h:158
NetworkMode
Defines the possible network modes.
Definition: iModem.h:97
Modem is off, modem functionalities are not available.
Definition: iModem.h:43
Signal quality is not adequate and this can affect performance.
Definition: iModem.h:70
ADDED.
Definition: iModem.h:17
ModemPowerStatus
Defines the possible MODEM POWER states that the modem can be in.
Definition: iModem.h:58
Modem not registered in the GPRS mobile network.
Definition: iModem.h:89
ModemState currentState
Current modem FSM state.
Definition: iModem.h:127
EDGE (2G network)
Definition: iModem.h:115
HSDPA (3G network)
Definition: iModem.h:118
ListEvent
Definition: iModem.h:15
Not using any technology (modem disabled, sleep or being enabled) or technology is unknown...
Definition: iModem.h:111
Modem has been able to register in the Cellular Roaming network (i.e. an external network) ...
Definition: iModem.h:82
Signal quality should be enough to perform communications.
Definition: iModem.h:71
SimStatus simStatus
Current Sim Status.
Definition: iModem.h:129
std::string model
Modem Model.
Definition: iModem.h:140
Modem Data connection has been configured and enabled.
Definition: iModem.h:52
Modem is enabled and SIM card is ready.
Definition: iModem.h:47
GPRS_NETWORK_STATUS
Defines the possible GPRS network registration status that can be reported. Note that this field info...
Definition: iModem.h:87
Modem searching for a operator for the Cellular network.
Definition: iModem.h:80
UMTS (3G network)
Definition: iModem.h:116
CSD, GSM and circuit-switched.
Definition: iModem.h:100
GPRS (2G network)
Definition: iModem.h:114
Supply voltage is close to the undervoltage threshold. If the voltage continues to decrease until it ...
Definition: iModem.h:149
Signal quality is high.
Definition: iModem.h:73
Plain old telephone service.
Definition: iModem.h:112
Struct to keep call Configuration as configured by the Voice call.
Definition: iModem.h:165
3G mode
Definition: iModem.h:102
Indicates that the power-off procedure is finished and the modem will be switched off in less than 1 ...
Definition: iModem.h:157
SimStatus
Defines the possible states in which SIM card may be.
Definition: iSim.h:48
Modem module is above overtemperature limit, imminent switch off.
Definition: iModem.h:154
Modem has been able to register in the Cellular Home network.
Definition: iModem.h:81
AccessTechnology accessTech
Current network Access Technology being used.
Definition: iModem.h:132
std::string fw_version
Modem firmware version.
Definition: iModem.h:142
Modem Jamming has been detected in the module.
Definition: iModem.h:156
ModemState
Definition: iModem.h:41
Modem signal quality is good enough to perform communications.
Definition: iModem.h:48
Modem has been able to register in the GPRS Roaming network (i.e., an external network) ...
Definition: iModem.h:92
SignalQuality signalQuality
Current Signal Quality.
Definition: iModem.h:130
ModemType
Modem types.
Definition: iModem.h:22
GSM (2G network)
Definition: iModem.h:113
LTE (4G network)
Definition: iModem.h:121
Defines the structure containing Modem information.
Definition: iModem.h:137
Modem is being restarted, modem functionalities are not available.
Definition: iModem.h:44
Modem Antenna is not connected to the device.
Definition: iModem.h:69
2G mode
Definition: iModem.h:101
Modem module is below undertemperature limit, imminent switch off.
Definition: iModem.h:153
HSPA (3G network)
Definition: iModem.h:117
ModemPowerStatus powerStatus
Current Power Status.
Definition: iModem.h:128
Modem is registered in the Cellular network : roaming network.
Definition: iModem.h:50
Any mode,select to go back to default network mode.
Definition: iModem.h:104
virtual ~ModemObserver()
Destructor.
Definition: iModem.h:211
Modem module is close to undertemperature limit.
Definition: iModem.h:151
CDMA2000 (2G - 3G network)
Definition: iModem.h:120
Modem module is close to overtemperature limit.
Definition: iModem.h:152
NetworkStatus
Defines the possible Cellular network registration status that can be reported. Note that this field ...
Definition: iModem.h:77
Modem low consumption mode, modem functionalities are not available.
Definition: iModem.h:45
Modem low consumption mode.
Definition: iModem.h:62
ModemWarning
Defines the possible warnings that the modem can report during its operation.
Definition: iModem.h:147
SignalQuality
Defines the possible SIGNAL QUALITY results that that can be obtained.
Definition: iModem.h:67
NetworkStatus cellularNetworkStatus
Current Network Status.
Definition: iModem.h:131
Modem has configured the device for data connections and it&#39;s trying to connect.
Definition: iModem.h:53
Modem has not been able to register either in Home or Roaming networks.
Definition: iModem.h:83
Modem Observer class.
Definition: iModem.h:183
Modem is ready to perform data connections, a network interface should be available for use...
Definition: iModem.h:54
No mode.
Definition: iModem.h:99