diff options
author | Arthur GUYADER <arthur.guyader@iot.bzh> | 2019-12-12 15:26:59 +0100 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2020-01-09 16:25:36 +0100 |
commit | c57722b34d38c9843a728829204d2711aaadacbb (patch) | |
tree | 9bc32030d40980a1cad1203505d24278a7154719 /low-can-binding/utils | |
parent | 707dff688bbd411974f472a3bdc3ad2faafbd3bd (diff) |
socket-j1939: Function add_filter return int to check error
Change-Id: Ia79320108e8293d2b7a5beba4f49036999d5ebbb
Signed-off-by: Arthur GUYADER <arthur.guyader@iot.bzh>
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 | 6 | ||||
-rw-r--r-- | low-can-binding/utils/socketcan-j1939/socketcan-j1939.hpp | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/low-can-binding/utils/socketcan-j1939/socketcan-j1939.cpp b/low-can-binding/utils/socketcan-j1939/socketcan-j1939.cpp index e8d85b56..90e68218 100644 --- a/low-can-binding/utils/socketcan-j1939/socketcan-j1939.cpp +++ b/low-can-binding/utils/socketcan-j1939/socketcan-j1939.cpp @@ -40,7 +40,7 @@ namespace utils * @param pgn_mask - The mask to apply to the pgn (No mask : J1939_NO_PGN) * @param addr_mask - The mask to apply to the addr (No mask : J1939_NO_ADDR) */ - void socketcan_j1939_t::add_filter(name_t name, pgn_t pgn, uint8_t addr, name_t name_mask, pgn_t pgn_mask, uint8_t addr_mask) + int socketcan_j1939_t::add_filter(name_t name, pgn_t pgn, uint8_t addr, name_t name_mask, pgn_t pgn_mask, uint8_t addr_mask) { // AFB_DEBUG("[socketcan_j1939_t][add_filter] PGN : %" PRIu32 " ; NAME : %" PRIu64 " ; ADDR : %" PRIu8, pgn,(long unsigned int)name, addr); // AFB_DEBUG("PGN_MASK : %" PRIu32 " ; NAME_MASK : %" PRIu64 "; ADDR_MASK : %" PRIu8, pgn_mask,(long unsigned int)name_mask, addr_mask); @@ -79,7 +79,9 @@ namespace utils } if(filter_on) - setopt(SOL_CAN_J1939, SO_J1939_FILTER, &filter, sizeof(filter)); + return setopt(SOL_CAN_J1939, SO_J1939_FILTER, &filter, sizeof(filter)); + + return 0; } /** diff --git a/low-can-binding/utils/socketcan-j1939/socketcan-j1939.hpp b/low-can-binding/utils/socketcan-j1939/socketcan-j1939.hpp index f9132972..1ae8d1c9 100644 --- a/low-can-binding/utils/socketcan-j1939/socketcan-j1939.hpp +++ b/low-can-binding/utils/socketcan-j1939/socketcan-j1939.hpp @@ -60,7 +60,7 @@ namespace utils static std::mutex mutex_claiming_; static std::condition_variable signal_address_claiming_; void define_tx_address(std::string device_name, name_t name, pgn_t pgn, uint8_t addr); - void add_filter(name_t name, pgn_t pgn, uint8_t addr, name_t name_mask, pgn_t pgn_mask, uint8_t addr_mask); + int add_filter(name_t name, pgn_t pgn, uint8_t addr, name_t name_mask, pgn_t pgn_mask, uint8_t addr_mask); void define_opt(bool promisc = true, bool recv_own_msgs = true, bool broadcast = true); }; |