Custom Channel Plan version of MTDOT Box firmware

Dependencies:   DOGS102 GpsParser ISL29011 MMA845x MPL3115A2 MTS-Serial NCP5623B libmDot-Custom mDot_Channel_Plans

Fork of MTDOT-BOX-EVB-Factory-Firmware by MultiTech

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers CmdDisplayConfig.cpp Source File

CmdDisplayConfig.cpp

00001 /* Copyright (c) <2016> <MultiTech Systems>, MIT License
00002  *
00003  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 
00004  * and associated documentation files (the "Software"), to deal in the Software without restriction, 
00005  * including without limitation the rights to use, copy, modify, merge, publish, distribute, 
00006  * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 
00007  * furnished to do so, subject to the following conditions:
00008  *
00009  * The above copyright notice and this permission notice shall be included in all copies or 
00010  * substantial portions of the Software.
00011  *
00012  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 
00013  * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
00014  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
00015  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
00016  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00017  */
00018 
00019 #include "CmdDisplayConfig.h"
00020 #include "dotbox_version.h"
00021 #include "MTSLog.h"
00022 
00023 std::string version = MTDOT_BOX_VERSION;
00024 
00025 CmdDisplayConfig::CmdDisplayConfig(mDot* dot, mts::MTSSerial& serial)
00026 :
00027   Command(dot, "Display Settings", "AT&V", "Displays current settings and status"),
00028   _serial(serial) {
00029     _help = std::string(text()) + ": " + std::string(desc());
00030     _usage = "TABLE";
00031 }
00032 
00033 uint32_t CmdDisplayConfig::action(std::vector<std::string> args) {
00034     _serial.writef("Firmware: \t\t%s\r\n", version.c_str());
00035     _serial.writef("Library : \t\t%s\r\n", _dot->getId().c_str());
00036     
00037     _serial.writef("Device ID:\t\t");
00038     _serial.writef("%s\r\n", mts::Text::bin2hexString(_dot->getDeviceId(), ":").c_str());
00039 
00040     _serial.writef("Frequency Band:\t\t%s\r\n", _dot->FrequencyBandStr(_dot->getFrequencyBand()).c_str());
00041     
00042     _serial.writef("Frequency Sub Band:\t%u\r\n", _dot->getFrequencySubBand());
00043 
00044     _serial.writef("Public Network:\t\t%s\r\n", _dot->getPublicNetwork() ? "on" : "off");
00045 
00046     _serial.writef("Network Address:\t%s\r\n", mts::Text::bin2hexString(_dot->getNetworkAddress()).c_str());
00047 
00048     _serial.writef("Network ID:\t\t");
00049     _serial.writef("%s\r\n", mts::Text::bin2hexString(_dot->getNetworkId(), ":").c_str());
00050 
00051     _serial.writef("Network ID Passphrase:\t%s\r\n", _dot->getNetworkName().c_str());
00052 
00053     _serial.writef("Network Key:\t\t");
00054     _serial.writef("%s\r\n", mts::Text::bin2hexString(_dot->getNetworkKey(), ".").c_str());
00055 
00056     _serial.writef("Network Key Passphrase:\t%s\r\n", _dot->getNetworkPassphrase().c_str());
00057 
00058     _serial.writef("Network Session Key:\t");
00059     _serial.writef("%s\r\n", mts::Text::bin2hexString(_dot->getNetworkSessionKey(), ".").c_str());
00060 
00061     _serial.writef("Data Session Key:\t");
00062     _serial.writef("%s\r\n", mts::Text::bin2hexString(_dot->getDataSessionKey(), ".").c_str());
00063 
00064     _serial.writef("Network Join Mode:\t%s\r\n", mDot::JoinModeStr(_dot->getJoinMode()).c_str());
00065 
00066     _serial.writef("Tx Data Rate:\t\t%s\r\n", mDot::DataRateStr(_dot->getTxDataRate()).c_str());
00067     _serial.writef("Tx Power:\t\t%u\r\n", _dot->getTxPower());
00068     //_serial.writef("Log Level:\t\t%ld\r\n", _dot->getLogLevel());
00069     _serial.writef("Log Level:\t\t%ld\r\n", mts::MTSLog::TRACE_LEVEL);
00070 
00071     _serial.writef("Maximum Size:\t\t%u\r\n",   _dot->getWakeDelay());      //DotBox +MaxSize is stored here.
00072     _serial.writef("Minimum Size:\t\t%u\r\n",   _dot->getWakeInterval());   //DotBox +MinSize is stored here.
00073     _serial.writef("Maximum Power:\t\t%u\r\n",  _dot->getWakeMode());       //DotBox +MaxPwr is stored here.
00074     _serial.writef("Minimum Power:\t\t%u\r\n",  _dot->getWakeTimeout());    //DotBox +MinPwr is stored here.
00075     _serial.writef("Data:\t\t\t%d\r\n", _dot->getStartUpMode());            //DotBox +Data is stored here.
00076 
00077 
00078     return 0;
00079 }
00080