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.
Dependencies: FXOS8700CQ MODSERIAL XadowGPS mbed
Fork of Avnet_ATT_Cellular_IOT by
Diff: cell_modem.cpp
- Revision:
- 64:09004cd610df
- Parent:
- 63:90d7c69993cd
- Child:
- 68:6e311c747045
--- a/cell_modem.cpp Mon Aug 01 20:19:58 2016 +0000
+++ b/cell_modem.cpp Mon Aug 01 23:32:55 2016 +0000
@@ -66,7 +66,7 @@
if (cmd && strlen(cmd) > 0) {
if (mdm_dbgmask & MDM_DBG_AT_CMDS) {
- printf(MAG "ATCMD: " DEF "--> " GRN "%s" DEF "\n", cmd);
+ PRINTF(MAG "ATCMD: " DEF "--> " GRN "%s" DEF "\n", cmd);
}
mdm.puts(cmd);
mdm.puts("\r\n");
@@ -88,7 +88,7 @@
continue;
if (mdm_dbgmask & MDM_DBG_AT_CMDS) {
- printf(MAG "ATRSP: " DEF "<-- " CYN "%s" DEF "\n", rsp);
+ PRINTF(MAG "ATRSP: " DEF "<-- " CYN "%s" DEF "\n", rsp);
}
if (rsp_list) {
@@ -149,7 +149,7 @@
if (rc == 0)
return true; //timer.read();
wait_ms(1000 - (timer.read_ms() % 1000));
- pc.printf("\r%d",timer.read_ms()/1000);
+ PRINTF("\r%d",timer.read_ms()/1000);
}
return false;
}
@@ -163,7 +163,7 @@
if (cmd && n > 0) {
if (mdm_dbgmask & MDM_DBG_AT_CMDS) {
- printf(MAG "ATCMD: " DEF "--> " GRN "%s" DEF "\n", cmd);
+ PRINTF(MAG "ATCMD: " DEF "--> " GRN "%s" DEF "\n", cmd);
}
// mdm.puts(cmd);
// mdm.puts("\r\n");
@@ -196,7 +196,7 @@
}
if (mdm_dbgmask & MDM_DBG_AT_CMDS) {
- printf(MAG "ATRSP: " DEF "<-- " CYN "%s" DEF "\n", cmd_buf);
+ PRINTF(MAG "ATRSP: " DEF "<-- " CYN "%s" DEF "\n", cmd_buf);
}
int rsp_idx = 0;
@@ -216,11 +216,11 @@
void reinitialize_mdm(void)
{
// Initialize the modem
- printf(GRN "Modem RE-initializing..." DEF "\r\n");
+ PRINTF(GRN "Modem RE-initializing..." DEF "\r\n");
if (!mdm_init()) {
- printf(RED "\n\rModem RE-initialization failed!" DEF "\n");
+ PRINTF(RED "\n\rModem RE-initialization failed!" DEF "\n");
}
- printf("\r\n");
+ PRINTF("\r\n");
}
// These are built on the fly
string MyServerIpAddress;
@@ -266,11 +266,11 @@
pc.baud(115200);
// Initialize the modem
- printf(GRN "Modem initializing... will take up to 60 seconds" DEF "\r\n");
+ PRINTF(GRN "Modem initializing... will take up to 60 seconds" DEF "\r\n");
do {
i=mdm_init();
if (!i) {
- pc.printf(RED "Modem initialization failed!" DEF "\n");
+ PRINTF(RED "Modem initialization failed!" DEF "\n");
}
} while (!i);
@@ -287,31 +287,31 @@
int cell_modem_Sendreceive(char* tx_string, char* rx_string)
{
int iStatus = 0; //error by default
- printf(DEF "\r\n");
- printf(BLU "Sending to modem : %s" DEF "\r\n", &tx_string[0]);
+ PRINTF(DEF "\r\n");
+ PRINTF(BLU "Sending to modem : %s" DEF "\r\n", &tx_string[0]);
sockwrite_mdm(&tx_string[0]);
if (sockread_mdm(&MySocketData, 1024, 20))
{
- printf(DEF "\r\n");
- printf(YEL "Read back : %s" DEF "\r\n", &MySocketData[0]);
+ PRINTF(DEF "\r\n");
+ PRINTF(YEL "Read back : %s" DEF "\r\n", &MySocketData[0]);
char stringToCharBuf[BUF_SIZE_FOR_N_MAX_SOCKREAD*MAX_WNC_SOCKREAD_PAYLOAD+1]; // WNC can return max of 1500 (per sockread)
if ((MySocketData.length() + 1) < sizeof(stringToCharBuf))
{
strcpy(stringToCharBuf, MySocketData.c_str());
if (extract_JSON(stringToCharBuf, &rx_string[0]))
{
- printf(GRN "JSON : %s" DEF "\n", &rx_string[0]);
+ PRINTF(GRN "JSON : %s" DEF "\n", &rx_string[0]);
iStatus = 1; //all good
}
}
else
{
- printf(RED "BUFFER not big enough for sock data!" DEF "\r\n");
+ PRINTF(RED "BUFFER not big enough for sock data!" DEF "\r\n");
}
}
else
{
- printf(RED "No response..." DEF "\r\n");
+ PRINTF(RED "No response..." DEF "\r\n");
}
return iStatus;
}
