Rename some of the classes removing can- prefix
[apps/agl-service-can-low-level.git] / low-can-binding / binding / application-generated.cpp
index 60a21f5..de7d6a1 100644 (file)
 #include "application.hpp"
 #include "../can/can-decoder.hpp"
+#include "../can/can-encoder.hpp"
 
 application_t::application_t()
        : can_bus_manager_{utils::config_parser_t{"/etc/dev-mapping.conf"}}
-       , can_message_set_{
-               {std::make_shared<can_message_set_t>(can_message_set_t{0,"example",
+       , message_set_{
+               {std::make_shared<message_set_t>(message_set_t{0,"AGL Virtual Car",
                        { // beginning can_message_definition_ vector
-                               {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x3D9,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
+                               {std::make_shared<message_definition_t>(message_definition_t{
+                                "ls",
+                                0x30,
+                                false,
+                                message_format_t::EXTENDED,
+                                frequency_clock_t(5.00000f),
+                                true,
                                        { // beginning can_signals vector
-                                               {std::make_shared<can_signal_t> (can_signal_t{
+                                               {std::make_shared<signal_t> (signal_t{
+                                                       "hvac.fan.speed",
+                                                       32,
+                                                       8,
+                                                       23.5294f,
+                                                       0.00000,
+                                                       0,
+                                                       0,
+                                                       frequency_clock_t(0.00000f),
+                                                       true,
+                                                       false,
+                                                       {
+                                                       },
+                                                       false,
+                                                       nullptr,
+                                                       nullptr,
+                                                       false
+                                               })},
+                                               {std::make_shared<signal_t> (signal_t{
+                                                       "hvac.temperature.left",
+                                                       0,
+                                                       8,
+                                                       1.00000f,
+                                                       0.00000,
+                                                       0,
+                                                       0,
+                                                       frequency_clock_t(0.00000f),
+                                                       true,
+                                                       false,
+                                                       {
+                                                       },
+                                                       true,
+                                                       nullptr,
+                                                       nullptr,
+                                                       false
+                                               })},
+                                               {std::make_shared<signal_t> (signal_t{
+                                                       "hvac.temperature.right",
+                                                       8,
+                                                       8,
+                                                       1.00000f,
+                                                       0.00000,
+                                                       0,
+                                                       0,
+                                                       frequency_clock_t(0.00000f),
+                                                       true,
+                                                       false,
+                                                       {
+                                                       },
+                                                       true,
+                                                       nullptr,
+                                                       nullptr,
+                                                       false
+                                               })},
+                                               {std::make_shared<signal_t> (signal_t{
+                                                       "hvac.temperature.average",
+                                                       16,
+                                                       8,
+                                                       1.00000f,
+                                                       0.00000,
+                                                       0,
+                                                       0,
+                                                       frequency_clock_t(0.00000f),
+                                                       true,
+                                                       false,
+                                                       {
+                                                       },
+                                                       true,
+                                                       nullptr,
+                                                       nullptr,
+                                                       false
+                                               })}
+                                       } // end can_signals vector
+                               })} // end can_message_definition entry
+,                              {std::make_shared<message_definition_t>(message_definition_t{
+                                "hs",
+                                0x3D9,
+                                true,
+                                message_format_t::STANDARD,
+                                frequency_clock_t(5.00000f),
+                                true,
+                                       { // beginning can_signals vector
+                                               {std::make_shared<signal_t> (signal_t{
                                                        "engine.speed",
                                                        16,
                                                        16,
@@ -26,7 +115,7 @@ application_t::application_t()
                                                        nullptr,
                                                        false
                                                })},
-                                               {std::make_shared<can_signal_t> (can_signal_t{
+                                               {std::make_shared<signal_t> (signal_t{
                                                        "fuel.level.low",
                                                        55,
                                                        1,
@@ -40,11 +129,11 @@ application_t::application_t()
                                                        {
                                                        },
                                                        false,
-                                                       decoder_t::booleanDecoder,
+                                                       decoder_t::decode_boolean,
                                                        nullptr,
                                                        false
                                                })},
-                                               {std::make_shared<can_signal_t> (can_signal_t{
+                                               {std::make_shared<signal_t> (signal_t{
                                                        "fuel.level",
                                                        8,
                                                        8,
@@ -64,9 +153,15 @@ application_t::application_t()
                                                })}
                                        } // end can_signals vector
                                })} // end can_message_definition entry
-,                              {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x3E9,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
+,                              {std::make_shared<message_definition_t>(message_definition_t{
+                                "hs",
+                                0x3E9,
+                                false,
+                                message_format_t::EXTENDED,
+                                frequency_clock_t(5.00000f),
+                                true,
                                        { // beginning can_signals vector
-                                               {std::make_shared<can_signal_t> (can_signal_t{
+                                               {std::make_shared<signal_t> (signal_t{
                                                        "vehicle.average.speed",
                                                        0,
                                                        15,
@@ -86,9 +181,15 @@ application_t::application_t()
                                                })}
                                        } // end can_signals vector
                                })} // end can_message_definition entry
-,                              {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x4D1,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
+,                              {std::make_shared<message_definition_t>(message_definition_t{
+                                "hs",
+                                0x4D1,
+                                false,
+                                message_format_t::STANDARD,
+                                frequency_clock_t(5.00000f),
+                                true,
                                        { // beginning can_signals vector
-                                               {std::make_shared<can_signal_t> (can_signal_t{
+                                               {std::make_shared<signal_t> (signal_t{
                                                        "engine.oil.temp",
                                                        16,
                                                        8,
@@ -106,7 +207,7 @@ application_t::application_t()
                                                        nullptr,
                                                        false
                                                })},
-                                               {std::make_shared<can_signal_t> (can_signal_t{
+                                               {std::make_shared<signal_t> (signal_t{
                                                        "engine.oil.temp.high",
                                                        7,
                                                        1,
@@ -120,15 +221,177 @@ application_t::application_t()
                                                        {
                                                        },
                                                        false,
-                                                       decoder_t::booleanDecoder,
+                                                       decoder_t::decode_boolean,
+                                                       nullptr,
+                                                       false
+                                               })}
+                                       } // end can_signals vector
+                               })} // end can_message_definition entry
+,                              {std::make_shared<message_definition_t>(message_definition_t{
+                                "hs",
+                                0x5D1,
+                                false,
+                                message_format_t::STANDARD,
+                                frequency_clock_t(5.00000f),
+                                true,
+                                       { // beginning can_signals vector
+                                               {std::make_shared<signal_t> (signal_t{
+                                                       "accelerator.pedal.position",
+                                                       16,
+                                                       8,
+                                                       0.500000f,
+                                                       0.00000,
+                                                       0,
+                                                       0,
+                                                       frequency_clock_t(0.00000f),
+                                                       true,
+                                                       false,
+                                                       {
+                                                       },
+                                                       false,
+                                                       nullptr,
+                                                       nullptr,
+                                                       false
+                                               })},
+                                               {std::make_shared<signal_t> (signal_t{
+                                                       "steering.wheel.angle",
+                                                       4,
+                                                       12,
+                                                       1.00000f,
+                                                       0.00000,
+                                                       0,
+                                                       0,
+                                                       frequency_clock_t(0.00000f),
+                                                       true,
+                                                       false,
+                                                       {
+                                                       },
+                                                       false,
+                                                       nullptr,
+                                                       nullptr,
+                                                       false
+                                               })}
+                                       } // end can_signals vector
+                               })} // end can_message_definition entry
+,                              {std::make_shared<message_definition_t>(message_definition_t{
+                                "hs",
+                                0x5D2,
+                                false,
+                                message_format_t::STANDARD,
+                                frequency_clock_t(5.00000f),
+                                true,
+                                       { // beginning can_signals vector
+                                               {std::make_shared<signal_t> (signal_t{
+                                                       "transmission.gearinfo",
+                                                       20,
+                                                       4,
+                                                       1.00000f,
+                                                       0.00000,
+                                                       0,
+                                                       0,
+                                                       frequency_clock_t(0.00000f),
+                                                       true,
+                                                       false,
+                                                       {
+                                                       },
+                                                       false,
+                                                       nullptr,
+                                                       nullptr,
+                                                       false
+                                               })},
+                                               {std::make_shared<signal_t> (signal_t{
+                                                       "transmission.mode",
+                                                       16,
+                                                       4,
+                                                       1.00000f,
+                                                       0.00000,
+                                                       0,
+                                                       0,
+                                                       frequency_clock_t(0.00000f),
+                                                       true,
+                                                       false,
+                                                       {
+                                                       },
+                                                       false,
+                                                       nullptr,
+                                                       nullptr,
+                                                       false
+                                               })}
+                                       } // end can_signals vector
+                               })} // end can_message_definition entry
+,                              {std::make_shared<message_definition_t>(message_definition_t{
+                                "hs",
+                                0x5D3,
+                                false,
+                                message_format_t::STANDARD,
+                                frequency_clock_t(5.00000f),
+                                true,
+                                       { // beginning can_signals vector
+                                               {std::make_shared<signal_t> (signal_t{
+                                                       "turnsignal.status",
+                                                       26,
+                                                       3,
+                                                       1.00000f,
+                                                       0.00000,
+                                                       0,
+                                                       0,
+                                                       frequency_clock_t(0.00000f),
+                                                       true,
+                                                       false,
+                                                       {
+                                                       },
+                                                       false,
+                                                       nullptr,
+                                                       nullptr,
+                                                       false
+                                               })},
+                                               {std::make_shared<signal_t> (signal_t{
+                                                       "lightstatus.brake",
+                                                       7,
+                                                       1,
+                                                       1.00000f,
+                                                       0.00000,
+                                                       0,
+                                                       0,
+                                                       frequency_clock_t(0.00000f),
+                                                       true,
+                                                       false,
+                                                       {
+                                                       },
+                                                       false,
+                                                       decoder_t::decode_boolean,
+                                                       nullptr,
+                                                       false
+                                               })},
+                                               {std::make_shared<signal_t> (signal_t{
+                                                       "parking.brake.status",
+                                                       8,
+                                                       1,
+                                                       1.00000f,
+                                                       0.00000,
+                                                       0,
+                                                       0,
+                                                       frequency_clock_t(0.00000f),
+                                                       true,
+                                                       false,
+                                                       {
+                                                       },
+                                                       false,
+                                                       decoder_t::decode_boolean,
                                                        nullptr,
                                                        false
                                                })}
                                        } // end can_signals vector
                                })} // end can_message_definition entry
-,                              {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x620,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
+,                              {std::make_shared<message_definition_t>(message_definition_t{
+                                "hs",
+                                0x620,
+                                false,
+                                message_format_t::STANDARD,
+                                frequency_clock_t(5.00000f),
+                                true,
                                        { // beginning can_signals vector
-                                               {std::make_shared<can_signal_t> (can_signal_t{
+                                               {std::make_shared<signal_t> (signal_t{
                                                        "doors.boot.open",
                                                        47,
                                                        1,
@@ -142,11 +405,11 @@ application_t::application_t()
                                                        {
                                                        },
                                                        false,
-                                                       decoder_t::booleanDecoder,
+                                                       decoder_t::decode_boolean,
                                                        nullptr,
                                                        false
                                                })},
-                                               {std::make_shared<can_signal_t> (can_signal_t{
+                                               {std::make_shared<signal_t> (signal_t{
                                                        "doors.front_left.open",
                                                        43,
                                                        1,
@@ -160,11 +423,11 @@ application_t::application_t()
                                                        {
                                                        },
                                                        false,
-                                                       decoder_t::booleanDecoder,
+                                                       decoder_t::decode_boolean,
                                                        nullptr,
                                                        false
                                                })},
-                                               {std::make_shared<can_signal_t> (can_signal_t{
+                                               {std::make_shared<signal_t> (signal_t{
                                                        "doors.front_right.open",
                                                        44,
                                                        1,
@@ -178,11 +441,11 @@ application_t::application_t()
                                                        {
                                                        },
                                                        false,
-                                                       decoder_t::booleanDecoder,
+                                                       decoder_t::decode_boolean,
                                                        nullptr,
                                                        false
                                                })},
-                                               {std::make_shared<can_signal_t> (can_signal_t{
+                                               {std::make_shared<signal_t> (signal_t{
                                                        "doors.rear_left.open",
                                                        46,
                                                        1,
@@ -196,11 +459,11 @@ application_t::application_t()
                                                        {
                                                        },
                                                        false,
-                                                       decoder_t::booleanDecoder,
+                                                       decoder_t::decode_boolean,
                                                        nullptr,
                                                        false
                                                })},
-                                               {std::make_shared<can_signal_t> (can_signal_t{
+                                               {std::make_shared<signal_t> (signal_t{
                                                        "doors.rear_right.open",
                                                        45,
                                                        4,
@@ -214,15 +477,21 @@ application_t::application_t()
                                                        {
                                                        },
                                                        false,
-                                                       decoder_t::booleanDecoder,
+                                                       decoder_t::decode_boolean,
                                                        nullptr,
                                                        false
                                                })}
                                        } // end can_signals vector
                                })} // end can_message_definition entry
-,                              {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x799,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
+,                              {std::make_shared<message_definition_t>(message_definition_t{
+                                "hs",
+                                0x799,
+                                false,
+                                message_format_t::STANDARD,
+                                frequency_clock_t(5.00000f),
+                                true,
                                        { // beginning can_signals vector
-                                               {std::make_shared<can_signal_t> (can_signal_t{
+                                               {std::make_shared<signal_t> (signal_t{
                                                        "windows.front_left.open",
                                                        43,
                                                        1,
@@ -236,11 +505,11 @@ application_t::application_t()
                                                        {
                                                        },
                                                        false,
-                                                       decoder_t::booleanDecoder,
+                                                       decoder_t::decode_boolean,
                                                        nullptr,
                                                        false
                                                })},
-                                               {std::make_shared<can_signal_t> (can_signal_t{
+                                               {std::make_shared<signal_t> (signal_t{
                                                        "windows.front_right.open",
                                                        44,
                                                        1,
@@ -254,11 +523,11 @@ application_t::application_t()
                                                        {
                                                        },
                                                        false,
-                                                       decoder_t::booleanDecoder,
+                                                       decoder_t::decode_boolean,
                                                        nullptr,
                                                        false
                                                })},
-                                               {std::make_shared<can_signal_t> (can_signal_t{
+                                               {std::make_shared<signal_t> (signal_t{
                                                        "windows.rear_left.open",
                                                        46,
                                                        1,
@@ -272,11 +541,11 @@ application_t::application_t()
                                                        {
                                                        },
                                                        false,
-                                                       decoder_t::booleanDecoder,
+                                                       decoder_t::decode_boolean,
                                                        nullptr,
                                                        false
                                                })},
-                                               {std::make_shared<can_signal_t> (can_signal_t{
+                                               {std::make_shared<signal_t> (signal_t{
                                                        "windows.rear_right.open",
                                                        45,
                                                        4,
@@ -290,7 +559,7 @@ application_t::application_t()
                                                        {
                                                        },
                                                        false,
-                                                       decoder_t::booleanDecoder,
+                                                       decoder_t::decode_boolean,
                                                        nullptr,
                                                        false
                                                })}
@@ -308,7 +577,8 @@ application_t::application_t()
                                        5.00000f,
                                        decoder_t::decode_obd2_response,
                                        nullptr,
-                                       true
+                                       true,
+                                       false
                                })}
 ,                              {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
                                        5,
@@ -319,7 +589,8 @@ application_t::application_t()
                                        1.00000f,
                                        decoder_t::decode_obd2_response,
                                        nullptr,
-                                       true
+                                       true,
+                                       false
                                })}
 ,                              {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
                                        10,
@@ -330,7 +601,8 @@ application_t::application_t()
                                        1.00000f,
                                        decoder_t::decode_obd2_response,
                                        nullptr,
-                                       true
+                                       true,
+                                       false
                                })}
 ,                              {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
                                        11,
@@ -341,7 +613,8 @@ application_t::application_t()
                                        1.00000f,
                                        decoder_t::decode_obd2_response,
                                        nullptr,
-                                       true
+                                       true,
+                                       false
                                })}
 ,                              {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
                                        12,
@@ -352,7 +625,8 @@ application_t::application_t()
                                        5.00000f,
                                        decoder_t::decode_obd2_response,
                                        nullptr,
-                                       true
+                                       true,
+                                       false
                                })}
 ,                              {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
                                        13,
@@ -363,7 +637,8 @@ application_t::application_t()
                                        5.00000f,
                                        decoder_t::decode_obd2_response,
                                        nullptr,
-                                       true
+                                       true,
+                                       false
                                })}
 ,                              {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
                                        15,
@@ -374,7 +649,8 @@ application_t::application_t()
                                        1.00000f,
                                        decoder_t::decode_obd2_response,
                                        nullptr,
-                                       true
+                                       true,
+                                       false
                                })}
 ,                              {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
                                        16,
@@ -385,7 +661,8 @@ application_t::application_t()
                                        5.00000f,
                                        decoder_t::decode_obd2_response,
                                        nullptr,
-                                       true
+                                       true,
+                                       false
                                })}
 ,                              {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
                                        17,
@@ -396,7 +673,8 @@ application_t::application_t()
                                        5.00000f,
                                        decoder_t::decode_obd2_response,
                                        nullptr,
-                                       true
+                                       true,
+                                       false
                                })}
 ,                              {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
                                        31,
@@ -407,7 +685,8 @@ application_t::application_t()
                                        1.00000f,
                                        decoder_t::decode_obd2_response,
                                        nullptr,
-                                       true
+                                       true,
+                                       false
                                })}
 ,                              {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
                                        45,
@@ -418,7 +697,8 @@ application_t::application_t()
                                        0.00000f,
                                        decoder_t::decode_obd2_response,
                                        nullptr,
-                                       true
+                                       true,
+                                       false
                                })}
 ,                              {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
                                        47,
@@ -429,7 +709,8 @@ application_t::application_t()
                                        1.00000f,
                                        decoder_t::decode_obd2_response,
                                        nullptr,
-                                       true
+                                       true,
+                                       false
                                })}
 ,                              {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
                                        51,
@@ -440,7 +721,8 @@ application_t::application_t()
                                        1.00000f,
                                        decoder_t::decode_obd2_response,
                                        nullptr,
-                                       true
+                                       true,
+                                       false
                                })}
 ,                              {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
                                        70,
@@ -451,7 +733,8 @@ application_t::application_t()
                                        1.00000f,
                                        decoder_t::decode_obd2_response,
                                        nullptr,
-                                       true
+                                       true,
+                                       false
                                })}
 ,                              {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
                                        76,
@@ -462,7 +745,8 @@ application_t::application_t()
                                        1.00000f,
                                        decoder_t::decode_obd2_response,
                                        nullptr,
-                                       true
+                                       true,
+                                       false
                                })}
 ,                              {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
                                        82,
@@ -473,7 +757,8 @@ application_t::application_t()
                                        1.00000f,
                                        decoder_t::decode_obd2_response,
                                        nullptr,
-                                       true
+                                       true,
+                                       false
                                })}
 ,                              {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
                                        90,
@@ -484,7 +769,8 @@ application_t::application_t()
                                        5.00000f,
                                        decoder_t::decode_obd2_response,
                                        nullptr,
-                                       true
+                                       true,
+                                       false
                                })}
 ,                              {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
                                        91,
@@ -495,7 +781,8 @@ application_t::application_t()
                                        5.00000f,
                                        decoder_t::decode_obd2_response,
                                        nullptr,
-                                       true
+                                       true,
+                                       false
                                })}
 ,                              {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
                                        92,
@@ -506,7 +793,8 @@ application_t::application_t()
                                        1.00000f,
                                        decoder_t::decode_obd2_response,
                                        nullptr,
-                                       true
+                                       true,
+                                       false
                                })}
 ,                              {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
                                        94,
@@ -517,7 +805,8 @@ application_t::application_t()
                                        1.00000f,
                                        decoder_t::decode_obd2_response,
                                        nullptr,
-                                       true
+                                       true,
+                                       false
                                })}
 ,                              {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
                                        99,
@@ -528,30 +817,31 @@ application_t::application_t()
                                        1.00000f,
                                        decoder_t::decode_obd2_response,
                                        nullptr,
-                                       true
+                                       true,
+                                       false
                                })}
 
                        } // end diagnostic_messages_ vector
                })} // end can_message_set entry
        } // end can_message_set vector
 {
-       for(auto& cms: can_message_set_)
+       for(auto& cms: message_set_)
        {
-               std::vector<std::shared_ptr<can_message_definition_t> >& can_messages_definition = cms->get_can_message_definition();
+               std::vector<std::shared_ptr<message_definition_t> >& can_messages_definition = cms->get_messages_definition();
                for(auto& cmd : can_messages_definition)
                {
-                       cmd->set_parent(cms.get());
-                       std::vector<std::shared_ptr<can_signal_t> >& can_signals = cmd->get_can_signals();
+                       cmd->set_parent(cms);
+                       std::vector<std::shared_ptr<signal_t> >& can_signals = cmd->get_signals();
                        for(auto& sig: can_signals)
                        {
-                               sig->set_parent(cmd.get());
+                               sig->set_parent(cmd);
                        }
                }
 
                std::vector<std::shared_ptr<diagnostic_message_t> >& diagnostic_messages = cms->get_diagnostic_messages();
                for(auto& dm : diagnostic_messages)
                {
-                       dm->set_parent(cms.get());
+                       dm->set_parent(cms);
                }
        }
                }