mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-24 23:09:26 -05:00
Rename AISModel to AISLogger.
That's really what it is. Also move receiver initialization to AISView. It'll eventually move further out to an AISApp, once I figure out what an App looks like...
This commit is contained in:
parent
8c34e116af
commit
01741f3c7c
@ -80,20 +80,12 @@ static std::string navigational_status(const unsigned int value) {
|
||||
} /* namespace format */
|
||||
} /* namespace ais */
|
||||
|
||||
AISModel::AISModel() {
|
||||
receiver_model.set_baseband_configuration({
|
||||
.mode = 3,
|
||||
.sampling_rate = 2457600,
|
||||
.decimation_factor = 1,
|
||||
});
|
||||
receiver_model.set_baseband_bandwidth(1750000);
|
||||
|
||||
AISLogger::AISLogger() {
|
||||
log_file.open_for_append("ais.txt");
|
||||
}
|
||||
|
||||
bool AISModel::on_packet(const ais::Packet& packet) {
|
||||
void AISLogger::on_packet(const ais::Packet& packet) {
|
||||
// TODO: Unstuff here, not in baseband!
|
||||
|
||||
if( log_file.is_ready() ) {
|
||||
std::string entry;
|
||||
entry.reserve((packet.length() + 3) / 4);
|
||||
@ -105,8 +97,6 @@ bool AISModel::on_packet(const ais::Packet& packet) {
|
||||
|
||||
log_file.write_entry(packet.received_at(), entry);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
namespace ui {
|
||||
@ -119,11 +109,18 @@ AISView::AISView() {
|
||||
const auto message = static_cast<const AISPacketMessage*>(p);
|
||||
const ais::Packet packet { message->packet };
|
||||
if( packet.is_valid() ) {
|
||||
this->model.on_packet(packet);
|
||||
this->logger.on_packet(packet);
|
||||
this->on_packet(packet);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
receiver_model.set_baseband_configuration({
|
||||
.mode = 3,
|
||||
.sampling_rate = 2457600,
|
||||
.decimation_factor = 1,
|
||||
});
|
||||
receiver_model.set_baseband_bandwidth(1750000);
|
||||
}
|
||||
|
||||
AISView::~AISView() {
|
||||
|
@ -63,11 +63,11 @@ struct AISRecentEntry {
|
||||
}
|
||||
};
|
||||
|
||||
class AISModel {
|
||||
class AISLogger {
|
||||
public:
|
||||
AISModel();
|
||||
AISLogger();
|
||||
|
||||
bool on_packet(const ais::Packet& packet);
|
||||
void on_packet(const ais::Packet& packet);
|
||||
|
||||
private:
|
||||
LogFile log_file;
|
||||
@ -88,7 +88,7 @@ public:
|
||||
bool on_encoder(const EncoderEvent event) override;
|
||||
|
||||
private:
|
||||
AISModel model;
|
||||
AISLogger logger;
|
||||
|
||||
using EntryKey = ais::MMSI;
|
||||
EntryKey selected_key;
|
||||
|
Loading…
Reference in New Issue
Block a user