diff options
Diffstat (limited to 'CAN-binder/low-can-binding')
-rw-r--r-- | CAN-binder/low-can-binding/can/can-bus-dev.cpp | 16 | ||||
-rw-r--r-- | CAN-binder/low-can-binding/can/can-bus.cpp | 18 | ||||
-rw-r--r-- | CAN-binder/low-can-binding/can/can-decoder.cpp | 4 | ||||
-rw-r--r-- | CAN-binder/low-can-binding/can/can-message.cpp | 14 | ||||
-rw-r--r-- | CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp | 38 | ||||
-rw-r--r-- | CAN-binder/low-can-binding/low-can-binding.cpp | 16 | ||||
-rw-r--r-- | CAN-binder/low-can-binding/utils/config-parser.cpp | 4 | ||||
-rw-r--r-- | CAN-binder/low-can-binding/utils/signals.cpp | 7 | ||||
-rw-r--r-- | CAN-binder/low-can-binding/utils/socket.cpp | 8 |
9 files changed, 64 insertions, 61 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, ×tamp_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; } diff --git a/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp b/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp index 7bbd780b..e2fc67d3 100644 --- a/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp +++ b/CAN-binder/low-can-binding/diagnostic/diagnostic-manager.cpp @@ -51,7 +51,7 @@ bool diagnostic_manager_t::initialize() reset(); initialized_ = true; - DEBUG(binder_interface, "initialize: Diagnostic Manager initialized"); + DEBUG(binder_interface, "%s: Diagnostic Manager initialized", __FUNCTION__); return initialized_; } @@ -61,13 +61,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, "init_diagnostic_shims: Shims initialized"); + DEBUG(binder_interface, "%s: Shims initialized", __FUNCTION__); } /// @brief Force cleanup all active requests. void diagnostic_manager_t::reset() { - DEBUG(binder_interface, "Clearing existing diagnostic requests"); + DEBUG(binder_interface, "%s: Clearing existing diagnostic requests", __FUNCTION__); cleanup_active_requests(true); } @@ -86,7 +86,7 @@ bool diagnostic_manager_t::shims_send(const uint32_t arbitration_id, const uint8 std::shared_ptr<can_bus_dev_t> can_bus_dev = can_bus_t::get_can_device(configuration_t::instance().get_diagnostic_manager().bus_); if(can_bus_dev != nullptr) return can_bus_dev->shims_send(arbitration_id, data, size); - ERROR(binder_interface, "shims_send: Can not retrieve diagnostic bus: %s", configuration_t::instance().get_diagnostic_manager().bus_.c_str()); + ERROR(binder_interface, "%s: Can not retrieve diagnostic bus: %s", __FUNCTION__, configuration_t::instance().get_diagnostic_manager().bus_.c_str()); return false; } @@ -105,7 +105,7 @@ void diagnostic_manager_t::shims_logger(const char* format, ...) char buffer[256]; vsnprintf(buffer, 256, format, args); - DEBUG(binder_interface, "shims_logger: %s", buffer); + DEBUG(binder_interface, "%S: %s", __FUNCTION__, buffer); } /// @brief The type signature for a... OpenXC TODO: not used yet. @@ -178,11 +178,11 @@ void diagnostic_manager_t::cleanup_request(active_diagnostic_request_t* entry, b { find_and_erase(entry, recurring_requests_); cancel_request(entry); - DEBUG(binder_interface, "cleanup_request: Cancelling completed, recurring request: %s", request_string); + DEBUG(binder_interface, "%s: Cancelling completed, recurring request: %s", __FUNCTION__, request_string); } else { - DEBUG(binder_interface, "cleanup_request: Cancelling completed, non-recurring request: %s", request_string); + DEBUG(binder_interface, "%s: Cancelling completed, non-recurring request: %s", __FUNCTION__, request_string); find_and_erase(entry, non_recurring_requests_); cancel_request(entry); } @@ -272,14 +272,14 @@ bool diagnostic_manager_t::add_request(DiagnosticRequest* request, const std::st sizeof(request_string)); find_and_erase(entry, non_recurring_requests_); - DEBUG(binder_interface, "Added one-time diagnostic request on bus %s: %s", + DEBUG(binder_interface, "%s: Added one-time diagnostic request on bus %s: %s", __FUNCTION__, bus_.c_str(), request_string); non_recurring_requests_.push_back(entry); } else { - WARNING(binder_interface, "There isn't enough request entry. Vector exhausted %d/%d", (int)non_recurring_requests_.size(), MAX_SIMULTANEOUS_DIAG_REQUESTS); + WARNING(binder_interface, "%s: There isn't enough request entry. Vector exhausted %d/%d", __FUNCTION__, (int)non_recurring_requests_.size(), MAX_SIMULTANEOUS_DIAG_REQUESTS); non_recurring_requests_.resize(MAX_SIMULTANEOUS_DIAG_REQUESTS); added = false; } @@ -289,7 +289,7 @@ bool diagnostic_manager_t::add_request(DiagnosticRequest* request, const std::st bool diagnostic_manager_t::validate_optional_request_attributes(float frequencyHz) { if(frequencyHz > MAX_RECURRING_DIAGNOSTIC_FREQUENCY_HZ) { - DEBUG(binder_interface, "Requested recurring diagnostic frequency %lf is higher than maximum of %d", + DEBUG(binder_interface, "%s: Requested recurring diagnostic frequency %lf is higher than maximum of %d", __FUNCTION__, frequencyHz, MAX_RECURRING_DIAGNOSTIC_FREQUENCY_HZ); return false; } @@ -379,11 +379,11 @@ bool diagnostic_manager_t::add_recurring_request(DiagnosticRequest* request, con sd_event_now(afb_daemon_get_event_loop(binder_interface->daemon), CLOCK_BOOTTIME, &usec); if(recurring_requests_.size() > 0) { - DEBUG(binder_interface, "add_recurring_request: Added 100ms to usec to stagger sending requests"); + DEBUG(binder_interface, "%s: Added 100ms to usec to stagger sending requests", __FUNCTION__); usec += 100000; } - DEBUG(binder_interface, "add_recurring_request: Added recurring diagnostic request (freq: %f) on bus %s at %ld. Event loop state: %d", + DEBUG(binder_interface, "%s: Added recurring diagnostic request (freq: %f) on bus %s at %ld. Event loop state: %d", __FUNCTION__, frequencyHz, bus_.c_str(), usec, @@ -392,21 +392,21 @@ bool diagnostic_manager_t::add_recurring_request(DiagnosticRequest* request, con if(sd_event_add_time(afb_daemon_get_event_loop(binder_interface->daemon), &source, CLOCK_BOOTTIME, usec, TIMERFD_ACCURACY, send_request, request) < 0) { - ERROR(binder_interface, "add_recurring_request: Request fails to be schedule through event loop"); + ERROR(binder_interface, "%s: Request fails to be schedule through event loop", __FUNCTION__); added = false; } recurring_requests_.push_back(entry); } else { - WARNING(binder_interface, "add_recurring_request: There isn't enough request entry. Vector exhausted %d/%d", (int)recurring_requests_.size(), MAX_SIMULTANEOUS_DIAG_REQUESTS); + WARNING(binder_interface, "%s: There isn't enough request entry. Vector exhausted %d/%d", __FUNCTION__, (int)recurring_requests_.size(), MAX_SIMULTANEOUS_DIAG_REQUESTS); recurring_requests_.resize(MAX_SIMULTANEOUS_DIAG_REQUESTS); added = false; } } else { - DEBUG(binder_interface, "add_recurring_request: Can't add request, one already exists with same key"); + DEBUG(binder_interface, "%s: Can't add request, one already exists with same key", __FUNCTION__); added = false; } return added; @@ -450,7 +450,7 @@ bool diagnostic_manager_t::clear_to_send(active_diagnostic_request_t* request) c int diagnostic_manager_t::reschedule_request(sd_event_source *s, uint64_t usec, active_diagnostic_request_t* adr) { usec = usec + (uint64_t)(adr->get_frequency_clock().frequency_to_period()); - DEBUG(binder_interface, "send_request: Event loop state: %d. usec: %ld", sd_event_get_state(afb_daemon_get_event_loop(binder_interface->daemon)), usec); + DEBUG(binder_interface, "%s: Event loop state: %d. usec: %ld", __FUNCTION__, sd_event_get_state(afb_daemon_get_event_loop(binder_interface->daemon)), usec); if(sd_event_source_set_time(s, usec) >= 0) if(sd_event_source_set_enabled(s, SD_EVENT_ON) >= 0) return 0; @@ -483,7 +483,7 @@ int diagnostic_manager_t::send_request(sd_event_source *s, uint64_t usec, void * start_diagnostic_request(&dm.shims_, adr->get_handle()); if(adr->get_handle()->completed && !adr->get_handle()->success) { - ERROR(binder_interface, "send_request: Fatal error sending diagnostic request"); + ERROR(binder_interface, "%s: Fatal error sending diagnostic request", __FUNCTION__); sd_event_source_unref(s); return -1; } @@ -498,7 +498,7 @@ int diagnostic_manager_t::send_request(sd_event_source *s, uint64_t usec, void * } sd_event_source_unref(s); - NOTICE(binder_interface, "send_request: Request doesn't exist anymore. Canceling.'"); + NOTICE(binder_interface, "%s: Request doesn't exist anymore. Canceling.'", __FUNCTION__); return -2; } @@ -539,7 +539,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, "relay_diagnostic_response: PID not supported or ill formed. Please unsubscribe from it. Error code : %d", response.negative_response_code); + NOTICE(binder_interface, "%s: PID not supported or ill formed. Please unsubscribe from it. Error code : %d", __FUNCTION__, 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/low-can-binding.cpp b/CAN-binder/low-can-binding/low-can-binding.cpp index 5a1dba97..0244bebc 100644 --- a/CAN-binder/low-can-binding/low-can-binding.cpp +++ b/CAN-binder/low-can-binding/low-can-binding.cpp @@ -67,7 +67,7 @@ static int make_subscription_unsubscription(struct afb_req request, const std::s /* Make the subscription or unsubscription to the event */ if (((subscribe ? afb_req_subscribe : afb_req_unsubscribe)(request, s[sig_name])) < 0) { - ERROR(binder_interface, "make_subscription_unsubscription: Operation goes wrong for signal: %s", sig_name.c_str()); + ERROR(binder_interface, "%s: Operation goes wrong for signal: %s", __FUNCTION__, sig_name.c_str()); return 0; } return 1; @@ -78,7 +78,7 @@ static int create_event_handle(const std::string& sig_name, std::map<std::string s[sig_name] = afb_daemon_make_event(binder_interface->daemon, sig_name.c_str()); if (!afb_event_is_valid(s[sig_name])) { - ERROR(binder_interface, "create_event_handle: Can't create an event for %s, something goes wrong.", sig_name.c_str()); + ERROR(binder_interface, "%s: Can't create an event for %s, something goes wrong.", __FUNCTION__, sig_name.c_str()); return 0; } return 1; @@ -96,7 +96,7 @@ static int subscribe_unsubscribe_signal(struct afb_req request, bool subscribe, { if (!afb_event_is_valid(s[sig]) && !subscribe) { - NOTICE(binder_interface, "subscribe_unsubscribe_signal: Event isn't valid, it can't be unsubscribed."); + NOTICE(binder_interface, "%s: Event isn't valid, it can't be unsubscribed.", __FUNCTION__); ret = -1; } /*else @@ -157,7 +157,7 @@ static int subscribe_unsubscribe_signals(struct afb_req request, bool subscribe, { conf.get_diagnostic_manager().cleanup_request( conf.get_diagnostic_manager().find_recurring_request(diag_req), true); - WARNING(binder_interface, "Signal: %s isn't supported. Canceling operation.", sig->get_name().c_str()); + WARNING(binder_interface, "%s: signal: %s isn't supported. Canceling operation.", __FUNCTION__, sig->get_name().c_str()); return -1; } @@ -165,7 +165,7 @@ static int subscribe_unsubscribe_signals(struct afb_req request, bool subscribe, if(ret <= 0) return ret; rets++; - DEBUG(binder_interface, "Signal: %s subscribed", sig->get_name().c_str()); + DEBUG(binder_interface, "%s: Signal: %s subscribed", __FUNCTION__, sig->get_name().c_str()); } for(const auto& sig: signals.can_signals) @@ -174,7 +174,7 @@ static int subscribe_unsubscribe_signals(struct afb_req request, bool subscribe, if(ret <= 0) return ret; rets++; - DEBUG(binder_interface, "Signal: %s subscribed", sig->get_name().c_str()); + DEBUG(binder_interface, "%s: signal: %s subscribed", __FUNCTION__, sig->get_name().c_str()); } return rets; } @@ -190,7 +190,7 @@ static int subscribe_unsubscribe_name(struct afb_req request, bool subscribe, co ret = 0; ret = subscribe_unsubscribe_signals(request, subscribe, signals); - NOTICE(binder_interface, "Subscribed/unsubscribe correctly to %d/%d signal(s).", ret, (int)(signals.can_signals.size() + signals.diagnostic_messages.size()) ); + NOTICE(binder_interface, "%s: Subscribed/unsubscribe correctly to %d/%d signal(s).", __FUNCTION__, ret, (int)(signals.can_signals.size() + signals.diagnostic_messages.size()) ); return ret; } @@ -279,7 +279,7 @@ extern "C" return 0; } - ERROR(binder_interface, "There was something wrong with CAN device Initialization. Check your config file maybe"); + ERROR(binder_interface, "%s: There was something wrong with CAN device Initialization. Check your config file maybe", __FUNCTION__); return 1; } }; diff --git a/CAN-binder/low-can-binding/utils/config-parser.cpp b/CAN-binder/low-can-binding/utils/config-parser.cpp index dd500d30..c2528e0c 100644 --- a/CAN-binder/low-can-binding/utils/config-parser.cpp +++ b/CAN-binder/low-can-binding/utils/config-parser.cpp @@ -34,10 +34,10 @@ namespace utils { if (config_content_.size() <= 0) { - ERROR(binder_interface, "read_conf: Can't load the INI config file."); + ERROR(binder_interface, "%s: Can't load the INI config file.", __FUNCTION__); return false; } - DEBUG(binder_interface, "read_conf: Configuration file parsed"); + DEBUG(binder_interface, "%s: Configuration file parsed", __FUNCTION__); return true; } diff --git a/CAN-binder/low-can-binding/utils/signals.cpp b/CAN-binder/low-can-binding/utils/signals.cpp index 219dfd40..b75eb2c5 100644 --- a/CAN-binder/low-can-binding/utils/signals.cpp +++ b/CAN-binder/low-can-binding/utils/signals.cpp @@ -19,6 +19,9 @@ namespace utils { + signals_manager_t::signals_manager_t() + {} + /// @brief Return singleton instance of configuration object. signals_manager_t& signals_manager_t::instance() { @@ -65,10 +68,10 @@ namespace utils lookup_signals_by_id(key.numeric_value, configuration_t::instance().get_diagnostic_messages(), sf.diagnostic_messages); break; default: - ERROR(binder_interface, "find_signals: wrong openxc_DynamicField specified. Use openxc_DynamicField_Type_NUM or openxc_DynamicField_Type_STRING type only."); + ERROR(binder_interface, "%s: wrong openxc_DynamicField specified. Use openxc_DynamicField_Type_NUM or openxc_DynamicField_Type_STRING type only.", __FUNCTION__); break; } - DEBUG(binder_interface, "find_signals: Found %d signal(s)", (int)(sf.can_signals.size() + sf.diagnostic_messages.size())); + DEBUG(binder_interface, "%s: Found %d signal(s)", __FUNCTION__, (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/socket.cpp b/CAN-binder/low-can-binding/utils/socket.cpp index e166b8c9..01937ed4 100644 --- a/CAN-binder/low-can-binding/utils/socket.cpp +++ b/CAN-binder/low-can-binding/utils/socket.cpp @@ -116,10 +116,10 @@ namespace utils // Attempts to open a socket to CAN bus ::strcpy(ifr.ifr_name, device_name.c_str()); - DEBUG(binder_interface, "open: ifr_name is : %s", ifr.ifr_name); + DEBUG(binder_interface, "%s: ifr_name is : %s", __FUNCTION__, ifr.ifr_name); if(::ioctl(socket_, SIOCGIFINDEX, &ifr) < 0) { - ERROR(binder_interface, "open: ioctl failed. Error was : %s", strerror(errno)); + ERROR(binder_interface, "%s: ioctl failed. Error was : %s", __FUNCTION__, strerror(errno)); close(); } else @@ -129,13 +129,13 @@ namespace utils if(bcm && connect((struct sockaddr *)&txAddress_, sizeof(txAddress_)) < 0) { - ERROR(binder_interface, "Connect failed. %s", strerror(errno)); + ERROR(binder_interface, "%s: Connect failed. %s", __FUNCTION__, strerror(errno)); close(); } // It's a RAW socket request, bind it to txAddress else if(bind((struct sockaddr *)&txAddress_, sizeof(txAddress_)) < 0) { - ERROR(binder_interface, "Bind failed. %s", strerror(errno)); + ERROR(binder_interface, "%s: Bind failed. %s", __FUNCTION__, strerror(errno)); close(); } } |