examples: updates
[apps/agl-service-can-low-level.git] / examples / OBD2 / application-generated.cpp
index f66748b..5bed759 100644 (file)
@@ -1,13 +1,14 @@
 #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",
-                       { // beginning can_message_definition_ vector
+       , message_set_{
+               {std::make_shared<message_set_t>(message_set_t{0,"example",
+                       { // beginning message_definition_ vector
 
-               }, // end can_message_definition vector
+               }, // end message_definition vector
                        { // beginning diagnostic_messages_ vector
                                {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
                                        4,
@@ -18,7 +19,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,
@@ -29,7 +31,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,
@@ -40,7 +43,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,
@@ -51,7 +55,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,
@@ -62,7 +67,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,
@@ -73,7 +79,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,
@@ -84,7 +91,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,
@@ -95,7 +103,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,
@@ -106,7 +115,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,
@@ -117,7 +127,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,
@@ -128,7 +139,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,
@@ -139,7 +151,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,
@@ -150,7 +163,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,
@@ -161,7 +175,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,
@@ -172,7 +187,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,
@@ -183,7 +199,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,
@@ -194,7 +211,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,
@@ -205,7 +223,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,
@@ -216,7 +235,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,
@@ -227,7 +247,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,
@@ -238,30 +259,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
+               })} // end message_set entry
+       } // end message_set vector
 {
-       for(auto& cms: can_message_set_)
+       for(std::shared_ptr<message_set_t> cms: message_set_)
        {
-               std::vector<std::shared_ptr<can_message_definition_t> >& can_messages_definition = cms->get_can_message_definition();
-               for(auto& cmd : can_messages_definition)
+               vect_ptr_msg_def_t messages_definition = cms->get_messages_definition();
+               for(std::shared_ptr<message_definition_t> cmd : messages_definition)
                {
-                       cmd->set_parent(cms.get());
-                       std::vector<std::shared_ptr<can_signal_t> >& can_signals = cmd->get_can_signals();
-                       for(auto& sig: can_signals)
+                       cmd->set_parent(cms);
+                       std::vector<std::shared_ptr<signal_t>> signals = cmd->get_signals();
+                       for(std::shared_ptr<signal_t> sig: 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)
+               std::vector<std::shared_ptr<diagnostic_message_t>> diagnostic_messages = cms->get_diagnostic_messages();
+               for(std::shared_ptr<diagnostic_message_t> dm : diagnostic_messages)
                {
-                       dm->set_parent(cms.get());
+                       dm->set_parent(cms);
                }
        }
                }