Reinstate logging of ERT packets.

This commit is contained in:
Jared Boone 2015-12-07 15:31:01 -08:00
parent a2df8ea599
commit f1b45d4e7f
2 changed files with 12 additions and 1 deletions

View File

@ -72,6 +72,10 @@ Consumption Packet::consumption() const {
return invalid_consumption; return invalid_consumption;
} }
ManchesterFormatted Packet::symbols_formatted() const {
return format_manchester(decoder_);
}
bool Packet::crc_ok() const { bool Packet::crc_ok() const {
if( type() == ERTPacket::Type::SCM ) { if( type() == ERTPacket::Type::SCM ) {
CRC<uint16_t> ert_bch { 0x6f63 }; CRC<uint16_t> ert_bch { 0x6f63 };
@ -100,7 +104,12 @@ ERTModel::ERTModel() {
log_file.open_for_append("ert.txt"); log_file.open_for_append("ert.txt");
} }
bool ERTModel::on_packet(const ert::Packet&) { bool ERTModel::on_packet(const ert::Packet& packet) {
if( log_file.is_ready() ) {
const auto formatted = packet.symbols_formatted();
log_file.write_entry(packet.received_at(), formatted.data + "/" + formatted.errors);
}
return true; return true;
} }

View File

@ -71,6 +71,8 @@ public:
ID id() const; ID id() const;
Consumption consumption() const; Consumption consumption() const;
ManchesterFormatted symbols_formatted() const;
bool crc_ok() const; bool crc_ok() const;
private: private: