summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaksym Telychko <maksym.telychko@globallogic.com>2019-06-10 11:59:57 +0300
committerMaksym Telychko <maksym.telychko@globallogic.com>2019-06-10 11:59:57 +0300
commit5f7e999597ef8297fa4a82a71dda38dff3cd68fa (patch)
treee68b849a0320b64813e9c4ea9e07daa67c4a0d09
parent74fb4bb2d18bb1bd5b3a0ffa933064611a24de0d (diff)
downloadradio-cmd-5f7e999597ef8297fa4a82a71dda38dff3cd68fa.tar.gz
radio-cmd-5f7e999597ef8297fa4a82a71dda38dff3cd68fa.tar.bz2
radio-cmd-5f7e999597ef8297fa4a82a71dda38dff3cd68fa.zip
[MTS-MTQ] refactoring: switched to ICellularRadio
-rw-r--r--main.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/main.cpp b/main.cpp
index a5eeb97..b74c9c6 100644
--- a/main.cpp
+++ b/main.cpp
@@ -21,7 +21,7 @@
#include <mts/MTS_Text.h>
#include <mts/MTS_Logger.h>
#include <mts/MTS_AutoPtr.h>
-#include <mts/MTS_IO_CellularRadio.h>
+#include <mts/MTS_IO_ICellularRadio.h>
#include <mts/MTS_IO_CellularRadioFactory.h>
#include <json/json.h>
#include <sstream>
@@ -67,7 +67,7 @@ std::string g_sActiveFirmware;
std::string g_sConfigFile;
Json::Value g_jData;
-MTS::AutoPtr<MTS::IO::CellularRadio> g_apRadio;
+MTS::AutoPtr<MTS::IO::ICellularRadio> g_apRadio;
int32_t g_iOptions = 0;
@@ -108,7 +108,7 @@ void printHelp(const std::string& sApp);
void parseOptions(int argc, char** argv);
void initializeCache();
void shutdown();
-const char *code2str(MTS::IO::CellularRadio::CODE code);
+const char *code2str(MTS::IO::ICellularRadio::CODE code);
std::string loadImeiFromDeviceInfo();
@@ -147,7 +147,7 @@ std::string loadImeiFromDeviceInfo();
Json::Value getStaticData();
Json::Value getNetworkData();
-MTS::IO::CellularRadio::UpdateCb cb = [](const Json::Value& s)->void {
+MTS::IO::ICellularRadio::UpdateCb cb = [](const Json::Value& s)->void {
if(s.isString()) {
printf("%s\n", s.asCString());
}
@@ -199,7 +199,7 @@ int main(int argc, char** argv) {
return EXIT_FAILURE;
}
- CellularRadio::CODE result = CellularRadio::CODE::SUCCESS;
+ ICellularRadio::CODE result = ICellularRadio::CODE::SUCCESS;
if(g_iOptions & OPT_COMMAND) {
int32_t timeoutMillis = DEFAULT_TIMEOUT;
@@ -211,7 +211,7 @@ int main(int argc, char** argv) {
}
}
printDebug("AT Command: %s\n", g_sAtCommand.c_str());
- std::string sResult = g_apRadio->sendCommand(g_sAtCommand, MTS::IO::CellularRadio::DEFAULT_BAIL_STRINGS, timeoutMillis);
+ std::string sResult = g_apRadio->sendCommand(g_sAtCommand, MTS::IO::ICellularRadio::DEFAULT_BAIL_STRINGS, timeoutMillis);
printDebug("RESULT: %s\n", sResult.c_str());
// skip first line
std::size_t pos = sResult.find('\n');
@@ -305,7 +305,7 @@ int main(int argc, char** argv) {
Json::Value jArgs(Json::objectValue);
jArgs["msl"] = g_sMSL;
result = g_apRadio->validateMsl(jArgs);
- if(result == MTS::IO::CellularRadio::CODE::SUCCESS) {
+ if(result == MTS::IO::ICellularRadio::CODE::SUCCESS) {
std::ofstream fMSL((g_sCache + "/" + FMSL).c_str(), std::ios_base::trunc | std::ios_base::out);
if(fMSL.is_open()) {
std::string sMSL;
@@ -362,7 +362,7 @@ int main(int argc, char** argv) {
shutdown();
- return (result == CellularRadio::CODE::SUCCESS) ? 0 : 1;
+ return (result == ICellularRadio::CODE::SUCCESS) ? 0 : 1;
}
void handle_sigterm(int signum) {
@@ -627,19 +627,19 @@ void printHelp(const std::string& sApp) {
printf("\t\tLE910, HE910, GE910, DE910, CE910\n");
}
-const char *code2str(MTS::IO::CellularRadio::CODE code) {
+const char *code2str(MTS::IO::ICellularRadio::CODE code) {
switch (code) {
- case MTS::IO::CellularRadio::CODE::SUCCESS:
+ case MTS::IO::ICellularRadio::CODE::SUCCESS:
return "Success";
- case MTS::IO::CellularRadio::CODE::ERROR:
+ case MTS::IO::ICellularRadio::CODE::ERROR:
return "Error";
- case MTS::IO::CellularRadio::CODE::FAILURE:
+ case MTS::IO::ICellularRadio::CODE::FAILURE:
return "Failure";
- case MTS::IO::CellularRadio::CODE::NO_RESPONSE:
+ case MTS::IO::ICellularRadio::CODE::NO_RESPONSE:
return "No Response";
- case MTS::IO::CellularRadio::CODE::NOT_APPLICABLE:
+ case MTS::IO::ICellularRadio::CODE::NOT_APPLICABLE:
return "Not Applicable";
- case MTS::IO::CellularRadio::CODE::INVALID_ARGS:
+ case MTS::IO::ICellularRadio::CODE::INVALID_ARGS:
return "Invalid Arguments";
}
return "Unknown";