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.
Fork of mDot_AT_firmware by
CmdClassBTimeout.cpp
00001 #include "CmdClassBTimeout.h" 00002 00003 CmdClassBTimeout::CmdClassBTimeout() : 00004 #if MTS_CMD_TERM_VERBOSE 00005 Command("Class B Timeout", "AT+BTO", "Set the timeout the network expects an ACK sent for a confirmed downlink received in a Class B window", "(0-120)") 00006 #else 00007 Command("AT+BTO") 00008 #endif 00009 { 00010 _queryable = true; 00011 } 00012 00013 uint32_t CmdClassBTimeout::action(const std::vector<std::string>& args) 00014 { 00015 mDot* dot = CommandTerminal::Dot(); 00016 if (args.size() == 1) { 00017 CommandTerminal::Serial()->writef("%" SCNu32 "\r\n", dot->getClassBTimeout()); 00018 } else if (args.size() == 2) { 00019 uint32_t timeout; 00020 sscanf(args[1].c_str(), "%" SCNu32, &timeout); 00021 00022 if (dot->setClassBTimeout(static_cast<uint8_t>(timeout)) != mDot::MDOT_OK) { 00023 return 1; 00024 } 00025 } 00026 00027 return 0; 00028 } 00029 00030 bool CmdClassBTimeout::verify(const std::vector<std::string>& args) 00031 { 00032 if (args.size() == 1) 00033 return true; 00034 00035 if (args.size() == 2) { 00036 uint32_t timeout; 00037 if (sscanf(args[1].c_str(), "%" SCNu32, &timeout) == 1) { 00038 if (timeout > 120) { 00039 #if MTS_CMD_TERM_VERBOSE 00040 CommandTerminal::setErrorMessage("Invalid timeout, expects (0-120)"); 00041 #endif 00042 return false; 00043 } 00044 00045 return true; 00046 } 00047 } 00048 00049 #if MTS_CMD_TERM_VERBOSE 00050 CommandTerminal::setErrorMessage("Invalid arguments"); 00051 #endif 00052 return false; 00053 }
Generated on Wed Jan 15 2025 16:10:47 by
1.7.2


