MultiTech / Mbed OS Dot-AT-Firmware

Fork of mDot_AT_firmware by MultiTech

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers CmdRssi.cpp Source File

CmdRssi.cpp

00001 #include "CmdRssi.h"
00002 
00003 CmdRssi::CmdRssi() :
00004 #if MTS_CMD_TERM_VERBOSE
00005     Command("Signal Strength", "AT+RSSI", "Displays signal strength information for received packets: last, min, max, avg in dB", "(-140-0),(-140-0),(-140-0),(-140-0)")
00006 #else
00007     Command("AT+RSSI")
00008 #endif
00009 {
00010     _queryable = true;
00011 }
00012 
00013 uint32_t CmdRssi::action(const std::vector<std::string>& args)
00014 {
00015     mDot::rssi_stats stats = CommandTerminal::Dot()->getRssiStats();
00016     if (stats.last == lora::INVALID_RSSI) {
00017 #if MTS_CMD_TERM_VERBOSE
00018         CommandTerminal::Serial()->writef("No data\r\n");
00019 #endif
00020         return 1;
00021     }
00022     CommandTerminal::Serial()->writef("%d, %d, %d, %d\r\n", stats.last, stats.min, stats.max, stats.avg);
00023     return 0;
00024 }
00025