dev

Dependencies:   MTS-Serial libmDot-mbed5

Fork of Dot-AT-Firmware by MultiTech

Revision:
9:ff62b20f7000
Parent:
4:666017851052
Child:
14:f9a77400b622
--- a/CommandTerminal/CmdLinkCheckThreshold.cpp	Mon Apr 04 13:17:44 2016 +0000
+++ b/CommandTerminal/CmdLinkCheckThreshold.cpp	Mon Apr 04 09:00:31 2016 -0500
@@ -1,7 +1,7 @@
 #include "CmdLinkCheckThreshold.h"
 
 CmdLinkCheckThreshold::CmdLinkCheckThreshold(mDot* dot, mts::MTSSerial& serial) :
-        Command(dot, "Link Check Threshold", "AT+LCT", "Set threshold for number of link check of ACK failures to tolerate, (0: off, N: number of failures)"), _serial(serial)
+        Command(dot, "Link Check Threshold", "AT+LCT", "Set threshold for number of link check or ACK failures to tolerate, (0: off, N: number of failures)"), _serial(serial)
 {
     _help = std::string(text()) + ": " + std::string(desc());
     _usage = "(0-255)";
@@ -20,13 +20,13 @@
     else if (args.size() == 2)
     {
         int32_t code;
-        uint32_t count;
-        sscanf(args[1].c_str(), "%lu", &count);
+        int count;
+        sscanf(args[1].c_str(), "%d", &count);
 
         if ((code = _dot->setLinkCheckThreshold(count)) != mDot::MDOT_OK)
         {
-            std::string error = mDot::getReturnCodeString(code) + " - " + _dot->getLastError();
-            setErrorMessage(error);
+            
+            setErrorMessage(_dot->getLastError());;
             return 1;
         }
     }
@@ -41,10 +41,10 @@
 
     if (args.size() == 2)
     {
-        uint32_t count;
-        sscanf(args[1].c_str(), "%lu", &count);
+        int count;
+        sscanf(args[1].c_str(), "%d", &count);
 
-        if (count > 255) {
+        if (count < 0 || count > 255) {
             setErrorMessage("Invalid count, expects (0-255))");
             return false;
         }