few changes for RTS/CTS control
Dependencies: MTS-Serial libmDot mbed-rtos mbed
Fork of mDot_AT_firmware by
CmdLinkCheckThreshold.cpp
00001 #include "CmdLinkCheckThreshold.h" 00002 00003 CmdLinkCheckThreshold::CmdLinkCheckThreshold(mDot* dot, mts::MTSSerial& serial) : 00004 Command(dot, "Link Check Threshold", "AT+LCT", "Set threshold for number of link check or ACK failures to tolerate, (0: off, N: number of failures)"), _serial(serial) 00005 { 00006 _help = std::string(text()) + ": " + std::string(desc()); 00007 _usage = "(0-255)"; 00008 _queryable = true; 00009 } 00010 00011 uint32_t CmdLinkCheckThreshold::action(std::vector<std::string> args) 00012 { 00013 if (args.size() == 1) 00014 { 00015 if (_dot->getVerbose()) 00016 _serial.writef("Link Check Threshold: "); 00017 00018 _serial.writef("%u\r\n", _dot->getLinkCheckThreshold()); 00019 } 00020 else if (args.size() == 2) 00021 { 00022 int32_t code; 00023 int count; 00024 sscanf(args[1].c_str(), "%d", &count); 00025 00026 if ((code = _dot->setLinkCheckThreshold(count)) != mDot::MDOT_OK) 00027 { 00028 00029 setErrorMessage(_dot->getLastError());; 00030 return 1; 00031 } 00032 } 00033 00034 return 0; 00035 } 00036 00037 bool CmdLinkCheckThreshold::verify(std::vector<std::string> args) 00038 { 00039 if (args.size() == 1) 00040 return true; 00041 00042 if (args.size() == 2) 00043 { 00044 int count; 00045 sscanf(args[1].c_str(), "%d", &count); 00046 00047 if (count < 0 || count > 255) { 00048 setErrorMessage("Invalid count, expects (0-255))"); 00049 return false; 00050 } 00051 00052 return true; 00053 } 00054 00055 setErrorMessage("Invalid arguments"); 00056 return false; 00057 }
Generated on Tue Jul 12 2022 16:01:22 by 1.7.2