AT Command Set mDot firmware with updated libmDot, to fix endian problem with joining LoRaWAN network

Dependencies:   MTS-Serial libmDot mbed-rtos mbed-src

Fork of mDot_AT_firmware by MultiTech

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers CmdDeviceId.cpp Source File

CmdDeviceId.cpp

00001 #include "CmdDeviceId.h"
00002 #include <algorithm>
00003 
00004 CmdDeviceId::CmdDeviceId(mDot* dot, mts::MTSSerial& serial) :
00005         Command(dot, "Device ID", "AT+DI", "Device EUI (unique, set at factory) (8 bytes)"), _serial(serial)
00006 {
00007     _help = std::string(text()) + ": " + std::string(desc());
00008     _usage = "(hex:8)";
00009     _queryable = true;
00010 }
00011 
00012 uint32_t CmdDeviceId::action(std::vector<std::string> args)
00013 {
00014     if (args.size() == 1)
00015     {
00016         if (_dot->getVerbose())
00017             _serial.writef("%s: ", name());
00018         _serial.writef("%s\r\n", mts::Text::bin2hexString(_dot->getDeviceId(), ":").c_str());
00019     }
00020 
00021     return 0;
00022 }
00023 
00024 bool CmdDeviceId::verify(std::vector<std::string> args)
00025 {
00026     if (args.size() == 1)
00027         return true;
00028 
00029     setErrorMessage("Invalid arguments");
00030     return false;
00031 }