diff options
author | Bijoy Anose <banose@multitech.com> | 2015-11-03 08:55:16 -0600 |
---|---|---|
committer | Bijoy Anose <banose@multitech.com> | 2015-11-03 08:55:16 -0600 |
commit | 14273be01c47845b85626488229c4e94802f3458 (patch) | |
tree | f4658278cae4fe7819e4bf7d2bbce155a507a232 | |
parent | 3c09ac56410043e662bcc1f9d9c4472f11e617ae (diff) | |
download | radio-cmd-14273be01c47845b85626488229c4e94802f3458.tar.gz radio-cmd-14273be01c47845b85626488229c4e94802f3458.tar.bz2 radio-cmd-14273be01c47845b85626488229c4e94802f3458.zip |
[IN001490] radio-cmd: adding command line option to set RX Diversity for DE910, HE910, and LE910 radios0.3
-rw-r--r-- | main.cpp | 83 |
1 files changed, 51 insertions, 32 deletions
@@ -62,14 +62,15 @@ std::string g_sMIPMnHaSpi; std::string g_sMIPRevTun; std::string g_sMIPMnAaaSs; std::string g_sMIPMnHaSs; +std::string g_sRxDiversity; Json::Value g_jData; MTS::AutoPtr<MTS::IO::CellularRadio> g_apRadio; int32_t g_iOptions = 0; -const uint32_t OPT_INDIVIDUAL = 0x00FFFFFF; -const uint32_t OPT_SUMMARY = 0x7F000000; +const uint32_t OPT_INDIVIDUAL = 0x01FFFFFF; +const uint32_t OPT_SUMMARY = 0x7E000000; const uint32_t OPT_INITIALIZE = 0x10000000; const uint32_t OPT_TIMEOUT = 0x00000001; @@ -96,6 +97,7 @@ const uint32_t OPT_INIT_RTN = 0x00100000; const uint32_t OPT_INIT_ACTIVATION = 0x00200000; const uint32_t OPT_MDN = 0x00400000; const uint32_t OPT_MSID = 0x00800000; +const uint32_t OPT_SETRXDIVERSITY = 0x01000000; void handle_sigterm(int signum); void printHelp(const std::string& sApp); @@ -105,6 +107,37 @@ void shutdown(); const char *code2str(MTS::IO::CellularRadio::CODE code); std::string loadImeiFromDeviceInfo(); + + int iOption = 0; + static struct option long_options[] = + { { "help", no_argument, 0, '?' }, + { "version", no_argument, 0, 'v' }, + { "printlvl", required_argument, 0, 'p' }, + { "device", required_argument, 0, 'd' }, + { "set-mdn", required_argument, 0, 'n' }, + { "set-msl", required_argument, 0, 'm' }, + { "set-msid", required_argument, 0, 's' }, + { "msl", required_argument, 0, 'l' }, + { "mdn", required_argument, 0, 'k' }, + { "msid", required_argument, 0, 'j' }, + { "set-rx-diversity", required_argument, 0, 'r' }, + { "set-mip-active-profile", required_argument, 0, '0' }, + { "set-mip-nai", required_argument, 0, '1' }, + { "set-mip-home-ip", required_argument, 0, '2' }, + { "set-mip-primary-ha", required_argument, 0, '3' }, + { "set-mip-secondary-ha", required_argument, 0, '4' }, + { "set-mip-mn-aaa-spi", required_argument, 0, '5' }, + { "set-mip-mn-ha-spi", required_argument, 0, '6' }, + { "set-mip-rev-tun", required_argument, 0, '7' }, + { "set-mip-mn-aaa-ss", required_argument, 0, '8' }, + { "set-mip-mn-ha-ss", required_argument, 0, '9' }, + { "init-dc", no_argument, &iOption, OPT_INIT_DC }, + { "init-fumo", no_argument, &iOption, OPT_INIT_FUMO }, + { "init-prl", no_argument, &iOption, OPT_INIT_PRL }, + { "init-activation", no_argument, &iOption, OPT_INIT_ACTIVATION }, + { "factory-default", no_argument, &iOption, OPT_INIT_RTN }, + { 0, 0, 0, 0 } }; + Json::Value getStaticData(); Json::Value getNetworkData(); @@ -306,6 +339,11 @@ int main(int argc, char** argv) { } result = g_apRadio->activate(jArgs, cb); printf("%s\n", code2str(result)); + } else if(g_iOptions & OPT_SETRXDIVERSITY) { + Json::Value jArgs(Json::objectValue); + jArgs["enabled"] = g_sRxDiversity; + result = g_apRadio->setRxDiversity(jArgs); + printf("%s\n", code2str(result)); } shutdown(); @@ -328,7 +366,7 @@ void shutdown() { void parseOptions(int argc, char** argv) { int c; - int iOption = 0; + //int iOption = 0; if(argc == 1) { printHelp(argv[0]); @@ -336,38 +374,11 @@ void parseOptions(int argc, char** argv) { } while (1) { - static struct option long_options[] = - { { "help", no_argument, 0, '?' }, - { "version", no_argument, 0, 'v' }, - { "printlvl", required_argument, 0, 'p' }, - { "device", required_argument, 0, 'd' }, - { "set-mdn", required_argument, 0, 'n' }, - { "set-msl", required_argument, 0, 'm' }, - { "set-msid", required_argument, 0, 's' }, - { "msl", required_argument, 0, 'l' }, - { "mdn", required_argument, 0, 'k' }, - { "msid", required_argument, 0, 'j' }, - { "set-mip-active-profile", required_argument, 0, '0' }, - { "set-mip-nai", required_argument, 0, '1' }, - { "set-mip-home-ip", required_argument, 0, '2' }, - { "set-mip-primary-ha", required_argument, 0, '3' }, - { "set-mip-secondary-ha", required_argument, 0, '4' }, - { "set-mip-mn-aaa-spi", required_argument, 0, '5' }, - { "set-mip-mn-ha-spi", required_argument, 0, '6' }, - { "set-mip-rev-tun", required_argument, 0, '7' }, - { "set-mip-mn-aaa-ss", required_argument, 0, '8' }, - { "set-mip-mn-ha-ss", required_argument, 0, '9' }, - { "init-dc", no_argument, &iOption, OPT_INIT_DC }, - { "init-fumo", no_argument, &iOption, OPT_INIT_FUMO }, - { "init-prl", no_argument, &iOption, OPT_INIT_PRL }, - { "init-activation", no_argument, &iOption, OPT_INIT_ACTIVATION }, - { "factory-default", no_argument, &iOption, OPT_INIT_RTN }, - { 0, 0, 0, 0 } }; /* getopt_long stores the option index here. */ int option_index = 0; - c = getopt_long(argc, argv, "t:d:p:?v", long_options, &option_index); + c = getopt_long(argc, argv, "t:d:p:r:?v", long_options, &option_index); /* Detect the end of the options. */ if(c == -1) { @@ -401,6 +412,13 @@ void parseOptions(int argc, char** argv) { } break; + case 'r': + if(optarg != 0) { + g_sRxDiversity = optarg; + } + g_iOptions |= OPT_SETRXDIVERSITY; + break; + case 't': if(optarg != 0) { g_sTimeout = optarg; @@ -568,6 +586,7 @@ void printHelp(const std::string& sApp) { printf("\t--set-mip-rev-tun <VAL> : set MIP Reverse Tunneling\n"); printf("\t--set-mip-mn-aaa-ss <VAL> : set MIP MN AAA SS\n"); printf("\t--set-mip-mn-ha-ss <VAL> : set MIP MN HA SS\n"); + printf("\t--set-rx-diversity <VAL> : set RX Diversity\n"); printf("\t--factory-default [ --msl <MSL> ] : reset to factory defaults\n"); printf("\n"); printf("\t--printlvl (p) <level> : sets the printlvl [0-100]\n"); @@ -575,7 +594,7 @@ void printHelp(const std::string& sApp) { printf("\t--help (?) : returns this message\n"); printf("\n"); printf("\tSupported Radios:\n"); - printf("\t\tHE910, GE910, DE910, CE910\n"); + printf("\t\tLE910, HE910, GE910, DE910, CE910\n"); } const char *code2str(MTS::IO::CellularRadio::CODE code) { |