Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MTS-Serial libmDot-mbed5
Fork of Dot-AT-Firmware by
CmdDeviceClass.cpp
00001 #include "CmdDeviceClass.h" 00002 #include "CommandTerminal.h" 00003 00004 CmdDeviceClass::CmdDeviceClass() 00005 : 00006 Command("Device Class", "AT+DC", "Device class (A,B,C)", "(A,B,C)") { 00007 00008 _queryable = true; 00009 } 00010 00011 CmdDeviceClass::~CmdDeviceClass() { 00012 00013 } 00014 00015 uint32_t CmdDeviceClass::action(std::vector<std::string> args) { 00016 00017 if (args.size() == 1) { 00018 CommandTerminal::Serial()->writef("%s\r\n", CommandTerminal::Dot()->getClass().c_str()); 00019 } else { 00020 if (CommandTerminal::Dot()->setClass(args[1]) != mDot::MDOT_OK) { 00021 CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError());; 00022 return 1; 00023 } 00024 } 00025 00026 return 0; 00027 } 00028 00029 bool CmdDeviceClass::verify(std::vector<std::string> args) 00030 { 00031 if (args.size() == 1) 00032 return true; 00033 00034 if (args.size() == 2) { 00035 args[1] = mts::Text::toUpper(args[1]); 00036 if (args[1] == "A" || args[1] == "B" || args[1] == "C") { 00037 return true; 00038 } 00039 } 00040 00041 CommandTerminal::setErrorMessage("Invalid arguments"); 00042 return false; 00043 }
Generated on Tue Jul 12 2022 20:40:03 by
