From 32818ee9ab58ba28f385ad3d9ea9310f4824f203 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Mon, 18 Jan 2016 13:54:07 -0800 Subject: [PATCH] Introduce tpms::Packet type. --- firmware/application/tpms_app.cpp | 4 ++-- firmware/application/tpms_app.hpp | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/firmware/application/tpms_app.cpp b/firmware/application/tpms_app.cpp index 37534b4b4..62dae6852 100644 --- a/firmware/application/tpms_app.cpp +++ b/firmware/application/tpms_app.cpp @@ -28,7 +28,7 @@ using namespace portapack; #include "string_format.hpp" -ManchesterFormatted TPMSModel::on_packet(const TPMSPacketMessage& message) { +tpms::Packet TPMSModel::on_packet(const TPMSPacketMessage& message) { const ManchesterDecoder decoder(message.packet, 1); const auto hex_formatted = format_manchester(decoder); @@ -75,7 +75,7 @@ void TPMSAppView::set_parent_rect(const Rect new_parent_rect) { console.set_parent_rect({ 0, 0, new_parent_rect.width(), new_parent_rect.height() }); } -void TPMSAppView::log(const ManchesterFormatted& formatted) { +void TPMSAppView::log(const tpms::Packet& formatted) { console.writeln(formatted.data.substr(0, 240 / 8)); } diff --git a/firmware/application/tpms_app.hpp b/firmware/application/tpms_app.hpp index d4a36747a..620d88c00 100644 --- a/firmware/application/tpms_app.hpp +++ b/firmware/application/tpms_app.hpp @@ -28,9 +28,15 @@ #include "manchester.hpp" #include "log_file.hpp" +namespace tpms { + +using Packet = ManchesterFormatted; + +} /* namespace tpms */ + class TPMSModel { public: - ManchesterFormatted on_packet(const TPMSPacketMessage& message); + tpms::Packet on_packet(const TPMSPacketMessage& message); private: LogFile log_file { "tpms.txt" }; @@ -50,7 +56,7 @@ private: Console console; - void log(const ManchesterFormatted& formatted); + void log(const tpms::Packet& formatted); }; } /* namespace ui */