Cellular library for MTS Socket Modem Arduino Shield devices from Multi-Tech Systems
Dependents: mtsas mtsas mtsas mtsas
Diff: Cellular/CellularFactory.cpp
- Revision:
- 16:1bc3e44d4746
- Parent:
- 14:614952fb3af3
- Child:
- 26:2b769ed8de4f
diff -r 700a7662c52e -r 1bc3e44d4746 Cellular/CellularFactory.cpp --- a/Cellular/CellularFactory.cpp Wed Jun 04 12:20:37 2014 +0000 +++ b/Cellular/CellularFactory.cpp Thu Jun 05 14:52:59 2014 +0000 @@ -25,7 +25,15 @@ } /* "ATI4" gets us the model (HE910, DE910, etc) */ - model = sendCommand(io, "ATI4", 2000); + for (int i = 0; i < 5; i++) { + model = sendCommand(io, "ATI4", 2000); + if (model.find("error") == string::npos && model.find("ERROR") == string::npos) { + /* didn't get an error - keep going */ + break; + } + + wait(1); + } /* AT#VVERSION is a IUP specific AT command * if we get an error response, we're not using a UIP board */ @@ -38,29 +46,32 @@ if (uip && model.find("HE910") != string::npos) { type = Cellular::MTSMC_H5_IP; + logDebug("radio model: HE910"); cell = new UIP(type); } else if (uip && model.find("DE910") != string::npos) { type = Cellular::MTSMC_EV3_IP; + logDebug("radio model: DE910"); cell = new UIP(type); } else if (uip && model.find("CE910") != string::npos) { type = Cellular::MTSMC_C2_IP; + logDebug("radio model: CE910"); cell = new UIP(type); /* } else if (model.find("HE910") != string::npos) { type = Cellular::MTSMC_H5; - logDebug("%s", Cellular::getRadioNames(type).data()); + logDebug("radio model: HE910"); cell = new EasyIP(type); } else if (model.find("DE910") != string::npos) { type = Cellular::MTSMC_EV3; - logDebug("%s", Cellular::getRadioNames(type).data()); + logDebug("radio model: DE910"); cell = new EasyIP(type); } else if (model.find("GE910") != string::npos) { type = Cellular::MTSMC_G3; - logDebug("%s", Cellular::getRadioNames(type).data()); + logDebug("radio model: GE910"); cell = new EasyIP(type); } else if (model.find("CE910") != string::npos) { type = Cellular::MTSMC_C2; - logDebug("%s", Cellular::getRadioNames(type).data()); + logDebug("radio model: CE910"); cell = new EasyIP(type); */ } else {