Make dumb poco class from old C struct
authorRomain Forlot <romain.forlot@iot.bzh>
Wed, 8 Mar 2017 11:52:46 +0000 (12:52 +0100)
committerRomain Forlot <romain.forlot@iot.bzh>
Thu, 16 Mar 2017 16:10:39 +0000 (17:10 +0100)
Change-Id: I1cae74b33e1351bb84d002e86f93c9329f8389f0
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
src/can/can-message.hpp
src/can/can-signals.hpp

index c5abd7f..090a7d3 100644 (file)
@@ -22,6 +22,7 @@
 #include <cstdint>
 #include <linux/can.h>
 
+#include "can/can-bus.hpp"
 #include "utils/timer.hpp"
 
 #define CAN_MESSAGE_SIZE 8
@@ -115,15 +116,15 @@ typedef struct CanMessageDefinition CanMessageDefinition;
 class can_message_definition_t
 {
        private:
-       can_bus_dev_t& bus_; /*!< bus - A pointer to the bus this message is on. */
-       uint32_t id_; /*!<  id - The ID of the message.*/
-       CanMessageFormat format_; /*!< format - the format of the message's ID.*/
-       FrequencyClock clock_; /*!<  clock - an optional frequency clock to control the output of this
+       can_bus_dev_t& bus_; /*!< bus_ - A pointer to the bus this message is on. */
+       uint32_t id_; /*!< id_ - The ID of the message.*/
+       CanMessageFormat format_; /*!< format_ - the format of the message's ID.*/
+       FrequencyClock clock_; /*!<  clock_ - an optional frequency clock to control the output of this
                                                        *       message, if sent raw, or simply to mark the max frequency for custom
                                                        *       handlers to retriec++ if ? syntaxve.*/
-       bool forceSendChanged_; /*!< forceSendChanged - If true, regardless of the frequency, it will send CAN
+       bool force_send_changed_; /*!< force_send_changed_ - If true, regardless of the frequency, it will send CAN
                                                         *      message if it has changed when using raw passthrough.*/
-       uint8_t lastValue_[CAN_MESSAGE_SIZE]; /*!< lastValue - The last received value of the message. Defaults to undefined.
+       uint8_t last_value_[CAN_MESSAGE_SIZE]; /*!< last_value_ - The last received value of the message. Defaults to undefined.
                                                                                  *     This is required for the forceSendChanged functionality, as the stack
                                                                                  *     needs to compare an incoming CAN message with the previous frame.*/
        
index 99f62c7..e618c19 100644 (file)
@@ -155,10 +155,18 @@ class can_signal_t
                                                                 * is used. */
                bool received_; /*!< received_ - True if this signal has ever been received.*/
                float lastValue_; /*!< lastValue_ - The last received value of the signal. If 'received' is false,
-                                                     this value is undefined. */
+                                                  *    this value is undefined. */
 
        public:
+               can_message_definition_t* get_message()
+               {
+                       return message_;
+               }
 
+               const std::string& get_generic_name()
+               {
+                       return generic_name_;
+               }
 };
 
 void find_can_signals(const openxc_DynamicField &key, std::vector<CanSignal*>& found_signals);