mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-08-22 15:39:04 +00:00
Rename ::Packet to baseband::Packet. Remove IPC packet types.
This commit is contained in:
@@ -33,7 +33,7 @@ using namespace portapack;
|
||||
namespace baseband {
|
||||
namespace ais {
|
||||
|
||||
using CRCFieldReader = ::FieldReader<::Packet, BitRemapNone>;
|
||||
using CRCFieldReader = ::FieldReader<baseband::Packet, BitRemapNone>;
|
||||
|
||||
struct PacketLengthRange {
|
||||
constexpr PacketLengthRange(
|
||||
@@ -320,7 +320,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.packet };
|
||||
const baseband::ais::Packet packet { datetime, message->packet };
|
||||
if( this->model.on_packet(packet) ) {
|
||||
this->on_packet(packet);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "message.hpp"
|
||||
#include "log_file.hpp"
|
||||
#include "field_reader.hpp"
|
||||
#include "packet.hpp"
|
||||
#include "baseband_packet.hpp"
|
||||
|
||||
#include "lpc43xx_cpp.hpp"
|
||||
using namespace lpc43xx;
|
||||
@@ -61,7 +61,7 @@ class Packet {
|
||||
public:
|
||||
constexpr Packet(
|
||||
const rtc::RTC& received_at,
|
||||
const ::Packet& packet
|
||||
const baseband::Packet& packet
|
||||
) : packet_ { packet },
|
||||
received_at_ { received_at },
|
||||
field_ { packet_ }
|
||||
@@ -90,9 +90,9 @@ public:
|
||||
bool crc_ok() const;
|
||||
|
||||
private:
|
||||
using Reader = FieldReader<::Packet, BitRemapByteReverse>;
|
||||
using Reader = FieldReader<baseband::Packet, BitRemapByteReverse>;
|
||||
|
||||
const ::Packet packet_;
|
||||
const baseband::Packet packet_;
|
||||
const rtc::RTC received_at_;
|
||||
const Reader field_;
|
||||
|
||||
|
||||
@@ -46,27 +46,27 @@ rtc::RTC Packet::received_at() const {
|
||||
return received_at_;
|
||||
}
|
||||
|
||||
ERTPacket::Type Packet::type() const {
|
||||
ERTPacketMessage::Type Packet::type() const {
|
||||
return type_;
|
||||
}
|
||||
|
||||
ID Packet::id() const {
|
||||
if( type() == ERTPacket::Type::SCM ) {
|
||||
if( type() == ERTPacketMessage::Type::SCM ) {
|
||||
const auto msb = reader_.read(0, 2);
|
||||
const auto lsb = reader_.read(35, 24);
|
||||
return (msb << 24) | lsb;
|
||||
}
|
||||
if( type() == ERTPacket::Type::IDM ) {
|
||||
if( type() == ERTPacketMessage::Type::IDM ) {
|
||||
return reader_.read(5 * 8, 32);
|
||||
}
|
||||
return invalid_id;
|
||||
}
|
||||
|
||||
Consumption Packet::consumption() const {
|
||||
if( type() == ERTPacket::Type::SCM ) {
|
||||
if( type() == ERTPacketMessage::Type::SCM ) {
|
||||
return reader_.read(11, 24);
|
||||
}
|
||||
if( type() == ERTPacket::Type::IDM ) {
|
||||
if( type() == ERTPacketMessage::Type::IDM ) {
|
||||
return reader_.read(25 * 8, 32);
|
||||
}
|
||||
return invalid_consumption;
|
||||
@@ -78,8 +78,8 @@ ManchesterFormatted Packet::symbols_formatted() const {
|
||||
|
||||
bool Packet::crc_ok() const {
|
||||
switch(type()) {
|
||||
case ERTPacket::Type::SCM: return crc_ok_scm();
|
||||
case ERTPacket::Type::IDM: return crc_ok_idm();
|
||||
case ERTPacketMessage::Type::SCM: return crc_ok_scm();
|
||||
case ERTPacketMessage::Type::IDM: return crc_ok_idm();
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
@@ -135,7 +135,7 @@ void ERTView::on_show() {
|
||||
const auto message = static_cast<const ERTPacketMessage*>(p);
|
||||
rtc::RTC datetime;
|
||||
rtcGetTime(&RTCD1, &datetime);
|
||||
const ert::Packet packet { datetime, message->packet.type, message->packet.packet };
|
||||
const ert::Packet packet { datetime, message->type, message->packet };
|
||||
if( this->model.on_packet(packet) ) {
|
||||
this->on_packet(packet);
|
||||
}
|
||||
@@ -153,14 +153,14 @@ void ERTView::on_hide() {
|
||||
void ERTView::on_packet(const ert::Packet& packet) {
|
||||
std::string msg;
|
||||
switch(packet.type()) {
|
||||
case ERTPacket::Type::SCM:
|
||||
case ERTPacketMessage::Type::SCM:
|
||||
msg += "SCM ";
|
||||
msg += to_string_dec_uint(packet.id(), 10);
|
||||
msg += " ";
|
||||
msg += to_string_dec_uint(packet.consumption(), 10);
|
||||
break;
|
||||
|
||||
case ERTPacket::Type::IDM:
|
||||
case ERTPacketMessage::Type::IDM:
|
||||
msg += "IDM ";
|
||||
msg += to_string_dec_uint(packet.id(), 10);
|
||||
msg += " ";
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "log_file.hpp"
|
||||
#include "manchester.hpp"
|
||||
#include "field_reader.hpp"
|
||||
#include "packet.hpp"
|
||||
#include "baseband_packet.hpp"
|
||||
|
||||
#include "lpc43xx_cpp.hpp"
|
||||
using namespace lpc43xx;
|
||||
@@ -45,8 +45,8 @@ class Packet {
|
||||
public:
|
||||
Packet(
|
||||
const rtc::RTC& received_at,
|
||||
const ERTPacket::Type type,
|
||||
const ::Packet& packet
|
||||
const ERTPacketMessage::Type type,
|
||||
const baseband::Packet& packet
|
||||
) : packet_ { packet },
|
||||
received_at_ { received_at },
|
||||
decoder_ { packet_ },
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
|
||||
rtc::RTC received_at() const;
|
||||
|
||||
ERTPacket::Type type() const;
|
||||
ERTPacketMessage::Type type() const;
|
||||
ID id() const;
|
||||
Consumption consumption() const;
|
||||
|
||||
@@ -72,11 +72,11 @@ public:
|
||||
private:
|
||||
using Reader = FieldReader<ManchesterDecoder, BitRemapNone>;
|
||||
|
||||
const ::Packet packet_;
|
||||
const baseband::Packet packet_;
|
||||
const rtc::RTC received_at_;
|
||||
const ManchesterDecoder decoder_;
|
||||
const Reader reader_;
|
||||
const ERTPacket::Type type_;
|
||||
const ERTPacketMessage::Type type_;
|
||||
|
||||
const ID invalid_id = 0;
|
||||
const Consumption invalid_consumption = 0;
|
||||
|
||||
@@ -44,7 +44,7 @@ ManchesterFormatted TPMSModel::on_packet(const TPMSPacketMessage& message) {
|
||||
rtc::RTC received_at;
|
||||
rtcGetTime(&RTCD1, &received_at);
|
||||
|
||||
const ManchesterDecoder decoder(message.packet.packet, 1);
|
||||
const ManchesterDecoder decoder(message.packet, 1);
|
||||
const auto hex_formatted = format_manchester(decoder);
|
||||
|
||||
if( log_file.is_ready() ) {
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <bitset>
|
||||
#include <string>
|
||||
|
||||
#include "packet.hpp"
|
||||
#include "baseband_packet.hpp"
|
||||
|
||||
class ManchesterDecoder {
|
||||
public:
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
};
|
||||
|
||||
constexpr ManchesterDecoder(
|
||||
const ::Packet& packet,
|
||||
const baseband::Packet& packet,
|
||||
const size_t sense = 0
|
||||
) : packet { packet },
|
||||
sense { sense }
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
size_t symbols_count() const;
|
||||
|
||||
private:
|
||||
const ::Packet& packet;
|
||||
const baseband::Packet& packet;
|
||||
const size_t sense;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user