From 3e0acc998850e3ee19c641312cd4a05535ef094b Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Tue, 8 Dec 2015 15:53:17 -0800 Subject: [PATCH] AIS-related namespace cleanup. --- firmware/application/ais_app.cpp | 10 +++++----- firmware/application/ais_app.hpp | 14 +++++++------- firmware/application/ais_packet.cpp | 2 -- firmware/application/ais_packet.hpp | 2 -- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/firmware/application/ais_app.cpp b/firmware/application/ais_app.cpp index 91559976..1aaa0e38 100644 --- a/firmware/application/ais_app.cpp +++ b/firmware/application/ais_app.cpp @@ -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(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; } diff --git a/firmware/application/ais_app.hpp b/firmware/application/ais_app.hpp index 8261db71..9f51ebbd 100644 --- a/firmware/application/ais_app.hpp +++ b/firmware/application/ais_app.hpp @@ -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; RecentEntries recent; - void on_packet(const baseband::ais::Packet& packet); + void on_packet(const ais::Packet& packet); void draw_entry( const RecentEntry& entry, diff --git a/firmware/application/ais_packet.cpp b/firmware/application/ais_packet.cpp index 62bb98e2..c212936d 100644 --- a/firmware/application/ais_packet.cpp +++ b/firmware/application/ais_packet.cpp @@ -25,7 +25,6 @@ #include -namespace baseband { namespace ais { using CRCFieldReader = ::FieldReader; @@ -225,4 +224,3 @@ bool Packet::length_valid() const { } } /* namespace ais */ -} /* namespace baseband */ diff --git a/firmware/application/ais_packet.hpp b/firmware/application/ais_packet.hpp index c6ed84ee..ac23b3b9 100644 --- a/firmware/application/ais_packet.hpp +++ b/firmware/application/ais_packet.hpp @@ -32,7 +32,6 @@ using namespace lpc43xx; #include #include -namespace baseband { namespace ais { struct DateTime { @@ -97,6 +96,5 @@ private: }; } /* namespace ais */ -} /* namespace baseband */ #endif/*__AIS_PACKET_H__*/