From 28474b279248cc2a928cbec6073864828ba4d35c Mon Sep 17 00:00:00 2001 From: Serhii Kostiuk Date: Mon, 22 Jul 2019 10:34:17 +0300 Subject: [MTX-2890][IN:3756] MTR-MTQ - PPP Mode - Radio Reboot Enabled - Radio does not reboot Added radio reboot feature to the public interface of radio-cmd. This will allow to reboot the radio using AT commands in a uniform way from scripts and other components that may need it. --- main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.cpp b/main.cpp index 25b2f8d..d72faee 100644 --- a/main.cpp +++ b/main.cpp @@ -107,6 +107,7 @@ const uint32_t OPT_CONFIG_FILE = 0x04000000; const uint32_t OPT_GET_RADIOMODE = 0x08000000; const uint32_t OPT_SET_RADIOMODE = 0x10000000; const uint32_t OPT_UNLOCK_SIM_CARD = 0x20000000; +const uint32_t OPT_RESET_RADIO = 0x40000000; void handle_sigterm(int signum); void printHelp(const std::string& sApp); @@ -147,6 +148,7 @@ static struct option long_options[] = { { "unlock-sim-card", required_argument, 0, OPT_UNLOCK_SIM_CARD }, { "get-radio-network-mode", no_argument, &iOption, OPT_GET_RADIOMODE }, { "set-radio-network-mode", required_argument, 0, OPT_SET_RADIOMODE }, + { "reset-radio", no_argument, &iOption, OPT_RESET_RADIO }, { "init-dc", no_argument, &iOption, OPT_INIT_DC }, { "init-fumo", no_argument, &iOption, OPT_INIT_FUMO }, { "init-prl", no_argument, &iOption, OPT_INIT_PRL }, @@ -381,6 +383,10 @@ int main(int argc, char** argv) { jArgs["pin"] = g_sSimPin; result = g_apRadio->unlockSimCard(jArgs); printf("%s\n", code2str(result)); + } else if(g_iOptions & OPT_RESET_RADIO) { + bool ret = g_apRadio->resetRadio(); + result = (ret) ? ICellularRadio::CODE::SUCCESS : ICellularRadio::CODE::FAILURE; + printf("%s\n", code2str(result)); } shutdown(); @@ -651,6 +657,7 @@ void printHelp(const std::string& sApp) { // printf("\t--set-active-firmware : switch to a specific firmware image\n"); printf("\t--factory-default [ --msl ] : reset to factory defaults\n"); printf("\t--unlock-sim-card : unlock the SIM card using the PIN code provided\n"); + printf("\t--reset-radio : reset the radio module using AT commands\n"); printf("\n"); printf("\t--printlvl (p) : sets the printlvl [0-100]\n"); printf("\t--version (v) : returns version\n"); -- cgit v1.2.3