Update bit position and bit size in signal 54/22254/4
authorArthur Guyader <arthur.guyader@iot.bzh>
Tue, 27 Aug 2019 12:45:58 +0000 (14:45 +0200)
committerArthur Guyader <arthur.guyader@iot.bzh>
Fri, 30 Aug 2019 13:08:36 +0000 (15:08 +0200)
It's necessary to change the size of attributes
to manage multi packet signal.

Bug-AGL : SPEC-2779

Change-Id: If211c218ffa5a2e81ccfb32d3a5eeae0267e8f74
Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
low-can-binding/can/signals.cpp
low-can-binding/can/signals.hpp

index 3d26343..7d3b733 100644 (file)
@@ -30,8 +30,8 @@ std::string signal_t::prefix_ = "messages";
 
 signal_t::signal_t(
        std::string generic_name,
-       uint8_t bit_position,
-       uint8_t bit_size,
+       uint32_t bit_position,
+       uint32_t bit_size,
        float factor,
        float offset,
        float min_value,
@@ -73,8 +73,8 @@ signal_t::signal_t(
 
 signal_t::signal_t(
        std::string generic_name,
-       uint8_t bit_position,
-       uint8_t bit_size,
+       uint32_t bit_position,
+       uint32_t bit_size,
        float factor,
        float offset,
        float min_value,
@@ -119,12 +119,12 @@ const std::string signal_t::get_name() const
        return prefix_ + "." + generic_name_;
 }
 
-uint8_t signal_t::get_bit_position() const
+uint32_t signal_t::get_bit_position() const
 {
        return bit_position_;
 }
 
-uint8_t signal_t::get_bit_size() const
+uint32_t signal_t::get_bit_size() const
 {
        return bit_size_;
 }
index 9a8572c..e723100 100644 (file)
@@ -62,6 +62,7 @@ typedef openxc_DynamicField (*signal_decoder)(signal_t& signal, float value, boo
 typedef uint64_t (*signal_encoder)(signal_t& signal,
                 const openxc_DynamicField& field, bool* send);
 
+
 class signal_t
 {
 private:
@@ -69,10 +70,10 @@ private:
        std::string generic_name_; /*!< generic_name_ - The name of the signal to be output.*/
        static std::string prefix_; /*!< prefix_ - generic_name_ will be prefixed with it. It has to reflect the used protocol.
                                         * which make easier to sort message when the come in.*/
-       uint8_t bit_position_; /*!< bitPosition_ - The starting bit of the signal in its CAN message (assuming
+       uint32_t bit_position_; /*!< bitPosition_ - The starting bit of the signal in its CAN message (assuming
                                *       non-inverted bit numbering, i.e. the most significant bit of
                                *       each byte is 0) */
-       uint8_t bit_size_; /*!< bit_size_ - The width of the bit field in the CAN message. */
+       uint32_t bit_size_; /*!< bit_size_ - The width of the bit field in the CAN message. */
        float factor_; /*!< factor_ - The final value will be multiplied by this factor. Use 1 if you
                        *       don't need a factor. */
        float offset_; /*!< offset_ - The final value will be added to this offset. Use 0 if you
@@ -108,8 +109,8 @@ public:
 
        signal_t(
                std::string generic_name,
-               uint8_t bit_position,
-               uint8_t bit_size,
+               uint32_t bit_position,
+               uint32_t bit_size,
                float factor,
                float offset,
                float min_value,
@@ -130,8 +131,8 @@ public:
 
        signal_t(
                std::string generic_name,
-               uint8_t bit_position,
-               uint8_t bit_size,
+               uint32_t bit_position,
+               uint32_t bit_size,
                float factor,
                float offset,
                float min_value,
@@ -149,8 +150,8 @@ public:
        std::shared_ptr<message_definition_t> get_message() const;
        const std::string get_generic_name() const;
        const std::string get_name() const;
-       uint8_t get_bit_position() const;
-       uint8_t get_bit_size() const;
+       uint32_t get_bit_position() const;
+       uint32_t get_bit_size() const;
        float get_factor() const;
        float get_offset() const;
        frequency_clock_t& get_frequency();