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
CmdCRC.cpp
00001 #include "CmdCRC.h" 00002 00003 CmdCRC::CmdCRC() 00004 : 00005 Command("CRC Checking", "AT+CRC", "Enable/disable CRC (0: off, 1: on)", "(0,1)") 00006 { 00007 _queryable = true; 00008 } 00009 00010 uint32_t CmdCRC::action(std::vector<std::string> args) 00011 { 00012 if (args.size() == 1) { 00013 CommandTerminal::Serial()->writef("%d\r\n", CommandTerminal::Dot()->getCrc()); 00014 } 00015 else if (args.size() == 2) { 00016 bool enable = (args[1] == "1"); 00017 if (CommandTerminal::Dot()->setCrc(enable) != mDot::MDOT_OK) { 00018 CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError()); 00019 return 1; 00020 } 00021 } 00022 00023 return 0; 00024 } 00025 00026 bool CmdCRC::verify(std::vector<std::string> args) 00027 { 00028 if (args.size() == 1) 00029 return true; 00030 00031 if (args.size() == 2) { 00032 if (args[1] != "1" && args[1] != "0") { 00033 CommandTerminal::setErrorMessage("Invalid parameter, expects (0: off, 1: on)"); 00034 return false; 00035 } 00036 00037 return true; 00038 } 00039 00040 CommandTerminal::setErrorMessage("Invalid arguments"); 00041 return false; 00042 }
Generated on Tue Jul 12 2022 20:40:03 by
