diff --git a/Demos/Can/CanDemoCommon.hpp b/Demos/Can/CanDemoCommon.hpp index ded4f6b5..a75aa868 100644 --- a/Demos/Can/CanDemoCommon.hpp +++ b/Demos/Can/CanDemoCommon.hpp @@ -38,7 +38,7 @@ void FrameHandler(const CanFrameEvent& canFrameEvent, ILogger* logger) // Log std::string payloadStr(canFrameEvent.frame.dataField.begin(), canFrameEvent.frame.dataField.end()); std::stringstream buffer; - buffer << "Receive CAN " << frameTypeHint << "frame, canId=" << canFrameEvent.frame.canId << ", data ='" + buffer << "Receive CAN " << frameTypeHint << "frame, canId=" << canFrameEvent.frame.canId << ", data='" << payloadStr << "'"; logger->Info(buffer.str()); } diff --git a/Demos/Can/CanWriterDemo.cpp b/Demos/Can/CanWriterDemo.cpp index e413691d..539e24be 100644 --- a/Demos/Can/CanWriterDemo.cpp +++ b/Demos/Can/CanWriterDemo.cpp @@ -57,17 +57,13 @@ class CanWriter: public ApplicationBase canFrame.canId = 3; // Cycle between normal and FD frames - std::string frameTypeHint = ""; - if (messageId % 2 == 1) - { - canFrame.flags = static_cast(CanFrameFlag::Fdf) // FD Format Indicator - | static_cast(CanFrameFlag::Brs); // Bit Rate Switch (for FD Format only) - frameTypeHint = "FD "; - } + canFrame.flags = static_cast(CanFrameFlag::Fdf) // FD Format Indicator + | static_cast(CanFrameFlag::Brs); // Bit Rate Switch (for FD Format only) + // Build a payload with the message Id std::stringstream payloadBuilder; - payloadBuilder << "Hello CAN Bus, this is frame #" << messageId; + payloadBuilder << "CAN " << messageId; auto payloadStr = payloadBuilder.str(); std::vector payloadBytes(payloadStr.begin(), payloadStr.end()); canFrame.dataField = payloadBytes; @@ -75,7 +71,7 @@ class CanWriter: public ApplicationBase // Log std::stringstream buffer; - buffer << "Send CAN " << frameTypeHint << "frame, canId = " << canFrame.canId << ", data = '" << payloadStr + buffer << "Send CAN FD frame, canId=" << canFrame.canId << ", data='" << payloadStr << "' "; GetLogger()->Info(buffer.str()); diff --git a/Demos/include/ApplicationBase.hpp b/Demos/include/ApplicationBase.hpp index c176655b..df6660ec 100644 --- a/Demos/include/ApplicationBase.hpp +++ b/Demos/include/ApplicationBase.hpp @@ -198,7 +198,7 @@ class ApplicationBase auto ToLowerCase(std::string s) -> std::string { - std::for_each(s.begin(), s.end(), [](char& c) { c = std::tolower(c); }); + std::for_each(s.begin(), s.end(), [](char& c) { c = static_cast(std::tolower(c)); }); return s; } auto IsValidLogLevel(const std::string& levelStr) -> bool