mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-25 23:39:37 -05:00
Introduce tpms::Packet type.
This commit is contained in:
parent
be328c5f38
commit
32818ee9ab
@ -28,7 +28,7 @@ using namespace portapack;
|
|||||||
|
|
||||||
#include "string_format.hpp"
|
#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 ManchesterDecoder decoder(message.packet, 1);
|
||||||
const auto hex_formatted = format_manchester(decoder);
|
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() });
|
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));
|
console.writeln(formatted.data.substr(0, 240 / 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,9 +28,15 @@
|
|||||||
#include "manchester.hpp"
|
#include "manchester.hpp"
|
||||||
#include "log_file.hpp"
|
#include "log_file.hpp"
|
||||||
|
|
||||||
|
namespace tpms {
|
||||||
|
|
||||||
|
using Packet = ManchesterFormatted;
|
||||||
|
|
||||||
|
} /* namespace tpms */
|
||||||
|
|
||||||
class TPMSModel {
|
class TPMSModel {
|
||||||
public:
|
public:
|
||||||
ManchesterFormatted on_packet(const TPMSPacketMessage& message);
|
tpms::Packet on_packet(const TPMSPacketMessage& message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LogFile log_file { "tpms.txt" };
|
LogFile log_file { "tpms.txt" };
|
||||||
@ -50,7 +56,7 @@ private:
|
|||||||
|
|
||||||
Console console;
|
Console console;
|
||||||
|
|
||||||
void log(const ManchesterFormatted& formatted);
|
void log(const tpms::Packet& formatted);
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace ui */
|
} /* namespace ui */
|
||||||
|
Loading…
Reference in New Issue
Block a user