Skip to content

Commit d6cfa41

Browse files
committed
clean up summaries
1 parent 65975b0 commit d6cfa41

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

Source/DSP/Model.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,15 @@ namespace AIS
809809

810810
std::string ModelNMEA::Get()
811811
{
812-
return "nmea_refresh " + Util::Convert::toString(nmea.getRegenerate()) + " uuid " + nmea.getUUID() + " ID " + std::to_string(nmea.getStation()) + " stamp " + Util::Convert::toString(nmea.getStamp()) + " crc_check " + Util::Convert::toString(nmea.getCRCcheck()) + " VDO " + Util::Convert::toString(nmea.getVDO()) + Model::Get();
812+
std::string result = "nmea_refresh " + Util::Convert::toString(nmea.getRegenerate());
813+
std::string uuid = nmea.getUUID();
814+
if (!uuid.empty())
815+
result += " uuid " + uuid;
816+
int station = nmea.getStation();
817+
if (station != 0)
818+
result += " ID " + std::to_string(station);
819+
result += " stamp " + Util::Convert::toString(nmea.getStamp()) + " crc_check " + Util::Convert::toString(nmea.getCRCcheck()) + " VDO " + Util::Convert::toString(nmea.getVDO()) + Model::Get();
820+
return result;
813821
}
814822

815823
void ModelN2K::buildModel(char CH1, char CH2, int sample_rate, bool timerOn, Device::Device *dev)

Source/Device/Device.h

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,21 @@ namespace Device {
119119

120120
virtual std::string Get() {
121121

122-
std::string str = "rate " + std::to_string(getSampleRate() / 1000) + "K";
123-
if (tuner_bandwidth) str += " bw " + std::to_string(tuner_bandwidth / 1000) + "K";
124-
if (freq_offset) str += " freqoffset " + std::to_string(freq_offset);
125-
str += " format " + Util::Convert::toString(format);
122+
std::string str;
123+
uint32_t rate = getSampleRate();
124+
if (rate != 0) {
125+
str = "rate " + std::to_string(rate / 1000) + "K";
126+
}
127+
if (tuner_bandwidth) {
128+
if (!str.empty()) str += " ";
129+
str += "bw " + std::to_string(tuner_bandwidth / 1000) + "K";
130+
}
131+
if (freq_offset) {
132+
if (!str.empty()) str += " ";
133+
str += "freqoffset " + std::to_string(freq_offset);
134+
}
135+
if (!str.empty()) str += " ";
136+
str += "format " + Util::Convert::toString(format);
126137

127138
return str;
128139
}

0 commit comments

Comments
 (0)