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,"example",
9 { // beginning message_definition_ vector
11 }, // end message_definition vector
12 { // beginning diagnostic_messages_ vector
13 {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
20 decoder_t::decode_obd2_response,
25 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
27 "engine.coolant.temperature",
32 decoder_t::decode_obd2_response,
37 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
44 decoder_t::decode_obd2_response,
49 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
51 "intake.manifold.pressure",
56 decoder_t::decode_obd2_response,
61 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
68 decoder_t::decode_obd2_response,
73 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
80 decoder_t::decode_obd2_response,
85 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
87 "intake.air.temperature",
92 decoder_t::decode_obd2_response,
97 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
104 decoder_t::decode_obd2_response,
109 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
116 decoder_t::decode_obd2_response,
121 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
128 decoder_t::decode_obd2_response,
133 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
140 decoder_t::decode_obd2_response,
145 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
152 decoder_t::decode_obd2_response,
157 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
159 "barometric.pressure",
164 decoder_t::decode_obd2_response,
169 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
171 "ambient.air.temperature",
176 decoder_t::decode_obd2_response,
181 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
183 "commanded.throttle.position",
188 decoder_t::decode_obd2_response,
193 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
195 "ethanol.fuel.percentage",
200 decoder_t::decode_obd2_response,
205 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
207 "accelerator.pedal.position",
212 decoder_t::decode_obd2_response,
217 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
219 "hybrid.battery-pack.remaining.life",
224 decoder_t::decode_obd2_response,
229 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
231 "engine.oil.temperature",
236 decoder_t::decode_obd2_response,
241 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
248 decoder_t::decode_obd2_response,
253 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
260 decoder_t::decode_obd2_response,
266 } // end diagnostic_messages_ vector
267 })} // end message_set entry
268 } // end message_set vector
270 for(std::shared_ptr<message_set_t> cms: message_set_)
272 std::vector<std::shared_ptr<message_definition_t>> messages_definition = cms->get_messages_definition();
273 for(std::shared_ptr<message_definition_t> cmd : messages_definition)
275 cmd->set_parent(cms);
276 std::vector<std::shared_ptr<signal_t>> signals = cmd->get_signals();
277 for(std::shared_ptr<signal_t> sig: signals)
279 sig->set_parent(cmd);
283 std::vector<std::shared_ptr<diagnostic_message_t>> diagnostic_messages = cms->get_diagnostic_messages();
284 for(std::shared_ptr<diagnostic_message_t> dm : diagnostic_messages)
291 const std::string application_t::get_diagnostic_bus() const