msg_definition: integrate frame layout as a flag 57/23257/6
authorRomain Forlot <romain.forlot@iot.bzh>
Wed, 4 Dec 2019 10:39:33 +0000 (11:39 +0100)
committerRomain Forlot <romain.forlot@iot.bzh>
Thu, 9 Jan 2020 15:25:36 +0000 (16:25 +0100)
Integrate frame layout as a flag instead of a separate boolean

Change-Id: I0fe32fd8a80238006ef89152af25001ecdf018c9
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
low-can-binding/can/message-definition.cpp
low-can-binding/can/message-definition.hpp
low-can-binding/can/message/message.hpp
plugins/agl-vcar-signals.cpp
plugins/j1939-signals.cpp

index 5977fb4..5935f72 100644 (file)
@@ -23,7 +23,6 @@ message_definition_t::message_definition_t(
        const std::string bus,
        uint32_t id,
        uint32_t flags,
-       bool frame_layout_is_little,
        frequency_clock_t frequency_clock,
        bool force_send_changed,
        const vect_ptr_signal_t& signals)
@@ -31,7 +30,6 @@ message_definition_t::message_definition_t(
        bus_{bus},
        id_{id},
        flags_{flags},
-       frame_layout_is_little_{frame_layout_is_little},
        frequency_clock_{frequency_clock},
        force_send_changed_{force_send_changed},
        last_value_{CAN_MESSAGE_SIZE},
@@ -43,7 +41,6 @@ message_definition_t::message_definition_t(const std::string bus,
        const std::string name,
        uint32_t length,
        uint32_t flags,
-       bool frame_layout_is_little,
        frequency_clock_t frequency_clock,
        bool force_send_changed,
        const vect_ptr_signal_t& signals)
@@ -53,7 +50,6 @@ message_definition_t::message_definition_t(const std::string bus,
        name_{name},
        length_{length},
        flags_{flags},
-       frame_layout_is_little_{frame_layout_is_little},
        frequency_clock_{frequency_clock},
        force_send_changed_{force_send_changed},
        last_value_{CAN_MESSAGE_SIZE},
@@ -116,5 +112,5 @@ uint32_t message_definition_t::get_flags() const
 }
 
 bool message_definition_t::frame_layout_is_little() const{
-       return frame_layout_is_little_;
+       return (flags_ & FRAME_LAYOUT_IS_LE);
 }
index ab6b4be..b0866d3 100644 (file)
@@ -46,8 +46,6 @@ private:
        std::string name_; ///< name_ - J1939 PGN name
        uint32_t length_; ///< length_ - Message data length in bytes. For J1939 message, this is the expected data size
        uint32_t flags_; ///< format_ - the format of the message's ID.*/
-       bool frame_layout_is_little_; ///<frame_layout_is_little_ Defines if the can frame layout is little endian or big endian.
-                                                                 /// Default is true;
        frequency_clock_t frequency_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 retrieve.*/
@@ -66,7 +64,6 @@ public:
        message_definition_t(const std::string bus,
                                 uint32_t id,
                                 uint32_t flags,
-                                bool frame_layout_is_little,
                                 frequency_clock_t frequency_clock,
                                 bool force_send_changed,
                                 const vect_ptr_signal_t& signals);
@@ -75,7 +72,6 @@ public:
                                 std::string name,
                                 uint32_t length,
                                 uint32_t flags,
-                                bool frame_layout_is_little,
                                 frequency_clock_t frequency_clock,
                                 bool force_send_changed,
                                 const vect_ptr_signal_t& signals);
index af34615..9a074e3 100644 (file)
@@ -44,6 +44,7 @@
 #define ISOTP_SEND 0x0020
 #define ISOTP_RECEIVE 0x0040
 #define CAN_PROTOCOL_WITH_FD_FRAME 0x0080
+#define FRAME_LAYOUT_IS_LE 0x0100
 
 /// @class message_t
 ///
index 12b2d63..8c1b03f 100644 (file)
@@ -9,7 +9,7 @@ CTLP_CAPI_REGISTER("agl-vcar-signals");
 
 std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set_t{0,"AGL Virtual Car",
                        { // beginning message_definition_ vector
-                               {std::make_shared<message_definition_t>(message_definition_t{"ls",0x30,"",8,0,true,frequency_clock_t(5.00000f),true,
+                               {std::make_shared<message_definition_t>(message_definition_t{"ls",0x30,"",8,0,frequency_clock_t(5.00000f),true,
                                        { // beginning signals vector
                                                {std::make_shared<signal_t> (signal_t{
                                                        "hvac.fan.speed",// generic_name
@@ -105,7 +105,7 @@ std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set
                                                })}
                                        } // end signals vector
                                })} // end message_definition entry
-,                              {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3D9,"",8,128,true,frequency_clock_t(5.00000f),true,
+,                              {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3D9,"",8,128,frequency_clock_t(5.00000f),true,
                                        { // beginning signals vector
                                                {std::make_shared<signal_t> (signal_t{
                                                        "engine.speed",// generic_name
@@ -178,7 +178,7 @@ std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set
                                                })}
                                        } // end signals vector
                                })} // end message_definition entry
-,                              {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3E9,"",8,0,true,frequency_clock_t(5.00000f),true,
+,                              {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3E9,"",8,0,frequency_clock_t(5.00000f),true,
                                        { // beginning signals vector
                                                {std::make_shared<signal_t> (signal_t{
                                                        "vehicle.average.speed",// generic_name
@@ -205,7 +205,7 @@ std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set
                                                })}
                                        } // end signals vector
                                })} // end message_definition entry
-,                              {std::make_shared<message_definition_t>(message_definition_t{"hs",0x4D1,"",8,0,true,frequency_clock_t(5.00000f),true,
+,                              {std::make_shared<message_definition_t>(message_definition_t{"hs",0x4D1,"",8,0,frequency_clock_t(5.00000f),true,
                                        { // beginning signals vector
                                                {std::make_shared<signal_t> (signal_t{
                                                        "engine.oil.temp",// generic_name
@@ -255,7 +255,7 @@ std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set
                                                })}
                                        } // end signals vector
                                })} // end message_definition entry
-,                              {std::make_shared<message_definition_t>(message_definition_t{"hs",0x620,"",8,0,true,frequency_clock_t(5.00000f),true,
+,                              {std::make_shared<message_definition_t>(message_definition_t{"hs",0x620,"",8,0,frequency_clock_t(5.00000f),true,
                                        { // beginning signals vector
                                                {std::make_shared<signal_t> (signal_t{
                                                        "doors.boot.open",// generic_name
@@ -374,7 +374,7 @@ std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set
                                                })}
                                        } // end signals vector
                                })} // end message_definition entry
-,                              {std::make_shared<message_definition_t>(message_definition_t{"hs",0x799,"",8,0,true,frequency_clock_t(5.00000f),true,
+,                              {std::make_shared<message_definition_t>(message_definition_t{"hs",0x799,"",8,0,frequency_clock_t(5.00000f),true,
                                        { // beginning signals vector
                                                {std::make_shared<signal_t> (signal_t{
                                                        "windows.front_left.open",// generic_name
index 863df57..90962f6 100644 (file)
@@ -9,7 +9,7 @@ CTLP_CAPI_REGISTER("j1939-signals");
 
 std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set_t{0,"Virtual J1939",
                        { // beginning message_definition_ vector
-                               {std::make_shared<message_definition_t>(message_definition_t{"j1939",61442,"ETC1",8,4,true,frequency_clock_t(5.00000f),true,
+                               {std::make_shared<message_definition_t>(message_definition_t{"j1939",61442,"ETC1",8,4,frequency_clock_t(5.00000f),true,
                                        { // beginning signals vector
                                                {std::make_shared<signal_t> (signal_t{
                                                        "Eng.Momentary.Overspeed.Enable",// generic_name
@@ -294,7 +294,7 @@ std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set
                                                })}
                                        } // end signals vector
                                })} // end message_definition entry
-,                              {std::make_shared<message_definition_t>(message_definition_t{"j1939",61444,"EEC1",8,4,true,frequency_clock_t(5.00000f),true,
+,                              {std::make_shared<message_definition_t>(message_definition_t{"j1939",61444,"EEC1",8,4,frequency_clock_t(5.00000f),true,
                                        { // beginning signals vector
                                                {std::make_shared<signal_t> (signal_t{
                                                        "Actl.Eng.Prcnt.Trque.High.Resolution",// generic_name
@@ -512,7 +512,7 @@ std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set
                                                })}
                                        } // end signals vector
                                })} // end message_definition entry
-,                              {std::make_shared<message_definition_t>(message_definition_t{"j1939",61449,"VDC2",8,4,true,frequency_clock_t(5.00000f),true,
+,                              {std::make_shared<message_definition_t>(message_definition_t{"j1939",61449,"VDC2",8,4,frequency_clock_t(5.00000f),true,
                                        { // beginning signals vector
                                                {std::make_shared<signal_t> (signal_t{
                                                        "Lateral.Acceleration",// generic_name
@@ -658,7 +658,7 @@ std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set
                                                })}
                                        } // end signals vector
                                })} // end message_definition entry
-,                              {std::make_shared<message_definition_t>(message_definition_t{"j1939",65215,"EBC2",8,4,true,frequency_clock_t(5.00000f),true,
+,                              {std::make_shared<message_definition_t>(message_definition_t{"j1939",65215,"EBC2",8,4,frequency_clock_t(5.00000f),true,
                                        { // beginning signals vector
                                                {std::make_shared<signal_t> (signal_t{
                                                        "Front.Axle.Speed",// generic_name
@@ -823,7 +823,7 @@ std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set
                                                })}
                                        } // end signals vector
                                })} // end message_definition entry
-,                              {std::make_shared<message_definition_t>(message_definition_t{"j1939",65253,"HOURS",8,4,true,frequency_clock_t(5.00000f),true,
+,                              {std::make_shared<message_definition_t>(message_definition_t{"j1939",65253,"HOURS",8,4,frequency_clock_t(5.00000f),true,
                                        { // beginning signals vector
                                                {std::make_shared<signal_t> (signal_t{
                                                        "Eng.Total.Hours.Of.Operation",// generic_name
@@ -873,7 +873,7 @@ std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set
                                                })}
                                        } // end signals vector
                                })} // end message_definition entry
-,                              {std::make_shared<message_definition_t>(message_definition_t{"j1939",65262,"ET1",8,4,true,frequency_clock_t(5.00000f),true,
+,                              {std::make_shared<message_definition_t>(message_definition_t{"j1939",65262,"ET1",8,4,frequency_clock_t(5.00000f),true,
                                        { // beginning signals vector
                                                {std::make_shared<signal_t> (signal_t{
                                                        "Eng.Coolant.Temp",// generic_name