renamed RawMessage to InternalMessage

David Rebbe 2024-12-03 23:59:19 -05:00
parent dc54bc6868
commit 4901168068
21 changed files with 40 additions and 40 deletions

View File

@ -738,7 +738,7 @@ int icsneo_getDeviceStatus(const neodevice_t* device, void* status, size_t* size
if(!msg) // Did not receive a message
return false;
auto rawMessage = std::static_pointer_cast<RawMessage>(msg);
auto rawMessage = std::static_pointer_cast<InternalMessage>(msg);
if(!rawMessage || (rawMessage->network.getNetID() != Network::NetID::DeviceStatus))
return false;

View File

@ -230,7 +230,7 @@ bool Decoder::decode(std::shared_ptr<Message>& result, const std::shared_ptr<Pac
// They come in as CAN but we will handle them in the device rather than
// passing them onto the user.
if(packet->data.size() < 24) {
auto rawmsg = std::make_shared<RawMessage>(Network::NetID::Device);
auto rawmsg = std::make_shared<InternalMessage>(Network::NetID::Device);
result = rawmsg;
rawmsg->data = packet->data;
return true;
@ -244,7 +244,7 @@ bool Decoder::decode(std::shared_ptr<Message>& result, const std::shared_ptr<Pac
// Timestamps are in (resolution) ns increments since 1/1/2007 GMT 00:00:00.0000
// The resolution depends on the device
auto* raw = dynamic_cast<RawMessage*>(result.get());
auto* raw = dynamic_cast<InternalMessage*>(result.get());
if(raw == nullptr) {
report(APIEvent::Type::PacketDecodingError, APIEvent::Severity::Error);
return false; // A nullptr was returned, the packet was malformed
@ -255,7 +255,7 @@ bool Decoder::decode(std::shared_ptr<Message>& result, const std::shared_ptr<Pac
}
case Network::NetID::DeviceStatus: {
// Just pass along the data, the device needs to handle this itself
result = std::make_shared<RawMessage>(packet->network, packet->data);
result = std::make_shared<InternalMessage>(packet->network, packet->data);
return true;
}
case Network::NetID::RED_INT_MEMORYREAD: {
@ -483,6 +483,6 @@ bool Decoder::decode(std::shared_ptr<Message>& result, const std::shared_ptr<Pac
}
// For the moment other types of messages will automatically be decoded as raw messages
result = std::make_shared<RawMessage>(packet->network, packet->data);
result = std::make_shared<InternalMessage>(packet->network, packet->data);
return true;
}

View File

@ -131,7 +131,7 @@ bool Encoder::encode(const Packetizer& packetizer, std::vector<uint8_t>& result,
break;
}
case Message::Type::RawMessage: {
auto raw = std::dynamic_pointer_cast<RawMessage>(message);
auto raw = std::dynamic_pointer_cast<InternalMessage>(message);
// Raw message uses raw->data as the buffer unless directed otherwise
buffer = &raw->data;
@ -243,7 +243,7 @@ bool Encoder::encode(const Packetizer& packetizer, std::vector<uint8_t>& result,
* In this case, command 0x06 is SetLEDState.
* This old command type is not really used anywhere else.
*/
auto canmsg = std::make_shared<RawMessage>(Network::NetID::Device);
auto canmsg = std::make_shared<InternalMessage>(Network::NetID::Device);
msg = canmsg;
if(arguments.empty()) {
report(APIEvent::Type::MessageFormattingError, APIEvent::Severity::Error);

View File

@ -472,7 +472,7 @@ int8_t Device::prepareScriptLoad() {
return false;
}
const auto resp = std::static_pointer_cast<RawMessage>(generic);
const auto resp = std::static_pointer_cast<InternalMessage>(generic);
retVal = (int8_t)resp->data[0];
}
@ -1719,7 +1719,7 @@ void Device::handleInternalMessage(std::shared_ptr<Message> message) {
latestResetStatus = std::static_pointer_cast<ResetStatusMessage>(message);
break;
case Message::Type::RawMessage: {
auto rawMessage = std::static_pointer_cast<RawMessage>(message);
auto rawMessage = std::static_pointer_cast<InternalMessage>(message);
switch(rawMessage->network.getNetID()) {
case Network::NetID::Device: {
// Device is not guaranteed to be a CANMessage, it might be a RawMessage
@ -1895,7 +1895,7 @@ std::optional<std::chrono::time_point<std::chrono::system_clock>> Device::getRTC
if(!generic) // Did not receive a message
return std::nullopt;
auto rawMes = std::dynamic_pointer_cast<RawMessage>(generic);
auto rawMes = std::dynamic_pointer_cast<InternalMessage>(generic);
if(!rawMes)
return std::nullopt;

View File

@ -64,9 +64,9 @@ enum class AppErrorType : uint16_t {
AppNoError = 255
};
class AppErrorMessage : public RawMessage {
class AppErrorMessage : public InternalMessage {
public:
AppErrorMessage() : RawMessage(Message::Type::AppError, Network::NetID::RED_App_Error) {}
AppErrorMessage() : InternalMessage(Message::Type::AppError, Network::NetID::RED_App_Error) {}
uint16_t errorType;
Network::NetID errorNetID;
uint32_t timestamp10us;

View File

@ -7,9 +7,9 @@
namespace icsneo {
class DiskDataMessage : public RawMessage {
class DiskDataMessage : public InternalMessage {
public:
DiskDataMessage(std::vector<uint8_t>&& d) : RawMessage(Network::NetID::DiskData) {
DiskDataMessage(std::vector<uint8_t>&& d) : InternalMessage(Network::NetID::DiskData) {
data = std::move(d);
}
};

View File

@ -29,7 +29,7 @@ public:
if(message->type == Message::Type::Frame || message->type == Message::Type::Main51 ||
message->type == Message::Type::RawMessage || message->type == Message::Type::ReadSettings) {
const auto frame = std::static_pointer_cast<RawMessage>(message);
const auto frame = std::static_pointer_cast<InternalMessage>(message);
if(!matchNetworkType(frame->network.getType()))
return false;
if(!matchNetID(frame->network.getNetID()))

View File

@ -7,9 +7,9 @@
namespace icsneo {
class FlashMemoryMessage : public RawMessage {
class FlashMemoryMessage : public InternalMessage {
public:
FlashMemoryMessage() : RawMessage(Message::Type::RawMessage, Network::NetID::RED_INT_MEMORYREAD) {}
FlashMemoryMessage() : InternalMessage(Message::Type::RawMessage, Network::NetID::RED_INT_MEMORYREAD) {}
uint16_t startAddress = 0;
};

View File

@ -8,9 +8,9 @@
#include "icsneo/communication/livedata.h"
namespace icsneo {
class LiveDataMessage : public RawMessage {
class LiveDataMessage : public InternalMessage {
public:
LiveDataMessage() : RawMessage(Message::Type::LiveData, Network::NetID::ExtendedCommand) {}
LiveDataMessage() : InternalMessage(Message::Type::LiveData, Network::NetID::ExtendedCommand) {}
LiveDataHandle handle;
LiveDataCommand cmd;
};

View File

@ -8,9 +8,9 @@
namespace icsneo {
class Main51Message : public RawMessage {
class Main51Message : public InternalMessage {
public:
Main51Message() : RawMessage(Message::Type::Main51, Network::NetID::Main51) {}
Main51Message() : InternalMessage(Message::Type::Main51, Network::NetID::Main51) {}
Command command = Command(0);
bool forceShortFormat = false; // Necessary for EnableNetworkCom and EnableNetworkComEx
};

View File

@ -57,12 +57,12 @@ public:
uint64_t timestamp = 0;
};
class RawMessage : public Message {
class InternalMessage : public Message {
public:
RawMessage(Message::Type type = Message::Type::RawMessage) : Message(type) {}
RawMessage(Message::Type type, Network net) : Message(type), network(net) {}
RawMessage(Network net) : Message(Message::Type::RawMessage), network(net) {}
RawMessage(Network net, std::vector<uint8_t> d) : Message(Message::Type::RawMessage), network(net), data(d) {}
InternalMessage(Message::Type type = Message::Type::RawMessage) : Message(type) {}
InternalMessage(Message::Type type, Network net) : Message(type), network(net) {}
InternalMessage(Network net) : Message(Message::Type::RawMessage), network(net) {}
InternalMessage(Network net, std::vector<uint8_t> d) : Message(Message::Type::RawMessage), network(net), data(d) {}
virtual const icsneo_msg_type_t getMsgType() const { return icsneo_msg_type_internal; }
@ -70,9 +70,9 @@ public:
std::vector<uint8_t> data;
};
class BusMessage : public RawMessage {
class BusMessage : public InternalMessage {
public:
BusMessage() : RawMessage(Message::Type::Frame) {}
BusMessage() : InternalMessage(Message::Type::Frame) {}
const icsneo_msg_type_t getMsgType() const final { return icsneo_msg_type_bus; }

View File

@ -7,9 +7,9 @@
namespace icsneo {
class NeoReadMemorySDMessage : public RawMessage {
class NeoReadMemorySDMessage : public InternalMessage {
public:
NeoReadMemorySDMessage() : RawMessage(Message::Type::RawMessage, Network::NetID::NeoMemorySDRead) {}
NeoReadMemorySDMessage() : InternalMessage(Message::Type::RawMessage, Network::NetID::NeoMemorySDRead) {}
uint32_t startAddress = 0;
};

View File

@ -8,9 +8,9 @@
namespace icsneo {
class ReadSettingsMessage : public RawMessage {
class ReadSettingsMessage : public InternalMessage {
public:
ReadSettingsMessage() : RawMessage(Message::Type::ReadSettings, Network::NetID::ReadSettings) {}
ReadSettingsMessage() : InternalMessage(Message::Type::ReadSettings, Network::NetID::ReadSettings) {}
enum class Response : uint8_t {
OK = 0,

View File

@ -835,7 +835,7 @@ protected:
void handleInternalMessage(std::shared_ptr<Message> message);
virtual void handleDeviceStatus(const std::shared_ptr<RawMessage>&) {}
virtual void handleDeviceStatus(const std::shared_ptr<InternalMessage>&) {}
neodevice_t& getWritableNeoDevice() { return data; }

View File

@ -121,7 +121,7 @@ protected:
// The supported TX networks are the same as the supported RX networks for this device
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
void handleDeviceStatus(const std::shared_ptr<RawMessage>& message) override {
void handleDeviceStatus(const std::shared_ptr<InternalMessage>& message) override {
if(message->data.size() < sizeof(neovifire2_status_t))
return;
std::lock_guard<std::mutex> lk(ioMutex);

View File

@ -81,7 +81,7 @@ protected:
return ret;
}
void handleDeviceStatus(const std::shared_ptr<RawMessage>& message) override {
void handleDeviceStatus(const std::shared_ptr<InternalMessage>& message) override {
if(message->data.size() < sizeof(fire2vnet_status_t))
return;
std::lock_guard<std::mutex> lk(ioMutex);

View File

@ -91,7 +91,7 @@ protected:
// The supported TX networks are the same as the supported RX networks for this device
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
void handleDeviceStatus(const std::shared_ptr<RawMessage>& message) override {
void handleDeviceStatus(const std::shared_ptr<InternalMessage>& message) override {
if(message->data.size() < sizeof(radgalaxy_status_t))
return;
std::lock_guard<std::mutex> lk(ioMutex);

View File

@ -104,7 +104,7 @@ protected:
txNetworks.insert(txNetworks.end(), supportedTxNetworks.begin(), supportedTxNetworks.end());
}
void handleDeviceStatus(const std::shared_ptr<RawMessage>& message) override {
void handleDeviceStatus(const std::shared_ptr<InternalMessage>& message) override {
if(message->data.size() < sizeof(radgigastar_status_t))
return;
std::lock_guard<std::mutex> lk(ioMutex);

View File

@ -112,7 +112,7 @@ namespace icsneo
// The supported TX networks are the same as the supported RX networks for this device
void setupSupportedTXNetworks(std::vector<Network> &txNetworks) override { setupSupportedRXNetworks(txNetworks); }
void handleDeviceStatus(const std::shared_ptr<RawMessage> &message) override
void handleDeviceStatus(const std::shared_ptr<InternalMessage> &message) override
{
if (message->data.size() < sizeof(radgigastar2_status_t))
return;

View File

@ -96,7 +96,7 @@ protected:
txNetworks.insert(txNetworks.end(), supportedTxNetworks.begin(), supportedTxNetworks.end());
}
void handleDeviceStatus(const std::shared_ptr<RawMessage>& message) override {
void handleDeviceStatus(const std::shared_ptr<InternalMessage>& message) override {
if(message->data.size() < sizeof(radmars_status_t))
return;
std::lock_guard<std::mutex> lk(ioMutex);

View File

@ -75,7 +75,7 @@ protected:
size_t getEthernetActivationLineCount() const override { return 1; }
void handleDeviceStatus(const std::shared_ptr<RawMessage>& message) override {
void handleDeviceStatus(const std::shared_ptr<InternalMessage>& message) override {
if(message->data.size() < sizeof(valuecan4_2el_status_t))
return;
std::lock_guard<std::mutex> lk(ioMutex);