aboutsummaryrefslogtreecommitdiffstats
path: root/low-can-binding/can
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2019-11-05 19:33:29 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2020-01-08 00:17:29 +0100
commit64691cf96f9c4d7ff59dbd49e1fe01d26c1a00f6 (patch)
tree6e32fa6d9574223d5560508c76ce31d50bc42a14 /low-can-binding/can
parent3fb6ac3c3670499bee4ce02ff7813739017e8b8f (diff)
all: Format one line 'if' or 'for' statement.
Bug-AGL: SPEC-2988 Change-Id: Ic3b9670a2ce9e982220c54f3632f690ee4eea686 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'low-can-binding/can')
-rw-r--r--low-can-binding/can/can-bus.cpp8
-rw-r--r--low-can-binding/can/can-decoder.cpp47
-rw-r--r--low-can-binding/can/can-encoder.cpp17
3 files changed, 21 insertions, 51 deletions
diff --git a/low-can-binding/can/can-bus.cpp b/low-can-binding/can/can-bus.cpp
index 6cd99ba3..ddf54918 100644
--- a/low-can-binding/can/can-bus.cpp
+++ b/low-can-binding/can/can-bus.cpp
@@ -120,7 +120,7 @@ void can_bus_t::process_diagnostic_signals(diagnostic_manager_t& manager, std::s
openxc_VehicleMessage vehicle_message = manager.find_and_decode_adr(message);
if (message->get_timestamp())
- {vehicle_message.timestamp = message->get_timestamp();}
+ vehicle_message.timestamp = message->get_timestamp();
if( (vehicle_message.has_simple_message && vehicle_message.simple_message.has_name) &&
s.find(subscription_id) != s.end() && afb_event_is_valid(s[subscription_id]->get_event()))
{
@@ -166,7 +166,7 @@ void can_bus_t::can_decode_message()
process_diagnostic_signals(application_t::instance().get_diagnostic_manager(), message, s);
}
else
- {process_signals(message, s);}
+ process_signals(message, s);
}
can_message_lock.lock();
}
@@ -200,9 +200,9 @@ void can_bus_t::can_event_push()
if(afb_event_push(s[v_message.first]->get_event(), jo) == 0)
{
if(v_message.second.has_diagnostic_response)
- {on_no_clients(s[v_message.first], v_message.second.diagnostic_response.pid, s);}
+ on_no_clients(s[v_message.first], v_message.second.diagnostic_response.pid, s);
else
- {on_no_clients(s[v_message.first], s);}
+ on_no_clients(s[v_message.first], s);
}
}
}
diff --git a/low-can-binding/can/can-decoder.cpp b/low-can-binding/can/can-decoder.cpp
index c19614c0..56626691 100644
--- a/low-can-binding/can/can-decoder.cpp
+++ b/low-can-binding/can/can-decoder.cpp
@@ -36,55 +36,30 @@ float decoder_t::parse_signal_bitfield(signal_t& signal, std::shared_ptr<message
{
const std::vector<uint8_t> data = message->get_data_vector();
std::vector<uint8_t> data_signal;
- uint32_t bit_size = signal.get_bit_size();
+ uint8_t bit_size = (uint8_t) signal.get_bit_size();
uint32_t bit_position = signal.get_bit_position();
int new_start_byte = 0;
int new_end_byte = 0;
- int new_start_bit = 0;
- int new_end_bit = 0;
+ uint8_t new_start_bit = 0;
+ uint8_t new_end_bit = 0;
converter_t::signal_to_bits_bytes(bit_position, bit_size, new_start_byte, new_end_byte, new_start_bit, new_end_bit);
for(int i=new_start_byte;i<=new_end_byte;i++)
- {
data_signal.push_back(data[i]);
- }
-
- uint8_t new_bit_size = 0;
-
- if(bit_size > 255)
- {
- AFB_ERROR("Error signal %s to long bit size",signal.get_name().c_str());
- }
- else
- {
- new_bit_size = (uint8_t) bit_size;
- }
- uint8_t bit_offset = 0;
- if(new_start_bit > 255)
- {
- AFB_ERROR("Too long signal offset %d", new_start_bit);
- }
- else
- {
- bit_offset = (uint8_t) new_start_bit;
- }
+// if(bit_size > 255)
+// AFB_ERROR("Error signal %s to long bit size",signal.get_name().c_str());
- uint16_t length = 0;
+// if(new_start_bit > 255)
+// AFB_ERROR("Too long signal offset %d", new_start_bit);
if(data_signal.size() > 65535)
- {
AFB_ERROR("Too long data signal %s",signal.get_name().c_str());
- }
- else
- {
- length = (uint16_t) data_signal.size();
- }
- return bitfield_parse_float(data_signal.data(), length,
- bit_offset, new_bit_size, signal.get_factor(),
+ return bitfield_parse_float(data_signal.data(), (uint16_t) data_signal.size(),
+ new_start_bit, bit_size, signal.get_factor(),
signal.get_offset());
}
@@ -114,8 +89,8 @@ openxc_DynamicField decoder_t::decode_bytes(signal_t& signal, std::shared_ptr<me
int new_start_byte = 0;
int new_end_byte = 0;
- int new_start_bit = 0;
- int new_end_bit = 0;
+ uint8_t new_start_bit = 0;
+ uint8_t new_end_bit = 0;
converter_t::signal_to_bits_bytes(bit_position, bit_size, new_start_byte, new_end_byte, new_start_bit, new_end_bit);
diff --git a/low-can-binding/can/can-encoder.cpp b/low-can-binding/can/can-encoder.cpp
index 2d836cf9..fb68b879 100644
--- a/low-can-binding/can/can-encoder.cpp
+++ b/low-can-binding/can/can-encoder.cpp
@@ -37,10 +37,10 @@ void encoder_t::encode_data(std::shared_ptr<signal_t> sig, std::vector<uint8_t>
uint32_t bit_position = sig->get_bit_position();
int new_start_byte = 0;
int new_end_byte = 0;
- int new_start_bit_tmp = 0;
- int new_end_bit = 0;
+ uint8_t new_start_bit = 0;
+ uint8_t new_end_bit = 0;
- converter_t::signal_to_bits_bytes(bit_position, bit_size, new_start_byte, new_end_byte, new_start_bit_tmp, new_end_bit);
+ converter_t::signal_to_bits_bytes(bit_position, bit_size, new_start_byte, new_end_byte, new_start_bit, new_end_bit);
int len_signal_bytes_tmp = new_end_byte - new_start_byte + 1;
@@ -53,17 +53,12 @@ void encoder_t::encode_data(std::shared_ptr<signal_t> sig, std::vector<uint8_t>
{
len_signal_bytes = (uint8_t) len_signal_bytes_tmp;
}
-
- uint8_t new_start_bit = 0;
- if(new_start_bit_tmp > 255)
+/*
+ if(new_start_bit > 255)
{
AFB_ERROR("Error signal %s too long",sig->get_name().c_str());
}
- else
- {
- new_start_bit = (uint8_t) new_start_bit_tmp;
- }
-
+*/
uint8_t new_bit_size = 0;
if(bit_size > 255)
{