diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-07-17 10:57:45 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-07-21 12:02:11 +0200 |
commit | 61adb20886a9cc611a8b48a86998cfeaad31d7b7 (patch) | |
tree | 7c1aa5341b8b9528c9547020e1be9f4f3a856274 /low-can-binding | |
parent | 1a90edea7d3d45da772c590d642c0093839cc91f (diff) |
Check whether a signal is writable before sending
Change-Id: Id04d04a07e43738f7379e33fa7c6022eaa426343
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'low-can-binding')
-rw-r--r-- | low-can-binding/binding/low-can-cb.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
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());} } } |