![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
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
CommandTerminal/CmdJoinByteOrder.cpp@14:f9a77400b622, 2016-11-04 (annotated)
- Committer:
- Mike Fiore
- Date:
- Fri Nov 04 14:25:43 2016 -0500
- Revision:
- 14:f9a77400b622
- Parent:
- 9:ff62b20f7000
update from git revision 2.0.16
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Mike Fiore |
4:666017851052 | 1 | #include "CmdJoinByteOrder.h" |
Mike Fiore |
4:666017851052 | 2 | |
Mike Fiore |
14:f9a77400b622 | 3 | CmdJoinByteOrder::CmdJoinByteOrder() : |
Mike Fiore |
14:f9a77400b622 | 4 | Command("Join Byte Order", "AT+JBO", "Send EUI's in join request with configured byte ordering (0:LSB,1:MSB)", "(0:LSB,1:MSB)") |
Mike Fiore |
4:666017851052 | 5 | { |
Mike Fiore |
4:666017851052 | 6 | _queryable = true; |
Mike Fiore |
4:666017851052 | 7 | } |
Mike Fiore |
4:666017851052 | 8 | |
Mike Fiore |
4:666017851052 | 9 | uint32_t CmdJoinByteOrder::action(std::vector<std::string> args) |
Mike Fiore |
4:666017851052 | 10 | { |
Mike Fiore |
4:666017851052 | 11 | if (args.size() == 1) |
Mike Fiore |
4:666017851052 | 12 | { |
Mike Fiore |
14:f9a77400b622 | 13 | CommandTerminal::Serial()->writef("%d\r\n", CommandTerminal::Dot()->getJoinByteOrder()); |
Mike Fiore |
4:666017851052 | 14 | } |
Mike Fiore |
4:666017851052 | 15 | else if (args.size() == 2) |
Mike Fiore |
4:666017851052 | 16 | { |
Mike Fiore |
4:666017851052 | 17 | mDot::JoinByteOrder order = mDot::LSB; |
Mike Fiore |
4:666017851052 | 18 | |
Mike Fiore |
4:666017851052 | 19 | if (args[1] == "1") |
Mike Fiore |
4:666017851052 | 20 | order = mDot::MSB; |
Mike Fiore |
4:666017851052 | 21 | |
Mike Fiore |
14:f9a77400b622 | 22 | if (CommandTerminal::Dot()->setJoinByteOrder(order) != mDot::MDOT_OK) |
Mike Fiore |
4:666017851052 | 23 | { |
Mike Fiore |
14:f9a77400b622 | 24 | CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError());; |
Mike Fiore |
4:666017851052 | 25 | return 1; |
Mike Fiore |
4:666017851052 | 26 | } |
Mike Fiore |
4:666017851052 | 27 | } |
Mike Fiore |
4:666017851052 | 28 | |
Mike Fiore |
4:666017851052 | 29 | return 0; |
Mike Fiore |
4:666017851052 | 30 | } |
Mike Fiore |
4:666017851052 | 31 | |
Mike Fiore |
4:666017851052 | 32 | bool CmdJoinByteOrder::verify(std::vector<std::string> args) |
Mike Fiore |
4:666017851052 | 33 | { |
Mike Fiore |
4:666017851052 | 34 | if (args.size() == 1) |
Mike Fiore |
4:666017851052 | 35 | return true; |
Mike Fiore |
4:666017851052 | 36 | |
Mike Fiore |
4:666017851052 | 37 | if (args.size() == 2) |
Mike Fiore |
4:666017851052 | 38 | { |
Mike Fiore |
4:666017851052 | 39 | if (args[1] != "0" && args[1] != "1") { |
Mike Fiore |
14:f9a77400b622 | 40 | CommandTerminal::setErrorMessage("Invalid argument"); |
Mike Fiore |
4:666017851052 | 41 | return false; |
Mike Fiore |
4:666017851052 | 42 | } |
Mike Fiore |
4:666017851052 | 43 | |
Mike Fiore |
4:666017851052 | 44 | return true; |
Mike Fiore |
4:666017851052 | 45 | } |
Mike Fiore |
4:666017851052 | 46 | |
Mike Fiore |
14:f9a77400b622 | 47 | CommandTerminal::setErrorMessage("Invalid arguments"); |
Mike Fiore |
4:666017851052 | 48 | return false; |
Mike Fiore |
4:666017851052 | 49 | } |