From a0e0cb5ac95e779cd2746d8c1f0740e141bbcc41 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Mon, 13 Mar 2017 17:46:50 +0100 Subject: Adding/Fix classes constructors to make them correspond to the ones generated. Change-Id: I6b0b778f59ac52fe66e36a327f60ae58550ac271 Signed-off-by: Romain Forlot --- src/configuration-generated.cpp | 49 ++++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 8 deletions(-) (limited to 'src/configuration-generated.cpp') diff --git a/src/configuration-generated.cpp b/src/configuration-generated.cpp index 867f203f..26d65645 100644 --- a/src/configuration-generated.cpp +++ b/src/configuration-generated.cpp @@ -3,17 +3,46 @@ // THIS IS AN EXAMPLE ///////////////////////////////////////////////////////////////////////////////////// -#include +#include "configuration.hpp" +#include "can/can-decoder.hpp" + +// Pre-defined OBD-II PIDs to query for if supported by the vehicle. + std::vector OBD2_PIDS = { + obd2_signal_t(0x04, "engine.load", 0, 100, POURCENT, 5, false), + obd2_signal_t(0x05, "engine.coolant.temperature", -40, 215, DEGREES_CELSIUS, 1, false), + obd2_signal_t(0x0a, "fuel.pressure", 0, 765, KPA, 1, false), + obd2_signal_t(0x0b, "intake.manifold.pressure", 0, 255, KPA, 1, false), + obd2_signal_t(0x0c, "engine.speed", 0, 16383, RPM, 5, false), + obd2_signal_t(0x0d, "vehicle.speed", 0, 255, KM_H, 5, false), + obd2_signal_t(0x0f, "intake.air.temperature", -40, 215, DEGREES_CELSIUS, 1, false), + obd2_signal_t(0x10, "mass.airflow", 0, 655, GRAMS_SEC, 5, false), + obd2_signal_t(0x11, "throttle.position", 0, 100, POURCENT, 5, false), + obd2_signal_t(0x1f, "running.time", 0, 65535, SECONDS, 1, false), + obd2_signal_t(0x2d, "EGR.error", -100, 99, POURCENT, 0, false), + obd2_signal_t(0x2f, "fuel.level", 0, 100, POURCENT, 1, false), + obd2_signal_t(0x33, "barometric.pressure", 0, 255, KPA, 1, false), + obd2_signal_t(0x4c, "commanded.throttle.position", 0, 100, POURCENT, 1, false), + obd2_signal_t(0x52, "ethanol.fuel.percentage", 0, 100, POURCENT, 1, false), + obd2_signal_t(0x5a, "accelerator.pedal.position", 0, 100, POURCENT, 5, false), + obd2_signal_t(0x5b, "hybrid.battery-pack.remaining.life", 0, 100, POURCENT, 5, false), + obd2_signal_t(0x5c, "engine.oil.temperature",-40, 210, DEGREES_CELSIUS, 1, false), + obd2_signal_t(0x63, "engine.torque", 0, 65535, NM, 1, false) +}; + +std::vector get_predefined_obd2() +{ + return OBD2_PIDS; +} std::vector CAN_MESSAGE_SET = { - {0, "example_messages", 1, 2, 2, 0, 19}, + can_message_set_t(0, "example_messages", 1, 2, 2, 0, 19), }; -std::vector> CAN_MESSAGES_DEFINTION = { +std::vector> CAN_MESSAGES_DEFINITION = { { - {0x620, can_message_format_t::STANDARD, {10, 0, nullptr}, false, (uint8_t)NULL}, - {0x442, can_message_format_t::STANDARD, {10, 0, nullptr}, false, (uint8_t)NULL}, + can_message_definition_t(0, 0x620, can_message_format_t::STANDARD, frequency_clock_t(), false), + can_message_definition_t(0, 0x442, can_message_format_t::STANDARD, frequency_clock_t(), false), }, }; @@ -23,7 +52,11 @@ std::vector> CAN_MESSAGES_DEFINTION = { */ std::vector> SIGNALS = { { - {&(CAN_MESSAGES_DEFINTION[MESSAGE_SET_ID][0]), "can.driver_door.open", 2, 4, 1.000000, 0.000000, 0.000000, 0.000000, {10, 0, nullptr}, false, true, nullptr, 0, false, decoder_t::booleanDecoder, nullptr, false, 0.0}, - {&(CAN_MESSAGES_DEFINTION[MESSAGE_SET_ID][1]), "can.driver_door.close", 0, 4, 1.000000, 0.000000, 0.000000, 0.000000, {10, 0, nullptr}, false, true, nullptr, 0, false, decoder_t::booleanDecoder, nullptr, false, 0.0} + can_signal_t((CAN_MESSAGES_DEFINITION[MESSAGE_SET_ID][0]), "can.driver_door.open", 2, 4, 1.000000, 0.000000, 0.000000, 0.000000, frequency_clock_t(), false, true, std::map(), false, decoder_t::booleanDecoder, nullptr, false), + can_signal_t((CAN_MESSAGES_DEFINITION[MESSAGE_SET_ID][1]), "can.driver_door.close", 0, 4, 1.000000, 0.000000, 0.000000, 0.000000, frequency_clock_t(), false, true, std::map(),false, decoder_t::booleanDecoder, nullptr, false) }, -}; \ No newline at end of file +}; + +configuration_t::configuration_t() + : can_message_set_{CAN_MESSAGE_SET}, can_message_definition_{CAN_MESSAGES_DEFINITION}, can_signals_{SIGNALS}, obd2_signals_{OBD2_PIDS} +{} \ No newline at end of file -- cgit 1.2.3-korg