Modem C++
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
Modem API related documentation
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);}}