Skip to content
Snippets Groups Projects
Commit 01741f3c authored by Jared Boone's avatar Jared Boone
Browse files

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...
parent 8c34e116
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment