From 61adb20886a9cc611a8b48a86998cfeaad31d7b7 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Mon, 17 Jul 2017 10:57:45 +0200 Subject: Check whether a signal is writable before sending Change-Id: Id04d04a07e43738f7379e33fa7c6022eaa426343 Signed-off-by: Romain Forlot --- low-can-binding/binding/low-can-cb.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'low-can-binding/binding/low-can-cb.cpp') diff --git a/low-can-binding/binding/low-can-cb.cpp b/low-can-binding/binding/low-can-cb.cpp index cac9fc4e..be2985fb 100644 --- a/low-can-binding/binding/low-can-cb.cpp +++ b/low-can-binding/binding/low-can-cb.cpp @@ -427,9 +427,14 @@ static int write_signal(const std::string& name, uint64_t value) { for(const auto& sig: sf.can_signals) { - cf = encoder_t::build_frame(sig, value); - const std::string bus_name = sig->get_message()->get_bus_name(); - rc = send_frame(bus_name, cf); + if(sig->get_writable()) + { + cf = encoder_t::build_frame(sig, value); + const std::string bus_name = sig->get_message()->get_bus_name(); + rc = send_frame(bus_name, cf); + } + else + {AFB_NOTICE("%s isn't writable. Message not sent.", sig->get_name().c_str());} } } -- cgit 1.2.3-korg