From c0aa5515a92c0c62dd74e07e23199ad37182e5f1 Mon Sep 17 00:00:00 2001 From: Andrii Davydenko Date: Wed, 2 Nov 2022 16:37:31 +0200 Subject: [MTX-4694][GP-1791] MTCAP3 mPower R.6.1.X: LNA7D support - APN setup behavior when provider is Verizon Add pdp-conf-static parameter to get the PDP context Add ctx-id parameter to choose the PDP context to print --- main.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index f2cc086..8a763cf 100644 --- a/main.cpp +++ b/main.cpp @@ -58,6 +58,7 @@ std::string g_sModel; std::string g_sType; std::string g_sPort(DEFAULT_PORT); Json::Value g_jData; +std::string g_sPdpContextId; MTS::AutoPtr g_apRadio; @@ -101,6 +102,7 @@ const uint32_t OPT_SELECTED_BANDS_RAW = 0x20000000; int32_t g_iAuxOptions = 0; const uint32_t AOPT_VOICE_SUPPORT = 0x00000001; +const uint32_t AOPT_PDP_CONF_STATIC = 0x00000002; void handle_sigterm(int signum); void printHelp(const std::string& sApp); @@ -376,6 +378,20 @@ int main(int argc, char** argv) { if (result == ICellularRadio::SUCCESS) { printf("%s", sResult.c_str()); } + } else if (g_iAuxOptions & AOPT_PDP_CONF_STATIC) { + Json::Value jValue; + result = g_apRadio->getPdpContexts(jValue); + if (result == ICellularRadio::SUCCESS) { + if (g_sPdpContextId.empty()) { + printf("%s", toCompactStyledString(jValue).c_str()); + } else { + if (jValue.isMember(g_sPdpContextId)) { + printf("%s", toCompactStyledString(jValue[g_sPdpContextId]).c_str()); + } else { + result = ICellularRadio::CODE::FAILURE; + } + } + } } if (g_bIstty && result == ICellularRadio::CODE::SUCCESS) @@ -670,12 +686,14 @@ void parseOptions(int argc, char** argv) { { "sim-mcc-mnc", no_argument, &iOption, OPT_SIM_MCC_MNC }, { "voice-support",no_argument, &iAuxOption, AOPT_VOICE_SUPPORT }, { "selected-bands-raw", no_argument, &iOption, OPT_SELECTED_BANDS_RAW }, + { "pdp-conf-static", no_argument, &iAuxOption, AOPT_PDP_CONF_STATIC }, + { "ctx-id", required_argument, 0, 'C' }, { 0, 0, 0, 0 } }; /* getopt_long stores the option index here. */ int option_index = 0; - c = getopt_long(argc, argv, "d:p:ic:?v", long_options, &option_index); + c = getopt_long(argc, argv, "d:p:ic:?vC:", long_options, &option_index); /* Detect the end of the options. */ if (c == -1) { @@ -729,6 +747,12 @@ void parseOptions(int argc, char** argv) { } break; + case 'C': + if(optarg != 0) { + g_sPdpContextId = optarg; + } + break; + default: printf("OPTION: [%d] ABORTING!!\n", c); abort(); @@ -785,6 +809,7 @@ void printHelp(const std::string& sApp) { printf("\t--sim-mcc-mnc\n"); printf("\t--voice-support\n"); printf("\t--selected-bands-raw\n"); + printf("\t--pdp-conf-static --ctx-id \n"); // Applicable for LTE910-NA1 dual FW images only // printf("\t--active-firmware\n"); printf("\n"); -- cgit v1.2.3