firm newest
Dependencies: MTS-Serial libmDot-dev-mbed5-deprecated
CommandTerminal/CmdTimeOnAir.cpp
- Committer:
- nguyenhoang9x5555
- Date:
- 2018-10-18
- Revision:
- 0:3c869a8cb8f8
File content as of revision 0:3c869a8cb8f8:
#include "CmdTimeOnAir.h" CmdTimeOnAir::CmdTimeOnAir() : Command("Time on air", "AT+TOA", "Get time in ms of packet tx with current datarate", "(0-242)") { _queryable = true; } uint32_t CmdTimeOnAir::action(std::vector<std::string> args) { int bytes; sscanf(args[1].c_str(), "%d", &bytes); CommandTerminal::Serial()->writef("%lu\r\n", CommandTerminal::Dot()->getTimeOnAir(bytes + 13)); return 0; } bool CmdTimeOnAir::verify(std::vector<std::string> args) { if (args.size() < 2) { CommandTerminal::setErrorMessage("Invalid parameter, expects (0-242)"); return false; } int bytes; sscanf(args[1].c_str(), "%d", &bytes); if (bytes < 0 || bytes > 242) { CommandTerminal::setErrorMessage("Invalid parameter, expects (0-242)"); return false; } return true; }