Hadi Ho / Mbed 2 deprecated mDot_USB_AT_firmware

Dependencies:   MTS-Serial libmDot mbed-rtos mbed

Fork of mDot_USB_AT_firmware by Hadi Ho

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-64 (MSB) (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 }