diff --git a/include/etl/message_bus.h b/include/etl/message_bus.h index 0cfa5ee0..134d0940 100644 --- a/include/etl/message_bus.h +++ b/include/etl/message_bus.h @@ -414,7 +414,7 @@ namespace etl /// Send a message to a bus. //*************************************************************************** static inline void send_message(etl::imessage_bus& bus, - const etl::imessage& message) + const etl::imessage& message) { bus.receive(message); } @@ -423,8 +423,8 @@ namespace etl /// Send a message to a bus. //*************************************************************************** static inline void send_message(etl::imessage_bus& bus, - etl::message_router_id_t id, - const etl::imessage& message) + etl::message_router_id_t id, + const etl::imessage& message) { bus.receive(id, message); } diff --git a/include/etl/message_router.h b/include/etl/message_router.h index f442ad71..50b72055 100644 --- a/include/etl/message_router.h +++ b/include/etl/message_router.h @@ -319,6 +319,15 @@ namespace etl destination.receive(message); } + //*************************************************************************** + /// Send a shared message to a router. + //*************************************************************************** + static inline void send_message(etl::imessage_router& destination, + etl::shared_message message) + { + destination.receive(message); + } + //************************************************************************************************* // For C++17 and above. //************************************************************************************************* diff --git a/test/test_shared_message.cpp b/test/test_shared_message.cpp index bdb1af9a..6983466d 100644 --- a/test/test_shared_message.cpp +++ b/test/test_shared_message.cpp @@ -230,7 +230,7 @@ namespace bus.receive(sm2); bus.receive(sm1); bus.receive(sm3); - bus.receive(sm4); // sm4 is a copy of sm1 + etl::send_message(bus, sm4); // sm4 is a copy of sm1. Use non-member function. bus.receive(RouterId2, sm1); // Only send sm1 to Router2 CHECK(sm1.is_valid());