summaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding/can
diff options
context:
space:
mode:
Diffstat (limited to 'CAN-binder/low-can-binding/can')
-rw-r--r--CAN-binder/low-can-binding/can/can-bus-dev.cpp16
-rw-r--r--CAN-binder/low-can-binding/can/can-bus.cpp18
-rw-r--r--CAN-binder/low-can-binding/can/can-decoder.cpp4
-rw-r--r--CAN-binder/low-can-binding/can/can-message.cpp14
4 files changed, 26 insertions, 26 deletions
diff --git a/CAN-binder/low-can-binding/can/can-bus-dev.cpp b/CAN-binder/low-can-binding/can/can-bus-dev.cpp
index 765eda7f..5c484eed 100644
--- a/CAN-binder/low-can-binding/can/can-bus-dev.cpp
+++ b/CAN-binder/low-can-binding/can/can-bus-dev.cpp
@@ -55,7 +55,7 @@ uint32_t can_bus_dev_t::get_address() const
/// @return socket value or -1 if something wrong.
int can_bus_dev_t::open(bool bcm)
{
- DEBUG(binder_interface, "open_raw: CAN Handler socket : %d", can_socket_.socket());
+ DEBUG(binder_interface, "%s: CAN Handler using BCM socket ? %s", __FUNCTION__, bcm ? "true" : "false");
return can_socket_.open(device_name_, bcm);
}
@@ -67,22 +67,22 @@ void can_bus_dev_t::configure()
const int timestamp_on = 1;
const int canfd_on = 1;
- DEBUG(binder_interface, "open_raw: CAN Handler socket correctly initialized : %d", can_socket_.socket());
+ DEBUG(binder_interface, "%s: CAN Handler socket correctly initialized : %d", __FUNCTION__, can_socket_.socket());
// Set timestamp for receveid frame
if (can_socket_.setopt(SOL_SOCKET, SO_TIMESTAMP, &timestamp_on, sizeof(timestamp_on)) < 0)
- WARNING(binder_interface, "open_raw: setsockopt SO_TIMESTAMP error: %s", ::strerror(errno));
- DEBUG(binder_interface, "open_raw: Switch CAN Handler socket to use fd mode");
+ WARNING(binder_interface, "%s: setsockopt SO_TIMESTAMP error: %s", __FUNCTION__, ::strerror(errno));
+ DEBUG(binder_interface, "%s: Switch CAN Handler socket to use fd mode", __FUNCTION__);
// try to switch the socket into CAN_FD mode
if (can_socket_.setopt(SOL_CAN_RAW, CAN_RAW_FD_FRAMES, &canfd_on, sizeof(canfd_on)) < 0)
{
- NOTICE(binder_interface, "open_raw: Can not switch into CAN Extended frame format.");
+ NOTICE(binder_interface, "%s: Can not switch into CAN Extended frame format.", __FUNCTION__);
is_fdmode_on_ = false;
}
else
{
- DEBUG(binder_interface, "open_raw: Correctly set up CAN socket to use FD frames.");
+ DEBUG(binder_interface, "%s: Correctly set up CAN socket to use FD frames.", __FUNCTION__);
is_fdmode_on_ = true;
}
}
@@ -127,7 +127,7 @@ can_message_t can_bus_dev_t::read()
::memset(&cfd, 0, sizeof(cfd));
}
- DEBUG(binder_interface, "read: Found id: %X, length: %X, data %02X%02X%02X%02X%02X%02X%02X%02X", cfd.can_id, cfd.len,
+ DEBUG(binder_interface, "%s: Found id: %X, length: %X, data %02X%02X%02X%02X%02X%02X%02X%02X", __FUNCTION__, cfd.can_id, cfd.len,
cfd.data[0], cfd.data[1], cfd.data[2], cfd.data[3], cfd.data[4], cfd.data[5], cfd.data[6], cfd.data[7]);
return can_message_t::convert_from_canfd_frame(cfd, nbytes);
}
@@ -136,7 +136,7 @@ can_message_t can_bus_dev_t::read()
/// @param[in] can_bus reference can_bus_t. it will be passed to the thread to allow using can_bus_t queue.
void can_bus_dev_t::start_reading(can_bus_t& can_bus)
{
- DEBUG(binder_interface, "Launching reading thread");
+ DEBUG(binder_interface, "%s: Launching reading thread", __FUNCTION__);
is_running_ = true;
th_reading_ = std::thread(&can_bus_dev_t::can_reader, this, std::ref(can_bus));
if(!th_reading_.joinable())
diff --git a/CAN-binder/low-can-binding/can/can-bus.cpp b/CAN-binder/low-can-binding/can/can-bus.cpp
index ee6a7cfa..6b3689d0 100644
--- a/CAN-binder/low-can-binding/can/can-bus.cpp
+++ b/CAN-binder/low-can-binding/can/can-bus.cpp
@@ -93,7 +93,7 @@ int can_bus_t::process_can_signals(can_message_t& can_message)
}
}
- DEBUG(binder_interface, "process_can_signals: %d/%d CAN signals processed.", processed_signals, (int)signals.can_signals.size());
+ DEBUG(binder_interface, "%s: %d/%d CAN signals processed.", __FUNCTION__, processed_signals, (int)signals.can_signals.size());
return processed_signals;
}
@@ -245,24 +245,24 @@ int can_bus_t::init_can_dev()
if (can_bus_t::can_devices_[device]->open(true) >= 0)
{
can_bus_t::can_devices_[device]->configure();
- DEBUG(binder_interface, "Start reading thread");
- NOTICE(binder_interface, "%s device opened and reading", device.c_str());
+ DEBUG(binder_interface, "%s: Start reading thread", __FUNCTION__);
+ NOTICE(binder_interface, "%s: %s device opened and reading", __FUNCTION__, device.c_str());
can_bus_t::can_devices_[device]->start_reading(*this);
i++;
}
else
{
- ERROR(binder_interface, "Can't open device %s", device.c_str());
+ ERROR(binder_interface, "%s: Can't open device %s", __FUNCTION__, device.c_str());
return 1;
}
}
- NOTICE(binder_interface, "Initialized %d/%d can bus device(s)", i, (int)t);
+ NOTICE(binder_interface, "%s: Initialized %d/%d can bus device(s)", __FUNCTION__, i, (int)t);
return 0;
}
- ERROR(binder_interface, "init_can_dev: Error at CAN device initialization. No devices read from configuration file");
+ ERROR(binder_interface, "%s: Error at CAN device initialization. No devices read from configuration file", __FUNCTION__);
return 1;
}
- ERROR(binder_interface, "init_can_dev: Can't read INI configuration file");
+ ERROR(binder_interface, "%s: Can't read INI configuration file", __FUNCTION__);
return 2;
}
@@ -293,7 +293,7 @@ can_message_t can_bus_t::next_can_message()
{
can_msg = can_message_q_.front();
can_message_q_.pop();
- DEBUG(binder_interface, "next_can_message: 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(),
+ DEBUG(binder_interface, "%s: Here is the next can message : id %X, length %X, data %02X%02X%02X%02X%02X%02X%02X%02X", __FUNCTION__, 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;
}
@@ -320,7 +320,7 @@ openxc_VehicleMessage can_bus_t::next_vehicle_message()
{
v_msg = vehicle_message_q_.front();
vehicle_message_q_.pop();
- DEBUG(binder_interface, "next_vehicle_message: next vehicle message poped");
+ DEBUG(binder_interface, "%s: next vehicle message poped", __FUNCTION__);
return v_msg;
}
diff --git a/CAN-binder/low-can-binding/can/can-decoder.cpp b/CAN-binder/low-can-binding/can/can-decoder.cpp
index 8843059d..a6c064db 100644
--- a/CAN-binder/low-can-binding/can/can-decoder.cpp
+++ b/CAN-binder/low-can-binding/can/can-decoder.cpp
@@ -130,7 +130,7 @@ openxc_DynamicField decoder_t::stateDecoder(can_signal_t& signal,
if(signal_state.size() <= 0)
{
*send = false;
- ERROR(binder_interface, "stateDecoder: No state found with index: %d", (int)value);
+ ERROR(binder_interface, "%s: No state found with index: %d", __FUNCTION__, (int)value);
}
return decoded_value;
}
@@ -153,7 +153,7 @@ openxc_DynamicField decoder_t::translateSignal(can_signal_t& signal, can_message
const std::vector<can_signal_t>& signals)
{
float value = decoder_t::parseSignalBitfield(signal, message);
- DEBUG(binder_interface, "translateSignal: Decoded message from parseSignalBitfield: %f", value);
+ DEBUG(binder_interface, "%s: Decoded message from parseSignalBitfield: %f", __FUNCTION__, value);
bool send = true;
// Must call the decoders every time, regardless of if we are going to
diff --git a/CAN-binder/low-can-binding/can/can-message.cpp b/CAN-binder/low-can-binding/can/can-message.cpp
index f61de67e..f27dce3f 100644
--- a/CAN-binder/low-can-binding/can/can-message.cpp
+++ b/CAN-binder/low-can-binding/can/can-message.cpp
@@ -140,7 +140,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::ERROR)
format_ = new_format;
else
- ERROR(binder_interface, "ERROR: Can set format, wrong format chosen");
+ ERROR(binder_interface, "%s: Can set format, wrong format chosen", __FUNCTION__);
}
///
@@ -164,15 +164,15 @@ can_message_t can_message_t::convert_from_canfd_frame(const struct canfd_frame&
switch(nbytes)
{
case CANFD_MTU:
- DEBUG(binder_interface, "set_max_data_length: Got an CAN FD frame");
+ DEBUG(binder_interface, "%s: Got an CAN FD frame", __FUNCTION__);
maxdlen = CANFD_MAX_DLEN;
break;
case CAN_MTU:
- DEBUG(binder_interface, "set_max_data_length: Got a legacy CAN frame");
+ DEBUG(binder_interface, "%s: Got a legacy CAN frame", __FUNCTION__);
maxdlen = CAN_MAX_DLEN;
break;
default:
- ERROR(binder_interface, "set_max_data_length: unsupported CAN frame");
+ ERROR(binder_interface, "%s: unsupported CAN frame", __FUNCTION__);
break;
}
@@ -195,7 +195,7 @@ can_message_t can_message_t::convert_from_canfd_frame(const struct canfd_frame&
id = frame.can_id & (CAN_ERR_MASK|CAN_ERR_FLAG);
break;
default:
- ERROR(binder_interface, "ERROR: Can set id, not a compatible format or format not set prior to set id.");
+ ERROR(binder_interface, "%s: Can set id, not a compatible format or format not set prior to set id.", __FUNCTION__);
break;
}
@@ -233,7 +233,7 @@ can_message_t can_message_t::convert_from_canfd_frame(const struct canfd_frame&
data.push_back(frame.data[i]);
};
- DEBUG(binder_interface, "convert_from_canfd_frame: Found id: %X, format: %X, length: %X, data %02X%02X%02X%02X%02X%02X%02X%02X",
+ DEBUG(binder_interface, "%s: Found id: %X, format: %X, length: %X, data %02X%02X%02X%02X%02X%02X%02X%02X", __FUNCTION__,
id, (uint8_t)format, length, data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
}
@@ -258,7 +258,7 @@ canfd_frame can_message_t::convert_to_canfd_frame()
::memcpy(frame.data, get_data(), length_);
}
else
- ERROR(binder_interface, "can_message_t not correctly initialized to be sent");
+ ERROR(binder_interface, "%s: can_message_t not correctly initialized to be sent", __FUNCTION__);
return frame;
}