From 00439630bb52e1d80be032e3c2020a016b677611 Mon Sep 17 00:00:00 2001 From: Serhii Kostiuk Date: Sat, 22 Jun 2019 13:13:57 +0300 Subject: [MTS-MTQ] SIM status reporting for radio-query Added a new "--sim-status" query for fetching all the information about the current SIM card status: - isSimInserted - bool, is the SIM card installed or not; - isSimLocked - bool, is the SIM card blocked with PIN/PUK or not (or is READY); - lockStatus - string, either "READY", "SIM PUK", "SIM PIN" or other status as returned by "AT+CPIN?" AT command; - attemptsPin - integer, the number of attempts lef to enter a PIN code; - attemptsPuk - integer, the number of attempts lef to enter a PUK code. --- main.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main.cpp b/main.cpp index 4f71673..be87d06 100644 --- a/main.cpp +++ b/main.cpp @@ -84,6 +84,7 @@ const uint32_t OPT_DATETIME = 0x00004000; const uint32_t OPT_ACTIVEFIRMWARE = 0x00008000; const uint32_t OPT_LOCATION = 0x00010000; const uint32_t OPT_FIRMWAREBUILD = 0x00020000; +const uint32_t OPT_SIM_STATUS = 0x00040000; const uint32_t OPT_SUMMARY_STATIC = 0x01000000; const uint32_t OPT_SUMMARY_NETWORK = 0x02000000; @@ -155,6 +156,12 @@ int main(int argc, char** argv) { printf("%s", getNetworkData().toStyledString().c_str()); } else if(g_iOptions & OPT_SUMMARY_STATIC) { printf("%s", getStaticData().toStyledString().c_str()); + } else if(g_iOptions & OPT_SIM_STATUS) { + Json::Value jValue; + result = g_apRadio->getSimStatusSummary(jValue); + if(result == ICellularRadio::SUCCESS) { + printf("%s", jValue.toStyledString().c_str()); + } } else if(g_iOptions & OPT_RSSI) { int32_t iValue; result = g_apRadio->getSignalStrength(iValue); @@ -528,6 +535,7 @@ void parseOptions(int argc, char** argv) { { "carrier", no_argument, &iOption, OPT_CARRIER }, { "datetime", no_argument, &iOption, OPT_DATETIME }, { "active-firmware", no_argument, &iOption, OPT_ACTIVEFIRMWARE }, + { "sim-status", no_argument, &iOption, OPT_SIM_STATUS }, { "static", no_argument, &iOption, OPT_SUMMARY_STATIC }, { "dynamic", no_argument, &iOption, OPT_SUMMARY_NETWORK }, { 0, 0, 0, 0 } }; @@ -634,6 +642,7 @@ void printHelp(const std::string& sApp) { printf("\t--type\n"); printf("\t--carrier\n"); printf("\t--datetime\n"); + printf("\t--sim-status\n"); // Applicable for LTE910-NA1 dual FW images only // printf("\t--active-firmware\n"); printf("\n"); -- cgit v1.2.3