mDot AT-Firmware for testing

Dependencies:   MTS-Serial libmDot-mbed5

Fork of Dot-AT-Firmware by MultiTech

Committer:
Mike Fiore
Date:
Mon Apr 04 09:00:31 2016 -0500
Revision:
9:ff62b20f7000
Parent:
4:666017851052
Child:
14:f9a77400b622
update to version 1.0.8 of AT firmware

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Mike Fiore 4:666017851052 1 #include "CmdJoinByteOrder.h"
Mike Fiore 4:666017851052 2
Mike Fiore 4:666017851052 3 CmdJoinByteOrder::CmdJoinByteOrder(mDot* dot, mts::MTSSerial& serial) :
Mike Fiore 4:666017851052 4 Command(dot, "Join Byte Order", "AT+JBO", "Send EUI's in join request with configured byte ordering (0:LSB,1:MSB)"), _serial(serial)
Mike Fiore 4:666017851052 5 {
Mike Fiore 4:666017851052 6 _help = std::string(text()) + ": " + std::string(desc());
Mike Fiore 4:666017851052 7 _usage = "(0:LSB,1:MSB)";
Mike Fiore 4:666017851052 8 _queryable = true;
Mike Fiore 4:666017851052 9 }
Mike Fiore 4:666017851052 10
Mike Fiore 4:666017851052 11 uint32_t CmdJoinByteOrder::action(std::vector<std::string> args)
Mike Fiore 4:666017851052 12 {
Mike Fiore 4:666017851052 13 if (args.size() == 1)
Mike Fiore 4:666017851052 14 {
Mike Fiore 4:666017851052 15 if (_dot->getVerbose())
Mike Fiore 4:666017851052 16 _serial.writef("Join Byte Order: ");
Mike Fiore 4:666017851052 17
Mike Fiore 4:666017851052 18 _serial.writef("%d\r\n", _dot->getJoinByteOrder());
Mike Fiore 4:666017851052 19 }
Mike Fiore 4:666017851052 20 else if (args.size() == 2)
Mike Fiore 4:666017851052 21 {
Mike Fiore 4:666017851052 22 int32_t code;
Mike Fiore 4:666017851052 23 mDot::JoinByteOrder order = mDot::LSB;
Mike Fiore 4:666017851052 24
Mike Fiore 4:666017851052 25 if (args[1] == "1")
Mike Fiore 4:666017851052 26 order = mDot::MSB;
Mike Fiore 4:666017851052 27
Mike Fiore 4:666017851052 28 if ((code = _dot->setJoinByteOrder(order)) != mDot::MDOT_OK)
Mike Fiore 4:666017851052 29 {
Mike Fiore 9:ff62b20f7000 30
Mike Fiore 9:ff62b20f7000 31 setErrorMessage(_dot->getLastError());;
Mike Fiore 4:666017851052 32 return 1;
Mike Fiore 4:666017851052 33 }
Mike Fiore 4:666017851052 34 }
Mike Fiore 4:666017851052 35
Mike Fiore 4:666017851052 36 return 0;
Mike Fiore 4:666017851052 37 }
Mike Fiore 4:666017851052 38
Mike Fiore 4:666017851052 39 bool CmdJoinByteOrder::verify(std::vector<std::string> args)
Mike Fiore 4:666017851052 40 {
Mike Fiore 4:666017851052 41 if (args.size() == 1)
Mike Fiore 4:666017851052 42 return true;
Mike Fiore 4:666017851052 43
Mike Fiore 4:666017851052 44 if (args.size() == 2)
Mike Fiore 4:666017851052 45 {
Mike Fiore 4:666017851052 46 if (args[1] != "0" && args[1] != "1") {
Mike Fiore 4:666017851052 47 setErrorMessage("Invalid argument");
Mike Fiore 4:666017851052 48 return false;
Mike Fiore 4:666017851052 49 }
Mike Fiore 4:666017851052 50
Mike Fiore 4:666017851052 51 return true;
Mike Fiore 4:666017851052 52 }
Mike Fiore 4:666017851052 53
Mike Fiore 4:666017851052 54 setErrorMessage("Invalid arguments");
Mike Fiore 4:666017851052 55 return false;
Mike Fiore 4:666017851052 56 }