Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: mtsas mtsas mtsas mtsas
Diff: Cellular/Cellular.cpp
- Revision:
- 18:fa0d8120f81f
- Parent:
- 16:1bc3e44d4746
- Child:
- 23:8333593dd86f
diff -r dee902f7d00e -r fa0d8120f81f Cellular/Cellular.cpp
--- a/Cellular/Cellular.cpp Thu Jun 05 17:29:32 2014 +0000
+++ b/Cellular/Cellular.cpp Mon Jun 16 13:50:28 2014 +0000
@@ -79,7 +79,7 @@
Code Cellular::test()
{
int i = 0;
- while (sendBasicCommand("AT", 1000) != SUCCESS) {
+ while (sendBasicCommand("AT", 1000) != MTS_SUCCESS) {
i++;
if (i >= 30) {
logError("Could not talk to radio after 30 tries");
@@ -87,7 +87,7 @@
}
wait(1);
}
- return SUCCESS;
+ return MTS_SUCCESS;
}
int Cellular::getSignalStrength()
@@ -136,14 +136,14 @@
{
if (type == MTSMC_H5_IP || type == MTSMC_H5 || type == MTSMC_G3) {
Code code = sendBasicCommand("AT#APNSERV=\"" + apn + "\"", 1000);
- if (code != SUCCESS) {
+ if (code != MTS_SUCCESS) {
return code;
}
this->apn = apn;
return code;
} else {
logInfo("CDMA radios don't need an APN");
- return SUCCESS;
+ return MTS_SUCCESS;
}
}
@@ -162,18 +162,18 @@
{
if(socketOpened) {
logError("socket is open. Can not send AT commands");
- return ERROR;
+ return MTS_ERROR;
}
string response = sendCommand(command, timeoutMillis, esc);
if (response.size() == 0) {
- return NO_RESPONSE;
+ return MTS_NO_RESPONSE;
} else if (response.find("OK") != string::npos) {
- return SUCCESS;
+ return MTS_SUCCESS;
} else if (response.find("ERROR") != string::npos) {
- return ERROR;
+ return MTS_ERROR;
} else {
- return FAILURE;
+ return MTS_FAILURE;
}
}
@@ -257,16 +257,16 @@
} else if (type == MTSMC_G3) {
} else {
logError("unknown radio type [%d]", type);
- return FAILURE;
+ return MTS_FAILURE;
}
Code code = sendBasicCommand("AT+CMGF=1", 1000);
- if (code != SUCCESS) {
+ if (code != MTS_SUCCESS) {
logError("CMGF failed");
return code;
}
code = sendBasicCommand(csmp, 1000);
- if (code != SUCCESS) {
+ if (code != MTS_SUCCESS) {
logError("CSMP failed [%s]", getRadioNames(type).c_str());
return code;
}
@@ -276,16 +276,16 @@
string response1 = sendCommand(cmd, 1000);
if (response1.find('>') == string::npos) {
logError("CMGS phone number failed");
- return NO_RESPONSE;
+ return MTS_NO_RESPONSE;
}
wait(.2);
string response2 = sendCommand(message, 4000, CTRL_Z);
logInfo("SMS Response: [%s]", response2.c_str());
if (response2.find("+CMGS:") == string::npos) {
logError("CMGS message failed");
- return FAILURE;
+ return MTS_FAILURE;
}
- return SUCCESS;
+ return MTS_SUCCESS;
}
std::vector<Cellular::Sms> Cellular::getReceivedSms()
@@ -296,7 +296,7 @@
size_t pos;
Code code = sendBasicCommand("AT+CMGF=1", 1000);
- if (code != SUCCESS) {
+ if (code != MTS_SUCCESS) {
logError("CMGF failed");
return vSms;
}