mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-10-19 10:11:59 +00:00
Wrap message handler registrations in class to subscribe/unsubscribe automatically.
This commit is contained in:
@@ -24,6 +24,8 @@
|
||||
|
||||
#include "ui_navigation.hpp"
|
||||
|
||||
#include "event_m0.hpp"
|
||||
|
||||
#include "log_file.hpp"
|
||||
|
||||
#include "ert_packet.hpp"
|
||||
@@ -124,6 +126,15 @@ private:
|
||||
|
||||
ERTRecentEntriesView recent_entries_view { recent };
|
||||
|
||||
MessageHandlerRegistration message_handler_packet {
|
||||
Message::ID::ERTPacket,
|
||||
[this](Message* const p) {
|
||||
const auto message = static_cast<const ERTPacketMessage*>(p);
|
||||
const ert::Packet packet { message->type, message->packet };
|
||||
this->on_packet(packet);
|
||||
}
|
||||
};
|
||||
|
||||
void on_packet(const ert::Packet& packet);
|
||||
void on_show_list();
|
||||
};
|
||||
|
Reference in New Issue
Block a user