1 #include "configuration.hpp"
2 #include "../can/can-decoder.hpp"
4 configuration_t::configuration_t()
5 : can_bus_manager_{utils::config_parser_t{"/etc/dev-mapping.conf"}}
7 {std::make_shared<can_message_set_t>(can_message_set_t{0,"example",
8 { // beginning can_message_definition_ vector
9 {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x3D9,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
10 { // beginning can_signals vector
11 {std::make_shared<can_signal_t> (can_signal_t{
19 frequency_clock_t(0.00000f),
29 {std::make_shared<can_signal_t> (can_signal_t{
37 frequency_clock_t(0.00000f),
43 decoder_t::booleanDecoder,
47 {std::make_shared<can_signal_t> (can_signal_t{
55 frequency_clock_t(0.00000f),
65 } // end can_signals vector
66 })} // end can_message_definition entry
67 , {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x3E9,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
68 { // beginning can_signals vector
69 {std::make_shared<can_signal_t> (can_signal_t{
70 "vehicle.average.speed",
77 frequency_clock_t(0.00000f),
87 } // end can_signals vector
88 })} // end can_message_definition entry
89 , {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x4D1,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
90 { // beginning can_signals vector
91 {std::make_shared<can_signal_t> (can_signal_t{
99 frequency_clock_t(0.00000f),
109 {std::make_shared<can_signal_t> (can_signal_t{
110 "engine.oil.temp.high",
117 frequency_clock_t(0.00000f),
123 decoder_t::booleanDecoder,
127 } // end can_signals vector
128 })} // end can_message_definition entry
129 , {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x620,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
130 { // beginning can_signals vector
131 {std::make_shared<can_signal_t> (can_signal_t{
139 frequency_clock_t(0.00000f),
145 decoder_t::booleanDecoder,
149 {std::make_shared<can_signal_t> (can_signal_t{
150 "doors.front_left.open",
157 frequency_clock_t(0.00000f),
163 decoder_t::booleanDecoder,
167 {std::make_shared<can_signal_t> (can_signal_t{
168 "doors.front_right.open",
175 frequency_clock_t(0.00000f),
181 decoder_t::booleanDecoder,
185 {std::make_shared<can_signal_t> (can_signal_t{
186 "doors.rear_left.open",
193 frequency_clock_t(0.00000f),
199 decoder_t::booleanDecoder,
203 {std::make_shared<can_signal_t> (can_signal_t{
204 "doors.rear_right.open",
211 frequency_clock_t(0.00000f),
217 decoder_t::booleanDecoder,
221 } // end can_signals vector
222 })} // end can_message_definition entry
223 }, // end can_message_definition vector
224 { // beginning diagnostic_messages_ vector
225 {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
232 decoder_t::decode_obd2_response,
236 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
238 "engine.coolant.temperature",
243 decoder_t::decode_obd2_response,
247 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
254 decoder_t::decode_obd2_response,
258 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
260 "intake.manifold.pressure",
265 decoder_t::decode_obd2_response,
269 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
276 decoder_t::decode_obd2_response,
280 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
287 decoder_t::decode_obd2_response,
291 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
293 "intake.air.temperature",
298 decoder_t::decode_obd2_response,
302 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
309 decoder_t::decode_obd2_response,
313 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
320 decoder_t::decode_obd2_response,
324 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
331 decoder_t::decode_obd2_response,
335 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
342 decoder_t::decode_obd2_response,
346 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
353 decoder_t::decode_obd2_response,
357 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
359 "barometric.pressure",
364 decoder_t::decode_obd2_response,
368 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
370 "ambient.air.temperature",
375 decoder_t::decode_obd2_response,
379 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
381 "commanded.throttle.position",
386 decoder_t::decode_obd2_response,
390 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
392 "ethanol.fuel.percentage",
397 decoder_t::decode_obd2_response,
401 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
403 "accelerator.pedal.position",
408 decoder_t::decode_obd2_response,
412 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
414 "hybrid.battery-pack.remaining.life",
419 decoder_t::decode_obd2_response,
423 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
425 "engine.oil.temperature",
430 decoder_t::decode_obd2_response,
434 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
441 decoder_t::decode_obd2_response,
445 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
452 decoder_t::decode_obd2_response,
456 } // end diagnostic_messages_ vector
457 })} // end can_message_set entry
458 } // end can_message_set vector
460 for(auto& cms: can_message_set_)
462 std::vector<std::shared_ptr<can_message_definition_t> >& can_messages_definition = cms->get_can_message_definition();
463 for(auto& cmd : can_messages_definition)
465 cmd->set_parent(cms.get());
466 std::vector<std::shared_ptr<can_signal_t> >& can_signals = cmd->get_can_signals();
467 for(auto& sig: can_signals)
469 sig->set_parent(cmd.get());
473 std::vector<std::shared_ptr<diagnostic_message_t> >& diagnostic_messages = cms->get_diagnostic_messages();
474 for(auto& dm : diagnostic_messages)
476 dm->set_parent(cms.get());
481 const std::string configuration_t::get_diagnostic_bus() const