summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-06-08 15:25:27 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-06-09 11:43:31 +0200
commit32fb0e5b1949ef115e92de9457cb4e83854e51f2 (patch)
treebb9444fb67783eda6a187acf17bcdffcdea4f8ec
parentce2bd1c557ae2cb44db1794909f129e82286c305 (diff)
Migration to AFB Binding V2
No more binder interface needed to use logging macros and others stuff like make_event or any other calls Change-Id: Iaee60697373bc8a0e67518e924b36b5389533e68 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--CAN-binder/low-can-binding/binding/low-can-cb.cpp22
-rw-r--r--CAN-binder/low-can-binding/binding/low-can-hat.cpp38
-rw-r--r--CAN-binder/low-can-binding/binding/low-can-hat.hpp6
-rw-r--r--CAN-binder/low-can-binding/can/can-bus.cpp10
-rw-r--r--CAN-binder/low-can-binding/can/can-decoder.cpp4
-rw-r--r--CAN-binder/low-can-binding/can/can-message.cpp20
-rw-r--r--CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp24
-rw-r--r--CAN-binder/low-can-binding/utils/config-parser.cpp4
-rw-r--r--CAN-binder/low-can-binding/utils/signals.cpp4
-rw-r--r--CAN-binder/low-can-binding/utils/socketcan-bcm.cpp10
-rw-r--r--CAN-binder/low-can-binding/utils/socketcan-raw.cpp10
-rw-r--r--CAN-binder/low-can-binding/utils/socketcan.hpp2
12 files changed, 72 insertions, 82 deletions
diff --git a/CAN-binder/low-can-binding/binding/low-can-cb.cpp b/CAN-binder/low-can-binding/binding/low-can-cb.cpp
index e352101..97b6d20 100644
--- a/CAN-binder/low-can-binding/binding/low-can-cb.cpp
+++ b/CAN-binder/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(binder_interface, "%s: Operation goes wrong for signal: %s", __FUNCTION__, can_subscription->get_name().c_str());
+ ERROR("Operation goes wrong for signal: %s", can_subscription->get_name().c_str());
return -1;
}
return 0;
@@ -114,11 +114,11 @@ static int make_subscription_unsubscription(struct afb_req request, std::shared_
static int create_event_handle(std::shared_ptr<low_can_subscription_t>& can_subscription, std::map<int, std::shared_ptr<low_can_subscription_t> >& s)
{
int sub_index = can_subscription->get_index();
- can_subscription->set_event(afb_daemon_make_event(binder_interface->daemon, can_subscription->get_name().c_str()));
+ can_subscription->set_event(afb_daemon_make_event(can_subscription->get_name().c_str()));
s[sub_index] = can_subscription;
if (!afb_event_is_valid(s[sub_index]->get_event()))
{
- ERROR(binder_interface, "%s: Can't create an event for %s, something goes wrong.", __FUNCTION__, can_subscription->get_name().c_str());
+ 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(binder_interface, "%s: Event isn't valid, no need to unsubscribed.", __FUNCTION__);
+ NOTICE("Event isn't valid, no need to unsubscribed.");
ret = -1;
}
ret = 0;
@@ -159,7 +159,7 @@ static int subscribe_unsubscribe_signal(struct afb_req request, bool subscribe,
static int add_to_event_loop(std::shared_ptr<low_can_subscription_t>& can_subscription)
{
struct sd_event_source* event_source = nullptr;
- return ( sd_event_add_io(afb_daemon_get_event_loop(binder_interface->daemon),
+ return ( sd_event_add_io(afb_daemon_get_event_loop(),
&event_source,
can_subscription->get_socket().socket(),
EPOLLIN,
@@ -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(binder_interface, "%s: Signal: %s subscribed", __FUNCTION__, sig->get_name().c_str());
+ 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(binder_interface, "%s: signal: %s isn't supported. Canceling operation.", __FUNCTION__, sig->get_name().c_str());
+ WARNING("signal: %s isn't supported. Canceling operation.", sig->get_name().c_str());
return -1;
}
}
else
{
if(sig->get_supported())
- {DEBUG(binder_interface, "%s: %s cancelled due to unsubscribe", __FUNCTION__, sig->get_name().c_str());}
+ {DEBUG("%s cancelled due to unsubscribe", sig->get_name().c_str());}
else
{
- WARNING(binder_interface, "%s: signal: %s isn't supported. Canceling operation.", __FUNCTION__, sig->get_name().c_str());
+ WARNING("signal: %s isn't supported. Canceling operation.", sig->get_name().c_str());
return -1;
}
}
@@ -245,7 +245,7 @@ static int subscribe_unsubscribe_can_signals(struct afb_req request, bool subscr
{return -1;}
rets++;
- DEBUG(binder_interface, "%s: signal: %s subscribed", __FUNCTION__, sig->get_name().c_str());
+ DEBUG("signal: %s subscribed", sig->get_name().c_str());
}
return rets;
}
@@ -307,7 +307,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(binder_interface, "%s: No signal(s) found for %s.", __FUNCTION__, tag.c_str());
+ NOTICE("No signal(s) found for %s.", tag.c_str());
else
ret = subscribe_unsubscribe_signals(request, subscribe, sf, event_filter);
diff --git a/CAN-binder/low-can-binding/binding/low-can-hat.cpp b/CAN-binder/low-can-binding/binding/low-can-hat.cpp
index e8e5629..7113b69 100644
--- a/CAN-binder/low-can-binding/binding/low-can-hat.cpp
+++ b/CAN-binder/low-can-binding/binding/low-can-hat.cpp
@@ -28,39 +28,33 @@
#include "application.hpp"
#include "../can/can-bus.hpp"
-// Interface between the daemon and the binding
-const struct afb_binding_interface *binder_interface;
-
extern "C"
{
- static const struct afb_verb_desc_v1 verbs[]=
+ static int initv2();
+
+ static const struct afb_verb_v2 verbs[]=
{
- { .name= "subscribe", .session= AFB_SESSION_NONE, .callback= subscribe, .info= "subscribe to notification of CAN bus messages." },
- { .name= "unsubscribe", .session= AFB_SESSION_NONE, .callback= unsubscribe, .info= "unsubscribe a previous subscription." }
+ { .verb= "subscribe", .callback= subscribe, .auth= NULL, .session= AFB_SESSION_NONE},
+ { .verb= "unsubscribe", .callback= unsubscribe, .auth= NULL, .session= AFB_SESSION_NONE},
+ { .verb= NULL, .callback= NULL, .auth= NULL, .session= 0}
};
- static const struct afb_binding binding_desc {
- AFB_BINDING_VERSION_1,
- {
- "Low level CAN bus service",
- "low-can",
- verbs
- }
+ const struct afb_binding_v2 afbBindingV2 {
+ .api = "low-can",
+ .specification = NULL,
+ .verbs = verbs,
+ .preinit = NULL,
+ .init = initv2,
+ .onevent = NULL,
+ .noconcurrency = 0
};
- const struct afb_binding *afbBindingV1Register (const struct afb_binding_interface *itf)
- {
- binder_interface = itf;
-
- return &binding_desc;
- }
-
/// @brief Initialize the binding.
///
/// @param[in] service Structure which represent the Application Framework Binder.
///
/// @return Exit code, zero if success.
- int afbBindingV1ServiceInit(struct afb_service service)
+ static int initv2()
{
can_bus_t& can_bus_manager = application_t::instance().get_can_bus_manager();
@@ -73,7 +67,7 @@ extern "C"
if(application_t::instance().get_diagnostic_manager().initialize())
return 0;
- ERROR(binder_interface, "%s: There was something wrong with CAN device Initialization.", __FUNCTION__);
+ ERROR("There was something wrong with CAN device Initialization.");
return 1;
}
};
diff --git a/CAN-binder/low-can-binding/binding/low-can-hat.hpp b/CAN-binder/low-can-binding/binding/low-can-hat.hpp
index 34dd80b..cf3d999 100644
--- a/CAN-binder/low-can-binding/binding/low-can-hat.hpp
+++ b/CAN-binder/low-can-binding/binding/low-can-hat.hpp
@@ -26,14 +26,10 @@
extern "C"
{
- #define AFB_BINDING_VERSION 1
+ #define AFB_BINDING_VERSION 2
#include <afb/afb-binding.h>
};
-extern "C" struct afb_binding_interface;
-
-extern const struct afb_binding_interface *binder_interface;
-
class low_can_subscription_t;
void on_no_clients(std::shared_ptr<low_can_subscription_t> can_subscription, std::map<int, std::shared_ptr<low_can_subscription_t> >& s);
diff --git a/CAN-binder/low-can-binding/can/can-bus.cpp b/CAN-binder/low-can-binding/can/can-bus.cpp
index e481a1b..1d3fce9 100644
--- a/CAN-binder/low-can-binding/can/can-bus.cpp
+++ b/CAN-binder/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(binder_interface, "%s: %s CAN signals processed.", __FUNCTION__, sig->get_name().c_str());
+ 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(binder_interface, "%s: %s CAN signals processed.", __FUNCTION__, s[subscription_id]->get_name().c_str());
+ 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(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(),
+ 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(binder_interface, "%s: next vehicle message poped", __FUNCTION__);
+ DEBUG("next vehicle message poped");
return v_msg;
}
@@ -299,7 +299,7 @@ void can_bus_t::set_can_devices()
if(can_devices_.empty())
{
- ERROR(binder_interface, "%s: No mapping found in config file: '%s'. Check it that it have a CANbus-mapping section.",
+ ERROR("No mapping found in config file: '%s'. Check it that it have a CANbus-mapping section.",
__FUNCTION__, conf_file_.filepath().c_str());
}
}
diff --git a/CAN-binder/low-can-binding/can/can-decoder.cpp b/CAN-binder/low-can-binding/can/can-decoder.cpp
index 3e21397..61bfe75 100644
--- a/CAN-binder/low-can-binding/can/can-decoder.cpp
+++ b/CAN-binder/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(binder_interface, "%s: No state found with index: %d", __FUNCTION__, (int)value);
+ 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(binder_interface, "%s: Decoded message from parseSignalBitfield: %f", __FUNCTION__, value);
+ 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.
diff --git a/CAN-binder/low-can-binding/can/can-message.cpp b/CAN-binder/low-can-binding/can/can-message.cpp
index 10b3232..057bc71 100644
--- a/CAN-binder/low-can-binding/can/can-message.cpp
+++ b/CAN-binder/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(binder_interface, "%s: Can set format, wrong format chosen", __FUNCTION__);
+ 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(binder_interface, "%s: Got an CAN FD frame", __FUNCTION__);
+ DEBUG("Got an CAN FD frame");
maxdlen = CANFD_MAX_DLEN;
break;
case CAN_MTU:
- DEBUG(binder_interface, "%s: Got a legacy CAN frame", __FUNCTION__);
+ DEBUG("Got a legacy CAN frame");
maxdlen = CAN_MAX_DLEN;
break;
default:
- ERROR(binder_interface, "%s: unsupported CAN frame", __FUNCTION__);
+ 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(binder_interface, "%s: Found id: %X, format: %X, length: %X, data %02X%02X%02X%02X%02X%02X%02X%02X", __FUNCTION__,
+ 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(binder_interface, "%s: Got a legacy CAN frame", __FUNCTION__);
+ DEBUG("Got a legacy CAN frame");
maxdlen = CAN_MAX_DLEN;
}
else
{
- ERROR(binder_interface, "%s: unsupported CAN frame", __FUNCTION__);
+ 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(binder_interface, "%s: Found id: %X, format: %X, length: %X, data %02X%02X%02X%02X%02X%02X%02X%02X", __FUNCTION__,
+// 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(binder_interface, "%s: can_message_t not correctly initialized to be sent", __FUNCTION__);
+ 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(binder_interface, "%s: can_message_t not correctly initialized to be sent", __FUNCTION__);
+ ERROR("can_message_t not correctly initialized to be sent");
return frame;
}
diff --git a/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp b/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp
index cfabfea..61aa699 100644
--- a/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp
+++ b/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp
@@ -52,7 +52,7 @@ bool diagnostic_manager_t::initialize()
reset();
initialized_ = true;
- DEBUG(binder_interface, "%s: Diagnostic Manager initialized", __FUNCTION__);
+ 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(binder_interface, "%s: Shims initialized", __FUNCTION__);
+ DEBUG("Shims initialized");
}
/// @brief Force cleanup all active requests.
void diagnostic_manager_t::reset()
{
- DEBUG(binder_interface, "%s: Clearing existing diagnostic requests", __FUNCTION__);
+ 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(binder_interface, "%s: %s", __FUNCTION__, buffer);
+ 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(binder_interface, "%s: Cancelling completed, recurring request: %s", __FUNCTION__, request_string);
+ DEBUG("Cancelling completed, recurring request: %s", request_string);
}
else if (!entry->get_recurring())
{
- DEBUG(binder_interface, "%s: Cancelling completed, non-recurring request: %s", __FUNCTION__, request_string);
+ 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(binder_interface, "%s: Added one-time diagnostic request on bus %s: %s", __FUNCTION__,
+ DEBUG("Added one-time diagnostic request on bus %s: %s",
bus_.c_str(), request_string);
non_recurring_requests_.push_back(entry);
}
else
{
- WARNING(binder_interface, "%s: There isn't enough request entry. Vector exhausted %d/%d", __FUNCTION__, (int)non_recurring_requests_.size(), MAX_SIMULTANEOUS_DIAG_REQUESTS);
+ 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(binder_interface, "%s: Requested recurring diagnostic frequency %lf is higher than maximum of %d", __FUNCTION__,
+ 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(binder_interface, "%s: There isn't enough request entry. Vector exhausted %d/%d", __FUNCTION__, (int)recurring_requests_.size(), MAX_SIMULTANEOUS_DIAG_REQUESTS);
+ 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(binder_interface, "%s: Can't add request, one already exists with same key", __FUNCTION__);}
+ { 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(binder_interface, "%s: PID not supported or ill formed. Please unsubscribe from it. Error code : %d", __FUNCTION__, response.negative_response_code);
+ 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/CAN-binder/low-can-binding/utils/config-parser.cpp b/CAN-binder/low-can-binding/utils/config-parser.cpp
index 3f33812..8ccf5bc 100644
--- a/CAN-binder/low-can-binding/utils/config-parser.cpp
+++ b/CAN-binder/low-can-binding/utils/config-parser.cpp
@@ -39,10 +39,10 @@ namespace utils
{
if (config_content_.size() <= 0)
{
- ERROR(binder_interface, "%s: Can't load the INI config file.", __FUNCTION__);
+ ERROR("Can't load the INI config file.");
return false;
}
- DEBUG(binder_interface, "%s: Configuration file parsed", __FUNCTION__);
+ DEBUG("Configuration file parsed");
return true;
}
diff --git a/CAN-binder/low-can-binding/utils/signals.cpp b/CAN-binder/low-can-binding/utils/signals.cpp
index 703b817..fbc4904 100644
--- a/CAN-binder/low-can-binding/utils/signals.cpp
+++ b/CAN-binder/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(binder_interface, "%s: wrong openxc_DynamicField specified. Use openxc_DynamicField_Type_NUM or openxc_DynamicField_Type_STRING type only.", __FUNCTION__);
+ ERROR("wrong openxc_DynamicField specified. Use openxc_DynamicField_Type_NUM or openxc_DynamicField_Type_STRING type only.");
break;
}
- DEBUG(binder_interface, "%s: Found %d signal(s)", __FUNCTION__, (int)(sf.can_signals.size() + sf.diagnostic_messages.size()));
+ 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/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp b/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp
index 5ee4b1a..e16b246 100644
--- a/CAN-binder/low-can-binding/utils/socketcan-bcm.cpp
+++ b/CAN-binder/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(binder_interface, "%s: BCM socket ifr_name is : %s", __FUNCTION__, ifr.ifr_name);
+ DEBUG("BCM socket ifr_name is : %s", ifr.ifr_name);
if(::ioctl(socket_, SIOCGIFINDEX, &ifr) < 0)
{
- ERROR(binder_interface, "%s: ioctl failed. Error was : %s", __FUNCTION__, strerror(errno));
+ 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(binder_interface, "%s: Connect failed. %s", __FUNCTION__, strerror(errno));
+ 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(binder_interface, "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(binder_interface, "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,
+ 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,
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;
diff --git a/CAN-binder/low-can-binding/utils/socketcan-raw.cpp b/CAN-binder/low-can-binding/utils/socketcan-raw.cpp
index a35a99d..31965c3 100644
--- a/CAN-binder/low-can-binding/utils/socketcan-raw.cpp
+++ b/CAN-binder/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(binder_interface, "%s: ifr_name is : %s", __FUNCTION__, ifr.ifr_name);
+ DEBUG("ifr_name is : %s", ifr.ifr_name);
if(::ioctl(socket_, SIOCGIFINDEX, &ifr) < 0)
{
- ERROR(binder_interface, "%s: ioctl failed. Error was : %s", __FUNCTION__, strerror(errno));
+ 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(binder_interface, "%s: Bind failed. %s", __FUNCTION__, strerror(errno));
+ 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(binder_interface, "Data available: %i bytes read", (int)nbytes);
- DEBUG(binder_interface, "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,
+ 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,
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;
diff --git a/CAN-binder/low-can-binding/utils/socketcan.hpp b/CAN-binder/low-can-binding/utils/socketcan.hpp
index 8300e6b..82b797e 100644
--- a/CAN-binder/low-can-binding/utils/socketcan.hpp
+++ b/CAN-binder/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(binder_interface, "%s: Error sending : %i %s", __FUNCTION__, errno, ::strerror(errno));
+ ERROR("Error sending : %i %s", errno, ::strerror(errno));
return s;
}
}