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
CmdJoinDelay.cpp
00001 /* 00002 * CmdJoinDelay.cpp 00003 * 00004 * Created on: Nov 4, 2015 00005 * Author: jreiss 00006 */ 00007 00008 #include "CmdJoinDelay.h" 00009 00010 CmdJoinDelay::CmdJoinDelay() 00011 : 00012 Command("Join Delay", "AT+JD", "Number of seconds before receive windows are opened for join (1 - 15)", "(1-15)") { 00013 00014 _queryable = true; 00015 } 00016 00017 CmdJoinDelay::~CmdJoinDelay() 00018 { 00019 // TODO Auto-generated destructor stub 00020 } 00021 00022 uint32_t CmdJoinDelay::action(std::vector<std::string> args) { 00023 00024 if (args.size() == 1) { 00025 CommandTerminal::Serial()->writef("%u\r\n", CommandTerminal::Dot()->getJoinDelay()); 00026 } else if (args.size() == 2) { 00027 uint32_t joinDelay; 00028 sscanf(args[1].c_str(), "%lu", &joinDelay); 00029 00030 if (CommandTerminal::Dot()->setJoinDelay(joinDelay) != mDot::MDOT_OK) { 00031 00032 CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError());; 00033 return 1; 00034 } 00035 } 00036 return 0; 00037 } 00038 00039 bool CmdJoinDelay::verify(std::vector<std::string> args) { 00040 if (args.size() == 1) 00041 return true; 00042 00043 if (args.size() == 2) { 00044 00045 int joinDelay; 00046 if (sscanf(args[1].c_str(), "%d", &joinDelay) == 1) { 00047 if (joinDelay > 15 || joinDelay < 1) { 00048 CommandTerminal::setErrorMessage("Invalid join delay, expects (1-15)"); 00049 return false; 00050 } 00051 return true; 00052 } 00053 } 00054 00055 CommandTerminal::setErrorMessage("Invalid arguments"); 00056 return false; 00057 }
Generated on Tue Jul 12 2022 20:40:03 by
