diff options
author | Serhii Kostiuk <serhii.o.kostiuk@globallogic.com> | 2020-06-02 17:19:03 +0300 |
---|---|---|
committer | Serhii Kostiuk <serhii.o.kostiuk@globallogic.com> | 2020-06-02 17:30:22 +0300 |
commit | 42d384984b2f760bc8f7a69c7ea3464c73f4d892 (patch) | |
tree | ac2006f36c3bd1d93d1b02002c1eeda5b883de26 /src/MTS_IO_QuectelRadio.cpp | |
parent | b3a9a71afdb0d6f4f104543cedba89d011ca68df (diff) | |
download | libmts-io-42d384984b2f760bc8f7a69c7ea3464c73f4d892.tar.gz libmts-io-42d384984b2f760bc8f7a69c7ea3464c73f4d892.tar.bz2 libmts-io-42d384984b2f760bc8f7a69c7ea3464c73f4d892.zip |
[GP-651] LNA7: Allow to start the OMA DM procedure when it is required
This commits adds support for the Quectel-specific OMA DM commands.
This allows to trigger OMA DM procedure om Verizon to fetch the corrent APN
values and other settings from the network.
Expected radio output on success:
```
+QODM: "DME",0,DM Start
+QODM: "DME",0,DM End
```
Other +QODM URC codes are also possible according to information from Quectel forum:
https://forums.quectel.com/t/what-is-the-meaning-of-qodm-fumo-report-failed/2444/5.
But only "DM Start" and "DM End" responses are expected, supported and treated
as correct in the libmts-io.
Diffstat (limited to 'src/MTS_IO_QuectelRadio.cpp')
-rw-r--r-- | src/MTS_IO_QuectelRadio.cpp | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/src/MTS_IO_QuectelRadio.cpp b/src/MTS_IO_QuectelRadio.cpp index c4bdc56..b750bd6 100644 --- a/src/MTS_IO_QuectelRadio.cpp +++ b/src/MTS_IO_QuectelRadio.cpp @@ -436,6 +436,78 @@ ICellularRadio::CODE QuectelRadio::setMdn(const Json::Value& jArgs) { return NOT_APPLICABLE; } +ICellularRadio::CODE QuectelRadio::startOmaDm(ICellularRadio::UpdateCb& stepCb) { + printTrace("%s| Start OMA DM procedure", getName().c_str()); + + const int32_t iTimeoutOk = 3 * 1000; // 3 seconds + const int32_t iTimeoutStart = 5 * 1000; // 5 seconds + const int32_t iTimeoutEnd = 1 * 60 * 1000; // 1 minute + + const std::string sOdmStarted = "DM Start"; + const std::string sOdmFinished = "DM End"; + + const std::vector<std::string> vOdmStartedStrings{ sOdmStarted }; + const std::vector<std::string> vOdmFinishedStrings{ sOdmFinished }; + + CODE eCode; + + do { + + // Send command and expect "OK" in iTimeoutOk milliseconds + eCode = sendBasicCommand("AT+QODM=\"DME\",2,\"UI\"", iTimeoutOk); + if (eCode != SUCCESS) { + printError("%s| OMA DM procedure can not be started", getName().c_str()); + if (stepCb) { + stepCb(Json::Value("OMA DM Error: OMA DM can not be started")); + } + break; + } + + // Wait for the "Start" response + std::string sResponse = sendCommand("", vOdmStartedStrings, iTimeoutStart, 0x00); + printDebug("%s| Radio returned: [%s]", getName().c_str(), sResponse.c_str()); + + if (sResponse.find(sOdmStarted) == std::string::npos) { + printError("%s| OMA DM procedure failed due to timeout", getName().c_str()); + if (stepCb) { + stepCb(Json::Value("OMA DM Error: OMA DM failed due to timeout")); + } + eCode = FAILURE; + break; + } + + // Got "DM Started" message from the radio + printTrace("%s| OMA DM started", getName().c_str()); + if (stepCb) { + stepCb(Json::Value("OMA DM Info: OMA DM started")); + } + + // Wait for the "End" response + sResponse = sendCommand("", vOdmFinishedStrings, iTimeoutEnd, 0x00); + printDebug("%s| Radio returned: [%s]", getName().c_str(), sResponse.c_str()); + + if (sResponse.find(sOdmFinished) == std::string::npos) { + printError("%s| OMA DM procedure failed due to timeout", getName().c_str()); + if (stepCb) { + stepCb(Json::Value("OMA DM Error: OMA DM failed due to timeout")); + } + eCode = FAILURE; + break; + } + + // Got "DM End" message from the radio + printTrace("%s| OMA DM finished", getName().c_str()); + if (stepCb) { + stepCb(Json::Value("OMA DM Info: OMA DM finished")); + } + + eCode = SUCCESS; + + } while (false); + + return eCode; +} + ICellularRadio::CODE QuectelRadio::getServiceDomain(ICellularRadio::SERVICEDOMAIN& sd) { printTrace("%s| Get Service Domain", getName().c_str()); |