diff options
Diffstat (limited to 'CommandTerminal')
| -rw-r--r-- | CommandTerminal/CmdData.cpp | 7 | ||||
| -rw-r--r-- | CommandTerminal/CmdFactoryDefault.cpp | 8 | ||||
| -rw-r--r-- | CommandTerminal/CmdMaximumPower.cpp | 15 | ||||
| -rw-r--r-- | CommandTerminal/CmdMaximumSize.cpp | 24 | ||||
| -rw-r--r-- | CommandTerminal/CmdMinimumPower.cpp | 14 | ||||
| -rw-r--r-- | CommandTerminal/CmdMinimumSize.cpp | 23 | 
6 files changed, 61 insertions, 30 deletions
| diff --git a/CommandTerminal/CmdData.cpp b/CommandTerminal/CmdData.cpp index 339fc4b..4b31de6 100644 --- a/CommandTerminal/CmdData.cpp +++ b/CommandTerminal/CmdData.cpp @@ -1,5 +1,7 @@  #include "CmdData.h" +//SPECIAL NOTE: +Data is stored in the LoraConfig StartUpMode field. We decided to use 5 LoRaConfig locations, +// that are not used for the DotBox, for the 5 DotBox settings... +minsize, +maxsize, +minpwr, +maxpwr and +data.  CmdData::CmdData(mDot* dot, mts::MTSSerial& serial) :          Command(dot, "Data", "AT+DATA", "Enable/disable sending survey data results packet to the network server upon each successful survey. (0: off, 1: on)"), _serial(serial)  { @@ -14,15 +16,14 @@ uint32_t CmdData::action(std::vector<std::string> args)      {          if (_dot->getVerbose())              _serial.writef("%s: ", name()); -//ToDo: Change from _dot->getPublicNetwork() to the structure we will use for this. -        _serial.writef("%d\r\n", _dot->getPublicNetwork()); +        _serial.writef("%d\r\n", _dot->getStartUpMode());      }      else if (args.size() == 2)      {          int32_t code;          bool enable = (args[1] == "1"); -        if ((code = _dot->setPublicNetwork(enable)) != mDot::MDOT_OK) { +        if ((code = _dot->setStartUpMode(enable)) != mDot::MDOT_OK) {              std::string error = mDot::getReturnCodeString(code) + " - " + _dot->getLastError();              setErrorMessage(error);              return 1; diff --git a/CommandTerminal/CmdFactoryDefault.cpp b/CommandTerminal/CmdFactoryDefault.cpp index 53b6ede..3e366e8 100644 --- a/CommandTerminal/CmdFactoryDefault.cpp +++ b/CommandTerminal/CmdFactoryDefault.cpp @@ -9,6 +9,14 @@ CmdFactoryDefault::CmdFactoryDefault(mDot* dot) : Command(dot, "Reset Factory De  uint32_t CmdFactoryDefault::action(std::vector<std::string> args)  {      _dot->resetConfig(); + +//Factory defaults for the DotBox. +	_dot->setWakeDelay(242);		//DotBox +MaxSize is stored here. Default is 242. +	_dot->setWakeInterval(11);		//DotBox +MinSize is stored here. Default is 11. +	_dot->setWakeMode(20);			//DotBox +MaxPwr is stored here. Default is 20. +	_dot->setWakeTimeout(2);		//DotBox +MinPwr is stored here. Default is 2. +	_dot->setStartUpMode(0);		//DotBox +Data is stored here. Default is 0. +	      _dot->resetNetworkSession();      return 0;  } diff --git a/CommandTerminal/CmdMaximumPower.cpp b/CommandTerminal/CmdMaximumPower.cpp index 832fbfb..d12c11f 100644 --- a/CommandTerminal/CmdMaximumPower.cpp +++ b/CommandTerminal/CmdMaximumPower.cpp @@ -1,5 +1,7 @@  #include "CmdMaximumPower.h" +//SPECIAL NOTE: Maximum power is stored in the LoraConfig WakeMode field. We decided to use 5 LoRaConfig locations, +// that are not used for the DotBox, for the 5 DotBox settings... +minsize, +maxsize, +minpwr, +maxpwr and +data.  CmdMaximumPower::CmdMaximumPower(mDot* dot, mts::MTSSerial& serial) :          Command(dot, "Maximum Power", "AT+MAXPWR", "Set the maximum transmit power for sweep survey mode"), _serial(serial)  { @@ -14,16 +16,14 @@ uint32_t CmdMaximumPower::action(std::vector<std::string> args)      {          if (_dot->getVerbose())              _serial.writef("Maximum Power: "); -//ToDo: Change from _dot->getTxPower() to the structure we will use for this. -        _serial.writef("%lu\r\n", _dot->getTxPower()); +        _serial.writef("%lu\r\n", _dot->getWakeMode());      }      else if (args.size() == 2)      {          int32_t code;          uint32_t power = 0;          sscanf(args[1].c_str(), "%lu", &power); - -        if ((code = _dot->setTxPower(power)) != mDot::MDOT_OK) +        if ((code = _dot->setWakeMode(power)) != mDot::MDOT_OK)          {              std::string error = mDot::getReturnCodeString(code) + " - " + _dot->getLastError();              setErrorMessage(error); @@ -52,7 +52,12 @@ bool CmdMaximumPower::verify(std::vector<std::string> args)              setErrorMessage("Invalid maximum transmit power for sweep survey mode, expects (2-20)");              return false;          } -//ToDo: Output warning if < minimum size. +        if (power < _dot->getWakeTimeout())	//WakeTimeout holds the MinPower setting. +        { +            setErrorMessage("+MAXPWR cannot be less than +MINPWR. Please decrease +MINPWR first."); +            return false; +        } +          return true;      } diff --git a/CommandTerminal/CmdMaximumSize.cpp b/CommandTerminal/CmdMaximumSize.cpp index b8be63b..3679c72 100644 --- a/CommandTerminal/CmdMaximumSize.cpp +++ b/CommandTerminal/CmdMaximumSize.cpp @@ -1,5 +1,7 @@  #include "CmdMaximumSize.h" +//SPECIAL NOTE: Maximum size is stored in the LoraConfig WakeDelay field. We decided to use 5 LoRaConfig locations, +// that are not used for the DotBox, for the 5 DotBox settings... +minsize, +maxsize, +minpwr, +maxpwr and +data.  CmdMaximumSize::CmdMaximumSize(mDot* dot, mts::MTSSerial& serial) :          Command(dot, "Maximum Size", "AT+MAXSIZE", "Set the maximum payload size for sweep survey mode"), _serial(serial)  { @@ -14,16 +16,15 @@ uint32_t CmdMaximumSize::action(std::vector<std::string> args)      {          if (_dot->getVerbose())              _serial.writef("Maximum Size: "); -//ToDo: Change from _dot->getTxPower() to the structure we will use for this. -        _serial.writef("%lu\r\n", _dot->getTxPower()); +        _serial.writef("%lu\r\n", _dot->getWakeDelay());      }      else if (args.size() == 2)      {          int32_t code; -        uint32_t power = 0; -        sscanf(args[1].c_str(), "%lu", &power); +        uint32_t size = 0; +        sscanf(args[1].c_str(), "%lu", &size); -        if ((code = _dot->setTxPower(power)) != mDot::MDOT_OK) +        if ((code = _dot->setWakeDelay(size)) != mDot::MDOT_OK)          {              std::string error = mDot::getReturnCodeString(code) + " - " + _dot->getLastError();              setErrorMessage(error); @@ -41,18 +42,23 @@ bool CmdMaximumSize::verify(std::vector<std::string> args)      if (args.size() == 2)      { -        uint32_t power = 0; -        if (sscanf(args[1].c_str(), "%lu", &power) != 1) { +        uint32_t size = 0; +        if (sscanf(args[1].c_str(), "%lu", &size) != 1) {              setErrorMessage("Invalid argument");              return false;          } -        if (power < 11 || power > 242) +        if (size < 11 || size > 242)          {              setErrorMessage("Invalid maximum payload size, expects (11-242)");              return false;          } -//ToDo: Output warning if < minimum size. +        if (size < _dot->getWakeInterval())	//WakeInterval holds the MinSize setting. +        { +            setErrorMessage("+MAXSIZE cannot be less than +MINSIZE. Please decrease +MINSIZE first."); +            return false; +        } +          return true;      } diff --git a/CommandTerminal/CmdMinimumPower.cpp b/CommandTerminal/CmdMinimumPower.cpp index 96aa28e..f3c997e 100644 --- a/CommandTerminal/CmdMinimumPower.cpp +++ b/CommandTerminal/CmdMinimumPower.cpp @@ -1,5 +1,7 @@  #include "CmdMinimumPower.h" +//SPECIAL NOTE: Minimum power is stored in the LoraConfig WakeTimeout field. We decided to use 5 LoRaConfig locations, +// that are not used for the DotBox, for the 5 DotBox settings... +minsize, +maxsize, +minpwr, +maxpwr and +data.  CmdMinimumPower::CmdMinimumPower(mDot* dot, mts::MTSSerial& serial) :          Command(dot, "Minimum Power", "AT+MINPWR", "Set the minimum transmit power for sweep survey mode"), _serial(serial)  { @@ -14,8 +16,7 @@ uint32_t CmdMinimumPower::action(std::vector<std::string> args)      {          if (_dot->getVerbose())              _serial.writef("Minimum Power: "); -//ToDo: Change from _dot->getTxPower() to the structure we will use for this. -        _serial.writef("%lu\r\n", _dot->getTxPower()); +        _serial.writef("%lu\r\n", _dot->getWakeTimeout());      }      else if (args.size() == 2)      { @@ -23,7 +24,7 @@ uint32_t CmdMinimumPower::action(std::vector<std::string> args)          uint32_t power = 0;          sscanf(args[1].c_str(), "%lu", &power); -        if ((code = _dot->setTxPower(power)) != mDot::MDOT_OK) +        if ((code = _dot->setWakeTimeout(power)) != mDot::MDOT_OK)          {              std::string error = mDot::getReturnCodeString(code) + " - " + _dot->getLastError();              setErrorMessage(error); @@ -52,7 +53,12 @@ bool CmdMinimumPower::verify(std::vector<std::string> args)              setErrorMessage("Invalid minimum transmit power for sweep survey mode, expects (2-20)");              return false;          } -//ToDo: Output warning if > maximum power. +        if (power > _dot->getWakeMode())	//WakeMode holds the MaxPower setting. +        { +            setErrorMessage("+MINPWR cannot be greater than +MAXPWR. Please increase +MAXPWR first."); +            return false; +        } +          return true;      } diff --git a/CommandTerminal/CmdMinimumSize.cpp b/CommandTerminal/CmdMinimumSize.cpp index 7091bd8..5315af7 100644 --- a/CommandTerminal/CmdMinimumSize.cpp +++ b/CommandTerminal/CmdMinimumSize.cpp @@ -1,5 +1,7 @@  #include "CmdMinimumSize.h" +//SPECIAL NOTE: Minimum size is stored in the LoraConfig WakeInterval field. We decided to use 5 LoRaConfig locations, +// that are not used for the DotBox, for the 5 DotBox settings... +minsize, +maxsize, +minpwr, +maxpwr and +data.  CmdMinimumSize::CmdMinimumSize(mDot* dot, mts::MTSSerial& serial) :          Command(dot, "Minimum Size", "AT+MINSIZE", "Set the minimum payload size for sweep survey mode"), _serial(serial)  { @@ -14,16 +16,15 @@ uint32_t CmdMinimumSize::action(std::vector<std::string> args)      {          if (_dot->getVerbose())              _serial.writef("Minimum Size: "); -//ToDo: Change from _dot->getTxPower() to the structure we will use for this. -        _serial.writef("%lu\r\n", _dot->getTxPower()); +        _serial.writef("%lu\r\n", _dot->getWakeInterval());      }      else if (args.size() == 2)      {          int32_t code; -        uint32_t power = 0; -        sscanf(args[1].c_str(), "%lu", &power); +        uint32_t size = 0; +        sscanf(args[1].c_str(), "%lu", &size); -        if ((code = _dot->setTxPower(power)) != mDot::MDOT_OK) +        if ((code = _dot->setWakeInterval(size)) != mDot::MDOT_OK)          {              std::string error = mDot::getReturnCodeString(code) + " - " + _dot->getLastError();              setErrorMessage(error); @@ -41,18 +42,22 @@ bool CmdMinimumSize::verify(std::vector<std::string> args)      if (args.size() == 2)      { -        uint32_t power = 0; -        if (sscanf(args[1].c_str(), "%lu", &power) != 1) { +        uint32_t size = 0; +        if (sscanf(args[1].c_str(), "%lu", &size) != 1) {              setErrorMessage("Invalid argument");              return false;          } -        if (power < 11 || power > 242) +        if (size < 11 || size > 242)          {              setErrorMessage("Invalid minimum payload size, expects (11-242)");              return false;          } -//ToDo: Output warning if > maximum size. +        if (size > _dot->getWakeDelay())	//WakeDelay holds the MaxSize setting. +        { +            setErrorMessage("+MINSIZE cannot be greater than +MAXSIZE. Please increase +MAXSIZE first."); +            return false; +        }          return true;      } | 
