Include file changes, typo and renaming operation.
authorRomain Forlot <romain.forlot@iot.bzh>
Thu, 16 Mar 2017 16:08:57 +0000 (17:08 +0100)
committerRomain Forlot <romain.forlot@iot.bzh>
Thu, 16 Mar 2017 16:08:57 +0000 (17:08 +0100)
Change-Id: I6643333cfcc8bea120496c53f1cd3b8596e33398
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
src/CMakeLists.txt
src/can/can-bus.cpp
src/can/can-bus.hpp
src/can/can-message.cpp
src/can/can-signals.cpp
src/diagnostic/diagnostic-message.cpp
src/diagnostic/diagnostic-message.hpp
src/utils/openxc-utils.cpp
src/utils/signals.cpp
src/utils/timer.cpp

index 8acdd1d..a1a3253 100644 (file)
@@ -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)
 
index d46092b..851f62a 100644 (file)
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-#include "can-bus.hpp"
+#include "can/can-bus.hpp"
 
 #include <map>
 #include <cerrno>
@@ -29,8 +29,8 @@
 #include <json-c/json.h>
 #include <linux/can/raw.h>
 
-#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<std::mutex> 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<std::string> 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<std::mutex> 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();
        }
 }
 
index bf0bdd3..0fa13b2 100644 (file)
@@ -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);
index ad03202..71e4879 100644 (file)
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-#include "can-message.hpp"
+#include "can/can-message.hpp"
 
 #include <cstring>
 
index 07689a0..64980b0 100644 (file)
  * limitations under the License.
  */
 
-#include "can-signals.hpp"
+#include "can/can-signals.hpp"
 
 #include <fnmatch.h>
 
-#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<std::vector<CanMessageDefinition>> CAN_MESSAGES = {
index bfca85b..c358aae 100644 (file)
  * 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<obd2_signals_t>& 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<std::string> Vector of signals name found. 
  */
-void obd2_signals_t::find_obd2_signals(const openxc_DynamicField &key, std::vector<Obd2Pid*>& found_signals)
+void obd2_signals_t::find_obd2_signals(const openxc_DynamicField &key, std::vector<obd2_signals_t*>& 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<Obd2Pid>& 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)
 {
index 1ee9d96..5a19393 100644 (file)
@@ -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<Obd2Pid>& get_obd2_signals();
 
                uint32_t get_signal_id(const Obd2Pid& sig);
-               void find_obd2_signals(const openxc_DynamicField &key, std::vector<Obd2Pid*>& found_signals);
+               void find_obd2_signals(const openxc_DynamicField &key, std::vector<obd2_signals_t*>& 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<obd2_signals_t>& get_obd2_signals();
\ No newline at end of file
index 40745a0..527f725 100644 (file)
@@ -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)
 {
index 6e2f396..a7510dc 100644 (file)
@@ -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
index 01fd763..8dec706 100644 (file)
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-#include "timer.hpp"
+#include "utils/timer.hpp"
 
 long long int systemTimeMs()
 {