aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-03-16 18:17:16 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-03-16 18:17:16 +0100
commite5a97dac176ab84b5903b41113921e42335b1def (patch)
treed232b2474db4b4901620248e9d35f1f49a28bd21
parent8fc21efc5ec7669d38712f44d71d10056614ea64 (diff)
Generated cpp file example.
Change-Id: I1608db0120a0501af0e4327fe348ef149d90bad4 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--src/configuration-generated.cpp223
1 files changed, 163 insertions, 60 deletions
diff --git a/src/configuration-generated.cpp b/src/configuration-generated.cpp
index ccbf559b..a2e8d2c1 100644
--- a/src/configuration-generated.cpp
+++ b/src/configuration-generated.cpp
@@ -1,67 +1,170 @@
-
-/////////////////////////////////////////////////////////////////////////////////////
-// THIS IS AN EXAMPLE
-/////////////////////////////////////////////////////////////////////////////////////
-
#include "configuration.hpp"
#include "can/can-decoder.hpp"
-// Pre-defined OBD-II PIDs to query for if supported by the vehicle.
- std::vector<diagnostic_message_t> DIAGNOSTIC_MESSAGES = {
- diagnostic_message_t(0x04, "engine.load", 0, 100, POURCENT, 5, decoder_t::decode_obd2_response, nullptr, false),
- diagnostic_message_t(0x05, "engine.coolant.temperature", -40, 215, DEGREES_CELSIUS, 1, decoder_t::decode_obd2_response, nullptr, false),
- diagnostic_message_t(0x0a, "fuel.pressure", 0, 765, KPA, 1, decoder_t::decode_obd2_response, nullptr, false),
- diagnostic_message_t(0x0b, "intake.manifold.pressure", 0, 255, KPA, 1, decoder_t::decode_obd2_response, nullptr, false),
- diagnostic_message_t(0x0c, "engine.speed", 0, 16383, RPM, 5, decoder_t::decode_obd2_response, nullptr, false),
- diagnostic_message_t(0x0d, "vehicle.speed", 0, 255, KM_H, 5, decoder_t::decode_obd2_response, nullptr, false),
- diagnostic_message_t(0x0f, "intake.air.temperature", -40, 215, DEGREES_CELSIUS, 1, decoder_t::decode_obd2_response, nullptr, false),
- diagnostic_message_t(0x10, "mass.airflow", 0, 655, GRAMS_SEC, 5, decoder_t::decode_obd2_response, nullptr, false),
- diagnostic_message_t(0x11, "throttle.position", 0, 100, POURCENT, 5, decoder_t::decode_obd2_response, nullptr, false),
- diagnostic_message_t(0x1f, "running.time", 0, 65535, SECONDS, 1, decoder_t::decode_obd2_response, nullptr, false),
- diagnostic_message_t(0x2d, "EGR.error", -100, 99, POURCENT, 0, decoder_t::decode_obd2_response, nullptr, false),
- diagnostic_message_t(0x2f, "fuel.level", 0, 100, POURCENT, 1, decoder_t::decode_obd2_response, nullptr, false),
- diagnostic_message_t(0x33, "barometric.pressure", 0, 255, KPA, 1, decoder_t::decode_obd2_response, nullptr, false),
- diagnostic_message_t(0x4c, "commanded.throttle.position", 0, 100, POURCENT, 1, decoder_t::decode_obd2_response, nullptr, false),
- diagnostic_message_t(0x52, "ethanol.fuel.percentage", 0, 100, POURCENT, 1, decoder_t::decode_obd2_response, nullptr, false),
- diagnostic_message_t(0x5a, "accelerator.pedal.position", 0, 100, POURCENT, 5, decoder_t::decode_obd2_response, nullptr, false),
- diagnostic_message_t(0x5b, "hybrid.battery-pack.remaining.life", 0, 100, POURCENT, 5, decoder_t::decode_obd2_response, nullptr, false),
- diagnostic_message_t(0x5c, "engine.oil.temperature",-40, 210, DEGREES_CELSIUS, 1, decoder_t::decode_obd2_response, nullptr, false),
- diagnostic_message_t(0x63, "engine.torque", 0, 65535, NM, 1, decoder_t::decode_obd2_response, nullptr, false)
-};
-
-std::vector<diagnostic_message_t> get_predefined_obd2()
-{
- return DIAGNOSTIC_MESSAGES;
-}
-
-std::vector<can_message_set_t> CAN_MESSAGE_SET =
-{
- can_message_set_t(0, "example_messages", 1, 2, 2, 0, 19),
-};
-
-std::vector<std::vector<can_message_definition_t>> CAN_MESSAGES_DEFINITION = {
+configuration_t::configuration_t()
+ : can_message_set_{{0, "example", 2, 2, 7, 1, 3}}
+ , can_message_definition_
{
- can_message_definition_t("vcan0", 0x620, can_message_format_t::STANDARD, frequency_clock_t(), false),
- can_message_definition_t("vcan0", 0x442, can_message_format_t::STANDARD, frequency_clock_t(), false),
- },
-};
-
-/**
- * @brief Dumb SIGNALS array. It is composed by can_message_set_t
- * SIGNALS[MESSAGE_SET_ID][can_signal_t]
- */
-std::vector<std::vector<can_signal_t>> SIGNALS = {
+ {
+ can_message_definition_t(0, "can0", 0x128, can_message_format_t::STANDARD, frequency_clock_t(0.00000f), true),
+ can_message_definition_t(0, "can0", 0x813, can_message_format_t::STANDARD, frequency_clock_t(0.00000f), true)
+ }
+ }
+ , can_signals_
{
- can_signal_t((CAN_MESSAGES_DEFINITION[MESSAGE_SET_ID][0]), "driver_door.open", 2, 4, 1.000000, 0.000000, 0.000000, 0.000000, frequency_clock_t(), false, true, std::map<uint8_t, std::string>(), false, decoder_t::booleanDecoder, nullptr, false),
- can_signal_t((CAN_MESSAGES_DEFINITION[MESSAGE_SET_ID][1]), "driver_door.close", 0, 4, 1.000000, 0.000000, 0.000000, 0.000000, frequency_clock_t(), false, true, std::map<uint8_t, std::string>(),false, decoder_t::booleanDecoder, nullptr, false)
- },
-};
+ {
+ {
+ 0,
+ 0,
+ "engine_speed",
+ 12,
+ 8,
+ 1.00000f,
+ 0,
+ 0,
+ 0,
+ frequency_clock_t(15.0000f),
+ true,
+ false,
+ {
+ },
+ false,
+ nullptr,
+ nullptr,
+ false
+ },
+ {
+ 0,
+ 0,
+ "GearshiftPosition",
+ 41,
+ 3,
+ 1.00000f,
+ 0,
+ 0,
+ 0,
+ frequency_clock_t(0.00000f),
+ true,
+ false,
+ {
+ {1, "FIRST"},
+ {4, "FOURTH"},
+ {6, "NEUTRAL"},
+ {5, "REVERSE"},
+ {2, "SECOND"},
+ {3, "THIRD"}
+ },
+ false,
+ nullptr,
+ nullptr,
+ false
+ },
+ {
+ 0,
+ 0,
+ "SteeringWheelAngle",
+ 52,
+ 12,
+ 0.153920f,
+ 0,
+ 0,
+ 0,
+ frequency_clock_t(0.00000f),
+ true,
+ false,
+ {
+ },
+ false,
+ nullptr,
+ nullptr,
+ false
+ },
+ {
+ 0,
+ 0,
+ "steering_wheel_angle_error",
+ 44,
+ 12,
+ 1.00000f,
+ 0,
+ 0,
+ 0,
+ frequency_clock_t(0.00000f),
+ true,
+ false,
+ {
+ },
+ false,
+ nullptr,
+ nullptr,
+ false
+ },
+ {
+ 0,
+ 0,
+ "steering_angle_sign",
+ 52,
+ 12,
+ 1.00000f,
+ 0,
+ 0,
+ 0,
+ frequency_clock_t(0.00000f),
+ true,
+ false,
+ {
+ },
+ false,
+ nullptr,
+ nullptr,
+ false
+ }
+ },
+ {
+ {
+ 0,
+ 1,
+ "abc",
+ 52,
+ 12,
+ 0.153920f,
+ 0,
+ 0,
+ 0,
+ frequency_clock_t(0.00000f),
+ true,
+ false,
+ {
+ },
+ false,
+ nullptr,
+ nullptr,
+ false
+ },
+ {
+ 0,
+ 1,
+ "def",
+ 52,
+ 12,
+ 1.00000f,
+ 0,
+ 0,
+ 0,
+ frequency_clock_t(0.00000f),
+ true,
+ false,
+ {
+ },
+ false,
+ decoder_t::ignoreDecoder,
+ nullptr,
+ false
+ }
+ }
+ }
+ //, obd2_signals_{/*...*/}
+{
+}
-configuration_t::configuration_t()
- : can_message_set_{CAN_MESSAGE_SET}, can_message_definition_{CAN_MESSAGES_DEFINITION}, can_signals_{SIGNALS}, diagnostic_messages_{DIAGNOSTIC_MESSAGES}
-{}
-const std::string configuration_t::get_diagnostic_bus() const
-{
- return "vcan0";
-} \ No newline at end of file