aboutsummaryrefslogtreecommitdiffstats
path: root/low-can-binding/binding/low-can-subscription.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2019-12-15 13:35:42 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2020-01-09 16:25:36 +0100
commit05e0dcd47f5cbe62de594c801f1c460622847716 (patch)
tree7c38ad9fbde74dacbbc2ec529111149395a57cf5 /low-can-binding/binding/low-can-subscription.cpp
parent334dbd3813551cb6d5e6dfb9d6625d9519caee2d (diff)
format: remove uneeded brackets.
Change-Id: I0689d62e32b9b60059adc2d4be78fa3b2581441c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'low-can-binding/binding/low-can-subscription.cpp')
-rw-r--r--low-can-binding/binding/low-can-subscription.cpp30
1 files changed, 5 insertions, 25 deletions
diff --git a/low-can-binding/binding/low-can-subscription.cpp b/low-can-binding/binding/low-can-subscription.cpp
index 4bdf3181..6cfcb718 100644
--- a/low-can-binding/binding/low-can-subscription.cpp
+++ b/low-can-binding/binding/low-can-subscription.cpp
@@ -102,12 +102,9 @@ int low_can_subscription_t::set_event()
int low_can_subscription_t::subscribe(afb_req_t request)
{
if(! afb_event_is_valid(event_))
- {
if(set_event() < 0)
- {
return -1;
- }
- }
+
return afb_req_subscribe(request, event_);
}
@@ -175,12 +172,9 @@ const vect_ptr_diag_msg_t low_can_subscription_t::get_diagnostic_message() const
const std::shared_ptr<diagnostic_message_t> low_can_subscription_t::get_diagnostic_message(uint32_t pid) const
{
for(const auto& diag: diagnostic_message_)
- {
if(diag->get_pid() == pid)
- {
return diag;
- }
- }
+
return nullptr;
}
@@ -190,12 +184,9 @@ const std::shared_ptr<diagnostic_message_t> low_can_subscription_t::get_diagnost
const std::shared_ptr<diagnostic_message_t> low_can_subscription_t::get_diagnostic_message(const std::string& name) const
{
for(const auto& diag: diagnostic_message_)
- {
if(diag->get_name() == name)
- {
return diag;
- }
- }
+
return nullptr;
}
@@ -421,9 +412,7 @@ int low_can_subscription_t::open_socket(low_can_subscription_t &subscription, co
pgn_t pgn = J1939_NO_PGN;
std::shared_ptr<utils::socketcan_j1939_addressclaiming_t> socket = std::make_shared<utils::socketcan_j1939_addressclaiming_t>();
if(!bus_name.empty())
- {
ret = socket->open(bus_name, pgn);
- }
subscription.socket_ = socket;
subscription.index_ = (int)subscription.socket_->socket();
}
@@ -628,26 +617,17 @@ int low_can_subscription_t::create_rx_filter_can(low_can_subscription_t &subscri
int low_can_subscription_t::create_rx_filter(std::shared_ptr<signal_t> sig)
{
if(!sig->get_message()->is_isotp() && !sig->get_message()->is_j1939())
- {
return low_can_subscription_t::create_rx_filter_can(*this, sig);
- }
#ifdef USE_FEATURE_ISOTP
else if(sig->get_message()->is_isotp())
- {
return low_can_subscription_t::create_rx_filter_isotp(*this, sig);
- }
#endif
#ifdef USE_FEATURE_J1939
else if(sig->get_message()->is_j1939())
- {
return low_can_subscription_t::create_rx_filter_j1939(*this, sig);
- }
#endif
- else
- {
- AFB_ERROR("Signal can't be j1939 and isotp");
- return -1;
- }
+ AFB_ERROR("Signal can't be j1939 and isotp");
+ return -1;
}