diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2020-01-07 16:29:23 +0100 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2020-01-08 00:17:29 +0100 |
commit | 699f7c0fd118615f53eb7b7b3a86e1c6d2a42c09 (patch) | |
tree | 4f5e7313ad9e74a03c633b2036fbe23b562ee2d4 /low-can-binding/utils | |
parent | c9f3b54ab16992bf4cd878618ccbf3e77891299a (diff) |
socketcan-j1939: format how to define_opt()
Bug-AGL: SPEC-2932
Change-Id: Ifec401451dc541b71dc2f98d25f5c953f1bcf532
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'low-can-binding/utils')
-rw-r--r-- | low-can-binding/utils/socketcan-j1939/socketcan-j1939.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/low-can-binding/utils/socketcan-j1939/socketcan-j1939.cpp b/low-can-binding/utils/socketcan-j1939/socketcan-j1939.cpp index 88bca560..d3996d4c 100644 --- a/low-can-binding/utils/socketcan-j1939/socketcan-j1939.cpp +++ b/low-can-binding/utils/socketcan-j1939/socketcan-j1939.cpp @@ -21,6 +21,7 @@ #include <iostream> #include <algorithm> #include <vector> + #include "./socketcan-j1939.hpp" #include "socketcan-j1939-addressclaiming.hpp" @@ -98,13 +99,9 @@ namespace utils */ void socketcan_j1939_t::define_opt(bool promisc, bool recv_own_msgs, bool broadcast) { - int promisc_i = 0; - int recv_own_msgs_i = 0; - int broadcast_i = 0; - - if(promisc) promisc_i = 1; - if(recv_own_msgs) recv_own_msgs_i=1; - if(broadcast) broadcast_i = 1; + int promisc_i = promisc ? 1 : 0; + //int recv_own_msgs_i = recv_own_msgs ? 1 : 0; + int broadcast_i = broadcast ? 1 : 0; setopt(SOL_CAN_J1939, SO_J1939_PROMISC, &promisc_i, sizeof(promisc_i)); setopt(SOL_SOCKET, SO_BROADCAST, &broadcast_i, sizeof(broadcast_i)); |