From 9dd6162772c7c60d6739202040e4b07e0342862c Mon Sep 17 00:00:00 2001 From: Andrii Pientsov Date: Thu, 16 Jul 2020 17:54:27 +0300 Subject: Add vendor firmware version --- main.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/main.cpp b/main.cpp index 065de30..0630d44 100644 --- a/main.cpp +++ b/main.cpp @@ -48,6 +48,7 @@ const std::string FCODE("code"); const std::string FRSSI("rssi"); const std::string FFIRMWARE("firmware"); const std::string FFIRMWAREBUILD("firmwarebuild"); +const std::string FVENDORFIRMWARE("vendorfirmware"); const std::string FCARRIER("carrier"); const std::string FMDN("mdn"); const std::string FICCID("iccid"); @@ -88,6 +89,7 @@ const uint32_t OPT_FIRMWAREBUILD = 0x00020000; const uint32_t OPT_SIM_STATUS = 0x00040000; const uint32_t OPT_RADIO_CODE = 0x00080000; const uint32_t OPT_SIM_CARRIER_CODE = 0x00100000; +const uint32_t OPT_VENDORFIRMWARE = 0x00200000; const uint32_t OPT_SUMMARY_STATIC = 0x01000000; const uint32_t OPT_SUMMARY_NETWORK = 0x02000000; @@ -245,6 +247,13 @@ int main(int argc, char** argv) { writeToCache(FFIRMWAREBUILD, sValue); printf("%s", sValue.c_str()); } + } else if(g_iOptions & OPT_VENDORFIRMWARE) { + std::string sValue; + result = g_apRadio->getVendorFirmware(sValue); + if(result == ICellularRadio::SUCCESS) { + writeToCache(FVENDORFIRMWARE, sValue); + printf("%s", sValue.c_str()); + } } else if(g_iOptions & OPT_IMEI) { std::string sValue; result = g_apRadio->getImei(sValue); @@ -407,6 +416,10 @@ void initializeCache() { ofile << jData[MTS::IO::ICellularRadio::KEY_FIRMWARE_BUILD].asString(); ofile.close(); + ofile.open(g_sCache + "/" + FVENDORFIRMWARE); + ofile << jData[MTS::IO::ICellularRadio::KEY_VENDOR_FIRMWARE].asString(); + ofile.close(); + ofile.open(g_sCache + "/" + FCARRIER); ofile << jData[MTS::IO::ICellularRadio::KEY_CARRIER].asString(); ofile.close(); @@ -492,6 +505,12 @@ Json::Value getStaticData() { } jData[ICellularRadio::KEY_FIRMWARE_BUILD] = sFirmwareBuild; + std::string sVendorFirmware(ICellularRadio::VALUE_UNKNOWN); + if(g_apRadio->getVendorFirmware(sVendorFirmware) != ICellularRadio::SUCCESS) { + printWarning("Radio Vendor Firmware not found"); + } + jData[ICellularRadio::KEY_VENDOR_FIRMWARE] = sVendorFirmware; + std::string sCarrier(ICellularRadio::VALUE_UNKNOWN); if(g_apRadio->getCarrier(sCarrier) != ICellularRadio::SUCCESS) { printWarning("Radio Carrier not found"); @@ -574,6 +593,7 @@ void parseOptions(int argc, char** argv) { { "cachedir", required_argument, 0, 'c' }, { "firmware", no_argument, &iOption, OPT_FIRMWARE }, { "firmwarebuild",no_argument, &iOption, OPT_FIRMWAREBUILD }, + { "vendorfirmware",no_argument, &iOption, OPT_VENDORFIRMWARE }, { "imei", no_argument, &iOption, OPT_IMEI }, { "imsi", no_argument, &iOption, OPT_IMSI }, { "lac", no_argument, &iOption, OPT_LAC }, @@ -686,6 +706,7 @@ void printHelp(const std::string& sApp) { printf("\tQueries:\n"); printf("\t--firmware\n"); printf("\t--firmwarebuild\n"); + printf("\t--vendorfirmware\n"); printf("\t--imei\n"); printf("\t--imsi\n"); printf("\t--lac\n"); -- cgit v1.2.3