Fix: wrong conf file name specified
[apps/agl-service-can-low-level.git] / src / can-signals.cpp
index 2cf4b03..5f23c40 100644 (file)
 
 #include "can-signals.hpp"
 
+#include <fnmatch.h>
+
+#include "can-decoder.hpp"
+#include "low-can-binding.hpp"
+
+std::vector<std::vector<CanMessageDefinition>> CAN_MESSAGES = {
+       {{620, CanMessageFormat::STANDARD, {10, 0, nullptr}, false, (uint8_t)NULL}},
+};
+
 /**
  * @brief Dumb SIGNALS array. It is composed by CanMessageSet
  * SIGNALS[MESSAGE_SET_ID][CanSignal]
  */
-std::vector<std::vector<CanSignal>> SIGNALS {
-       {}// message set: example
+std::vector<std::vector<CanSignal>> SIGNALS {
+       {{&(CAN_MESSAGES[0][0]), "can.driver_door.open", 2, 4, 1.000000, 0.000000, 0.000000, 0.000000, {10, 0, nullptr}, false, true, nullptr, 0, false, decoder_t::booleanDecoder, nullptr, false, (float)NULL}},
 };
 
+/**
+* @brief Mutex allowing safe manipulation on subscribed_signals map.
+* @desc To ensure that the map object isn't modified when we read it, you
+*  have to set this mutex before use subscribed_signals map object.
+*/
+std::mutex subscribed_signals_mutex;
+
+std::mutex& get_subscribed_signals_mutex()
+{
+       return subscribed_signals_mutex;
+}
+
 const std::vector<CanSignal> getSignals()
 {
        return SIGNALS[MESSAGE_SET_ID];
@@ -35,7 +56,7 @@ size_t getSignalCount()
        return SIGNALS[MESSAGE_SET_ID].size();
 }
 
-std::vector<CanSignal> find_can_signals(openxc_DynamicField& key)
+std::vector<CanSignal> find_can_signals(const openxc_DynamicField &key)
 {
        std::vector<CanSignal> signals;