diff options
-rw-r--r-- | src/MTS_IO_CellularRadio.cpp | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp index ce95929..fe252c0 100644 --- a/src/MTS_IO_CellularRadio.cpp +++ b/src/MTS_IO_CellularRadio.cpp @@ -848,16 +848,32 @@ ICellularRadio::CODE CellularRadio::getCellularMode(CELLULAR_MODES &networks) { printError("%s| AT+COPS Error parsing reply [AT+COPS?][%s]", getName().c_str(), cmdResult.c_str()); return FAILURE; } - if (op == 0) { - networks = CELLULAR_MODE_2G; - } else if (op >= 2 && op <= 6) { - networks = CELLULAR_MODE_3G; - } else if (op == 7) { - networks = CELLULAR_MODE_4G; - } else { - printError("%s| AT+COPS unknown Radio Access Technology [AT+COPS?][%s]", getName().c_str(), cmdResult.c_str()); - return FAILURE; + + switch (op) { + case 0: // GSM + case 1: // GSM Compact + case 3: // GSM w/EGPRS + networks = CELLULAR_MODE_2G; + break; + + case 2: // UTRAN + case 4: // UTRAN w/HSDPA + case 5: // UTRAN w/HSUPA + case 6: // UTRAN w/HSDPA and HSUPA + networks = CELLULAR_MODE_3G; + break; + + case 7: // E-UTRAN, LTE + case 8: // CAT M1, EC-GSM-IoT (A/Gb mode), LTE + case 9: // NB IoT, E-UTRAN (NB-S1 mode), LTE + networks = CELLULAR_MODE_4G; + break; + + default: + printError("%s| AT+COPS unknown Radio Access Technology [AT+COPS?][%s]", getName().c_str(), cmdResult.c_str()); + return FAILURE; } + return SUCCESS; } |