MTDOT-BOX-EVB-Factory-Firmware
Dependencies: NCP5623B GpsParser ISL29011 libmDot-mbed5 MTS-Serial MMA845x DOGS102 MPL3115A2
Diff: CommandTerminal/CmdFrequencyBand.cpp
- Revision:
- 7:a31236c2e75c
- Parent:
- 1:71125aa00e33
- Child:
- 12:05435282f899
--- a/CommandTerminal/CmdFrequencyBand.cpp Fri Nov 04 22:21:01 2016 +0000 +++ b/CommandTerminal/CmdFrequencyBand.cpp Fri Nov 04 17:27:05 2016 -0500 @@ -19,10 +19,10 @@ #include "CmdFrequencyBand.h" CmdFrequencyBand::CmdFrequencyBand(mDot* dot, mts::MTSSerial& serial) : - Command(dot, "Frequency Band", "AT+FREQ", "Configured Frequency Band '868' or '915'"), _serial(serial) + Command(dot, "Frequency Band", "AT+FREQ", "Configured Frequency Band 'EU868', 'AU915' or 'US915'"), _serial(serial) { _help = std::string(text()) + ": " + std::string(desc()); - _usage = "(868,915)"; + _usage = "(EU868,AU915,US915)"; _queryable = true; } @@ -40,10 +40,22 @@ else if (args.size() == 2) { int32_t code; - uint8_t band = mDot::FB_915; + + std::string text = mts::Text::toUpper(args[1]); + + uint8_t band = mDot::FB_US915; + - if (mDot::FrequencyBandStr(mDot::FB_868).find(args[1]) != std::string::npos) { - band = mDot::FB_868; + if (mDot::FrequencyBandStr(mDot::FB_EU868).find(text) != std::string::npos) { + band = mDot::FB_EU868; + } + + if (mDot::FrequencyBandStr(mDot::FB_AU915).find(text) != std::string::npos) { + band = mDot::FB_AU915; + } + + if (mDot::FrequencyBandStr(mDot::FB_US915).find(text) != std::string::npos) { + band = mDot::FB_US915; } if ((code = _dot->setFrequencyBand(band)) != mDot::MDOT_OK) { @@ -65,10 +77,13 @@ #ifdef DEBUG_MAC if (args.size() == 2) { - if (mDot::FrequencyBandStr(mDot::FB_868).find(args[1]) == std::string::npos && - mDot::FrequencyBandStr(mDot::FB_915).find(args[1]) == std::string::npos) + std::string band = mts::Text::toUpper(args[1]); + + if (mDot::FrequencyBandStr(mDot::FB_EU868).find(band) == std::string::npos && + mDot::FrequencyBandStr(mDot::FB_US915).find(band) == std::string::npos && + mDot::FrequencyBandStr(mDot::FB_AU915).find(band) == std::string::npos) { - setErrorMessage("Invalid parameter, expects (868,915)"); + setErrorMessage("Invalid parameter, expects (EU868,AU915,US915)"); return false; }