diff --git a/api/icsneoc/icsneoc.cpp b/api/icsneoc/icsneoc.cpp index 8b86ba6..4b9da87 100644 --- a/api/icsneoc/icsneoc.cpp +++ b/api/icsneoc/icsneoc.cpp @@ -462,7 +462,7 @@ bool icsneo_transmit(const neodevice_t* device, const neomessage_t* message) { if(!icsneo_isValidNeoDevice(device)) return false; - if(auto frame = std::dynamic_pointer_cast(CreateMessageFromNeoMessage(message))) + if(auto frame = std::dynamic_pointer_cast(CreateMessageFromNeoMessage(message))) return device->device->transmit(frame); return false; diff --git a/communication/encoder.cpp b/communication/encoder.cpp index 4bbd0f5..395b2c5 100644 --- a/communication/encoder.cpp +++ b/communication/encoder.cpp @@ -24,7 +24,7 @@ bool Encoder::encode(const Packetizer& packetizer, std::vector& result, switch(message->type) { case Message::Type::Frame: { - auto frame = std::dynamic_pointer_cast(message); + auto frame = std::dynamic_pointer_cast(message); // Frame uses frame->data as the buffer unless directed otherwise buffer = &frame->data; diff --git a/communication/message/callback/streamoutput/a2bwavoutput.cpp b/communication/message/callback/streamoutput/a2bwavoutput.cpp index b9cf227..23662b6 100644 --- a/communication/message/callback/streamoutput/a2bwavoutput.cpp +++ b/communication/message/callback/streamoutput/a2bwavoutput.cpp @@ -106,7 +106,7 @@ bool A2BWAVOutput::callIfMatch(const std::shared_ptr& message) const { return false; } - const auto& frameMsg = std::dynamic_pointer_cast(message); + const auto& frameMsg = std::dynamic_pointer_cast(message); if(!frameMsg) { return false; diff --git a/communication/message/neomessage.cpp b/communication/message/neomessage.cpp index da99a45..5027d1b 100644 --- a/communication/message/neomessage.cpp +++ b/communication/message/neomessage.cpp @@ -16,7 +16,7 @@ neomessage_t icsneo::CreateNeoMessage(const std::shared_ptr message) { { case Message::Type::Frame: { neomessage_frame_t& frame = *(neomessage_frame_t*)&neomsg; - auto framemsg = std::static_pointer_cast(message); + auto framemsg = std::static_pointer_cast(message); const auto netType = framemsg->network.getType(); frame.netid = (neonetid_t)framemsg->network.getNetID(); diff --git a/device/device.cpp b/device/device.cpp index dadcceb..531fe1d 100644 --- a/device/device.cpp +++ b/device/device.cpp @@ -735,7 +735,7 @@ std::optional Device::readCoreminiHeader(Disk::MemoryType memTyp return ret; } -bool Device::transmit(std::shared_ptr frame) { +bool Device::transmit(std::shared_ptr frame) { if(!isOpen()) { report(APIEvent::Type::DeviceCurrentlyClosed, APIEvent::Severity::Error); return false; @@ -768,7 +768,7 @@ bool Device::transmit(std::shared_ptr frame) { return com->sendPacket(packet); } -bool Device::transmit(std::vector> frames) { +bool Device::transmit(std::vector> frames) { for(auto& frame : frames) { if(!transmit(frame)) return false; diff --git a/device/extensions/flexray/extension.cpp b/device/extensions/flexray/extension.cpp index 46ca9d3..05f938a 100644 --- a/device/extensions/flexray/extension.cpp +++ b/device/extensions/flexray/extension.cpp @@ -48,7 +48,7 @@ void FlexRay::Extension::handleMessage(const std::shared_ptr& message) } } -bool FlexRay::Extension::transmitHook(const std::shared_ptr& frame, bool& success) { +bool FlexRay::Extension::transmitHook(const std::shared_ptr& frame, bool& success) { if(!frame || frame->network.getType() != _icsneo_msg_bus_type_t::icsneo_msg_bus_type_flexray) return true; // Don't hook non-FlexRay messages diff --git a/examples/cpp/a2b/src/a2b.cpp b/examples/cpp/a2b/src/a2b.cpp index 3a9472f..2d8cc29 100644 --- a/examples/cpp/a2b/src/a2b.cpp +++ b/examples/cpp/a2b/src/a2b.cpp @@ -260,7 +260,7 @@ void example4(const std::shared_ptr& rada2b) { [] (std::shared_ptr newMsg) { if(newMsg->type == icsneo::Message::Type::Frame) { - const auto& frame = std::dynamic_pointer_cast(newMsg); + const auto& frame = std::dynamic_pointer_cast(newMsg); if(frame && frame->network.getNetID() == icsneo::Network::NetID::I2C2) { const auto& i2cMessage = std::dynamic_pointer_cast(frame); diff --git a/examples/cpp/interactive/src/InteractiveExample.cpp b/examples/cpp/interactive/src/InteractiveExample.cpp index 263684d..9b0e491 100644 --- a/examples/cpp/interactive/src/InteractiveExample.cpp +++ b/examples/cpp/interactive/src/InteractiveExample.cpp @@ -186,7 +186,7 @@ void printMessage(const std::shared_ptr& message) { switch(message->type) { case icsneo::Message::Type::Frame: { // A message of type Frame is guaranteed to be a Frame, so we can static cast safely - auto frame = std::static_pointer_cast(message); + auto frame = std::static_pointer_cast(message); switch(frame->network.getType()) { case _icsneo_msg_bus_type_t::icsneo_msg_bus_type_can: { // A message of type CAN is guaranteed to be a CANMessage, so we can static cast safely diff --git a/examples/cpp/lin/src/LINExample.cpp b/examples/cpp/lin/src/LINExample.cpp index 400d374..52e552c 100644 --- a/examples/cpp/lin/src/LINExample.cpp +++ b/examples/cpp/lin/src/LINExample.cpp @@ -97,7 +97,7 @@ int main() { auto handler = device->addMessageCallback(std::make_shared([&](std::shared_ptr message) { if(icsneo::Message::Type::Frame == message->type) { - auto frame = std::static_pointer_cast(message); + auto frame = std::static_pointer_cast(message); if(_icsneo_msg_bus_type_t::icsneo_msg_bus_type_lin == frame->network.getType()) { auto msg = std::static_pointer_cast(message); std::cout << msg->network << " RX frame | ID: 0x" << std::hex << static_cast(msg->ID) << " | "; diff --git a/examples/cpp/mdio/src/MDIOExample.cpp b/examples/cpp/mdio/src/MDIOExample.cpp index 5d14c7c..79aed24 100644 --- a/examples/cpp/mdio/src/MDIOExample.cpp +++ b/examples/cpp/mdio/src/MDIOExample.cpp @@ -93,7 +93,7 @@ int main() auto handler = device->addMessageCallback(std::make_shared([&](std::shared_ptr message) { if(icsneo::Message::Type::Frame == message->type) { - auto frame = std::static_pointer_cast(message); + auto frame = std::static_pointer_cast(message); if(_icsneo_msg_bus_type_t::icsneo_msg_bus_type_mdio == frame->network.getType()) { auto msg = std::static_pointer_cast(message); std::cout << msg->network << " " << ((msg->isTXMsg)? "TX" : "RX") << " frame\n"; diff --git a/examples/cpp/simple/src/SimpleExample.cpp b/examples/cpp/simple/src/SimpleExample.cpp index 0671aaf..e9d2053 100644 --- a/examples/cpp/simple/src/SimpleExample.cpp +++ b/examples/cpp/simple/src/SimpleExample.cpp @@ -171,7 +171,7 @@ int main() { switch(message->type) { case icsneo::Message::Type::Frame: { // A message of type Frame is guaranteed to be a Frame, so we can static cast safely - auto frame = std::static_pointer_cast(message); + auto frame = std::static_pointer_cast(message); switch(frame->network.getType()) { case _icsneo_msg_bus_type_t::icsneo_msg_bus_type_can: { // A message of type CAN is guaranteed to be a CANMessage, so we can static cast safely diff --git a/examples/cpp/vsa/src/VSAExample.cpp b/examples/cpp/vsa/src/VSAExample.cpp index 8404ed3..235a235 100644 --- a/examples/cpp/vsa/src/VSAExample.cpp +++ b/examples/cpp/vsa/src/VSAExample.cpp @@ -16,13 +16,13 @@ void onEvent(std::shared_ptr event) { std::cout << event->describe() << std::endl; } -std::vector> constructRandomFrames(size_t frameCount, MessageType frameType) { +std::vector> constructRandomFrames(size_t frameCount, MessageType frameType) { static constexpr size_t ClassicCANSize = 8; static constexpr size_t CANFDSize = 64; static constexpr size_t ShortEthSize = 500; static constexpr size_t LongEthSize = 1500; - std::vector> frames; + std::vector> frames; std::random_device randDev; std::mt19937 randEngine(randDev()); std::uniform_int_distribution randByteDist(0,255); @@ -169,7 +169,7 @@ int main(int argc, char* argv[]) { if(msg->type != icsneo::Message::Type::Frame) { return; } - const auto frame = std::static_pointer_cast(msg); + const auto frame = std::static_pointer_cast(msg); if(frame->network.getType() == _icsneo_msg_bus_type_t::icsneo_msg_bus_type_can) { ++canFrameCount; } else if(frame->network.getType() == _icsneo_msg_bus_type_t::icsneo_msg_bus_type_ethernet) { @@ -200,7 +200,7 @@ int main(int argc, char* argv[]) { const uint8_t NumFrameTypes = 4; const size_t FrameCountPerType = 2500; - std::vector> frames; + std::vector> frames; for(uint8_t i = 0; i < NumFrameTypes; i++) { std::cout << "info: transmitting " << FrameCountPerType << " random " << MessageTypeLabels[i] << " frames" << std::endl; auto tempFrames = constructRandomFrames(FrameCountPerType, static_cast(i)); @@ -219,7 +219,7 @@ int main(int argc, char* argv[]) { if(msg->type != icsneo::Message::Type::Frame) { return; } - auto frame = std::static_pointer_cast(msg); + auto frame = std::static_pointer_cast(msg); if(frames[currentMessage]->data == frame->data) { currentMessage++; } diff --git a/include/icsneo/communication/message/a2bmessage.h b/include/icsneo/communication/message/a2bmessage.h index 62e3562..92cd805 100644 --- a/include/icsneo/communication/message/a2bmessage.h +++ b/include/icsneo/communication/message/a2bmessage.h @@ -20,7 +20,7 @@ enum class PCMType : uint8_t { using ChannelMap = std::unordered_map; -class A2BMessage : public Frame { +class A2BMessage : public BusMessage { public: static constexpr size_t maxAudioBufferSize = 2048; diff --git a/include/icsneo/communication/message/canmessage.h b/include/icsneo/communication/message/canmessage.h index 76338fe..47337fa 100644 --- a/include/icsneo/communication/message/canmessage.h +++ b/include/icsneo/communication/message/canmessage.h @@ -7,7 +7,7 @@ namespace icsneo { -class CANMessage : public Frame { +class CANMessage : public BusMessage { public: uint32_t arbid; uint8_t dlcOnWire; diff --git a/include/icsneo/communication/message/ethernetmessage.h b/include/icsneo/communication/message/ethernetmessage.h index 3c54975..d4cfdac 100644 --- a/include/icsneo/communication/message/ethernetmessage.h +++ b/include/icsneo/communication/message/ethernetmessage.h @@ -31,7 +31,7 @@ struct MACAddress { } }; -class EthernetMessage : public Frame { +class EthernetMessage : public BusMessage { public: bool preemptionEnabled = false; uint8_t preemptionFlags = 0; diff --git a/include/icsneo/communication/message/extendeddatamessage.h b/include/icsneo/communication/message/extendeddatamessage.h index 7d65228..ee9c6fb 100644 --- a/include/icsneo/communication/message/extendeddatamessage.h +++ b/include/icsneo/communication/message/extendeddatamessage.h @@ -9,7 +9,7 @@ namespace icsneo { -class ExtendedDataMessage : public Frame { +class ExtendedDataMessage : public BusMessage { public: #pragma pack(push, 2) struct ExtendedDataHeader { diff --git a/include/icsneo/communication/message/flexray/flexraymessage.h b/include/icsneo/communication/message/flexray/flexraymessage.h index 16f5907..f662569 100644 --- a/include/icsneo/communication/message/flexray/flexraymessage.h +++ b/include/icsneo/communication/message/flexray/flexraymessage.h @@ -10,7 +10,7 @@ namespace icsneo { -class FlexRayMessage : public Frame { +class FlexRayMessage : public BusMessage { public: uint16_t slotid = 0; double tsslen = 0; diff --git a/include/icsneo/communication/message/i2cmessage.h b/include/icsneo/communication/message/i2cmessage.h index 86c3058..e600ebd 100644 --- a/include/icsneo/communication/message/i2cmessage.h +++ b/include/icsneo/communication/message/i2cmessage.h @@ -8,7 +8,7 @@ namespace icsneo { -class I2CMessage : public Frame { +class I2CMessage : public BusMessage { public: enum class DeviceMode : uint8_t { Target = 0, diff --git a/include/icsneo/communication/message/iso9141message.h b/include/icsneo/communication/message/iso9141message.h index 70b85ba..be7c4fb 100644 --- a/include/icsneo/communication/message/iso9141message.h +++ b/include/icsneo/communication/message/iso9141message.h @@ -8,7 +8,7 @@ namespace icsneo { -class ISO9141Message : public Frame { +class ISO9141Message : public BusMessage { public: std::array header; bool isInit = false; diff --git a/include/icsneo/communication/message/linmessage.h b/include/icsneo/communication/message/linmessage.h index 683fc1e..55dd27a 100644 --- a/include/icsneo/communication/message/linmessage.h +++ b/include/icsneo/communication/message/linmessage.h @@ -34,7 +34,7 @@ struct LINStatusFlags { bool BreakOnly = false; }; -class LINMessage : public Frame { +class LINMessage : public BusMessage { public: enum class Type : uint8_t { NOT_SET = 0, diff --git a/include/icsneo/communication/message/mdiomessage.h b/include/icsneo/communication/message/mdiomessage.h index 92960bc..688f509 100644 --- a/include/icsneo/communication/message/mdiomessage.h +++ b/include/icsneo/communication/message/mdiomessage.h @@ -7,7 +7,7 @@ namespace icsneo { -class MDIOMessage : public Frame { +class MDIOMessage : public BusMessage { public: enum class Clause : uint8_t { Clause45 = 0, diff --git a/include/icsneo/communication/message/message.h b/include/icsneo/communication/message/message.h index a46a369..2f144c5 100644 --- a/include/icsneo/communication/message/message.h +++ b/include/icsneo/communication/message/message.h @@ -70,9 +70,9 @@ public: std::vector data; }; -class Frame : public RawMessage { +class BusMessage : public RawMessage { public: - Frame() : RawMessage(Message::Type::Frame) {} + BusMessage() : RawMessage(Message::Type::Frame) {} const icsneo_msg_type_t getMsgType() const final { return icsneo_msg_type_bus; } diff --git a/include/icsneo/device/device.h b/include/icsneo/device/device.h index 9ba9bc2..63c3720 100644 --- a/include/icsneo/device/device.h +++ b/include/icsneo/device/device.h @@ -212,8 +212,8 @@ public: int addMessageCallback(const std::shared_ptr& cb) { return com->addMessageCallback(cb); } bool removeMessageCallback(int id) { return com->removeMessageCallback(id); } - bool transmit(std::shared_ptr frame); - bool transmit(std::vector> frames); + bool transmit(std::shared_ptr frame); + bool transmit(std::vector> frames); void setWriteBlocks(bool blocks); diff --git a/include/icsneo/device/extensions/deviceextension.h b/include/icsneo/device/extensions/deviceextension.h index b45596f..445999c 100644 --- a/include/icsneo/device/extensions/deviceextension.h +++ b/include/icsneo/device/extensions/deviceextension.h @@ -33,7 +33,7 @@ public: virtual void handleMessage(const std::shared_ptr&) {} // Return true to continue transmitting, success should be written to if false is returned - virtual bool transmitHook(const std::shared_ptr& frame, bool& success) { (void)frame; (void)success; return true; } + virtual bool transmitHook(const std::shared_ptr& frame, bool& success) { (void)frame; (void)success; return true; } protected: Device& device; diff --git a/include/icsneo/device/extensions/flexray/extension.h b/include/icsneo/device/extensions/flexray/extension.h index 0d70268..52fb487 100644 --- a/include/icsneo/device/extensions/flexray/extension.h +++ b/include/icsneo/device/extensions/flexray/extension.h @@ -25,7 +25,7 @@ public: void onGoOffline() override; void handleMessage(const std::shared_ptr& message) override; - bool transmitHook(const std::shared_ptr& frame, bool& success) override; + bool transmitHook(const std::shared_ptr& frame, bool& success) override; std::shared_ptr getController(uint8_t index) const { if(index >= controllers.size())