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 mbed-rtos mbed
Fork of mDot_USB_AT_firmware by
CmdDeviceClass.cpp
00001 #include "CmdDeviceClass.h" 00002 #include "CommandTerminal.h" 00003 00004 CmdDeviceClass::CmdDeviceClass(mDot* dot, mts::MTSSerial& serial) 00005 : 00006 Command(dot, "Device Class", "AT+DC", "Device class (A,B,C)"), 00007 _serial(serial) { 00008 _help = std::string(text()) + ": " + std::string(desc()); 00009 _queryable = true; 00010 _usage = "(A,B,C)"; 00011 } 00012 00013 CmdDeviceClass::~CmdDeviceClass() { 00014 00015 } 00016 00017 uint32_t CmdDeviceClass::action(std::vector<std::string> args) { 00018 00019 if (args.size() == 1) { 00020 if (_dot->getVerbose()) 00021 _serial.writef("Device Class:\r\n"); 00022 _serial.writef("%s\r\n", _dot->getClass().c_str()); 00023 } else { 00024 int32_t code; 00025 if ((code = _dot->setClass(args[1])) != mDot::MDOT_OK) { 00026 00027 setErrorMessage(_dot->getLastError());; 00028 return 1; 00029 } 00030 } 00031 00032 return 0; 00033 } 00034 00035 bool CmdDeviceClass::verify(std::vector<std::string> args) 00036 { 00037 if (args.size() == 1) 00038 return true; 00039 00040 if (args.size() == 2) { 00041 args[1] = mts::Text::toUpper(args[1]); 00042 if (args[1] == "A" || args[1] == "B" || args[1] == "C") { 00043 return true; 00044 } 00045 } 00046 00047 setErrorMessage("Invalid arguments"); 00048 return false; 00049 }
Generated on Tue Jul 12 2022 20:37:29 by
1.7.2
