mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
AIS-related namespace cleanup.
This commit is contained in:
parent
37d7d5b273
commit
3e0acc9988
@ -39,13 +39,13 @@ static std::string latlon_normalized(const int32_t normalized) {
|
||||
}
|
||||
|
||||
static std::string mmsi(
|
||||
const baseband::ais::MMSI& mmsi
|
||||
const ais::MMSI& mmsi
|
||||
) {
|
||||
return to_string_dec_uint(mmsi, 9, '0');
|
||||
}
|
||||
|
||||
static std::string datetime(
|
||||
const baseband::ais::DateTime& datetime
|
||||
const ais::DateTime& datetime
|
||||
) {
|
||||
return to_string_dec_uint(datetime.year, 4, '0') + "/" +
|
||||
to_string_dec_uint(datetime.month, 2, '0') + "/" +
|
||||
@ -89,7 +89,7 @@ AISModel::AISModel() {
|
||||
log_file.open_for_append("ais.txt");
|
||||
}
|
||||
|
||||
bool AISModel::on_packet(const baseband::ais::Packet& packet) {
|
||||
bool AISModel::on_packet(const ais::Packet& packet) {
|
||||
// TODO: Unstuff here, not in baseband!
|
||||
|
||||
if( !packet.is_valid() ) {
|
||||
@ -122,7 +122,7 @@ void AISView::on_show() {
|
||||
const auto message = static_cast<const AISPacketMessage*>(p);
|
||||
rtc::RTC datetime;
|
||||
rtcGetTime(&RTCD1, &datetime);
|
||||
const baseband::ais::Packet packet { datetime, message->packet };
|
||||
const ais::Packet packet { datetime, message->packet };
|
||||
if( this->model.on_packet(packet) ) {
|
||||
this->on_packet(packet);
|
||||
}
|
||||
@ -143,7 +143,7 @@ void AISView::truncate_entries() {
|
||||
}
|
||||
}
|
||||
|
||||
void AISView::on_packet(const baseband::ais::Packet& packet) {
|
||||
void AISView::on_packet(const ais::Packet& packet) {
|
||||
const auto source_id = packet.source_id();
|
||||
auto matching_recent = std::find_if(recent.begin(), recent.end(),
|
||||
[source_id](const AISView::RecentEntry& entry) { return entry.mmsi == source_id; }
|
||||
|
@ -42,7 +42,7 @@ class AISModel {
|
||||
public:
|
||||
AISModel();
|
||||
|
||||
bool on_packet(const baseband::ais::Packet& packet);
|
||||
bool on_packet(const ais::Packet& packet);
|
||||
|
||||
private:
|
||||
LogFile log_file;
|
||||
@ -69,7 +69,7 @@ public:
|
||||
private:
|
||||
AISModel model;
|
||||
|
||||
using EntryKey = baseband::ais::MMSI;
|
||||
using EntryKey = ais::MMSI;
|
||||
EntryKey selected_key;
|
||||
const EntryKey invalid_key = 0xffffffff;
|
||||
|
||||
@ -77,12 +77,12 @@ private:
|
||||
|
||||
struct Position {
|
||||
rtc::RTC timestamp { };
|
||||
baseband::ais::Latitude latitude { 0 };
|
||||
baseband::ais::Longitude longitude { 0 };
|
||||
ais::Latitude latitude { 0 };
|
||||
ais::Longitude longitude { 0 };
|
||||
};
|
||||
|
||||
struct RecentEntry {
|
||||
baseband::ais::MMSI mmsi;
|
||||
ais::MMSI mmsi;
|
||||
std::string name;
|
||||
std::string call_sign;
|
||||
std::string destination;
|
||||
@ -91,7 +91,7 @@ private:
|
||||
int8_t navigational_status;
|
||||
|
||||
RecentEntry(
|
||||
const baseband::ais::MMSI& mmsi
|
||||
const ais::MMSI& mmsi
|
||||
) : mmsi { mmsi },
|
||||
last_position { },
|
||||
received_count { 0 },
|
||||
@ -103,7 +103,7 @@ private:
|
||||
using RecentEntries = std::list<RecentEntry>;
|
||||
RecentEntries recent;
|
||||
|
||||
void on_packet(const baseband::ais::Packet& packet);
|
||||
void on_packet(const ais::Packet& packet);
|
||||
|
||||
void draw_entry(
|
||||
const RecentEntry& entry,
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
namespace baseband {
|
||||
namespace ais {
|
||||
|
||||
using CRCFieldReader = ::FieldReader<baseband::Packet, BitRemapNone>;
|
||||
@ -225,4 +224,3 @@ bool Packet::length_valid() const {
|
||||
}
|
||||
|
||||
} /* namespace ais */
|
||||
} /* namespace baseband */
|
||||
|
@ -32,7 +32,6 @@ using namespace lpc43xx;
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
|
||||
namespace baseband {
|
||||
namespace ais {
|
||||
|
||||
struct DateTime {
|
||||
@ -97,6 +96,5 @@ private:
|
||||
};
|
||||
|
||||
} /* namespace ais */
|
||||
} /* namespace baseband */
|
||||
|
||||
#endif/*__AIS_PACKET_H__*/
|
||||
|
Loading…
Reference in New Issue
Block a user