Cellular library for MTS Socket Modem Arduino Shield devices from Multi-Tech Systems
Dependents: mtsas mtsas mtsas mtsas
Diff: Cellular/UIP.cpp
- Revision:
- 26:2b769ed8de4f
- Parent:
- 22:c1004a807490
- Child:
- 43:91c5e53f508f
--- a/Cellular/UIP.cpp Mon Jun 23 14:33:01 2014 +0000 +++ b/Cellular/UIP.cpp Thu Jun 26 21:12:37 2014 +0000 @@ -90,9 +90,10 @@ logDebug("Making PPP Connection Attempt"); } std::string pppResult = sendCommand("AT#CONNECTIONSTART", 120000); - std::vector<std::string> parts = Text::split(pppResult, "\r\n"); + if(pppResult.find("Ok_Info_GprsActivation") != std::string::npos) { + std::vector<std::string> parts = Text::split(pppResult, "\r\n"); if(parts.size() >= 2) { local_address = parts[1]; } @@ -165,6 +166,7 @@ return pppConnected; } + bool UIP::bind(unsigned int port) { if(socketOpened) { @@ -528,6 +530,21 @@ } } +Code UIP::setApn(const std::string& apn) +{ + if (type == MTSMC_H5_IP) { + Code code = sendBasicCommand("AT#APNSERV=\"" + apn + "\"", 1000); + if (code != MTS_SUCCESS) { + return code; + } + this->apn = apn; + return code; //This will return MTS_SUCCESS + } else { + logInfo("CDMA radios don't need an APN"); + return MTS_SUCCESS; + } +} + void UIP::reset() { disconnect();