summaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--low-can-binding/binding/low-can-cb.cpp18
-rw-r--r--low-can-binding/binding/low-can-hat.cpp2
-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
-rw-r--r--low-can-binding/diagnostic/active-diagnostic-request.cpp4
-rw-r--r--low-can-binding/diagnostic/diagnostic-manager.cpp24
-rw-r--r--low-can-binding/utils/config-parser.cpp6
-rw-r--r--low-can-binding/utils/signals.cpp6
-rw-r--r--low-can-binding/utils/socketcan-bcm.cpp12
-rw-r--r--low-can-binding/utils/socketcan-raw.cpp12
-rw-r--r--low-can-binding/utils/socketcan.hpp2
12 files changed, 61 insertions, 61 deletions
diff --git a/low-can-binding/binding/low-can-cb.cpp b/low-can-binding/binding/low-can-cb.cpp
index 824aa81..e2ddf07 100644
--- a/low-can-binding/binding/low-can-cb.cpp
+++ b/low-can-binding/binding/low-can-cb.cpp
@@ -105,7 +105,7 @@ static int make_subscription_unsubscription(struct afb_req request, std::shared_
/* Make the subscription or unsubscription to the event */
if (((subscribe ? afb_req_subscribe : afb_req_unsubscribe)(request, s[can_subscription->get_index()]->get_event())) < 0)
{
- ERROR("Operation goes wrong for signal: %s", can_subscription->get_name().c_str());
+ AFB_ERROR("Operation goes wrong for signal: %s", can_subscription->get_name().c_str());
return -1;
}
return 0;
@@ -118,7 +118,7 @@ static int create_event_handle(std::shared_ptr<low_can_subscription_t>& can_subs
s[sub_index] = can_subscription;
if (!afb_event_is_valid(s[sub_index]->get_event()))
{
- ERROR("Can't create an event for %s, something goes wrong.", can_subscription->get_name().c_str());
+ AFB_ERROR("Can't create an event for %s, something goes wrong.", can_subscription->get_name().c_str());
return -1;
}
return 0;
@@ -136,7 +136,7 @@ static int subscribe_unsubscribe_signal(struct afb_req request, bool subscribe,
{
if (!afb_event_is_valid(s[sub_index]->get_event()) && !subscribe)
{
- NOTICE("Event isn't valid, no need to unsubscribed.");
+ AFB_NOTICE("Event isn't valid, no need to unsubscribed.");
ret = -1;
}
ret = 0;
@@ -192,22 +192,22 @@ static int subscribe_unsubscribe_diagnostic_messages(struct afb_req request, boo
diag_m.add_recurring_request(diag_req, sig->get_name().c_str(), false, sig->get_decoder(), sig->get_callback(), event_filter.frequency);
if(can_subscription->create_rx_filter(sig) < 0)
{return -1;}
- DEBUG("Signal: %s subscribed", sig->get_name().c_str());
+ AFB_DEBUG("Signal: %s subscribed", sig->get_name().c_str());
if(it == s.end() && add_to_event_loop(can_subscription) < 0)
{
diag_m.cleanup_request(
diag_m.find_recurring_request(*diag_req), true);
- WARNING("signal: %s isn't supported. Canceling operation.", sig->get_name().c_str());
+ AFB_WARNING("signal: %s isn't supported. Canceling operation.", sig->get_name().c_str());
return -1;
}
}
else
{
if(sig->get_supported())
- {DEBUG("%s cancelled due to unsubscribe", sig->get_name().c_str());}
+ {AFB_DEBUG("%s cancelled due to unsubscribe", sig->get_name().c_str());}
else
{
- WARNING("signal: %s isn't supported. Canceling operation.", sig->get_name().c_str());
+ AFB_WARNING("signal: %s isn't supported. Canceling operation.", sig->get_name().c_str());
return -1;
}
}
@@ -246,7 +246,7 @@ static int subscribe_unsubscribe_can_signals(struct afb_req request, bool subscr
{return -1;}
rets++;
- DEBUG("signal: %s subscribed", sig->get_name().c_str());
+ AFB_DEBUG("signal: %s subscribed", sig->get_name().c_str());
}
return rets;
}
@@ -308,7 +308,7 @@ static int one_subscribe_unsubscribe(struct afb_req request, bool subscribe, con
openxc_DynamicField search_key = build_DynamicField(tag);
sf = utils::signals_manager_t::instance().find_signals(search_key);
if (sf.can_signals.empty() && sf.diagnostic_messages.empty())
- NOTICE("No signal(s) found for %s.", tag.c_str());
+ AFB_NOTICE("No signal(s) found for %s.", tag.c_str());
else
ret = subscribe_unsubscribe_signals(request, subscribe, sf, event_filter);
diff --git a/low-can-binding/binding/low-can-hat.cpp b/low-can-binding/binding/low-can-hat.cpp
index 7113b69..fc6f9b5 100644
--- a/low-can-binding/binding/low-can-hat.cpp
+++ b/low-can-binding/binding/low-can-hat.cpp
@@ -67,7 +67,7 @@ extern "C"
if(application_t::instance().get_diagnostic_manager().initialize())
return 0;
- ERROR("There was something wrong with CAN device Initialization.");
+ AFB_ERROR("There was something wrong with CAN device Initialization.");
return 1;
}
};
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;
}
diff --git a/low-can-binding/diagnostic/active-diagnostic-request.cpp b/low-can-binding/diagnostic/active-diagnostic-request.cpp
index f503e0a..1ccb2e7 100644
--- a/low-can-binding/diagnostic/active-diagnostic-request.cpp
+++ b/low-can-binding/diagnostic/active-diagnostic-request.cpp
@@ -22,7 +22,7 @@
#include "../binding/application.hpp"
-#define ERROR_PID 0xFF
+#define AFB_ERROR_PID 0xFF
std::string active_diagnostic_request_t::prefix_ = "diagnostic_messages";
@@ -100,7 +100,7 @@ uint16_t active_diagnostic_request_t::get_pid() const
{
if (handle_->request.has_pid)
return handle_->request.pid;
- return ERROR_PID;
+ return AFB_ERROR_PID;
}
DiagnosticRequestHandle* active_diagnostic_request_t::get_handle()
diff --git a/low-can-binding/diagnostic/diagnostic-manager.cpp b/low-can-binding/diagnostic/diagnostic-manager.cpp
index 61aa699..89303f1 100644
--- a/low-can-binding/diagnostic/diagnostic-manager.cpp
+++ b/low-can-binding/diagnostic/diagnostic-manager.cpp
@@ -52,7 +52,7 @@ bool diagnostic_manager_t::initialize()
reset();
initialized_ = true;
- DEBUG("Diagnostic Manager initialized");
+ AFB_DEBUG("Diagnostic Manager initialized");
return initialized_;
}
@@ -62,13 +62,13 @@ bool diagnostic_manager_t::initialize()
void diagnostic_manager_t::init_diagnostic_shims()
{
shims_ = diagnostic_init_shims(shims_logger, shims_send, NULL);
- DEBUG("Shims initialized");
+ AFB_DEBUG("Shims initialized");
}
/// @brief Force cleanup all active requests.
void diagnostic_manager_t::reset()
{
- DEBUG("Clearing existing diagnostic requests");
+ AFB_DEBUG("Clearing existing diagnostic requests");
cleanup_active_requests(true);
}
@@ -132,7 +132,7 @@ void diagnostic_manager_t::shims_logger(const char* format, ...)
char buffer[256];
vsnprintf(buffer, 256, format, args);
- DEBUG("%s", buffer);
+ AFB_DEBUG("%s", buffer);
va_end(args);
}
@@ -201,11 +201,11 @@ void diagnostic_manager_t::cleanup_request(active_diagnostic_request_t* entry, b
{
cancel_request(entry);
find_and_erase(entry, recurring_requests_);
- DEBUG("Cancelling completed, recurring request: %s", request_string);
+ AFB_DEBUG("Cancelling completed, recurring request: %s", request_string);
}
else if (!entry->get_recurring())
{
- DEBUG("Cancelling completed, non-recurring request: %s", request_string);
+ AFB_DEBUG("Cancelling completed, non-recurring request: %s", request_string);
cancel_request(entry);
find_and_erase(entry, non_recurring_requests_);
}
@@ -297,14 +297,14 @@ active_diagnostic_request_t* diagnostic_manager_t::add_request(DiagnosticRequest
// Erase any existing request not already cleaned.
cleanup_request(entry, true);
- DEBUG("Added one-time diagnostic request on bus %s: %s",
+ AFB_DEBUG("Added one-time diagnostic request on bus %s: %s",
bus_.c_str(), request_string);
non_recurring_requests_.push_back(entry);
}
else
{
- WARNING("There isn't enough request entry. Vector exhausted %d/%d", (int)non_recurring_requests_.size(), MAX_SIMULTANEOUS_DIAG_REQUESTS);
+ AFB_WARNING("There isn't enough request entry. Vector exhausted %d/%d", (int)non_recurring_requests_.size(), MAX_SIMULTANEOUS_DIAG_REQUESTS);
non_recurring_requests_.resize(MAX_SIMULTANEOUS_DIAG_REQUESTS);
}
return entry;
@@ -319,7 +319,7 @@ active_diagnostic_request_t* diagnostic_manager_t::add_request(DiagnosticRequest
bool diagnostic_manager_t::validate_optional_request_attributes(float frequencyHz)
{
if(frequencyHz > MAX_RECURRING_DIAGNOSTIC_FREQUENCY_HZ) {
- DEBUG("Requested recurring diagnostic frequency %lf is higher than maximum of %d",
+ AFB_DEBUG("Requested recurring diagnostic frequency %lf is higher than maximum of %d",
frequencyHz, MAX_RECURRING_DIAGNOSTIC_FREQUENCY_HZ);
return false;
}
@@ -377,12 +377,12 @@ active_diagnostic_request_t* diagnostic_manager_t::add_recurring_request(Diagnos
}
else
{
- WARNING("There isn't enough request entry. Vector exhausted %d/%d", (int)recurring_requests_.size(), MAX_SIMULTANEOUS_DIAG_REQUESTS);
+ AFB_WARNING("There isn't enough request entry. Vector exhausted %d/%d", (int)recurring_requests_.size(), MAX_SIMULTANEOUS_DIAG_REQUESTS);
recurring_requests_.resize(MAX_SIMULTANEOUS_DIAG_REQUESTS);
}
}
else
- { DEBUG("Can't add request, one already exists with same key");}
+ { AFB_DEBUG("Can't add request, one already exists with same key");}
return entry;
}
@@ -425,7 +425,7 @@ openxc_VehicleMessage diagnostic_manager_t::relay_diagnostic_response(active_dia
found_signals = utils::signals_manager_t::instance().find_signals(build_DynamicField(adr->get_name()));
found_signals.diagnostic_messages.front()->set_supported(false);
cleanup_request(adr, true);
- NOTICE("PID not supported or ill formed. Please unsubscribe from it. Error code : %d", response.negative_response_code);
+ AFB_NOTICE("PID not supported or ill formed. Please unsubscribe from it. Error code : %d", response.negative_response_code);
message = build_VehicleMessage(build_SimpleMessage(adr->get_name(), build_DynamicField("This PID isn't supported by your vehicle.")));
}
diff --git a/low-can-binding/utils/config-parser.cpp b/low-can-binding/utils/config-parser.cpp
index 8ccf5bc..e3936eb 100644
--- a/low-can-binding/utils/config-parser.cpp
+++ b/low-can-binding/utils/config-parser.cpp
@@ -39,10 +39,10 @@ namespace utils
{
if (config_content_.size() <= 0)
{
- ERROR("Can't load the INI config file.");
+ AFB_ERROR("Can't load the INI config file.");
return false;
}
- DEBUG("Configuration file parsed");
+ AFB_DEBUG("Configuration file parsed");
return true;
}
@@ -64,4 +64,4 @@ namespace utils
return devices_name;
}
-} \ No newline at end of file
+}
diff --git a/low-can-binding/utils/signals.cpp b/low-can-binding/utils/signals.cpp
index fbc4904..5c08eaa 100644
--- a/low-can-binding/utils/signals.cpp
+++ b/low-can-binding/utils/signals.cpp
@@ -68,10 +68,10 @@ namespace utils
lookup_signals_by_id(key.numeric_value, application_t::instance().get_diagnostic_messages(), sf.diagnostic_messages);
break;
default:
- ERROR("wrong openxc_DynamicField specified. Use openxc_DynamicField_Type_NUM or openxc_DynamicField_Type_STRING type only.");
+ AFB_ERROR("wrong openxc_DynamicField specified. Use openxc_DynamicField_Type_NUM or openxc_DynamicField_Type_STRING type only.");
break;
}
- DEBUG("Found %d signal(s)", (int)(sf.can_signals.size() + sf.diagnostic_messages.size()));
+ AFB_DEBUG("Found %d signal(s)", (int)(sf.can_signals.size() + sf.diagnostic_messages.size()));
return sf;
}
-} \ No newline at end of file
+}
diff --git a/low-can-binding/utils/socketcan-bcm.cpp b/low-can-binding/utils/socketcan-bcm.cpp
index e16b246..39b53f5 100644
--- a/low-can-binding/utils/socketcan-bcm.cpp
+++ b/low-can-binding/utils/socketcan-bcm.cpp
@@ -45,10 +45,10 @@ namespace utils
// Attempts to open a socket to CAN bus
::strcpy(ifr.ifr_name, device_name.c_str());
- DEBUG("BCM socket ifr_name is : %s", ifr.ifr_name);
+ AFB_DEBUG("BCM socket ifr_name is : %s", ifr.ifr_name);
if(::ioctl(socket_, SIOCGIFINDEX, &ifr) < 0)
{
- ERROR("ioctl failed. Error was : %s", strerror(errno));
+ AFB_ERROR("ioctl failed. Error was : %s", strerror(errno));
close();
}
else
@@ -58,7 +58,7 @@ namespace utils
if(connect((struct sockaddr *)&tx_address_, sizeof(tx_address_)) < 0)
{
- ERROR("Connect failed. %s", strerror(errno));
+ AFB_ERROR("Connect failed. %s", strerror(errno));
close();
}
// Needed because of using systemD event loop. See sd_event_add_io manual.
@@ -84,8 +84,8 @@ namespace utils
ioctl(s.socket(), SIOCGIFNAME, &ifr);
long unsigned int frame_size = nbytes-sizeof(struct bcm_msg_head);
- DEBUG("Data available: %li bytes read. BCM head, opcode: %i, can_id: %i, nframes: %i", frame_size, msg.msg_head.opcode, msg.msg_head.can_id, msg.msg_head.nframes);
- DEBUG("read: Found on bus %s:\n id: %X, length: %X, data %02X%02X%02X%02X%02X%02X%02X%02X", ifr.ifr_name, msg.msg_head.can_id, msg.frames.can_dlc,
+ AFB_DEBUG("Data available: %li bytes read. BCM head, opcode: %i, can_id: %i, nframes: %i", frame_size, msg.msg_head.opcode, msg.msg_head.can_id, msg.msg_head.nframes);
+ AFB_DEBUG("read: Found on bus %s:\n id: %X, length: %X, data %02X%02X%02X%02X%02X%02X%02X%02X", ifr.ifr_name, msg.msg_head.can_id, msg.frames.can_dlc,
msg.frames.data[0], msg.frames.data[1], msg.frames.data[2], msg.frames.data[3], msg.frames.data[4], msg.frames.data[5], msg.frames.data[6], msg.frames.data[7]);
struct timeval tv;
@@ -98,4 +98,4 @@ namespace utils
return s;
}
-} \ No newline at end of file
+}
diff --git a/low-can-binding/utils/socketcan-raw.cpp b/low-can-binding/utils/socketcan-raw.cpp
index 31965c3..58b443b 100644
--- a/low-can-binding/utils/socketcan-raw.cpp
+++ b/low-can-binding/utils/socketcan-raw.cpp
@@ -42,10 +42,10 @@ namespace utils
// Attempts to open a socket to CAN bus
::strcpy(ifr.ifr_name, device_name.c_str());
- DEBUG("ifr_name is : %s", ifr.ifr_name);
+ AFB_DEBUG("ifr_name is : %s", ifr.ifr_name);
if(::ioctl(socket_, SIOCGIFINDEX, &ifr) < 0)
{
- ERROR("ioctl failed. Error was : %s", strerror(errno));
+ AFB_ERROR("ioctl failed. Error was : %s", strerror(errno));
close();
}
else
@@ -55,7 +55,7 @@ namespace utils
if(bind((struct sockaddr *)&tx_address_, sizeof(tx_address_)) < 0)
{
- ERROR("Bind failed. %s", strerror(errno));
+ AFB_ERROR("Bind failed. %s", strerror(errno));
close();
}
}
@@ -74,8 +74,8 @@ namespace utils
ifr.ifr_ifindex = addr.can_ifindex;
ioctl(s.socket(), SIOCGIFNAME, &ifr);
- DEBUG("Data available: %i bytes read", (int)nbytes);
- DEBUG("read: Found on bus %s:\n id: %X, length: %X, data %02X%02X%02X%02X%02X%02X%02X%02X", ifr.ifr_name, frame.can_id, frame.len,
+ AFB_DEBUG("Data available: %i bytes read", (int)nbytes);
+ AFB_DEBUG("read: Found on bus %s:\n id: %X, length: %X, data %02X%02X%02X%02X%02X%02X%02X%02X", ifr.ifr_name, frame.can_id, frame.len,
frame.data[0], frame.data[1], frame.data[2], frame.data[3], frame.data[4], frame.data[5], frame.data[6], frame.data[7]);
struct timeval tv;
@@ -85,4 +85,4 @@ namespace utils
return s;
}
-} \ No newline at end of file
+}
diff --git a/low-can-binding/utils/socketcan.hpp b/low-can-binding/utils/socketcan.hpp
index 82b797e..40e165b 100644
--- a/low-can-binding/utils/socketcan.hpp
+++ b/low-can-binding/utils/socketcan.hpp
@@ -65,7 +65,7 @@ namespace utils
socketcan_t& operator<<(socketcan_t& s, const T& obj)
{
if (::sendto(s.socket(), &obj, sizeof(obj), 0, (const struct sockaddr*)&s.get_tx_address(), sizeof(s.get_tx_address())) < 0)
- ERROR("Error sending : %i %s", errno, ::strerror(errno));
+ AFB_ERROR("Error sending : %i %s", errno, ::strerror(errno));
return s;
}
}