Modem interface class.

#include <iModem.h>

Public Member Functions

virtual ~IModem ()
 Destructor.
 
std::string getId () const
 Retrieve the modem ID. More...
 
virtual boost::system::error_code getModemInfo (dpyModem::ModemInfo &info) const =0
 Retrieve modem related information. More...
 
virtual boost::system::error_code getCurrentSim (boost::shared_ptr< ISim > &sim) const =0
 Retrieve current sim object being used. More...
 
virtual boost::system::error_code getSims (std::list< boost::shared_ptr< ISim >> &list) const =0
 Retrieve available sims for this modem. More...
 
virtual bool isSimActive (const std::string &simId) const =0
 Obtain the status of a sim in terms of active/inactive. More...
 
virtual boost::system::error_code getActiveSims (std::list< boost::shared_ptr< ISim >> &list) const =0
 Retrieve active sims for this modem. More...
 
virtual boost::system::error_code getSimById (const std::string &simid, boost::shared_ptr< ISim > &sim) const =0
 Retrieve a specific sim by specifying its id. More...
 
virtual boost::system::error_code getStatus (dpyModem::ModemStatus &status)=0
 Obtain current modem status, a structure composed by different parameters. More...
 
virtual bool enableModem (boost::system::error_code &ec)=0
 Enable the modem. More...
 
virtual bool disableModem (boost::system::error_code &ec)=0
 Disable the modem. More...
 
virtual bool sleepModem (boost::system::error_code &ec)=0
 Sleep the modem. More...
 
virtual bool softwareRestartModem (boost::system::error_code &ec)=0
 Perform a software restart of the modem. More...
 
virtual bool hardwareRestartModem (boost::system::error_code &ec)=0
 Perform a hardware restart of the modem. More...
 
virtual boost::system::error_code enableDataConnection ()=0
 Sets the modem data connection flag to true and, therefore, the modem will try to provide data connectivity. More...
 
virtual boost::system::error_code disableDataConnection ()=0
 Disables data connections performed with the modem, therefore, the modem will not try to use the data network. More...
 
virtual bool isDataConnectionEnabled ()=0
 Returns the status of the data connection flag, which informs the user if the data connection is enabled , allowing data connections, or disabled. More...
 
virtual boost::system::error_code forceNetworkMode (const dpyModem::NetworkMode &mode)=0
 Force a specific Network Mode to work with. More...
 
boost::system::error_code subscribe (ModemObserver *observer)
 Subscribe to the different modem events. More...
 
boost::system::error_code unsubscribe (ModemObserver *observer)
 Unsubscribe from the different modem events. More...
 

Protected Member Functions

void setId (const std::string &id)
 
void notifyModemStateUpdate (const std::string &modemid, const dpyModem::ModemState &status)
 
void notifyModemWarningEvent (const std::string &modemid, const dpyModem::ModemWarning &warning)
 
void notifySimListEvent (const std::string &modemid, const std::string &simid, const dpyModem::ListEvent &event)
 
void notifySimStatusUpdate (const std::string &simid, const dpyModem::SimStatus &status)
 

Protected Attributes

std::map< std::string, boost::shared_ptr< ISim > > mIdToSimMap
 Associates modem ids with the sim objects.
 

Member Function Documentation

virtual boost::system::error_code disableDataConnection ( )
pure virtual
Returns
DPY_OK if the operation was performed, DPY_NO_EFFECT if the connection was already disabled
virtual bool disableModem ( boost::system::error_code &  ec)
pure virtual
Parameters
ecerror code
Returns
true if the operation could be performed, false otherwise
virtual boost::system::error_code enableDataConnection ( )
pure virtual
Remarks
Modem data connection is enabled by default
Returns
DPY_OK if the operation was performed, DPY_NO_EFFECT if the connection was already disabled
virtual bool enableModem ( boost::system::error_code &  ec)
pure virtual
Parameters
ecerror code
Returns
true if the operation could be performed, false otherwise
virtual boost::system::error_code forceNetworkMode ( const dpyModem::NetworkMode mode)
pure virtual
Parameters
modenetwork mode to be set, select ANY so that the best one is selected automatically.
Returns
error code
virtual boost::system::error_code getActiveSims ( std::list< boost::shared_ptr< ISim >> &  list) const
pure virtual
Parameters
listlist of active sims
Returns
error code
virtual boost::system::error_code getCurrentSim ( boost::shared_ptr< ISim > &  sim) const
pure virtual
Parameters
simcurrent sim
Returns
error code
std::string getId ( ) const
Returns
modem ID
virtual boost::system::error_code getModemInfo ( dpyModem::ModemInfo info) const
pure virtual
Parameters
infostructure to be filled with the modem information
Returns
error code
virtual boost::system::error_code getSimById ( const std::string &  simid,
boost::shared_ptr< ISim > &  sim 
) const
pure virtual
Parameters
simidid to be retrieved
simresultant sim object with the specified id
Returns
error code
virtual boost::system::error_code getSims ( std::list< boost::shared_ptr< ISim >> &  list) const
pure virtual
Parameters
listlist of sims
Returns
error code
virtual boost::system::error_code getStatus ( dpyModem::ModemStatus status)
pure virtual
Parameters
statusmodem status
Returns
error code
virtual bool hardwareRestartModem ( boost::system::error_code &  ec)
pure virtual
Remarks
Do not use this method unless it is strictly necessary, use IModem::softwareRestartModem instead
Parameters
ecerror code
Returns
true if the operation could be performed, false otherwise
virtual bool isDataConnectionEnabled ( )
pure virtual
Returns
true if it is enabled, false if disabled
virtual bool isSimActive ( const std::string &  simId) const
pure virtual
Parameters
simIdsim whose activity status wants to be retrieved
Returns
true if the specified sim is active on this modem
virtual bool sleepModem ( boost::system::error_code &  ec)
pure virtual
Remarks
In sleep mode, the modem does not perform data connections and voice calls or SMS are not available from the user side. However, it may be able to wake up the system by making voice calls or sending SMS to the device.
Parameters
ecerror code
Returns
true if the operation could be performed, false otherwise
virtual bool softwareRestartModem ( boost::system::error_code &  ec)
pure virtual
Parameters
ecerror code
Returns
true if the operation could be performed, false otherwise
boost::system::error_code subscribe ( ModemObserver observer)
Parameters
observerobject to subscribe
Returns
error code
boost::system::error_code unsubscribe ( ModemObserver observer)
Parameters
observerobject to unsubscribe
Returns
error code