![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
AT terminal for the mDot using the USB debug port instead of the serial port.
Dependencies: MTS-Serial libmDot-mbed5
Fork of Dot-AT-Firmware by
CommandTerminal/CmdDisplayConfig.cpp@18:f5d28d621bb0, 2018-03-02 (annotated)
- Committer:
- pferland
- Date:
- Fri Mar 02 20:01:38 2018 +0000
- Revision:
- 18:f5d28d621bb0
- Parent:
- 16:d5cf2af81a6d
Added ability to force the AT terminal to use the USB debug port
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Mike Fiore |
1:e52ae6584f1c | 1 | #include "CmdDisplayConfig.h" |
Mike Fiore |
1:e52ae6584f1c | 2 | |
Mike Fiore |
14:f9a77400b622 | 3 | CmdDisplayConfig::CmdDisplayConfig() |
Mike Fiore |
1:e52ae6584f1c | 4 | : |
Mike Fiore |
14:f9a77400b622 | 5 | Command("Display Settings", "AT&V", "Displays current settings and status", "TABLE") { |
Mike Fiore |
14:f9a77400b622 | 6 | |
Mike Fiore |
1:e52ae6584f1c | 7 | } |
Mike Fiore |
1:e52ae6584f1c | 8 | |
Mike Fiore |
1:e52ae6584f1c | 9 | uint32_t CmdDisplayConfig::action(std::vector<std::string> args) { |
Mike Fiore |
9:ff62b20f7000 | 10 | |
Mike Fiore |
14:f9a77400b622 | 11 | CommandTerminal::Serial()->writef("Device ID:\t\t"); |
Mike Fiore |
14:f9a77400b622 | 12 | CommandTerminal::Serial()->writef("%s\r\n", mts::Text::bin2hexString(CommandTerminal::Dot()->getDeviceId(), ":").c_str()); |
Mike Fiore |
1:e52ae6584f1c | 13 | |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 14 | CommandTerminal::Serial()->writef("Default Frequency Band:\t%s\r\n", CommandTerminal::Dot()->FrequencyBandStr(CommandTerminal::Dot()->getDefaultFrequencyBand()).c_str()); |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 15 | // using getChannelPlanName here instead of mDot::FrequencyBandStr allows AT firmware to properly display custom channel plan names |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 16 | CommandTerminal::Serial()->writef("Current Frequency Band:\t%s\r\n", CommandTerminal::Dot()->getChannelPlanName().c_str()); |
Mike Fiore |
14:f9a77400b622 | 17 | CommandTerminal::Serial()->writef("Frequency Sub Band:\t%u\r\n", CommandTerminal::Dot()->getFrequencySubBand()); |
Mike Fiore |
1:e52ae6584f1c | 18 | |
Mike Fiore |
14:f9a77400b622 | 19 | CommandTerminal::Serial()->writef("Public Network:\t\t%s\r\n", CommandTerminal::Dot()->getPublicNetwork() ? "on" : "off"); |
Mike Fiore |
14:f9a77400b622 | 20 | CommandTerminal::Serial()->writef("Start Up Mode:\t\t%s\r\n", mDot::ModeStr(CommandTerminal::Dot()->getStartUpMode()).c_str()); |
Mike Fiore |
14:f9a77400b622 | 21 | |
Mike Fiore |
14:f9a77400b622 | 22 | CommandTerminal::Serial()->writef("Network Address:\t%s\r\n", mts::Text::bin2hexString(CommandTerminal::Dot()->getNetworkAddress()).c_str()); |
Mike Fiore |
1:e52ae6584f1c | 23 | |
Mike Fiore |
14:f9a77400b622 | 24 | CommandTerminal::Serial()->writef("Network ID:\t\t"); |
Mike Fiore |
14:f9a77400b622 | 25 | CommandTerminal::Serial()->writef("%s\r\n", mts::Text::bin2hexString(CommandTerminal::Dot()->getNetworkId(), ":").c_str()); |
Mike Fiore |
1:e52ae6584f1c | 26 | |
Mike Fiore |
14:f9a77400b622 | 27 | CommandTerminal::Serial()->writef("Network ID Passphrase:\t%s\r\n", CommandTerminal::Dot()->getNetworkName().c_str()); |
Mike Fiore |
1:e52ae6584f1c | 28 | |
Mike Fiore |
14:f9a77400b622 | 29 | CommandTerminal::Serial()->writef("Network Key:\t\t"); |
Mike Fiore |
14:f9a77400b622 | 30 | CommandTerminal::Serial()->writef("%s\r\n", mts::Text::bin2hexString(CommandTerminal::Dot()->getNetworkKey(), ".").c_str()); |
Mike Fiore |
1:e52ae6584f1c | 31 | |
Mike Fiore |
14:f9a77400b622 | 32 | CommandTerminal::Serial()->writef("Network Key Passphrase:\t%s\r\n", CommandTerminal::Dot()->getNetworkPassphrase().c_str()); |
Mike Fiore |
1:e52ae6584f1c | 33 | |
Mike Fiore |
14:f9a77400b622 | 34 | CommandTerminal::Serial()->writef("Network Session Key:\t"); |
Mike Fiore |
14:f9a77400b622 | 35 | CommandTerminal::Serial()->writef("%s\r\n", mts::Text::bin2hexString(CommandTerminal::Dot()->getNetworkSessionKey(), ".").c_str()); |
Mike Fiore |
1:e52ae6584f1c | 36 | |
Mike Fiore |
14:f9a77400b622 | 37 | CommandTerminal::Serial()->writef("Data Session Key:\t"); |
Mike Fiore |
14:f9a77400b622 | 38 | CommandTerminal::Serial()->writef("%s\r\n", mts::Text::bin2hexString(CommandTerminal::Dot()->getDataSessionKey(), ".").c_str()); |
Mike Fiore |
1:e52ae6584f1c | 39 | |
Mike Fiore |
14:f9a77400b622 | 40 | CommandTerminal::Serial()->writef("Network Join Mode:\t%s\r\n", mDot::JoinModeStr(CommandTerminal::Dot()->getJoinMode()).c_str()); |
Mike Fiore |
1:e52ae6584f1c | 41 | |
Mike Fiore |
14:f9a77400b622 | 42 | CommandTerminal::Serial()->writef("Network Join Retries:\t%u\r\n", CommandTerminal::Dot()->getJoinRetries()); |
Mike Fiore |
14:f9a77400b622 | 43 | |
Mike Fiore |
14:f9a77400b622 | 44 | CommandTerminal::Serial()->writef("Preserve Session:\t%s\r\n", CommandTerminal::Dot()->getPreserveSession() ? "on" : "off"); |
Mike Fiore |
1:e52ae6584f1c | 45 | |
Mike Fiore |
14:f9a77400b622 | 46 | CommandTerminal::Serial()->writef("Join Byte Order:\t%s\r\n", CommandTerminal::Dot()->getJoinByteOrder() ? "MSB" : "LSB"); |
Mike Fiore |
1:e52ae6584f1c | 47 | |
Mike Fiore |
14:f9a77400b622 | 48 | CommandTerminal::Serial()->writef("Join Delay:\t\t%d\r\n", CommandTerminal::Dot()->getJoinDelay()); |
Mike Fiore |
9:ff62b20f7000 | 49 | |
Mike Fiore |
14:f9a77400b622 | 50 | CommandTerminal::Serial()->writef("Join Rx1 DR Offset:\t%d\r\n", CommandTerminal::Dot()->getJoinRx1DataRateOffset()); |
Mike Fiore |
4:666017851052 | 51 | |
Mike Fiore |
14:f9a77400b622 | 52 | CommandTerminal::Serial()->writef("Join Rx2 Datarate:\tDR%d - %s\r\n", CommandTerminal::Dot()->getJoinRx2DataRate(), CommandTerminal::Dot()->getDateRateDetails(CommandTerminal::Dot()->getJoinRx2DataRate()).c_str()); |
Mike Fiore |
9:ff62b20f7000 | 53 | |
Mike Fiore |
14:f9a77400b622 | 54 | CommandTerminal::Serial()->writef("Join Rx2 Frequency:\t%lu\r\n", CommandTerminal::Dot()->getJoinRx2Frequency()); |
Mike Fiore |
9:ff62b20f7000 | 55 | |
Mike Fiore |
14:f9a77400b622 | 56 | CommandTerminal::Serial()->writef("App Port:\t\t%d\r\n", CommandTerminal::Dot()->getAppPort()); |
Mike Fiore |
14:f9a77400b622 | 57 | |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 58 | CommandTerminal::Serial()->writef("Listen Before Talk:\t"); |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 59 | if (CommandTerminal::Dot()->getLbtTimeUs() == 0 && CommandTerminal::Dot()->getLbtThreshold() == 0) { |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 60 | CommandTerminal::Serial()->writef("off\r\n"); |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 61 | } else { |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 62 | CommandTerminal::Serial()->writef("%u us, %d dBm\r\n", CommandTerminal::Dot()->getLbtTimeUs(), CommandTerminal::Dot()->getLbtThreshold()); |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 63 | } |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 64 | |
Mike Fiore |
14:f9a77400b622 | 65 | CommandTerminal::Serial()->writef("Link Check Threshold:\t"); |
Mike Fiore |
14:f9a77400b622 | 66 | if (CommandTerminal::Dot()->getLinkCheckThreshold() == 0) { |
Mike Fiore |
14:f9a77400b622 | 67 | CommandTerminal::Serial()->writef("off\r\n"); |
Mike Fiore |
1:e52ae6584f1c | 68 | } else { |
Mike Fiore |
14:f9a77400b622 | 69 | CommandTerminal::Serial()->writef("%lu\r\n", CommandTerminal::Dot()->getLinkCheckThreshold()); |
Mike Fiore |
1:e52ae6584f1c | 70 | } |
Mike Fiore |
1:e52ae6584f1c | 71 | |
Mike Fiore |
14:f9a77400b622 | 72 | CommandTerminal::Serial()->writef("Link Check Count:\t"); |
Mike Fiore |
14:f9a77400b622 | 73 | if (CommandTerminal::Dot()->getLinkCheckCount() == 0) { |
Mike Fiore |
14:f9a77400b622 | 74 | CommandTerminal::Serial()->writef("off\r\n"); |
Mike Fiore |
1:e52ae6584f1c | 75 | } else { |
Mike Fiore |
14:f9a77400b622 | 76 | CommandTerminal::Serial()->writef("%lu packets\r\n", CommandTerminal::Dot()->getLinkCheckCount()); |
Mike Fiore |
1:e52ae6584f1c | 77 | } |
Mike Fiore |
1:e52ae6584f1c | 78 | |
Mike Fiore |
14:f9a77400b622 | 79 | CommandTerminal::Serial()->writef("Error Correction:\t"); |
Mike Fiore |
14:f9a77400b622 | 80 | if (CommandTerminal::Dot()->getFec() == 0) { |
Mike Fiore |
14:f9a77400b622 | 81 | CommandTerminal::Serial()->writef("off\r\n"); |
Mike Fiore |
1:e52ae6584f1c | 82 | } else { |
Mike Fiore |
14:f9a77400b622 | 83 | CommandTerminal::Serial()->writef("%u bytes\r\n", CommandTerminal::Dot()->getFec()); |
Mike Fiore |
1:e52ae6584f1c | 84 | } |
Mike Fiore |
1:e52ae6584f1c | 85 | |
Mike Fiore |
14:f9a77400b622 | 86 | CommandTerminal::Serial()->writef("ACK Retries:\t\t"); |
Mike Fiore |
14:f9a77400b622 | 87 | if (CommandTerminal::Dot()->getAck() == 0) { |
Mike Fiore |
14:f9a77400b622 | 88 | CommandTerminal::Serial()->writef("off\r\n"); |
Mike Fiore |
1:e52ae6584f1c | 89 | } else { |
Mike Fiore |
14:f9a77400b622 | 90 | CommandTerminal::Serial()->writef("%u\r\n", CommandTerminal::Dot()->getAck()); |
Mike Fiore |
1:e52ae6584f1c | 91 | } |
Mike Fiore |
1:e52ae6584f1c | 92 | |
Mike Fiore |
14:f9a77400b622 | 93 | CommandTerminal::Serial()->writef("Packet Repeat:\t\t%d\r\n", CommandTerminal::Dot()->getRepeat()); |
Mike Fiore |
9:ff62b20f7000 | 94 | |
Mike Fiore |
14:f9a77400b622 | 95 | CommandTerminal::Serial()->writef("Encryption:\t\t%s\r\n", CommandTerminal::Dot()->getAesEncryption() ? "on" : "off"); |
Mike Fiore |
14:f9a77400b622 | 96 | CommandTerminal::Serial()->writef("CRC:\t\t\t%s\r\n", CommandTerminal::Dot()->getCrc() ? "on" : "off"); |
Mike Fiore |
14:f9a77400b622 | 97 | CommandTerminal::Serial()->writef("Adaptive Data Rate:\t%s\r\n", CommandTerminal::Dot()->getAdr() ? "on" : "off"); |
Mike Fiore |
14:f9a77400b622 | 98 | CommandTerminal::Serial()->writef("Command Echo:\t\t%s\r\n", CommandTerminal::Dot()->getEcho() ? "on" : "off"); |
Mike Fiore |
14:f9a77400b622 | 99 | CommandTerminal::Serial()->writef("Verbose Response:\t%s\r\n", CommandTerminal::Dot()->getVerbose() ? "on" : "off"); |
Mike Fiore |
1:e52ae6584f1c | 100 | |
Mike Fiore |
14:f9a77400b622 | 101 | CommandTerminal::Serial()->writef("Tx Frequency:\t\t%lu\r\n", CommandTerminal::Dot()->getTxFrequency()); |
Mike Fiore |
9:ff62b20f7000 | 102 | |
Mike Fiore |
14:f9a77400b622 | 103 | CommandTerminal::Serial()->writef("Tx Data Rate:\t\tDR%d - %s\r\n", CommandTerminal::Dot()->getTxDataRate(), CommandTerminal::Dot()->getDateRateDetails(CommandTerminal::Dot()->getTxDataRate()).c_str()); |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 104 | CommandTerminal::Serial()->writef("Min/Max Tx Data Rate:\tMin: DR%d - %s\r\n\t\t\tMax: DR%d - %s\r\n", CommandTerminal::Dot()->getMinDatarate(), CommandTerminal::Dot()->getDateRateDetails(CommandTerminal::Dot()->getMinDatarate()).c_str(), CommandTerminal::Dot()->getMaxDatarate(), CommandTerminal::Dot()->getDateRateDetails(CommandTerminal::Dot()->getMaxDatarate()).c_str()); |
Mike Fiore |
14:f9a77400b622 | 105 | CommandTerminal::Serial()->writef("Tx Power:\t\t%u\r\n", CommandTerminal::Dot()->getTxPower()); |
jenkins@jenkinsdm1 | 16:d5cf2af81a6d | 106 | CommandTerminal::Serial()->writef("Min/Max Tx Power:\tMin: %u\r\n\t\t\tMax: %u\r\n", CommandTerminal::Dot()->getMinTxPower(), CommandTerminal::Dot()->getMaxTxPower()); |
Mike Fiore |
14:f9a77400b622 | 107 | CommandTerminal::Serial()->writef("Tx Antenna Gain:\t%d\r\n", CommandTerminal::Dot()->getAntennaGain()); |
Mike Fiore |
14:f9a77400b622 | 108 | CommandTerminal::Serial()->writef("Tx Wait:\t\t%s\r\n", CommandTerminal::Dot()->getTxWait() ? "on" : "off"); |
Mike Fiore |
1:e52ae6584f1c | 109 | |
Mike Fiore |
14:f9a77400b622 | 110 | CommandTerminal::Serial()->writef("Tx Inverted Signal:\t%s\r\n", CommandTerminal::Dot()->getTxInverted() ? "on" : "off"); |
Mike Fiore |
1:e52ae6584f1c | 111 | |
Mike Fiore |
9:ff62b20f7000 | 112 | bool hasChannels = false; |
Mike Fiore |
9:ff62b20f7000 | 113 | for (size_t i = 0; i < 16; i++) { |
Mike Fiore |
14:f9a77400b622 | 114 | if (CommandTerminal::Dot()->getConfigChannels()[i] != 0) { |
Mike Fiore |
9:ff62b20f7000 | 115 | hasChannels = true; |
Mike Fiore |
9:ff62b20f7000 | 116 | break; |
Mike Fiore |
9:ff62b20f7000 | 117 | } |
Mike Fiore |
9:ff62b20f7000 | 118 | } |
Mike Fiore |
9:ff62b20f7000 | 119 | |
Mike Fiore |
9:ff62b20f7000 | 120 | if (hasChannels) { |
Mike Fiore |
14:f9a77400b622 | 121 | CommandTerminal::Serial()->writef("Tx Channels --------------------------------------\r\n"); |
Mike Fiore |
14:f9a77400b622 | 122 | CommandTerminal::Serial()->writef("\tIndex\tFrequency\tDR Range\r\n"); |
Mike Fiore |
9:ff62b20f7000 | 123 | for (size_t i = 0; i < 16; i++) { |
Mike Fiore |
14:f9a77400b622 | 124 | if (CommandTerminal::Dot()->getConfigChannels()[i] != 0) |
Mike Fiore |
14:f9a77400b622 | 125 | CommandTerminal::Serial()->writef("\t%d:\t%09lu\t%02x\r\n", i, CommandTerminal::Dot()->getConfigChannels()[i], CommandTerminal::Dot()->getConfigChannelRanges()[i]); |
Mike Fiore |
9:ff62b20f7000 | 126 | } |
Mike Fiore |
14:f9a77400b622 | 127 | CommandTerminal::Serial()->writef("--------------------------------------------------\r\n"); |
Mike Fiore |
9:ff62b20f7000 | 128 | } |
Mike Fiore |
9:ff62b20f7000 | 129 | |
Mike Fiore |
14:f9a77400b622 | 130 | CommandTerminal::Serial()->writef("Rx Delay:\t\t%d s\r\n", CommandTerminal::Dot()->getRxDelay()); |
Mike Fiore |
14:f9a77400b622 | 131 | // CommandTerminal::Serial()->writef("Rx Frequency:\t\t%lu\r\n", CommandTerminal::Dot()->getRxFrequency()); |
Mike Fiore |
14:f9a77400b622 | 132 | // CommandTerminal::Serial()->writef("Rx Data Rate:\t\t%s\r\n", mDot::DataRateStr(CommandTerminal::Dot()->getRxDataRate()).c_str()); |
Mike Fiore |
14:f9a77400b622 | 133 | CommandTerminal::Serial()->writef("Rx Inverted Signal:\t%s\r\n", CommandTerminal::Dot()->getRxInverted() ? "on" : "off"); |
Mike Fiore |
1:e52ae6584f1c | 134 | |
Mike Fiore |
14:f9a77400b622 | 135 | CommandTerminal::Serial()->writef("Rx Output Style:\t%s\r\n", mDot::RxOutputStr(CommandTerminal::Dot()->getRxOutput()).c_str()); |
Mike Fiore |
1:e52ae6584f1c | 136 | |
Mike Fiore |
14:f9a77400b622 | 137 | CommandTerminal::Serial()->writef("Debug Baud Rate:\t%lu\r\n", CommandTerminal::Dot()->getDebugBaud()); |
Mike Fiore |
14:f9a77400b622 | 138 | CommandTerminal::Serial()->writef("Serial Baud Rate:\t%lu\r\n", CommandTerminal::Dot()->getBaud()); |
Mike Fiore |
14:f9a77400b622 | 139 | CommandTerminal::Serial()->writef("Serial Flow Control:\t%s\r\n", CommandTerminal::Dot()->getFlowControl() == 0 ? "off" : "on"); |
Mike Fiore |
14:f9a77400b622 | 140 | CommandTerminal::Serial()->writef("Serial Clear On Error:\t%s\r\n", CommandTerminal::Dot()->getSerialClearOnError() == 0 ? "off" : "on"); |
Mike Fiore |
1:e52ae6584f1c | 141 | |
Mike Fiore |
14:f9a77400b622 | 142 | uint8_t mode = CommandTerminal::Dot()->getWakeMode(); |
Mike Fiore |
14:f9a77400b622 | 143 | CommandTerminal::Serial()->writef("Wake Mode:\t\t%s\r\n", mode == 0 ? "INTERVAL" : ( mode == 1 ? "INTERRUPT" : "BOTH")); |
Mike Fiore |
14:f9a77400b622 | 144 | CommandTerminal::Serial()->writef("Wake Interval:\t\t%lu s\r\n", CommandTerminal::Dot()->getWakeInterval()); |
Mike Fiore |
14:f9a77400b622 | 145 | CommandTerminal::Serial()->writef("Wake Delay:\t\t%lu ms\r\n", CommandTerminal::Dot()->getWakeDelay()); |
Mike Fiore |
14:f9a77400b622 | 146 | CommandTerminal::Serial()->writef("Wake Timeout:\t\t%u ms\r\n", CommandTerminal::Dot()->getWakeTimeout()); |
Mike Fiore |
14:f9a77400b622 | 147 | CommandTerminal::Serial()->writef("Wake Pin:\t\t%s\r\n", mDot::pinName2Str(CommandTerminal::Dot()->getWakePin()).c_str()); |
Mike Fiore |
1:e52ae6584f1c | 148 | |
Mike Fiore |
14:f9a77400b622 | 149 | CommandTerminal::Serial()->writef("Log Level:\t\t%ld\r\n", CommandTerminal::Dot()->getLogLevel()); |
Mike Fiore |
1:e52ae6584f1c | 150 | |
Mike Fiore |
1:e52ae6584f1c | 151 | return 0; |
Mike Fiore |
1:e52ae6584f1c | 152 | } |
Mike Fiore |
1:e52ae6584f1c | 153 |