firm newest

Dependencies:   MTS-Serial libmDot-dev-mbed5-deprecated

Committer:
nguyenhoang9x5555
Date:
Thu Oct 18 04:18:48 2018 +0000
Revision:
0:3c869a8cb8f8
DOT AT FIRMWARE 18102018

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nguyenhoang9x5555 0:3c869a8cb8f8 1 #include "CmdDisableDutyCycle.h"
nguyenhoang9x5555 0:3c869a8cb8f8 2
nguyenhoang9x5555 0:3c869a8cb8f8 3 CmdDisableDutyCycle::CmdDisableDutyCycle()
nguyenhoang9x5555 0:3c869a8cb8f8 4 : Command("Disable Duty Cycle", "AT+DD", "Disable duty cycle for TESTING PURPOSES ONLY!!! This setting will not be saved to config.", "(0-1)") {
nguyenhoang9x5555 0:3c869a8cb8f8 5 _queryable = true;
nguyenhoang9x5555 0:3c869a8cb8f8 6 }
nguyenhoang9x5555 0:3c869a8cb8f8 7
nguyenhoang9x5555 0:3c869a8cb8f8 8 uint32_t CmdDisableDutyCycle::action(std::vector<std::string> args) {
nguyenhoang9x5555 0:3c869a8cb8f8 9
nguyenhoang9x5555 0:3c869a8cb8f8 10 if (args.size() == 1) {
nguyenhoang9x5555 0:3c869a8cb8f8 11 CommandTerminal::Serial()->writef("%lu\r\n", CommandTerminal::Dot()->getDisableDutyCycle());
nguyenhoang9x5555 0:3c869a8cb8f8 12 } else if (args.size() == 2) {
nguyenhoang9x5555 0:3c869a8cb8f8 13 CommandTerminal::Dot()->setDisableDutyCycle(args[1] == "1");
nguyenhoang9x5555 0:3c869a8cb8f8 14 }
nguyenhoang9x5555 0:3c869a8cb8f8 15
nguyenhoang9x5555 0:3c869a8cb8f8 16 return 0;
nguyenhoang9x5555 0:3c869a8cb8f8 17 }
nguyenhoang9x5555 0:3c869a8cb8f8 18
nguyenhoang9x5555 0:3c869a8cb8f8 19 bool CmdDisableDutyCycle::verify(std::vector<std::string> args) {
nguyenhoang9x5555 0:3c869a8cb8f8 20
nguyenhoang9x5555 0:3c869a8cb8f8 21 if (args.size() > 2) {
nguyenhoang9x5555 0:3c869a8cb8f8 22 CommandTerminal::setErrorMessage("Invalid parameter, expects (0-1)");
nguyenhoang9x5555 0:3c869a8cb8f8 23 return false;
nguyenhoang9x5555 0:3c869a8cb8f8 24 }
nguyenhoang9x5555 0:3c869a8cb8f8 25
nguyenhoang9x5555 0:3c869a8cb8f8 26 if (args.size() == 2) {
nguyenhoang9x5555 0:3c869a8cb8f8 27 int bytes;
nguyenhoang9x5555 0:3c869a8cb8f8 28
nguyenhoang9x5555 0:3c869a8cb8f8 29 sscanf(args[1].c_str(), "%d", &bytes);
nguyenhoang9x5555 0:3c869a8cb8f8 30
nguyenhoang9x5555 0:3c869a8cb8f8 31 if (!(bytes == 0 || bytes == 1)) {
nguyenhoang9x5555 0:3c869a8cb8f8 32 CommandTerminal::setErrorMessage("Invalid parameter, expects (0-1)");
nguyenhoang9x5555 0:3c869a8cb8f8 33 return false;
nguyenhoang9x5555 0:3c869a8cb8f8 34 }
nguyenhoang9x5555 0:3c869a8cb8f8 35 }
nguyenhoang9x5555 0:3c869a8cb8f8 36
nguyenhoang9x5555 0:3c869a8cb8f8 37 return true;
nguyenhoang9x5555 0:3c869a8cb8f8 38 }