1 #include "application.hpp"
2 #include "../can/can-decoder.hpp"
4 application_t::application_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{"ls",0x30,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{
30 "hvac.temperature.left",
37 frequency_clock_t(0.00000f),
47 {std::make_shared<can_signal_t> (can_signal_t{
48 "hvac.temperature.right",
55 frequency_clock_t(0.00000f),
65 {std::make_shared<can_signal_t> (can_signal_t{
66 "hvac.temperature.average",
73 frequency_clock_t(0.00000f),
83 } // end can_signals vector
84 })} // end can_message_definition entry
85 , {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x3D9,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
86 { // beginning can_signals vector
87 {std::make_shared<can_signal_t> (can_signal_t{
95 frequency_clock_t(0.00000f),
105 {std::make_shared<can_signal_t> (can_signal_t{
113 frequency_clock_t(0.00000f),
119 decoder_t::decode_boolean,
123 {std::make_shared<can_signal_t> (can_signal_t{
131 frequency_clock_t(0.00000f),
141 } // end can_signals vector
142 })} // end can_message_definition entry
143 , {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x3E9,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
144 { // beginning can_signals vector
145 {std::make_shared<can_signal_t> (can_signal_t{
146 "vehicle.average.speed",
153 frequency_clock_t(0.00000f),
163 } // end can_signals vector
164 })} // end can_message_definition entry
165 , {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x4D1,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
166 { // beginning can_signals vector
167 {std::make_shared<can_signal_t> (can_signal_t{
175 frequency_clock_t(0.00000f),
185 {std::make_shared<can_signal_t> (can_signal_t{
186 "engine.oil.temp.high",
193 frequency_clock_t(0.00000f),
199 decoder_t::decode_boolean,
203 } // end can_signals vector
204 })} // end can_message_definition entry
205 , {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x620,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
206 { // beginning can_signals vector
207 {std::make_shared<can_signal_t> (can_signal_t{
215 frequency_clock_t(0.00000f),
221 decoder_t::decode_boolean,
225 {std::make_shared<can_signal_t> (can_signal_t{
226 "doors.front_left.open",
233 frequency_clock_t(0.00000f),
239 decoder_t::decode_boolean,
243 {std::make_shared<can_signal_t> (can_signal_t{
244 "doors.front_right.open",
251 frequency_clock_t(0.00000f),
257 decoder_t::decode_boolean,
261 {std::make_shared<can_signal_t> (can_signal_t{
262 "doors.rear_left.open",
269 frequency_clock_t(0.00000f),
275 decoder_t::decode_boolean,
279 {std::make_shared<can_signal_t> (can_signal_t{
280 "doors.rear_right.open",
287 frequency_clock_t(0.00000f),
293 decoder_t::decode_boolean,
297 } // end can_signals vector
298 })} // end can_message_definition entry
299 , {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x799,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
300 { // beginning can_signals vector
301 {std::make_shared<can_signal_t> (can_signal_t{
302 "windows.front_left.open",
309 frequency_clock_t(0.00000f),
315 decoder_t::decode_boolean,
319 {std::make_shared<can_signal_t> (can_signal_t{
320 "windows.front_right.open",
327 frequency_clock_t(0.00000f),
333 decoder_t::decode_boolean,
337 {std::make_shared<can_signal_t> (can_signal_t{
338 "windows.rear_left.open",
345 frequency_clock_t(0.00000f),
351 decoder_t::decode_boolean,
355 {std::make_shared<can_signal_t> (can_signal_t{
356 "windows.rear_right.open",
363 frequency_clock_t(0.00000f),
369 decoder_t::decode_boolean,
373 } // end can_signals vector
374 })} // end can_message_definition entry
376 }, // end can_message_definition vector
377 { // beginning diagnostic_messages_ vector
378 {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
385 decoder_t::decode_obd2_response,
389 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
391 "engine.coolant.temperature",
396 decoder_t::decode_obd2_response,
400 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
407 decoder_t::decode_obd2_response,
411 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
413 "intake.manifold.pressure",
418 decoder_t::decode_obd2_response,
422 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
429 decoder_t::decode_obd2_response,
433 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
440 decoder_t::decode_obd2_response,
444 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
446 "intake.air.temperature",
451 decoder_t::decode_obd2_response,
455 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
462 decoder_t::decode_obd2_response,
466 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
473 decoder_t::decode_obd2_response,
477 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
484 decoder_t::decode_obd2_response,
488 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
495 decoder_t::decode_obd2_response,
499 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
506 decoder_t::decode_obd2_response,
510 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
512 "barometric.pressure",
517 decoder_t::decode_obd2_response,
521 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
523 "ambient.air.temperature",
528 decoder_t::decode_obd2_response,
532 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
534 "commanded.throttle.position",
539 decoder_t::decode_obd2_response,
543 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
545 "ethanol.fuel.percentage",
550 decoder_t::decode_obd2_response,
554 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
556 "accelerator.pedal.position",
561 decoder_t::decode_obd2_response,
565 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
567 "hybrid.battery-pack.remaining.life",
572 decoder_t::decode_obd2_response,
576 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
578 "engine.oil.temperature",
583 decoder_t::decode_obd2_response,
587 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
594 decoder_t::decode_obd2_response,
598 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
605 decoder_t::decode_obd2_response,
610 } // end diagnostic_messages_ vector
611 })} // end can_message_set entry
612 } // end can_message_set vector
614 for(auto& cms: can_message_set_)
616 std::vector<std::shared_ptr<can_message_definition_t> >& can_messages_definition = cms->get_can_message_definition();
617 for(auto& cmd : can_messages_definition)
619 cmd->set_parent(cms.get());
620 std::vector<std::shared_ptr<can_signal_t> >& can_signals = cmd->get_can_signals();
621 for(auto& sig: can_signals)
623 sig->set_parent(cmd.get());
627 std::vector<std::shared_ptr<diagnostic_message_t> >& diagnostic_messages = cms->get_diagnostic_messages();
628 for(auto& dm : diagnostic_messages)
630 dm->set_parent(cms.get());
635 const std::string application_t::get_diagnostic_bus() const