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
CmdUplinkCounter.cpp
00001 #include "CmdUplinkCounter.h" 00002 00003 CmdUplinkCounter::CmdUplinkCounter() 00004 : Command("Uplink Counter", "AT+ULC", "Get or set the uplink counter for the next packet", "(0-4294967295)") 00005 { 00006 _queryable = true; 00007 } 00008 00009 uint32_t CmdUplinkCounter::action(std::vector<std::string> args) { 00010 if (args.size() == 1) { 00011 CommandTerminal::Serial()->writef("%u\r\n", CommandTerminal::Dot()->getUpLinkCounter()); 00012 } else if (args.size() == 2) { 00013 00014 int count; 00015 sscanf(args[1].c_str(), "%d", &count); 00016 00017 if (CommandTerminal::Dot()->setUpLinkCounter(count) != mDot::MDOT_OK) { 00018 CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError());; 00019 return 1; 00020 } 00021 } 00022 return 0; 00023 } 00024 00025 bool CmdUplinkCounter::verify(std::vector<std::string> args) { 00026 if (args.size() == 1) 00027 return true; 00028 00029 if (args.size() == 2) { 00030 00031 int count; 00032 if (sscanf(args[1].c_str(), "%d", &count) == 1) { 00033 if (count > 4294967295) { 00034 CommandTerminal::setErrorMessage("Invalid uplink counter, expects (0-4294967295)"); 00035 return false; 00036 } 00037 return true; 00038 } 00039 } 00040 00041 CommandTerminal::setErrorMessage("Invalid arguments"); 00042 return false; 00043 } 00044
Generated on Tue Jul 12 2022 20:40:04 by
