Modem C++
Modem API related documentation. More...
Namespaces | |
| dpyModem | |
| Deepsy Modem namespace that includes the different enums, structs or method signatures that should be used. | |
Classes | |
| class | ModemManager |
| Allows to interact with Modem Service. More... | |
Detailed Description
A quick overview of basic Modem capabilities and examples is given.
If you find Modem API useful and would like to know more details, please check out further sections of the Modem API documentation or contact the Deepsy platform team.
Examples
-
Creating a class object
#include <dpy/modemApi.h>ModemManager modemManager;
-
Obtaining modem status updates
#include <dpy/modemApi.h>#include <dpy/iModem.h>#include <iostream>#include <stdio.h>#include <map>#include <iomanip>using namespace dpyModem;std::map<ModemState, std::string> state_to_string_map;std::map<ModemPowerStatus, std::string> power_to_string_map;std::map<SimStatus, std::string> sim_to_string_map;std::map<SignalQuality, std::string> signal_to_string_map;std::map<NetworkStatus, std::string> cellular_network_to_string_map;std::map<AccessTechnology, std::string> access_tech_to_string_map;volatile bool waiting = true;static ModemManager modemManager;{std::cout << " Modem state is: " << state_to_string_map[modem_stat.currentState] << std::endl;std::cout << " Power status is: " << power_to_string_map[modem_stat.powerStatus] << std::endl;std::cout << " Sim status is: " << sim_to_string_map[modem_stat.simStatus] << std::endl;std::cout << " Signal quality is: " << signal_to_string_map[modem_stat.signalQuality] << std::endl;std::cout << " Cellular Network status is: " << cellular_network_to_string_map[modem_stat.cellularNetworkStatus] << std::endl;std::cout << " Access technology being used is: " << access_tech_to_string_map[modem_stat.accessTech] << std::endl;}void modem_permanent_status_handler(boost::system::error_code ec, std::string modemid, dpyModem::ModemStatus& modem_stat){if (ec) {std::cout << "\rError : " << ec.message() << std::endl;} else {using namespace dpyModem;std::cout << "\r Modem [" << modemid << "] status " << std::endl;print_modem_status(modem_stat);std::cout << "\n";}}int main(int argc, char *argv[]){state_to_string_map[DISABLED] = "DISABLED";state_to_string_map[RESTARTING] = "RESTARTING";state_to_string_map[SLEEPING] = "SLEEPING";state_to_string_map[ENABLING_MODEM] = "ENABLING MODEM";state_to_string_map[ENABLED_SIM_READY] = "ENABLED_SIM_READY";state_to_string_map[SERVICE_AVAILABLE_GOOD_SIGNAL] = "SERVICE_AVAILABLE_GOOD_SIGNAL";state_to_string_map[CELLULAR_NETWORK_REG_HOME] = "CELLULAR_NETWORK_REG_HOME";state_to_string_map[CELLULAR_NETWORK_REG_ROAMING] = "CELLULAR_NETWORK_REG_ROAMING";state_to_string_map[DATA_CONNECTION_NOT_AVAILABLE] = "DATA_CONNECTION_NOT_AVAILABLE";state_to_string_map[DATA_CONNECTION_ENABLED] = "DATA_CONNECTION_ENABLED";state_to_string_map[DATA_CONNECTION_CONNECTING] = "DATA_CONNECTION_CONNECTING";state_to_string_map[DATA_CONNECTION_ACTIVE] = "DATA_CONNECTION_ACTIVE";power_to_string_map[MODEM_DISABLED] = "MODEM_DISABLED";power_to_string_map[MODEM_RESTART] = "MODEM_RESTART";power_to_string_map[MODEM_SLEEP] = "MODEM_SLEEP";power_to_string_map[MODEM_ON] = "MODEM_ON";sim_to_string_map[SimStatus::SIM_NOT_INSERTED] = "SIM_NOT_INSERTED";sim_to_string_map[SimStatus::SIM_INVALID_OR_UNSUPPORTED] = "SIM_INVALID_OR_UNSUPPORTED";sim_to_string_map[SimStatus::SIM_LOCKED] = "SIM_LOCKED";sim_to_string_map[SimStatus::SIM_LOCKED_PIN] = "SIM_LOCKED_PIN";sim_to_string_map[SimStatus::SIM_LOCKED_PIN2] = "SIM_LOCKED_PIN2";sim_to_string_map[SimStatus::SIM_LOCKED_PUK] = "SIM_LOCKED_PUK";sim_to_string_map[SimStatus::SIM_READY] = "SIM_READY";signal_to_string_map[ANTENNA_NOT_DETECTED] = "ANTENNA_NOT_DETECTED";signal_to_string_map[POOR_SIGNAL_STRENGTH] = "POOR_SIGNAL_STRENGTH";signal_to_string_map[FAIR_SIGNAL_STRENGTH] = "FAIR_SIGNAL_STRENGTH";signal_to_string_map[GOOD_SIGNAL_STRENGTH] = "GOOD_SIGNAL_STRENGTH";signal_to_string_map[EXCELLENT_SIGNAL_STRENGTH] = "EXCELLENT_SIGNAL_STRENGTH";cellular_network_to_string_map[NOT_REGISTERED] = "NOT_REGISTERED";cellular_network_to_string_map[SEARCHING_OPERATOR] = "SEARCHING_OPERATOR";cellular_network_to_string_map[REGISTERED_HOME_NET] = "REGISTERED_HOME_NET";cellular_network_to_string_map[REGISTERED_ROAMING] = "REGISTERED_ROAMING";cellular_network_to_string_map[REGISTRATION_DENIED] = "REGISTRATION_DENIED";access_tech_to_string_map[NONE] = "NONE";access_tech_to_string_map[POTS] = "POTS";access_tech_to_string_map[GSM] = "GSM";access_tech_to_string_map[GPRS] = "GPRS";access_tech_to_string_map[EDGE] = "EDGE";access_tech_to_string_map[UMTS] = "UMTS";access_tech_to_string_map[HSPA] = "HSPA";access_tech_to_string_map[HSDPA] = "HSDPA";access_tech_to_string_map[HSUPA] = "HSUPA";access_tech_to_string_map[CDMA] = "CDMA";access_tech_to_string_map[LTE] = "LTE";modemManager.getModemStatusEvents_S(modem_permanent_status_handler);while(waiting){usleep(300000);}}
@ ENABLED_SIM_READY
Modem is enabled and SIM card is ready.
Definition: iModem.h:49
@ REGISTERED_ROAMING
Modem has been able to register in the Cellular Roaming network (i.e. an external network)
Definition: iModem.h:85
NetworkStatus cellularNetworkStatus
Current Network Status.
Definition: iModem.h:136
@ POOR_SIGNAL_STRENGTH
Signal quality is not adequate and this can affect performance.
Definition: iModem.h:73
@ DATA_CONNECTION_ENABLED
Modem Data connection has been configured and enabled.
Definition: iModem.h:54
Defines the status information structure that is obtained after a MODEM STATUS report.
Definition: iModem.h:130
SignalQuality signalQuality
Current Signal Quality.
Definition: iModem.h:135
@ ANTENNA_NOT_DETECTED
Modem Antenna is not connected to the device.
Definition: iModem.h:72
@ DATA_CONNECTION_ACTIVE
Modem is ready to perform data connections, a network interface should be available for use.
Definition: iModem.h:56
@ SLEEPING
Modem low consumption mode, modem functionalities are not available.
Definition: iModem.h:47
@ CELLULAR_NETWORK_REG_HOME
Modem is registered in the Cellular network : home network.
Definition: iModem.h:51
@ GOOD_SIGNAL_STRENGTH
Signal quality is good enough to perform communications.
Definition: iModem.h:75
@ SEARCHING_OPERATOR
Modem searching for a operator for the Cellular network.
Definition: iModem.h:83
@ CELLULAR_NETWORK_REG_ROAMING
Modem is registered in the Cellular network : roaming network.
Definition: iModem.h:52
@ EXCELLENT_SIGNAL_STRENGTH
Signal quality is high.
Definition: iModem.h:76
Deepsy Modem namespace that includes the different enums, structs or method signatures that should be...
@ REGISTERED_HOME_NET
Modem has been able to register in the Cellular Home network.
Definition: iModem.h:84
void getModemStatusEvents_S(dpyModem::modem_status_handler_function handler)
Establish the handler that the subscriber will call when a new modem status (coming from any modem) i...
@ RESTARTING
Modem is being restarted, modem functionalities are not available.
Definition: iModem.h:46
AccessTechnology accessTech
Current network Access Technology being used.
Definition: iModem.h:137
@ SERVICE_AVAILABLE_GOOD_SIGNAL
Modem signal quality is good enough to perform communications.
Definition: iModem.h:50
@ DISABLED
Modem is off, modem functionalities are not available.
Definition: iModem.h:45
@ ENABLING_MODEM
Modem Cellular network capabilities are being enabled but cellular network may not be available yet.
Definition: iModem.h:48
@ FAIR_SIGNAL_STRENGTH
Signal quality should be enough to perform communications.
Definition: iModem.h:74
ModemState currentState
Current modem FSM state.
Definition: iModem.h:132
@ NONE
Not using any technology (modem disabled, sleep or being enabled) or technology is unknown.
Definition: iModem.h:115
@ REGISTRATION_DENIED
Modem has not been able to register either in Home or Roaming networks.
Definition: iModem.h:86
@ DATA_CONNECTION_NOT_AVAILABLE
Modem Data connection system is being initiated.
Definition: iModem.h:53
@ NOT_REGISTERED
Modem not registered in the Cellular network.
Definition: iModem.h:82
@ DATA_CONNECTION_CONNECTING
Modem has configured the device for data connections and it's trying to connect.
Definition: iModem.h:55
ModemPowerStatus powerStatus
Current Power Status.
Definition: iModem.h:133