From 89e072c41f3417e0a80cf95be3cf88326df32777 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Thu, 16 Mar 2017 17:08:57 +0100 Subject: Include file changes, typo and renaming operation. Change-Id: I6643333cfcc8bea120496c53f1cd3b8596e33398 Signed-off-by: Romain Forlot --- src/CMakeLists.txt | 1 - src/can/can-bus.cpp | 16 ++++++++-------- src/can/can-bus.hpp | 2 +- src/can/can-message.cpp | 2 +- src/can/can-signals.cpp | 8 ++++---- src/diagnostic/diagnostic-message.cpp | 28 ++++++++++------------------ src/diagnostic/diagnostic-message.hpp | 9 +++++---- src/utils/openxc-utils.cpp | 2 +- src/utils/signals.cpp | 2 +- src/utils/timer.cpp | 2 +- 10 files changed, 32 insertions(+), 40 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8acdd1d7..a1a32532 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -85,7 +85,6 @@ message(STATUS "Creation of ${PROJECT_NAME} binding for AFB-DAEMON") ########################################################################### add_library(${PROJECT_NAME} MODULE ${PROJECT_NAME}.cpp can/can-bus.cpp can/can-message.cpp can/can-signals.cpp can/can-decoder.cpp - obd2/obd2-signals.cpp utils/signals.cpp utils/openxc-utils.cpp utils/timer.cpp) target_link_libraries(${PROJECT_NAME} ${EXTRAS_LIBRARIES} bitfield isotp uds openxc pthread) diff --git a/src/can/can-bus.cpp b/src/can/can-bus.cpp index d46092bf..851f62a5 100644 --- a/src/can/can-bus.cpp +++ b/src/can/can-bus.cpp @@ -15,7 +15,7 @@ * limitations under the License. */ -#include "can-bus.hpp" +#include "can/can-bus.hpp" #include #include @@ -29,8 +29,8 @@ #include #include -#include "can-decoder.hpp" -#include "openxc-utils.hpp" +#include "can/can-decoder.hpp" +#include "utils/openxc-utils.hpp" extern "C" { @@ -74,7 +74,7 @@ void can_bus_t::can_decode_message() while(is_decoding_) { std::unique_lock can_message_lock(can_message_mutex_); - new_can_message_.wait(can_message_lock); + new_can_message_cv_.wait(can_message_lock); can_message = next_can_message(); /* First we have to found which CanSignal it is */ @@ -144,7 +144,7 @@ void can_bus_t::can_event_push() */ void can_bus_t::start_threads() { - v_ = true; + is_decoding_ = true; th_decoding_ = std::thread(&can_bus_t::can_decode_message, this); if(!th_decoding_.joinable()) is_decoding_ = false; @@ -263,9 +263,9 @@ std::vector can_bus_t::read_conf() } /** -* @brief return new_can_message_ member +* @brief return new_can_message_cv_ member * -* @return return new_can_message_ member +* @return return new_can_message_cv_ member */ std::condition_variable& can_bus_t::get_new_can_message_cv() { @@ -518,7 +518,7 @@ void can_bus_dev_t::can_reader(can_bus_t& can_bus) std::lock_guard can_message_lock(can_bus.get_can_message_mutex()); can_bus.push_new_can_message(can_message); } - can_bus.get_new_can_message_cv_().notify_one(); + can_bus.get_new_can_message_cv().notify_one(); } } diff --git a/src/can/can-bus.hpp b/src/can/can-bus.hpp index bf0bdd31..0fa13b22 100644 --- a/src/can/can-bus.hpp +++ b/src/can/can-bus.hpp @@ -83,7 +83,7 @@ class can_bus_t { can_message_t next_can_message(); void push_new_can_message(const can_message_t& can_msg); std::mutex& get_can_message_mutex(); - std::condition_variable& get_new_can_message_cv_(); + std::condition_variable& get_new_can_message_cv(); openxc_VehicleMessage next_vehicle_message(); void push_new_vehicle_message(const openxc_VehicleMessage& v_msg); diff --git a/src/can/can-message.cpp b/src/can/can-message.cpp index ad032021..71e48792 100644 --- a/src/can/can-message.cpp +++ b/src/can/can-message.cpp @@ -15,7 +15,7 @@ * limitations under the License. */ -#include "can-message.hpp" +#include "can/can-message.hpp" #include diff --git a/src/can/can-signals.cpp b/src/can/can-signals.cpp index 07689a01..64980b04 100644 --- a/src/can/can-signals.cpp +++ b/src/can/can-signals.cpp @@ -15,13 +15,13 @@ * limitations under the License. */ -#include "can-signals.hpp" +#include "can/can-signals.hpp" #include -#include "signals.hpp" -#include "obd2-signals.hpp" -#include "can-decoder.hpp" +#include "utils/signals.hpp" +#include "can/can-decoder.hpp" +#include "obd2/obd2-signals.hpp" #include "low-can-binding.hpp" std::vector> CAN_MESSAGES = { diff --git a/src/diagnostic/diagnostic-message.cpp b/src/diagnostic/diagnostic-message.cpp index bfca85bc..c358aae4 100644 --- a/src/diagnostic/diagnostic-message.cpp +++ b/src/diagnostic/diagnostic-message.cpp @@ -15,9 +15,11 @@ * limitations under the License. */ -#include "obd2-signals.hpp" +#include "obd2/obd2-signals.hpp" -#include "signals.hpp" +#include "utils/signals.hpp" + +#define OBD2_FUNCTIONAL_BROADCAST_ID 0x7df const char *UNIT_NAMES[10] = { "POURCENT", @@ -62,16 +64,9 @@ obd2_signals_t::obd2_signals_t(uint8_t pid, const char* generic_name, const int { } -void obd2_signals_t::init_diagnostic_shims(can_bus_dev_t& can_bus_dev) +std::vector& get_obd2_signals() { - DiagnosticShims shims_ = diagnostic_init_shims(shims_logger, can_bus_dev.send_can_message, NULL); - - int n_pids_, i_; - - n_pids_ = size(Obd2Pid); - for(i_=0; i_<=n_pids_; i_++) - { - } + return OBD2_PIDS; } /** @@ -83,7 +78,7 @@ void obd2_signals_t::init_diagnostic_shims(can_bus_dev_t& can_bus_dev) * * @return std::vector Vector of signals name found. */ -void obd2_signals_t::find_obd2_signals(const openxc_DynamicField &key, std::vector& found_signals) +void obd2_signals_t::find_obd2_signals(const openxc_DynamicField &key, std::vector& found_signals) { switch(key.type) { @@ -100,11 +95,6 @@ void obd2_signals_t::find_obd2_signals(const openxc_DynamicField &key, std::vect DEBUG(binder_interface, "Found %d signal(s)", (int)found_signals.size()); } -std::vector& get_obd2_signals() -{ - return OBD2_PIDS; -} - uint32_t get_signal_id(const Obd2Pid& sig) { return (uint32_t)sig.pid; @@ -156,7 +146,9 @@ bool obd2_signals_t::is_obd2_response(can_message_t can_message) { debug("Sent message ID is outside the valid range for emulator (7DF to 7E7)"); status=false; -}; + } + return false; +} void obd2_signals_t::add_request(int pid) { diff --git a/src/diagnostic/diagnostic-message.hpp b/src/diagnostic/diagnostic-message.hpp index 1ee9d961..5a19393b 100644 --- a/src/diagnostic/diagnostic-message.hpp +++ b/src/diagnostic/diagnostic-message.hpp @@ -76,14 +76,13 @@ class obd2_signals_t { bool supported_; public: + const char* generic_name = generic_name_; obd2_signals_t(uint8_t pid, const char* generic_name, const int min_, const int max_, enum UNIT unit, int frequency, bool supported); - void init_diagnostic_shims(can_bus_dev_t& can_bus_dev); void add_request(int pid); - std::vector& get_obd2_signals(); uint32_t get_signal_id(const Obd2Pid& sig); - void find_obd2_signals(const openxc_DynamicField &key, std::vector& found_signals); + void find_obd2_signals(const openxc_DynamicField &key, std::vector& found_signals); bool is_obd2_response(can_message_t can_message); @@ -91,4 +90,6 @@ class obd2_signals_t { bool is_obd2_signal(const char *name); float decode_obd2_response(const DiagnosticResponse* response, float parsedPayload); -}; \ No newline at end of file +}; + +std::vector& get_obd2_signals(); \ No newline at end of file diff --git a/src/utils/openxc-utils.cpp b/src/utils/openxc-utils.cpp index 40745a06..527f7253 100644 --- a/src/utils/openxc-utils.cpp +++ b/src/utils/openxc-utils.cpp @@ -16,7 +16,7 @@ * limitations under the License. */ -#include "openxc-utils.hpp" +#include "utils/openxc-utils.hpp" openxc_VehicleMessage build_VehicleMessage_with_SimpleMessage(openxc_DynamicField_Type type, const openxc_SimpleMessage& message) { diff --git a/src/utils/signals.cpp b/src/utils/signals.cpp index 6e2f396a..a7510dc0 100644 --- a/src/utils/signals.cpp +++ b/src/utils/signals.cpp @@ -15,7 +15,7 @@ * limitations under the License. */ -#include "signals.hpp" +#include "utils/signals.hpp" /** * @brief Can signal event map making access to afb_event diff --git a/src/utils/timer.cpp b/src/utils/timer.cpp index 01fd7636..8dec7066 100644 --- a/src/utils/timer.cpp +++ b/src/utils/timer.cpp @@ -15,7 +15,7 @@ * limitations under the License. */ -#include "timer.hpp" +#include "utils/timer.hpp" long long int systemTimeMs() { -- cgit 1.2.3-korg