summaryrefslogtreecommitdiffstats
path: root/examples/basic
diff options
context:
space:
mode:
Diffstat (limited to 'examples/basic')
-rw-r--r--examples/basic/application-generated.cpp221
1 files changed, 121 insertions, 100 deletions
diff --git a/examples/basic/application-generated.cpp b/examples/basic/application-generated.cpp
index f4fddf0a..e05397ad 100644
--- a/examples/basic/application-generated.cpp
+++ b/examples/basic/application-generated.cpp
@@ -2,6 +2,7 @@
#include "../can/can-decoder.hpp"
#include "../can/can-encoder.hpp"
+
// >>>>> handlers.cpp >>>>>
#include "can/canread.h"
@@ -30,40 +31,44 @@ void myLooper() {
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",0x128,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",
- 12,
- 8,
- 1.00000f,
- 0.00000,
- 0,
- 0,
- frequency_clock_t(15.0000f),
- true,
- false,
+ , message_set_{
+ {std::make_shared<message_set_t>(message_set_t{0,"example",
+ { // beginning message_definition_ vector
+ {std::make_shared<message_definition_t>(message_definition_t{"hs",0x128,0,0,message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
+ { // beginning signals vector
+ {std::make_shared<signal_t> (signal_t{
+ "engine_speed",// generic_name
+ 12,// bit_position
+ 8,// bit_size
+ 1.00000f,// factor
+ 0.00000,// offset
+ 0,// min_value
+ 0,// max_value
+ frequency_clock_t(15.0000f),// frequency
+ true,// send_same
+ false,// force_send_changed
{
- },
- false,
- nullptr,
- nullptr,
- false
+ },// states
+ false,// writable
+ nullptr,// decoder
+ nullptr,// encoder
+ false,// received
+ std::make_pair<bool, int>(false, 0),// multiplex
+ 0,// is_big_endian
+ 0,// is_signed
+ ""// unit
})},
- {std::make_shared<can_signal_t> (can_signal_t{
- "GearshiftPosition",
- 41,
- 3,
- 1.00000f,
- 0.00000,
- 0,
- 0,
- frequency_clock_t(0.00000f),
- true,
- false,
+ {std::make_shared<signal_t> (signal_t{
+ "GearshiftPosition",// generic_name
+ 41,// bit_position
+ 3,// bit_size
+ 1.00000f,// factor
+ 0.00000,// offset
+ 0,// min_value
+ 0,// max_value
+ frequency_clock_t(0.00000f),// frequency
+ true,// send_same
+ false,// force_send_changed
{
{1,"FIRST"},
{4,"FOURTH"},
@@ -71,70 +76,86 @@ application_t::application_t()
{5,"REVERSE"},
{2,"SECOND"},
{3,"THIRD"}
- },
- false,
- nullptr,
- nullptr,
- false
+ },// states
+ false,// writable
+ nullptr,// decoder
+ nullptr,// encoder
+ false,// received
+ std::make_pair<bool, int>(false, 0),// multiplex
+ 0,// is_big_endian
+ 0,// is_signed
+ ""// unit
})},
- {std::make_shared<can_signal_t> (can_signal_t{
- "SteeringWheelAngle",
- 52,
- 12,
- 0.153920f,
- 0.00000,
- 0,
- 0,
- frequency_clock_t(0.00000f),
- true,
- false,
+ {std::make_shared<signal_t> (signal_t{
+ "SteeringWheelAngle",// generic_name
+ 52,// bit_position
+ 12,// bit_size
+ 0.153920f,// factor
+ 0.00000,// offset
+ 0,// min_value
+ 0,// max_value
+ frequency_clock_t(0.00000f),// frequency
+ true,// send_same
+ false,// force_send_changed
{
- },
- false,
- handleUnsignedSteeringWheelAngle,
- nullptr,
- false
+ },// states
+ false,// writable
+ handleUnsignedSteeringWheelAngle,// decoder
+ nullptr,// encoder
+ false,// received
+ std::make_pair<bool, int>(false, 0),// multiplex
+ 0,// is_big_endian
+ 0,// is_signed
+ ""// unit
})},
- {std::make_shared<can_signal_t> (can_signal_t{
- "steering_wheel_angle_error",
- 44,
- 12,
- 1.00000f,
- 0.00000,
- 0,
- 0,
- frequency_clock_t(0.00000f),
- true,
- false,
+ {std::make_shared<signal_t> (signal_t{
+ "steering_wheel_angle_error",// generic_name
+ 44,// bit_position
+ 12,// bit_size
+ 1.00000f,// factor
+ 0.00000,// offset
+ 0,// min_value
+ 0,// max_value
+ frequency_clock_t(0.00000f),// frequency
+ true,// send_same
+ false,// force_send_changed
{
- },
- false,
- ignoreDecoder,
- nullptr,
- false
+ },// states
+ false,// writable
+ ignoreDecoder,// decoder
+ nullptr,// encoder
+ false,// received
+ std::make_pair<bool, int>(false, 0),// multiplex
+ 0,// is_big_endian
+ 0,// is_signed
+ ""// unit
})},
- {std::make_shared<can_signal_t> (can_signal_t{
- "steering_angle_sign",
- 52,
- 12,
- 1.00000f,
- 0.00000,
- 0,
- 0,
- frequency_clock_t(0.00000f),
- true,
- false,
+ {std::make_shared<signal_t> (signal_t{
+ "steering_angle_sign",// generic_name
+ 52,// bit_position
+ 12,// bit_size
+ 1.00000f,// factor
+ 0.00000,// offset
+ 0,// min_value
+ 0,// max_value
+ frequency_clock_t(0.00000f),// frequency
+ true,// send_same
+ false,// force_send_changed
{
- },
- false,
- ignoreDecoder,
- nullptr,
- false
+ },// states
+ false,// writable
+ ignoreDecoder,// decoder
+ nullptr,// encoder
+ false,// received
+ std::make_pair<bool, int>(false, 0),// multiplex
+ 0,// is_big_endian
+ 0,// is_signed
+ ""// unit
})}
- } // end can_signals vector
- })} // end can_message_definition entry
+ } // end signals vector
+ })} // end message_definition entry
- }, // end can_message_definition vector
+ }, // end message_definition vector
{ // beginning diagnostic_messages_ vector
{std::make_shared<diagnostic_message_t>(diagnostic_message_t{
12,
@@ -174,26 +195,26 @@ application_t::application_t()
})}
} // 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)
+ std::vector<std::shared_ptr<message_definition_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);
}
}
}