summaryrefslogtreecommitdiffstats
path: root/low-can-binding/can
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-07-04 14:27:16 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-07-04 14:27:16 +0200
commitc16ccc9d6a1de5406ba0e74f757403ac7553b6a8 (patch)
tree16df16f5cf53367e21aa865426ded8e9fd78a0f3 /low-can-binding/can
parent621f55e3e4b104d5771a38aae4db5439fe9a5aa8 (diff)
DAB RC3 Fixes follows appfw API break.
Following functions now return 0 on success and negative value on failure : o afb_req_subcall o afb_req_subcall_sync o afb_service_call o afb_service_call_sync Verbosity macros used in v2 bindings now needs to be prefixed with AFB_ (ERROR -> AFB_ERROR) Change-Id: Ica4346f215bb142fcda0c6ea15e7074f7091f4cc 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.cpp10
-rw-r--r--low-can-binding/can/can-decoder.cpp6
-rw-r--r--low-can-binding/can/can-message.cpp20
3 files changed, 18 insertions, 18 deletions
diff --git a/low-can-binding/can/can-bus.cpp b/low-can-binding/can/can-bus.cpp
index 6167335..1b0e186 100644
--- a/low-can-binding/can/can-bus.cpp
+++ b/low-can-binding/can/can-bus.cpp
@@ -91,7 +91,7 @@ void can_bus_t::process_can_signals(const can_message_t& can_message, std::map<i
{
std::lock_guard<std::mutex> decoded_can_message_lock(decoded_can_message_mutex_);
push_new_vehicle_message(subscription_id, vehicle_message);
- DEBUG("%s CAN signals processed.", sig->get_name().c_str());
+ AFB_DEBUG("%s CAN signals processed.", sig->get_name().c_str());
}
}
}
@@ -116,7 +116,7 @@ void can_bus_t::process_diagnostic_signals(diagnostic_manager_t& manager, const
{
std::lock_guard<std::mutex> decoded_can_message_lock(decoded_can_message_mutex_);
push_new_vehicle_message(subscription_id, vehicle_message);
- DEBUG("%s CAN signals processed.", s[subscription_id]->get_name().c_str());
+ AFB_DEBUG("%s CAN signals processed.", s[subscription_id]->get_name().c_str());
}
}
}
@@ -249,7 +249,7 @@ const can_message_t can_bus_t::next_can_message()
{
can_msg = can_message_q_.front();
can_message_q_.pop();
- DEBUG("Here is the next can message : id %X, length %X, data %02X%02X%02X%02X%02X%02X%02X%02X", can_msg.get_id(), can_msg.get_length(),
+ AFB_DEBUG("Here is the next can message : id %X, length %X, data %02X%02X%02X%02X%02X%02X%02X%02X", can_msg.get_id(), can_msg.get_length(),
can_msg.get_data()[0], can_msg.get_data()[1], can_msg.get_data()[2], can_msg.get_data()[3], can_msg.get_data()[4], can_msg.get_data()[5], can_msg.get_data()[6], can_msg.get_data()[7]);
return can_msg;
}
@@ -276,7 +276,7 @@ std::pair<int, openxc_VehicleMessage> can_bus_t::next_vehicle_message()
{
v_msg = vehicle_message_q_.front();
vehicle_message_q_.pop();
- DEBUG("next vehicle message poped");
+ AFB_DEBUG("next vehicle message poped");
return v_msg;
}
@@ -299,7 +299,7 @@ void can_bus_t::set_can_devices()
if(can_devices_.empty())
{
- ERROR("No mapping found in config file: '%s'. Check it that it have a CANbus-mapping section.",
+ AFB_ERROR("No mapping found in config file: '%s'. Check it that it have a CANbus-mapping section.",
conf_file_.filepath().c_str());
}
}
diff --git a/low-can-binding/can/can-decoder.cpp b/low-can-binding/can/can-decoder.cpp
index 61bfe75..b77e13e 100644
--- a/low-can-binding/can/can-decoder.cpp
+++ b/low-can-binding/can/can-decoder.cpp
@@ -132,7 +132,7 @@ openxc_DynamicField decoder_t::stateDecoder(can_signal_t& signal,
if(signal_state.size() <= 0)
{
*send = false;
- ERROR("No state found with index: %d", (int)value);
+ AFB_ERROR("No state found with index: %d", (int)value);
}
return decoded_value;
}
@@ -157,7 +157,7 @@ openxc_DynamicField decoder_t::translateSignal(can_signal_t& signal, const can_m
const std::vector<std::shared_ptr<can_signal_t> >& signals, bool* send)
{
float value = decoder_t::parseSignalBitfield(signal, message);
- DEBUG("Decoded message from parseSignalBitfield: %f", value);
+ AFB_DEBUG("Decoded message from parseSignalBitfield: %f", value);
// Must call the decoders every time, regardless of if we are going to
// decide to send the signal or not.
@@ -241,4 +241,4 @@ openxc_DynamicField decoder_t::decodeSignal( can_signal_t& signal,
float decoder_t::decode_obd2_response(const DiagnosticResponse* response, float parsed_payload)
{
return diagnostic_decode_obd2_pid(response);
-} \ No newline at end of file
+}
diff --git a/low-can-binding/can/can-message.cpp b/low-can-binding/can/can-message.cpp
index 057bc71..fe66936 100644
--- a/low-can-binding/can/can-message.cpp
+++ b/low-can-binding/can/can-message.cpp
@@ -176,7 +176,7 @@ void can_message_t::set_format(const can_message_format_t new_format)
if(new_format == can_message_format_t::STANDARD || new_format == can_message_format_t::EXTENDED || new_format == can_message_format_t::INVALID)
format_ = new_format;
else
- ERROR("Can set format, wrong format chosen");
+ AFB_ERROR("Can set format, wrong format chosen");
}
/// @brief Take a canfd_frame struct to initialize class members
@@ -198,15 +198,15 @@ can_message_t can_message_t::convert_from_frame(const struct canfd_frame& frame,
switch(nbytes)
{
case CANFD_MTU:
- DEBUG("Got an CAN FD frame");
+ AFB_DEBUG("Got an CAN FD frame");
maxdlen = CANFD_MAX_DLEN;
break;
case CAN_MTU:
- DEBUG("Got a legacy CAN frame");
+ AFB_DEBUG("Got a legacy CAN frame");
maxdlen = CAN_MAX_DLEN;
break;
default:
- ERROR("unsupported CAN frame");
+ AFB_ERROR("unsupported CAN frame");
break;
}
@@ -260,7 +260,7 @@ can_message_t can_message_t::convert_from_frame(const struct canfd_frame& frame,
data.push_back(frame.data[i]);
};
- DEBUG("Found id: %X, format: %X, length: %X, data %02X%02X%02X%02X%02X%02X%02X%02X",
+ AFB_DEBUG("Found id: %X, format: %X, length: %X, data %02X%02X%02X%02X%02X%02X%02X%02X",
id, (uint8_t)format, length, data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
}
@@ -285,12 +285,12 @@ can_message_t can_message_t::convert_from_frame(const struct can_frame& frame, s
if(nbytes <= CAN_MTU)
{
- DEBUG("Got a legacy CAN frame");
+ AFB_DEBUG("Got a legacy CAN frame");
maxdlen = CAN_MAX_DLEN;
}
else
{
- ERROR("unsupported CAN frame");
+ AFB_ERROR("unsupported CAN frame");
}
if (frame.can_id & CAN_ERR_FLAG)
@@ -339,7 +339,7 @@ can_message_t can_message_t::convert_from_frame(const struct can_frame& frame, s
data.push_back(frame.data[i]);
};
-// DEBUG("Found id: %X, format: %X, length: %X, data %02X%02X%02X%02X%02X%02X%02X%02X",
+// AFB_DEBUG("Found id: %X, format: %X, length: %X, data %02X%02X%02X%02X%02X%02X%02X%02X",
// id, (uint8_t)format, length, data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
}
@@ -362,7 +362,7 @@ struct canfd_frame can_message_t::convert_to_canfd_frame()
::memcpy(frame.data, get_data(), length_);
}
else
- ERROR("can_message_t not correctly initialized to be sent");
+ AFB_ERROR("can_message_t not correctly initialized to be sent");
return frame;
}
@@ -383,7 +383,7 @@ struct can_frame can_message_t::convert_to_can_frame()
::memcpy(frame.data, get_data(), length_);
}
else
- ERROR("can_message_t not correctly initialized to be sent");
+ AFB_ERROR("can_message_t not correctly initialized to be sent");
return frame;
}