![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
FRDM-K64F, Avnet M14A2A, Grove Shield, to create smart home system. In use with AT&Ts M2x & Flow.
Dependencies: mbed FXOS8700CQ MODSERIAL
Diff: cell_modem.cpp
- Revision:
- 84:fc8c9b39723a
- Parent:
- 78:00cca62e5d9f
--- a/cell_modem.cpp Mon Dec 11 21:51:32 2017 +0000 +++ b/cell_modem.cpp Wed Mar 06 21:11:49 2019 +0000 @@ -83,7 +83,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"); @@ -105,7 +105,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) { @@ -114,7 +114,7 @@ if (strcasecmp(rsp, rsp_list[rsp_idx]) == 0) { return rsp_idx; } else if (strncmp(rsp, "@EXTERR", 7) == 0){ - pc.printf("----- We got EXTERR ---\r\n"); + //pc.printf("----- We got EXTERR ---\r\n"); return 2; } else if (strncmp(rsp, "+CME", 4) == 0){ return 3; @@ -171,7 +171,7 @@ if (rc == 0) return true; //timer.read(); wait_ms(1000 - (timer.read_ms() % 1000)); - PRINTF("\r%d",timer.read_ms()/1000); + //PRINTF("\r%d",timer.read_ms()/1000); } return false; } @@ -185,7 +185,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"); @@ -218,7 +218,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; @@ -227,7 +227,7 @@ if (strcasecmp(cmd_buf, rsp_list[rsp_idx]) == 0) { return rsp_idx; } else if (strncmp(cmd_buf, "@EXTERR", 7) == 0){ - PRINTF("----- We got EXTERR ---\r\n"); + //PRINTF("----- We got EXTERR ---\r\n"); return 2; } else if (strncmp(cmd_buf, "+CME", 4) == 0){ return 3; @@ -244,9 +244,9 @@ 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"); } @@ -294,11 +294,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) { - PRINTF(RED "Modem initialization failed!" DEF "\n"); + //PRINTF(RED "Modem initialization failed!" DEF "\n"); } } while (!i); @@ -315,31 +315,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.c_str()); + //PRINTF(DEF "\r\n"); + //PRINTF(YEL "Read back : %s" DEF "\r\n", MySocketData.c_str()); 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; }