mDot AT-Firmware for testing

Dependencies:   MTS-Serial libmDot-mbed5

Fork of Dot-AT-Firmware by MultiTech

Revision:
14:f9a77400b622
Parent:
9:ff62b20f7000
--- a/CommandTerminal/CmdTxPower.cpp	Fri Nov 04 19:10:24 2016 +0000
+++ b/CommandTerminal/CmdTxPower.cpp	Fri Nov 04 14:25:43 2016 -0500
@@ -1,10 +1,7 @@
 #include "CmdTxPower.h"
 
-CmdTxPower::CmdTxPower(mDot* dot, mts::MTSSerial& serial) :
-        Command(dot, "Tx Power", "AT+TXP", "Set the radio TX power before antenna gain in dBm"), _serial(serial)
-{
-    _help = std::string(text()) + ": " + std::string(desc());
-    _usage = "(0-20)";
+CmdTxPower::CmdTxPower() :
+    Command("Tx Power", "AT+TXP", "Set the radio TX power before antenna gain in dBm", "(0-30)") {
     _queryable = true;
 }
 
@@ -12,20 +9,16 @@
 {
     if (args.size() == 1)
     {
-        if (_dot->getVerbose())
-            _serial.writef("Tx Power: ");
-
-        _serial.writef("%lu\r\n", _dot->getTxPower());
+        CommandTerminal::Serial()->writef("%lu\r\n", CommandTerminal::Dot()->getTxPower());
     }
     else if (args.size() == 2)
     {
-        int32_t code;
         int power = 0;
         sscanf(args[1].c_str(), "%d", &power);
 
-        if ((code = _dot->setTxPower(power)) != mDot::MDOT_OK)
+        if (CommandTerminal::Dot()->setTxPower(power) != mDot::MDOT_OK)
         {
-            setErrorMessage(_dot->getLastError());;
+            CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError());;
             return 1;
         }
     }
@@ -42,20 +35,20 @@
     {
         int power = 0;
         if (sscanf(args[1].c_str(), "%d", &power) != 1) {
-            setErrorMessage("Invalid argument");
+            CommandTerminal::setErrorMessage("Invalid argument");
             return false;
         }
 
-        if (power < 0 || power > 20)
+        if (power < 0 || power > 30)
         {
-            setErrorMessage("Invalid power, expects (0-20)");
+            CommandTerminal::setErrorMessage("Invalid power, expects (0-30)");
             return false;
         }
 
         return true;
     }
 
-    setErrorMessage("Invalid arguments");
+    CommandTerminal::setErrorMessage("Invalid arguments");
     return false;
 }