summaryrefslogtreecommitdiffstats
path: root/examples/engine/application-generated.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-07-20 16:40:35 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-07-21 12:02:11 +0200
commitab6a4a5eb285a1ca88b3ad87ee035b9956e253ed (patch)
tree00de00bb9722bfdbbf9d015ce691894f9a1eccde /examples/engine/application-generated.cpp
parente2af4a871c6a8bcab4733193948833aed9c5ceb8 (diff)
Examples reorganization
Separated by protocols and created signals from reversed engineered signals. Meld all used signals into an "agl-vcar" folder to be used as default. Change-Id: I27f7bc227a6fcea3db6672819e6a4d7bbf09863b Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'examples/engine/application-generated.cpp')
-rw-r--r--examples/engine/application-generated.cpp163
1 files changed, 163 insertions, 0 deletions
diff --git a/examples/engine/application-generated.cpp b/examples/engine/application-generated.cpp
new file mode 100644
index 00000000..cc123b7d
--- /dev/null
+++ b/examples/engine/application-generated.cpp
@@ -0,0 +1,163 @@
+#include "application.hpp"
+#include "../can/can-decoder.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
+ {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x3D9,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
+ { // beginning can_signals vector
+ {std::make_shared<can_signal_t> (can_signal_t{
+ "engine.speed",
+ 16,
+ 16,
+ 0.250000f,
+ 0.00000,
+ 0,
+ 0,
+ frequency_clock_t(0.00000f),
+ true,
+ false,
+ {
+ },
+ false,
+ nullptr,
+ nullptr,
+ false
+ })},
+ {std::make_shared<can_signal_t> (can_signal_t{
+ "fuel.level.low",
+ 55,
+ 1,
+ 1.00000f,
+ 0.00000,
+ 0,
+ 0,
+ frequency_clock_t(0.00000f),
+ true,
+ false,
+ {
+ },
+ false,
+ decoder_t::booleanDecoder,
+ nullptr,
+ false
+ })},
+ {std::make_shared<can_signal_t> (can_signal_t{
+ "fuel.level",
+ 8,
+ 8,
+ 0.392157f,
+ 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<can_message_definition_t>(can_message_definition_t{"hs",0x3E9,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
+ { // beginning can_signals vector
+ {std::make_shared<can_signal_t> (can_signal_t{
+ "vehicle.average.speed",
+ 0,
+ 15,
+ 0.0156250f,
+ 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<can_message_definition_t>(can_message_definition_t{"hs",0x4D1,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
+ { // beginning can_signals vector
+ {std::make_shared<can_signal_t> (can_signal_t{
+ "engine.oil.temp",
+ 16,
+ 8,
+ 1.00000f,
+ 0.00000,
+ 0,
+ 0,
+ frequency_clock_t(0.00000f),
+ true,
+ false,
+ {
+ },
+ false,
+ nullptr,
+ nullptr,
+ false
+ })},
+ {std::make_shared<can_signal_t> (can_signal_t{
+ "engine.oil.temp.high",
+ 7,
+ 1,
+ 1.00000f,
+ 0.00000,
+ 0,
+ 0,
+ frequency_clock_t(0.00000f),
+ true,
+ false,
+ {
+ },
+ false,
+ decoder_t::booleanDecoder,
+ nullptr,
+ false
+ })}
+ } // end can_signals vector
+ })} // end can_message_definition entry
+
+ }, // end can_message_definition vector
+ { // beginning diagnostic_messages_ vector
+
+ } // end diagnostic_messages_ vector
+ })} // end can_message_set entry
+ } // end can_message_set vector
+{
+ for(auto& cms: can_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)
+ {
+ cmd->set_parent(cms.get());
+ std::vector<std::shared_ptr<can_signal_t> >& can_signals = cmd->get_can_signals();
+ for(auto& sig: can_signals)
+ {
+ sig->set_parent(cmd.get());
+ }
+ }
+
+ std::vector<std::shared_ptr<diagnostic_message_t> >& diagnostic_messages = cms->get_diagnostic_messages();
+ for(auto& dm : diagnostic_messages)
+ {
+ dm->set_parent(cms.get());
+ }
+ }
+ }
+
+const std::string application_t::get_diagnostic_bus() const
+{
+ return "";
+}
+
+