1 #include "application.hpp"
2 #include "../can/can-decoder.hpp"
3 #include "../can/can-encoder.hpp"
5 application_t::application_t()
6 : can_bus_manager_{utils::config_parser_t{"/etc/dev-mapping.conf"}}
8 {std::make_shared<message_set_t>(message_set_t{0,"AGL Virtual Car",
9 { // beginning can_message_definition_ vector
10 {std::make_shared<message_definition_t>(message_definition_t{
14 message_format_t::EXTENDED,
15 frequency_clock_t(5.00000f),
17 { // beginning can_signals vector
18 {std::make_shared<signal_t> (signal_t{
26 frequency_clock_t(0.00000f),
36 {std::make_shared<signal_t> (signal_t{
37 "hvac.temperature.left",
44 frequency_clock_t(0.00000f),
54 {std::make_shared<signal_t> (signal_t{
55 "hvac.temperature.right",
62 frequency_clock_t(0.00000f),
72 {std::make_shared<signal_t> (signal_t{
73 "hvac.temperature.average",
80 frequency_clock_t(0.00000f),
90 } // end can_signals vector
91 })} // end can_message_definition entry
92 , {std::make_shared<message_definition_t>(message_definition_t{
96 message_format_t::STANDARD,
97 frequency_clock_t(5.00000f),
99 { // beginning can_signals vector
100 {std::make_shared<signal_t> (signal_t{
108 frequency_clock_t(0.00000f),
118 {std::make_shared<signal_t> (signal_t{
126 frequency_clock_t(0.00000f),
132 decoder_t::decode_boolean,
136 {std::make_shared<signal_t> (signal_t{
144 frequency_clock_t(0.00000f),
154 } // end can_signals vector
155 })} // end can_message_definition entry
156 , {std::make_shared<message_definition_t>(message_definition_t{
160 message_format_t::EXTENDED,
161 frequency_clock_t(5.00000f),
163 { // beginning can_signals vector
164 {std::make_shared<signal_t> (signal_t{
165 "vehicle.average.speed",
172 frequency_clock_t(0.00000f),
182 } // end can_signals vector
183 })} // end can_message_definition entry
184 , {std::make_shared<message_definition_t>(message_definition_t{
188 message_format_t::STANDARD,
189 frequency_clock_t(5.00000f),
191 { // beginning can_signals vector
192 {std::make_shared<signal_t> (signal_t{
200 frequency_clock_t(0.00000f),
210 {std::make_shared<signal_t> (signal_t{
211 "engine.oil.temp.high",
218 frequency_clock_t(0.00000f),
224 decoder_t::decode_boolean,
228 } // end can_signals vector
229 })} // end can_message_definition entry
230 , {std::make_shared<message_definition_t>(message_definition_t{
234 message_format_t::STANDARD,
235 frequency_clock_t(5.00000f),
237 { // beginning can_signals vector
238 {std::make_shared<signal_t> (signal_t{
239 "accelerator.pedal.position",
246 frequency_clock_t(0.00000f),
256 {std::make_shared<signal_t> (signal_t{
257 "steering.wheel.angle",
264 frequency_clock_t(0.00000f),
274 } // end can_signals vector
275 })} // end can_message_definition entry
276 , {std::make_shared<message_definition_t>(message_definition_t{
280 message_format_t::STANDARD,
281 frequency_clock_t(5.00000f),
283 { // beginning can_signals vector
284 {std::make_shared<signal_t> (signal_t{
285 "transmission.gearinfo",
292 frequency_clock_t(0.00000f),
302 {std::make_shared<signal_t> (signal_t{
310 frequency_clock_t(0.00000f),
320 } // end can_signals vector
321 })} // end can_message_definition entry
322 , {std::make_shared<message_definition_t>(message_definition_t{
326 message_format_t::STANDARD,
327 frequency_clock_t(5.00000f),
329 { // beginning can_signals vector
330 {std::make_shared<signal_t> (signal_t{
338 frequency_clock_t(0.00000f),
348 {std::make_shared<signal_t> (signal_t{
356 frequency_clock_t(0.00000f),
362 decoder_t::decode_boolean,
366 {std::make_shared<signal_t> (signal_t{
367 "parking.brake.status",
374 frequency_clock_t(0.00000f),
380 decoder_t::decode_boolean,
384 } // end can_signals vector
385 })} // end can_message_definition entry
386 , {std::make_shared<message_definition_t>(message_definition_t{
390 message_format_t::STANDARD,
391 frequency_clock_t(5.00000f),
393 { // beginning can_signals vector
394 {std::make_shared<signal_t> (signal_t{
402 frequency_clock_t(0.00000f),
408 decoder_t::decode_boolean,
412 {std::make_shared<signal_t> (signal_t{
413 "doors.front_left.open",
420 frequency_clock_t(0.00000f),
426 decoder_t::decode_boolean,
430 {std::make_shared<signal_t> (signal_t{
431 "doors.front_right.open",
438 frequency_clock_t(0.00000f),
444 decoder_t::decode_boolean,
448 {std::make_shared<signal_t> (signal_t{
449 "doors.rear_left.open",
456 frequency_clock_t(0.00000f),
462 decoder_t::decode_boolean,
466 {std::make_shared<signal_t> (signal_t{
467 "doors.rear_right.open",
474 frequency_clock_t(0.00000f),
480 decoder_t::decode_boolean,
484 } // end can_signals vector
485 })} // end can_message_definition entry
486 , {std::make_shared<message_definition_t>(message_definition_t{
490 message_format_t::STANDARD,
491 frequency_clock_t(5.00000f),
493 { // beginning can_signals vector
494 {std::make_shared<signal_t> (signal_t{
495 "windows.front_left.open",
502 frequency_clock_t(0.00000f),
508 decoder_t::decode_boolean,
512 {std::make_shared<signal_t> (signal_t{
513 "windows.front_right.open",
520 frequency_clock_t(0.00000f),
526 decoder_t::decode_boolean,
530 {std::make_shared<signal_t> (signal_t{
531 "windows.rear_left.open",
538 frequency_clock_t(0.00000f),
544 decoder_t::decode_boolean,
548 {std::make_shared<signal_t> (signal_t{
549 "windows.rear_right.open",
556 frequency_clock_t(0.00000f),
562 decoder_t::decode_boolean,
566 } // end can_signals vector
567 })} // end can_message_definition entry
569 }, // end can_message_definition vector
570 { // beginning diagnostic_messages_ vector
571 {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
578 decoder_t::decode_obd2_response,
583 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
585 "engine.coolant.temperature",
590 decoder_t::decode_obd2_response,
595 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
602 decoder_t::decode_obd2_response,
607 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
609 "intake.manifold.pressure",
614 decoder_t::decode_obd2_response,
619 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
626 decoder_t::decode_obd2_response,
631 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
638 decoder_t::decode_obd2_response,
643 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
645 "intake.air.temperature",
650 decoder_t::decode_obd2_response,
655 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
662 decoder_t::decode_obd2_response,
667 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
674 decoder_t::decode_obd2_response,
679 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
686 decoder_t::decode_obd2_response,
691 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
698 decoder_t::decode_obd2_response,
703 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
710 decoder_t::decode_obd2_response,
715 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
717 "barometric.pressure",
722 decoder_t::decode_obd2_response,
727 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
729 "ambient.air.temperature",
734 decoder_t::decode_obd2_response,
739 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
741 "commanded.throttle.position",
746 decoder_t::decode_obd2_response,
751 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
753 "ethanol.fuel.percentage",
758 decoder_t::decode_obd2_response,
763 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
765 "accelerator.pedal.position",
770 decoder_t::decode_obd2_response,
775 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
777 "hybrid.battery-pack.remaining.life",
782 decoder_t::decode_obd2_response,
787 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
789 "engine.oil.temperature",
794 decoder_t::decode_obd2_response,
799 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
806 decoder_t::decode_obd2_response,
811 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
818 decoder_t::decode_obd2_response,
824 } // end diagnostic_messages_ vector
825 })} // end can_message_set entry
826 } // end can_message_set vector
828 for(auto& cms: message_set_)
830 std::vector<std::shared_ptr<message_definition_t> >& can_messages_definition = cms->get_messages_definition();
831 for(auto& cmd : can_messages_definition)
833 cmd->set_parent(cms);
834 std::vector<std::shared_ptr<signal_t> >& can_signals = cmd->get_signals();
835 for(auto& sig: can_signals)
837 sig->set_parent(cmd);
841 std::vector<std::shared_ptr<diagnostic_message_t> >& diagnostic_messages = cms->get_diagnostic_messages();
842 for(auto& dm : diagnostic_messages)
849 const std::string application_t::get_diagnostic_bus() const