AT terminal for the mDot using the USB debug port instead of the serial port.

Dependencies:   MTS-Serial libmDot-mbed5

Fork of Dot-AT-Firmware by MultiTech

Revision:
4:666017851052
Child:
9:ff62b20f7000
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CommandTerminal/CmdJoinByteOrder.cpp	Tue Aug 18 11:21:43 2015 -0500
@@ -0,0 +1,56 @@
+#include "CmdJoinByteOrder.h"
+
+CmdJoinByteOrder::CmdJoinByteOrder(mDot* dot, mts::MTSSerial& serial) :
+        Command(dot, "Join Byte Order", "AT+JBO", "Send EUI's in join request with configured byte ordering (0:LSB,1:MSB)"), _serial(serial)
+{
+    _help = std::string(text()) + ": " + std::string(desc());
+    _usage = "(0:LSB,1:MSB)";
+    _queryable = true;
+}
+
+uint32_t CmdJoinByteOrder::action(std::vector<std::string> args)
+{
+    if (args.size() == 1)
+    {
+        if (_dot->getVerbose())
+            _serial.writef("Join Byte Order: ");
+
+        _serial.writef("%d\r\n", _dot->getJoinByteOrder());
+    }
+    else if (args.size() == 2)
+    {
+        int32_t code;
+        mDot::JoinByteOrder order = mDot::LSB;
+
+        if (args[1] == "1")
+            order = mDot::MSB;
+
+        if ((code = _dot->setJoinByteOrder(order)) != mDot::MDOT_OK)
+        {
+            std::string error = mDot::getReturnCodeString(code) + " - " + _dot->getLastError();
+            setErrorMessage(error);
+            return 1;
+        }
+    }
+
+    return 0;
+}
+
+bool CmdJoinByteOrder::verify(std::vector<std::string> args)
+{
+    if (args.size() == 1)
+        return true;
+
+    if (args.size() == 2)
+    {
+        if (args[1] != "0" && args[1] != "1") {
+            setErrorMessage("Invalid argument");
+            return false;
+        }
+
+        return true;
+    }
+
+    setErrorMessage("Invalid arguments");
+    return false;
+}