summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.cpp27
1 files changed, 26 insertions, 1 deletions
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<MTS::IO::ICellularRadio> 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 <context-id>\n");
// Applicable for LTE910-NA1 dual FW images only
// printf("\t--active-firmware\n");
printf("\n");