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<can_message_set_t>(can_message_set_t{0,"AGL Virtual Car",
9 { // beginning can_message_definition_ vector
10 {std::make_shared<can_message_definition_t>(can_message_definition_t{"ls",0x30,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
11 { // beginning can_signals vector
12 {std::make_shared<can_signal_t> (can_signal_t{
20 frequency_clock_t(0.00000f),
30 {std::make_shared<can_signal_t> (can_signal_t{
31 "hvac.temperature.left",
38 frequency_clock_t(0.00000f),
48 {std::make_shared<can_signal_t> (can_signal_t{
49 "hvac.temperature.right",
56 frequency_clock_t(0.00000f),
66 {std::make_shared<can_signal_t> (can_signal_t{
67 "hvac.temperature.average",
74 frequency_clock_t(0.00000f),
84 } // end can_signals vector
85 })} // end can_message_definition entry
86 , {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x3D9,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
87 { // beginning can_signals vector
88 {std::make_shared<can_signal_t> (can_signal_t{
96 frequency_clock_t(0.00000f),
106 {std::make_shared<can_signal_t> (can_signal_t{
114 frequency_clock_t(0.00000f),
120 decoder_t::decode_boolean,
124 {std::make_shared<can_signal_t> (can_signal_t{
132 frequency_clock_t(0.00000f),
142 } // end can_signals vector
143 })} // end can_message_definition entry
144 , {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x3E9,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
145 { // beginning can_signals vector
146 {std::make_shared<can_signal_t> (can_signal_t{
147 "vehicle.average.speed",
154 frequency_clock_t(0.00000f),
164 } // end can_signals vector
165 })} // end can_message_definition entry
166 , {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x4D1,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
167 { // beginning can_signals vector
168 {std::make_shared<can_signal_t> (can_signal_t{
176 frequency_clock_t(0.00000f),
186 {std::make_shared<can_signal_t> (can_signal_t{
187 "engine.oil.temp.high",
194 frequency_clock_t(0.00000f),
200 decoder_t::decode_boolean,
204 } // end can_signals vector
205 })} // end can_message_definition entry
206 , {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x620,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
207 { // beginning can_signals vector
208 {std::make_shared<can_signal_t> (can_signal_t{
216 frequency_clock_t(0.00000f),
222 decoder_t::decode_boolean,
226 {std::make_shared<can_signal_t> (can_signal_t{
227 "doors.front_left.open",
234 frequency_clock_t(0.00000f),
240 decoder_t::decode_boolean,
244 {std::make_shared<can_signal_t> (can_signal_t{
245 "doors.front_right.open",
252 frequency_clock_t(0.00000f),
258 decoder_t::decode_boolean,
262 {std::make_shared<can_signal_t> (can_signal_t{
263 "doors.rear_left.open",
270 frequency_clock_t(0.00000f),
276 decoder_t::decode_boolean,
280 {std::make_shared<can_signal_t> (can_signal_t{
281 "doors.rear_right.open",
288 frequency_clock_t(0.00000f),
294 decoder_t::decode_boolean,
298 } // end can_signals vector
299 })} // end can_message_definition entry
300 , {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x799,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
301 { // beginning can_signals vector
302 {std::make_shared<can_signal_t> (can_signal_t{
303 "windows.front_left.open",
310 frequency_clock_t(0.00000f),
316 decoder_t::decode_boolean,
320 {std::make_shared<can_signal_t> (can_signal_t{
321 "windows.front_right.open",
328 frequency_clock_t(0.00000f),
334 decoder_t::decode_boolean,
338 {std::make_shared<can_signal_t> (can_signal_t{
339 "windows.rear_left.open",
346 frequency_clock_t(0.00000f),
352 decoder_t::decode_boolean,
356 {std::make_shared<can_signal_t> (can_signal_t{
357 "windows.rear_right.open",
364 frequency_clock_t(0.00000f),
370 decoder_t::decode_boolean,
374 } // end can_signals vector
375 })} // end can_message_definition entry
377 }, // end can_message_definition vector
378 { // beginning diagnostic_messages_ vector
379 {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
386 decoder_t::decode_obd2_response,
391 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
393 "engine.coolant.temperature",
398 decoder_t::decode_obd2_response,
403 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
410 decoder_t::decode_obd2_response,
415 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
417 "intake.manifold.pressure",
422 decoder_t::decode_obd2_response,
427 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
434 decoder_t::decode_obd2_response,
439 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
446 decoder_t::decode_obd2_response,
451 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
453 "intake.air.temperature",
458 decoder_t::decode_obd2_response,
463 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
470 decoder_t::decode_obd2_response,
475 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
482 decoder_t::decode_obd2_response,
487 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
494 decoder_t::decode_obd2_response,
499 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
506 decoder_t::decode_obd2_response,
511 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
518 decoder_t::decode_obd2_response,
523 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
525 "barometric.pressure",
530 decoder_t::decode_obd2_response,
535 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
537 "ambient.air.temperature",
542 decoder_t::decode_obd2_response,
547 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
549 "commanded.throttle.position",
554 decoder_t::decode_obd2_response,
559 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
561 "ethanol.fuel.percentage",
566 decoder_t::decode_obd2_response,
571 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
573 "accelerator.pedal.position",
578 decoder_t::decode_obd2_response,
583 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
585 "hybrid.battery-pack.remaining.life",
590 decoder_t::decode_obd2_response,
595 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
597 "engine.oil.temperature",
602 decoder_t::decode_obd2_response,
607 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
614 decoder_t::decode_obd2_response,
619 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
626 decoder_t::decode_obd2_response,
632 } // end diagnostic_messages_ vector
633 })} // end can_message_set entry
634 } // end can_message_set vector
636 for(auto& cms: can_message_set_)
638 std::vector<std::shared_ptr<can_message_definition_t> >& can_messages_definition = cms->get_can_message_definition();
639 for(auto& cmd : can_messages_definition)
641 cmd->set_parent(cms.get());
642 std::vector<std::shared_ptr<can_signal_t> >& can_signals = cmd->get_can_signals();
643 for(auto& sig: can_signals)
645 sig->set_parent(cmd.get());
649 std::vector<std::shared_ptr<diagnostic_message_t> >& diagnostic_messages = cms->get_diagnostic_messages();
650 for(auto& dm : diagnostic_messages)
652 dm->set_parent(cms.get());
657 const std::string application_t::get_diagnostic_bus() const