Changed the decoding function
[apps/agl-service-can-low-level.git] / src / can-signals.cpp
index c6a8ae9..0a6a829 100644 (file)
 
 #include "can-signals.hpp"
 
+#include <fnmatch.h>
+
+#include "low-can-binding.hpp"
+
+/**
+ * @brief Dumb SIGNALS array. It is composed by CanMessageSet
+ * SIGNALS[MESSAGE_SET_ID][CanSignal]
+ */
+std::vector<std::vector<CanSignal>> SIGNALS {
+       {}// message set: example
+};
+
 const std::vector<CanSignal> getSignals()
 {
        return SIGNALS[MESSAGE_SET_ID];
@@ -49,7 +61,7 @@ std::vector<CanSignal> find_can_signals(openxc_DynamicField& key)
                        }
                        break;
                default:
-                       ERROR(interface, "find_can_signals: wrong openxc_DynamicField specified. Use openxc_DynamicField_Type_NUM or openxc_DynamicField_Type_STRING type only.");
+                       ERROR(binder_interface, "find_can_signals: wrong openxc_DynamicField specified. Use openxc_DynamicField_Type_NUM or openxc_DynamicField_Type_STRING type only.");
                        CanSignal cs;
                        ::memset(&cs, 0, sizeof(CanSignal));
                        signals.push_back(cs);
@@ -59,21 +71,12 @@ std::vector<CanSignal> find_can_signals(openxc_DynamicField& key)
        return signals;
 }
 
-       struct CanMessageDefinition* message;
-       const char* genericName;
-       uint8_t bitPosition;
-       uint8_t bitSize;
-       float factor;
-       float offset;
-       float minValue;
-       float maxValue;
-       FrequencyClock frequencyClock;
-       bool sendSame;
-       bool forceSendChanged;
-       const CanSignalState* states;
-       uint8_t stateCount;
-       bool writable;
-       SignalDecoder decoder;
-       SignalEncoder encoder;
-       bool received;
-       float lastValue;
\ No newline at end of file
+inline uint32_t get_CanSignal_id(const CanSignal& sig)
+{
+       return sig.message->id;
+}
+
+const std::map<std::string, struct afb_event> get_subscribed_signals()
+{
+       return subscribed_signals;
+}
\ No newline at end of file