From 8e9b03928613c75befe059e772e7bdbb3109c350 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Thu, 2 Mar 2017 23:05:50 +0100 Subject: Debugging message cook Change-Id: If93bf9bf7c6e2f429a4313a7f6500ded950229c9 Signed-off-by: Romain Forlot --- src/can-bus.cpp | 12 ++++++------ src/can-message.cpp | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/can-bus.cpp b/src/can-bus.cpp index b1dcc3a..865c19d 100644 --- a/src/can-bus.cpp +++ b/src/can-bus.cpp @@ -77,14 +77,12 @@ void can_bus_t::can_decode_message() std::lock_guard subscribed_signals_lock(get_subscribed_signals_mutex()); std::map& s = get_subscribed_signals(); - const auto& it = s.find(sig.genericName); - if (it != s.end()) - DEBUG(binder_interface, "Iterator key: %s, event valid? %d", it->first.c_str(), afb_event_is_valid(it->second)); + /* DEBUG message to make easier debugger STL containers... DEBUG(binder_interface, "Operator[] key char: %s, event valid? %d", sig.genericName, afb_event_is_valid(s[sig.genericName])); DEBUG(binder_interface, "Operator[] key string: %s, event valid? %d", sig.genericName, afb_event_is_valid(s[std::string(sig.genericName)])); DEBUG(binder_interface, "Nb elt matched char: %d", (int)s.count(sig.genericName)); - DEBUG(binder_interface, "Nb elt matched string: %d", (int)s.count(std::string(sig.genericName))); - if( it != s.end() && afb_event_is_valid(it->second)) + DEBUG(binder_interface, "Nb elt matched string: %d", (int)s.count(std::string(sig.genericName))); */ + if( s.find(sig.genericName) != s.end() && afb_event_is_valid(s[sig.genericName])) { decoded_message = decoder.translateSignal(sig, can_message, getSignals()); @@ -380,7 +378,9 @@ std::pair can_bus_dev_t::read() ERROR(binder_interface, "read: Incomplete CAN(FD) frame"); ::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, + 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 std::pair(cfd, nbytes); } diff --git a/src/can-message.cpp b/src/can-message.cpp index 63f8a90..3905943 100644 --- a/src/can-message.cpp +++ b/src/can-message.cpp @@ -70,15 +70,15 @@ void can_message_t::set_max_data_length(size_t nbytes) switch(nbytes) { case CANFD_MTU: - DEBUG(binder_interface, "convert_from_canfd_frame: Got an CAN FD frame"); + DEBUG(binder_interface, "set_max_data_length: Got an CAN FD frame"); maxdlen_ = CANFD_MAX_DLEN; break; case CAN_MTU: - DEBUG(binder_interface, "convert_from_canfd_frame: Got a legacy CAN frame"); + DEBUG(binder_interface, "set_max_data_length: Got a legacy CAN frame"); maxdlen_ = CAN_MAX_DLEN; break; default: - ERROR(binder_interface, "convert_from_canfd_frame: unsupported CAN frame"); + ERROR(binder_interface, "set_max_data_length: unsupported CAN frame"); break; } } -- cgit 1.2.3-korg