diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2020-01-09 11:57:18 +0100 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2020-01-09 16:25:36 +0100 |
commit | 74e83bfde6652df2ada831ae003ec51ca8e673c7 (patch) | |
tree | 8150a62ee2c37972dd8f369f63de5f3773617d9e | |
parent | 439c289056564cc4723c249f2ba29100efc7d4f8 (diff) |
Cleanup examples, tests, configuration and plugins
This commit updates all files external to the code.
Change-Id: I910bc300c53b7669573bba414db7d7ad74313697
Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
27 files changed, 6847 insertions, 6322 deletions
diff --git a/conf.d/project/etc/control-agl-service-can-low-level.json b/conf.d/project/etc/control-agl-service-can-low-level.json index 0b10d33d..5e63188b 100644 --- a/conf.d/project/etc/control-agl-service-can-low-level.json +++ b/conf.d/project/etc/control-agl-service-can-low-level.json @@ -10,15 +10,16 @@ "active_message_set": 0, "dev-mapping": { "hs": "can0", - "ls": "can0" + "ls": "can0", + "j1939": "can0" }, "diagnostic_bus": "hs" }, "plugins": [ { - "uid": "agl-vcar-signals", - "info": "agl-vcar signals", - "libs": "agl-vcar-signals.ctlso" + "uid": "default-signals", + "info": "default signals", + "libs": "default-signals.ctlso" } ] } diff --git a/conf.d/project/etc/control-low-can-j1939.json b/conf.d/project/etc/control-low-can-j1939.json deleted file mode 100644 index 3e87a695..00000000 --- a/conf.d/project/etc/control-low-can-j1939.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "$schema": "", - "metadata": { - "uid": "Low Can", - "version": "1.0", - "api": "low-can", - "info": "Low can Configuration" - }, - "config": { - "active_message_set": 0, - "dev-mapping": { - "hs": "can0", - "ls": "can0" - }, - "diagnostic_bus": "hs" - }, - "plugins": [ - { - "uid": "agl-vcar-signals", - "info": "agl-vcar signals", - "libs": "agl-vcar-signals.ctlso" - }, - { - "uid": "j1939-signals", - "info": "J1939 signals", - "libs": "j1939-signals.ctlso" - } - ] -} diff --git a/examples/OBD2/application-generated.cpp b/examples/OBD2/application-generated.cpp deleted file mode 100644 index f5788d9b..00000000 --- a/examples/OBD2/application-generated.cpp +++ /dev/null @@ -1,296 +0,0 @@ -#include "application.hpp" -#include "../can/can-decoder.hpp" -#include "../can/can-encoder.hpp" - -application_t::application_t() - : can_bus_manager_{utils::config_parser_t{"/etc/dev-mapping.conf"}} - , message_set_{ - {std::make_shared<message_set_t>(message_set_t{0,"example", - { // beginning message_definition_ vector - - }, // end message_definition vector - { // beginning diagnostic_messages_ vector - {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 4, - "engine.load", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 5, - "engine.coolant.temperature", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 10, - "fuel.pressure", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 11, - "intake.manifold.pressure", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 12, - "engine.speed", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 13, - "vehicle.speed", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 15, - "intake.air.temperature", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 16, - "mass.airflow", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 17, - "throttle.position", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 31, - "running.time", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 45, - "EGR.error", - 0, - 0, - UNIT::INVALID, - 0.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 47, - "fuel.level", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 51, - "barometric.pressure", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 70, - "ambient.air.temperature", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 76, - "commanded.throttle.position", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 82, - "ethanol.fuel.percentage", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 90, - "accelerator.pedal.position", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 91, - "hybrid.battery-pack.remaining.life", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 92, - "engine.oil.temperature", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 94, - "engine.fuel.rate", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 99, - "engine.torque", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} - - } // end diagnostic_messages_ vector - })} // end message_set entry - } // end message_set vector -{ - for(std::shared_ptr<message_set_t> cms: message_set_) - { - std::vector<std::shared_ptr<message_definition_t>> messages_definition = cms->get_messages_definition(); - for(std::shared_ptr<message_definition_t> cmd : messages_definition) - { - cmd->set_parent(cms); - std::vector<std::shared_ptr<signal_t>> signals = cmd->get_signals(); - for(std::shared_ptr<signal_t> sig: signals) - { - sig->set_parent(cmd); - } - } - - std::vector<std::shared_ptr<diagnostic_message_t>> diagnostic_messages = cms->get_diagnostic_messages(); - for(std::shared_ptr<diagnostic_message_t> dm : diagnostic_messages) - { - dm->set_parent(cms); - } - } - } - -const std::string application_t::get_diagnostic_bus() const -{ - return "hs"; -} - - diff --git a/examples/OBD2/obd2-signals.cpp b/examples/OBD2/obd2-signals.cpp new file mode 100644 index 00000000..6551ce13 --- /dev/null +++ b/examples/OBD2/obd2-signals.cpp @@ -0,0 +1,277 @@ +#include <binding/application.hpp> +#include <can/can-decoder.hpp> +#include <can/can-encoder.hpp> + +extern "C" { +CTLP_CAPI_REGISTER("example"); + +std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set_t{0,"example", + { // beginning message_definition_ vector + }, // end message_definition vector + { // beginning diagnostic_messages_ vector + {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 4, + "engine.load", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 5, + "engine.coolant.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 10, + "fuel.pressure", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 11, + "intake.manifold.pressure", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 12, + "engine.speed", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 13, + "vehicle.speed", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 15, + "intake.air.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 16, + "mass.airflow", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 17, + "throttle.position", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 31, + "running.time", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 45, + "EGR.error", + 0, + 0, + UNIT::INVALID, + 0.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 47, + "fuel.level", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 51, + "barometric.pressure", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 70, + "ambient.air.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 76, + "commanded.throttle.position", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 82, + "ethanol.fuel.percentage", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 90, + "accelerator.pedal.position", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 91, + "hybrid.battery-pack.remaining.life", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 92, + "engine.oil.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 94, + "engine.fuel.rate", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 99, + "engine.torque", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} + + } // end diagnostic_messages_ vector +}); // end message_set entry + +CTLP_ONLOAD(plugin, handle) { + afb_api_t api = (afb_api_t) plugin->api; + CtlConfigT* CtlConfig = (CtlConfigT*) afb_api_get_userdata(api); + application_t* app = (application_t*) getExternalData(CtlConfig); + + return app->add_message_set(cms); +} + + +} diff --git a/examples/agl-vcar/agl-vcar-signals.cpp b/examples/agl-vcar/agl-vcar-signals.cpp new file mode 100644 index 00000000..22c851ac --- /dev/null +++ b/examples/agl-vcar/agl-vcar-signals.cpp @@ -0,0 +1,719 @@ +#include <binding/application.hpp> +#include <can/can-decoder.hpp> +#include <can/can-encoder.hpp> + +extern "C" { +CTLP_CAPI_REGISTER("agl-virtual-car"); + +std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set_t{0,"AGL Virtual Car", + { // beginning message_definition_ vector + {std::make_shared<message_definition_t>(message_definition_t{"ls",0x30,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "hvac.fan.speed",// generic_name + 32,// bit_position + 8,// bit_size + 23.5294f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "hvac.temperature.left",// generic_name + 0,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "hvac.temperature.right",// generic_name + 8,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "hvac.temperature.average",// generic_name + 16,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3D9,"",8,2,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "engine.speed",// generic_name + 16,// bit_position + 16,// bit_size + 0.250000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "fuel.level.low",// generic_name + 55,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "fuel.level",// generic_name + 8,// bit_position + 8,// bit_size + 0.392157f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3E9,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "vehicle.average.speed",// generic_name + 0,// bit_position + 15,// bit_size + 0.0156250f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x4D1,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "engine.oil.temp",// generic_name + 16,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "engine.oil.temp.high",// generic_name + 7,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x620,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "doors.boot.open",// generic_name + 47,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "doors.front_left.open",// generic_name + 43,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "doors.front_right.open",// generic_name + 44,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "doors.rear_left.open",// generic_name + 46,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "doors.rear_right.open",// generic_name + 45,// bit_position + 4,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x799,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "windows.front_left.open",// generic_name + 43,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "windows.front_right.open",// generic_name + 44,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "windows.rear_left.open",// generic_name + 46,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "windows.rear_right.open",// generic_name + 45,// bit_position + 4,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry + }, // end message_definition vector + { // beginning diagnostic_messages_ vector + {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 4, + "engine.load", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 5, + "engine.coolant.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 10, + "fuel.pressure", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 11, + "intake.manifold.pressure", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 12, + "engine.speed", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 13, + "vehicle.speed", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 15, + "intake.air.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 16, + "mass.airflow", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 17, + "throttle.position", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 31, + "running.time", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 45, + "EGR.error", + 0, + 0, + UNIT::INVALID, + 0.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 47, + "fuel.level", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 51, + "barometric.pressure", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 70, + "ambient.air.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 76, + "commanded.throttle.position", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 82, + "ethanol.fuel.percentage", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 90, + "accelerator.pedal.position", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 91, + "hybrid.battery-pack.remaining.life", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 92, + "engine.oil.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 94, + "engine.fuel.rate", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 99, + "engine.torque", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} + + } // end diagnostic_messages_ vector +}); // end message_set entry + +CTLP_ONLOAD(plugin, handle) { + afb_api_t api = (afb_api_t) plugin->api; + CtlConfigT* CtlConfig = (CtlConfigT*) afb_api_get_userdata(api); + application_t* app = (application_t*) getExternalData(CtlConfig); + + return app->add_message_set(cms); +} + + +} diff --git a/examples/basic/application-generated.cpp b/examples/basic/application-generated.cpp deleted file mode 100644 index 97482f65..00000000 --- a/examples/basic/application-generated.cpp +++ /dev/null @@ -1,294 +0,0 @@ -#include "application.hpp" -#include "../can/can-decoder.hpp" -#include "../can/can-encoder.hpp" - -#include "can/canread.h" - -using openxc::can::read::publishNumericalMessage; - -void handleSteeringWheelMessage(CanMessage* message, - CanSignal* signals, int signalCount, Pipeline* pipeline) { - publishNumericalMessage("latitude", 42.0, pipeline); -} - -openxc_DynamicField handleInverted(CanSignal* signal, CanSignal* signals, - int signalCount, float value, bool* send) { - return openxc::payload::wrapNumber(value * -1); -} - -void initializeMyStuff() { } - -void initializeOtherStuff() { } - -void myLooper() { - // this function will be called once, each time through the main loop, after - // all CAN message processing has been completed -} - -// >>>>> handlers.cpp >>>>> -#include "can/canread.h" - -using openxc::can::read::publishNumericalMessage; - -void handleSteeringWheelMessage(CanMessage* message, - CanSignal* signals, int signalCount, Pipeline* pipeline) { - publishNumericalMessage("latitude", 42.0, pipeline); -} - -openxc_DynamicField handleInverted(CanSignal* signal, CanSignal* signals, - int signalCount, float value, bool* send) { - return openxc::payload::wrapNumber(value * -1); -} - -void initializeMyStuff() { } - -void initializeOtherStuff() { } - -void myLooper() { - // this function will be called once, each time through the main loop, after - // all CAN message processing has been completed -} - -// <<<<< handlers.cpp <<<<< - -application_t::application_t() - : can_bus_manager_{utils::config_parser_t{"/etc/dev-mapping.conf"}} - , message_set_{ - {std::make_shared<message_set_t>(message_set_t{0,"example", - { // beginning message_definition_ vector - {std::make_shared<message_definition_t>(message_definition_t{"hs",0x128,"ECM_z_5D2",8,0,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "engine_speed",// generic_name - 12,// bit_position - 8,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(15.0000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "GearshiftPosition",// generic_name - 41,// bit_position - 3,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {1,"FIRST"}, - {4,"FOURTH"}, - {6,"NEUTRAL"}, - {5,"REVERSE"}, - {2,"SECOND"}, - {3,"THIRD"} - },// states - false,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "SteeringWheelAngle",// generic_name - 52,// bit_position - 12,// bit_size - 0.153920f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - decoder_t::v1_to_v2_gnedSteeringWheelAngle,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "steering_wheel_angle_error",// generic_name - 44,// bit_position - 12,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - decoder_t::v1_to_v2_der,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "steering_angle_sign",// generic_name - 52,// bit_position - 12,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - decoder_t::v1_to_v2_der,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry - - }, // end message_definition vector - { // beginning diagnostic_messages_ vector - {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 12, - "", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::v1_to_v2_Pid, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 12, - "", - 0, - 0, - UNIT::INVALID, - 1.00000f, - nullptr, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 6, - "", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::v1_to_v2_agRequest, - nullptr, - true, - false - })} - - } // end diagnostic_messages_ vector - })} // end message_set entry - } // end message_set vector -{ - for(std::shared_ptr<message_set_t> cms: message_set_) - { - std::vector<std::shared_ptr<message_definition_t>> messages_definition = cms->get_messages_definition(); - for(std::shared_ptr<message_definition_t> cmd : messages_definition) - { - cmd->set_parent(cms); - std::vector<std::shared_ptr<signal_t>> signals = cmd->get_signals(); - for(std::shared_ptr<signal_t> sig: signals) - { - sig->set_parent(cmd); - } - } - - std::vector<std::shared_ptr<diagnostic_message_t>> diagnostic_messages = cms->get_diagnostic_messages(); - for(std::shared_ptr<diagnostic_message_t> dm : diagnostic_messages) - { - dm->set_parent(cms); - } - } - } - -const std::string application_t::get_diagnostic_bus() const -{ - return "hs"; -} - - -openxc_DynamicField decoder_t::v1_to_v2_gnedSteeringWheelAngle(signal_t& signal, std::shared_ptr<message_t> message, bool* send){ - float value = decoder_t::parse_signal_bitfield(signal, message); - openxc_DynamicField ret = decoder_t::gnedSteeringWheelAngle(signal, value, send); - if ((signal.get_last_value() == value && !signal.get_send_same()) || !*send ){ - *send = false; - } - signal.set_last_value(value); - return ret; -} - -openxc_DynamicField decoder_t::v1_to_v2_der(signal_t& signal, std::shared_ptr<message_t> message, bool* send){ - float value = decoder_t::parse_signal_bitfield(signal, message); - openxc_DynamicField ret = decoder_t::der(signal, value, send); - if ((signal.get_last_value() == value && !signal.get_send_same()) || !*send ){ - *send = false; - } - signal.set_last_value(value); - return ret; -} - -openxc_DynamicField decoder_t::v1_to_v2_Pid(signal_t& signal, std::shared_ptr<message_t> message, bool* send){ - float value = decoder_t::parse_signal_bitfield(signal, message); - openxc_DynamicField ret = decoder_t::Pid(signal, value, send); - if ((signal.get_last_value() == value && !signal.get_send_same()) || !*send ){ - *send = false; - } - signal.set_last_value(value); - return ret; -} - -openxc_DynamicField decoder_t::v1_to_v2_agRequest(signal_t& signal, std::shared_ptr<message_t> message, bool* send){ - float value = decoder_t::parse_signal_bitfield(signal, message); - openxc_DynamicField ret = decoder_t::agRequest(signal, value, send); - if ((signal.get_last_value() == value && !signal.get_send_same()) || !*send ){ - *send = false; - } - signal.set_last_value(value); - return ret; -} - diff --git a/examples/basic/basic-signals.cpp b/examples/basic/basic-signals.cpp new file mode 100644 index 00000000..14b37aef --- /dev/null +++ b/examples/basic/basic-signals.cpp @@ -0,0 +1,230 @@ +#include <binding/application.hpp> +#include <can/can-decoder.hpp> +#include <can/can-encoder.hpp> + +extern "C" { +CTLP_CAPI_REGISTER("example"); + +#include "can/canread.h" + +using openxc::can::read::publishNumericalMessage; + +void handleSteeringWheelMessage(CanMessage* message, + CanSignal* signals, int signalCount, Pipeline* pipeline) { + publishNumericalMessage("latitude", 42.0, pipeline); +} + +openxc_DynamicField handleInverted(CanSignal* signal, CanSignal* signals, + int signalCount, float value, bool* send) { + return openxc::payload::wrapNumber(value * -1); +} + +void initializeMyStuff() { } + +void initializeOtherStuff() { } + +void myLooper() { + // this function will be called once, each time through the main loop, after + // all CAN message processing has been completed +} + +// >>>>> handlers.cpp >>>>> +#include "can/canread.h" + +using openxc::can::read::publishNumericalMessage; + +void handleSteeringWheelMessage(CanMessage* message, + CanSignal* signals, int signalCount, Pipeline* pipeline) { + publishNumericalMessage("latitude", 42.0, pipeline); +} + +openxc_DynamicField handleInverted(CanSignal* signal, CanSignal* signals, + int signalCount, float value, bool* send) { + return openxc::payload::wrapNumber(value * -1); +} + +void initializeMyStuff() { } + +void initializeOtherStuff() { } + +void myLooper() { + // this function will be called once, each time through the main loop, after + // all CAN message processing has been completed +} + +// <<<<< handlers.cpp <<<<< + +std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set_t{0,"example", + { // beginning message_definition_ vector + {std::make_shared<message_definition_t>(message_definition_t{"hs",0x128,"ECM_z_5D2",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "engine_speed",// generic_name + 12,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(15.0000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "GearshiftPosition",// generic_name + 41,// bit_position + 3,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {1,"FIRST"}, + {4,"FOURTH"}, + {6,"NEUTRAL"}, + {5,"REVERSE"}, + {2,"SECOND"}, + {3,"THIRD"} + },// states + false,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "SteeringWheelAngle",// generic_name + 52,// bit_position + 12,// bit_size + 0.153920f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + decoder_t::gnedSteeringWheelAngle,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "steering_wheel_angle_error",// generic_name + 44,// bit_position + 12,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + decoder_t::der,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "steering_angle_sign",// generic_name + 52,// bit_position + 12,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + decoder_t::der,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry + }, // end message_definition vector + { // beginning diagnostic_messages_ vector + {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 12, + "", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::Pid, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 12, + "", + 0, + 0, + UNIT::INVALID, + 1.00000f, + nullptr, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 6, + "", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::agRequest, + nullptr, + true, + false + })} + + } // end diagnostic_messages_ vector +}); // end message_set entry + +CTLP_ONLOAD(plugin, handle) { + afb_api_t api = (afb_api_t) plugin->api; + CtlConfigT* CtlConfig = (CtlConfigT*) afb_api_get_userdata(api); + application_t* app = (application_t*) getExternalData(CtlConfig); + + return app->add_message_set(cms); +} + + +} diff --git a/examples/engine/application-generated.cpp b/examples/engine/application-generated.cpp deleted file mode 100644 index ea003109..00000000 --- a/examples/engine/application-generated.cpp +++ /dev/null @@ -1,194 +0,0 @@ -#include "application.hpp" -#include "../can/can-decoder.hpp" -#include "../can/can-encoder.hpp" - -application_t::application_t() - : can_bus_manager_{utils::config_parser_t{"/etc/dev-mapping.conf"}} - , message_set_{ - {std::make_shared<message_set_t>(message_set_t{0,"example", - { // beginning message_definition_ vector - {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3D9,"",8,0,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "engine.speed",// generic_name - 16,// bit_position - 16,// bit_size - 0.250000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "fuel.level.low",// generic_name - 55,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "fuel.level",// generic_name - 8,// bit_position - 8,// bit_size - 0.392157f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3E9,"",8,0,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "vehicle.average.speed",// generic_name - 0,// bit_position - 15,// bit_size - 0.0156250f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x4D1,"",8,0,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "engine.oil.temp",// generic_name - 16,// bit_position - 8,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "engine.oil.temp.high",// generic_name - 7,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry - - }, // end message_definition vector - { // beginning diagnostic_messages_ vector - - } // end diagnostic_messages_ vector - })} // end message_set entry - } // end message_set vector -{ - for(std::shared_ptr<message_set_t> cms: message_set_) - { - std::vector<std::shared_ptr<message_definition_t>> messages_definition = cms->get_messages_definition(); - for(std::shared_ptr<message_definition_t> cmd : messages_definition) - { - cmd->set_parent(cms); - std::vector<std::shared_ptr<signal_t>> signals = cmd->get_signals(); - for(std::shared_ptr<signal_t> sig: signals) - { - sig->set_parent(cmd); - } - } - - std::vector<std::shared_ptr<diagnostic_message_t>> diagnostic_messages = cms->get_diagnostic_messages(); - for(std::shared_ptr<diagnostic_message_t> dm : diagnostic_messages) - { - dm->set_parent(cms); - } - } - } - -const std::string application_t::get_diagnostic_bus() const -{ - return ""; -} - - diff --git a/examples/engine/engine-signals.cpp b/examples/engine/engine-signals.cpp new file mode 100644 index 00000000..48d266f0 --- /dev/null +++ b/examples/engine/engine-signals.cpp @@ -0,0 +1,169 @@ +#include <binding/application.hpp> +#include <can/can-decoder.hpp> +#include <can/can-encoder.hpp> + +extern "C" { +CTLP_CAPI_REGISTER("example"); + +std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set_t{0,"example", + { // beginning message_definition_ vector + {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3D9,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "engine.speed",// generic_name + 16,// bit_position + 16,// bit_size + 0.250000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "fuel.level.low",// generic_name + 55,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "fuel.level",// generic_name + 8,// bit_position + 8,// bit_size + 0.392157f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3E9,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "vehicle.average.speed",// generic_name + 0,// bit_position + 15,// bit_size + 0.0156250f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x4D1,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "engine.oil.temp",// generic_name + 16,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "engine.oil.temp.high",// generic_name + 7,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry + }, // end message_definition vector + { // beginning diagnostic_messages_ vector + + } // end diagnostic_messages_ vector +}); // end message_set entry + +CTLP_ONLOAD(plugin, handle) { + afb_api_t api = (afb_api_t) plugin->api; + CtlConfigT* CtlConfig = (CtlConfigT*) afb_api_get_userdata(api); + application_t* app = (application_t*) getExternalData(CtlConfig); + + return app->add_message_set(cms); +} + + +} diff --git a/examples/hvac/application-generated.cpp b/examples/hvac/application-generated.cpp deleted file mode 100644 index 473f4245..00000000 --- a/examples/hvac/application-generated.cpp +++ /dev/null @@ -1,140 +0,0 @@ -#include "application.hpp" -#include "../can/can-decoder.hpp" -#include "../can/can-encoder.hpp" - -application_t::application_t() - : can_bus_manager_{utils::config_parser_t{"/etc/dev-mapping.conf"}} - , message_set_{ - {std::make_shared<message_set_t>(message_set_t{0,"example", - { // beginning message_definition_ vector - {std::make_shared<message_definition_t>(message_definition_t{"ls",0x30,"",8,0,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "hvac.fan.speed",// generic_name - 32,// bit_position - 8,// bit_size - 23.5294f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "hvac.temperature.left",// generic_name - 0,// bit_position - 8,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "hvac.temperature.right",// generic_name - 8,// bit_position - 8,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "hvac.temperature.average",// generic_name - 16,// bit_position - 8,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry - - }, // end message_definition vector - { // beginning diagnostic_messages_ vector - - } // end diagnostic_messages_ vector - })} // end message_set entry - } // end message_set vector -{ - for(std::shared_ptr<message_set_t> cms: message_set_) - { - std::vector<std::shared_ptr<message_definition_t>> messages_definition = cms->get_messages_definition(); - for(std::shared_ptr<message_definition_t> cmd : messages_definition) - { - cmd->set_parent(cms); - std::vector<std::shared_ptr<signal_t>> signals = cmd->get_signals(); - for(std::shared_ptr<signal_t> sig: signals) - { - sig->set_parent(cmd); - } - } - - std::vector<std::shared_ptr<diagnostic_message_t>> diagnostic_messages = cms->get_diagnostic_messages(); - for(std::shared_ptr<diagnostic_message_t> dm : diagnostic_messages) - { - dm->set_parent(cms); - } - } - } - -const std::string application_t::get_diagnostic_bus() const -{ - return ""; -} - - diff --git a/examples/hvac/hvac-signals.cpp b/examples/hvac/hvac-signals.cpp new file mode 100644 index 00000000..431aa821 --- /dev/null +++ b/examples/hvac/hvac-signals.cpp @@ -0,0 +1,117 @@ +#include <binding/application.hpp> +#include <can/can-decoder.hpp> +#include <can/can-encoder.hpp> + +extern "C" { +CTLP_CAPI_REGISTER("example"); + +std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set_t{0,"example", + { // beginning message_definition_ vector + {std::make_shared<message_definition_t>(message_definition_t{"ls",0x30,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "hvac.fan.speed",// generic_name + 32,// bit_position + 8,// bit_size + 23.5294f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "hvac.temperature.left",// generic_name + 0,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "hvac.temperature.right",// generic_name + 8,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "hvac.temperature.average",// generic_name + 16,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry + }, // end message_definition vector + { // beginning diagnostic_messages_ vector + + } // end diagnostic_messages_ vector +}); // end message_set entry + +CTLP_ONLOAD(plugin, handle) { + afb_api_t api = (afb_api_t) plugin->api; + CtlConfigT* CtlConfig = (CtlConfigT*) afb_api_get_userdata(api); + application_t* app = (application_t*) getExternalData(CtlConfig); + + return app->add_message_set(cms); +} + + +} diff --git a/examples/j1939/j1939-signals.cpp b/examples/j1939/j1939-signals.cpp new file mode 100644 index 00000000..bec22933 --- /dev/null +++ b/examples/j1939/j1939-signals.cpp @@ -0,0 +1,991 @@ +#include <binding/application.hpp> +#include <can/can-decoder.hpp> +#include <can/can-encoder.hpp> + +extern "C" { +CTLP_CAPI_REGISTER("virtual-j1939"); + +std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set_t{0,"Virtual J1939", + { // beginning message_definition_ vector + {std::make_shared<message_definition_t>(message_definition_t{"j1939",61442,"ETC1",8,8,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "Eng.Momentary.Overspeed.Enable",// generic_name + 32,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {0,"MomentaryEngOverspeedIsDisabled"}, + {1,"MomentaryEngOverspeedIsEnabled"}, + {2,"Reserved"}, + {3,"TakeNoAction"} + },// states + true,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Momentary.Eng.Max.Power.Enable",// generic_name + 36,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {2,"fault"}, + {1,"mmntarilyRqingMaxPowerAvailable"}, + {3,"notAvailable"}, + {0,"notRqingMaxPowerAvailable"} + },// states + true,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Percent.Clutch.Slip",// generic_name + 24,// bit_position + 8,// bit_size + 0.400000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "%"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Progressive.Shift.Disable",// generic_name + 34,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {1,"ProgressiveShiftIsDisabled"}, + {0,"ProgressiveShiftIsNotDisabled"}, + {2,"Reserved"}, + {3,"TakeNoAction"} + },// states + true,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Src.Addrss.Of.Ctrllng.Dvc.Fr.Trns.Cntrl",// generic_name + 56,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Trans.Driveline.Engaged",// generic_name + 0,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {0,"DrivelineDisengaged"}, + {1,"DrivelineEngaged"}, + {2,"Error"}, + {3,"NotAvailable"} + },// states + true,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Trans.Input.Shaft.Speed",// generic_name + 40,// bit_position + 16,// bit_size + 0.125000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "rpm"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Trans.Output.Shaft.Speed",// generic_name + 8,// bit_position + 16,// bit_size + 0.125000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "rpm"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Trans.Shift.In.Process",// generic_name + 4,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {2,"Error"}, + {3,"NotAvailable"}, + {1,"ShiftInProcess"}, + {0,"ShiftIsNotInProcess"} + },// states + true,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Trns.Trq.Cnvrtr.Lckp.Trnstn.In.Prcess",// generic_name + 6,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {2,"Error"}, + {3,"NotAvailable"}, + {1,"TransitionIsInProcess"}, + {0,"TransitionIsNotInProcess"} + },// states + true,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Trns.Trque.Converter.Lockup.Engaged",// generic_name + 2,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {2,"Error"}, + {3,"NotAvailable"}, + {0,"TorqueConverterLockupDisengaged"}, + {1,"TorqueConverterLockupEngaged"} + },// states + true,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"j1939",61444,"EEC1",8,8,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "Actl.Eng.Prcnt.Trque.High.Resolution",// generic_name + 4,// bit_position + 4,// bit_size + 0.125000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {0,"0000"}, + {1,"0125"}, + {7,"0875"}, + {8,"1111NotAvailable"} + },// states + false,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "%"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Actual.Eng.Percent.Torque",// generic_name + 16,// bit_position + 8,// bit_size + 1.00000f,// factor + -125.000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "%"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Drivers.Demand.Eng.Percent.Torque",// generic_name + 8,// bit_position + 8,// bit_size + 1.00000f,// factor + -125.000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "%"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Eng.Demand.Percent.Torque",// generic_name + 56,// bit_position + 8,// bit_size + 1.00000f,// factor + -125.000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "%"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Eng.Speed",// generic_name + 24,// bit_position + 16,// bit_size + 0.125000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "rpm"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Eng.Starter.Mode",// generic_name + 48,// bit_position + 4,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {9,"1011Reserved"}, + {14,"error"}, + {15,"notAvailable"}, + {0,"startNotRqed"}, + {2,"starterActiveGearEngaged"}, + {1,"starterActiveGearNotEngaged"}, + {12,"starterInhibitedReasonUnknown"}, + {3,"strtFnshdStrtrNtActvAftrHvngBnA"}, + {6,"strtrInhbtdDTDrvlnEnggdOthrTrns"}, + {5,"strtrInhbtdDTEngNtReadyForStart"}, + {7,"strtrInhbtdDToActiveImmobilizer"}, + {4,"strtrInhbtdDToEngAlreadyRunning"}, + {8,"strtrInhbtdDueToStarterOvertemp"} + },// states + false,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Eng.Torque.Mode",// generic_name + 0,// bit_position + 4,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {7,"ABS control"}, + {5,"ASR control"}, + {1,"Accelerator pedal/operator selec"}, + {10,"Braking system"}, + {2,"Cruise control"}, + {9,"High speed governor"}, + {0,"Low idle governor/no request (de"}, + {15,"Not available"}, + {3,"PTO governor"}, + {11,"Remote accelerator"}, + {4,"Road speed governor"}, + {8,"Torque limiting"}, + {6,"Transmission control"} + },// states + false,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Src.AddrssOf.Ctrllng.Dvc.Fr.Eng.Cntrl",// generic_name + 40,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"j1939",61449,"VDC2",8,8,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "Lateral.Acceleration",// generic_name + 40,// bit_position + 16,// bit_size + 0.000488281f,// factor + -15.6870f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "m/s/s"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Longitudinal.Acceleration",// generic_name + 56,// bit_position + 8,// bit_size + 0.100000f,// factor + -12.5000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "m/s/s"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Steer.Wheel.Angle",// generic_name + 0,// bit_position + 16,// bit_size + 0.000976562f,// factor + -31.3740f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "rad"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Steer.Wheel.Angle.Sensor.Type",// generic_name + 22,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {1,"AbsMeasuringPrinciple"}, + {3,"NotAvailable"}, + {0,"RelativeMeasuringPrinciple"}, + {2,"Reserved"} + },// states + false,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Steer.Wheel.Turn.Counter",// generic_name + 16,// bit_position + 6,// bit_size + 1.00000f,// factor + -32.0000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "turns"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Yaw.Rate",// generic_name + 24,// bit_position + 16,// bit_size + 0.000122070f,// factor + -3.92000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "rad/s"// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"j1939",65215,"EBC2",8,8,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "Front.Axle.Speed",// generic_name + 0,// bit_position + 16,// bit_size + 0.00390625f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "km/h"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Relative.Speed.Front.Axle.Left.Wheel",// generic_name + 16,// bit_position + 8,// bit_size + 0.0625000f,// factor + -7.81250f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "km/h"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Relative.Speed.Rear.Axle1.Left.Wheel",// generic_name + 32,// bit_position + 8,// bit_size + 0.0625000f,// factor + -7.81250f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "km/h"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Relative.Speed.Rear.Axle2.Left.Wheel",// generic_name + 48,// bit_position + 8,// bit_size + 0.0625000f,// factor + -7.81250f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "km/h"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Rlative.Speed.Front.Axle.Right.Wheel",// generic_name + 24,// bit_position + 8,// bit_size + 0.0625000f,// factor + -7.81250f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "km/h"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Rlative.Speed.Rear.Axle1.Right.Wheel",// generic_name + 40,// bit_position + 8,// bit_size + 0.0625000f,// factor + -7.81250f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "km/h"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Rlative.Speed.Rear.Axle2.Right.Wheel",// generic_name + 56,// bit_position + 8,// bit_size + 0.0625000f,// factor + -7.81250f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "km/h"// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"j1939",65253,"HOURS",8,8,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "Eng.Total.Hours.Of.Operation",// generic_name + 0,// bit_position + 32,// bit_size + 0.0500000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "hr"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Eng.Total.Revolutions",// generic_name + 32,// bit_position + 32,// bit_size + 1000.00f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "r"// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"j1939",65262,"ET1",8,8,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "Eng.Coolant.Temp",// generic_name + 0,// bit_position + 8,// bit_size + 0.0312500f,// factor + -273.000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "deg C"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Eng.Fuel.Temp1",// generic_name + 8,// bit_position + 8,// bit_size + 1.00000f,// factor + -40.0000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "deg C"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Eng.Intercooler.Temp",// generic_name + 48,// bit_position + 8,// bit_size + 1.00000f,// factor + -40.0000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "deg C"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Eng.Intercooler.Thermostat.Opening",// generic_name + 56,// bit_position + 8,// bit_size + 0.400000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "%"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Eng.Oil.Temp1",// generic_name + 16,// bit_position + 16,// bit_size + 0.0312500f,// factor + -273.000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "deg C"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Eng.Turbo.Oil.Temp",// generic_name + 32,// bit_position + 16,// bit_size + 0.0312500f,// factor + -273.000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "deg C"// unit + })} + } // end signals vector + })} // end message_definition entry + }, // end message_definition vector + { // beginning diagnostic_messages_ vector + + } // end diagnostic_messages_ vector +}); // end message_set entry + +CTLP_ONLOAD(plugin, handle) { + afb_api_t api = (afb_api_t) plugin->api; + CtlConfigT* CtlConfig = (CtlConfigT*) afb_api_get_userdata(api); + application_t* app = (application_t*) getExternalData(CtlConfig); + + return app->add_message_set(cms); +} + + +} diff --git a/examples/j1939/j1939-simple.cpp b/examples/j1939/j1939-simple.cpp deleted file mode 100644 index 660d0ffa..00000000 --- a/examples/j1939/j1939-simple.cpp +++ /dev/null @@ -1,1050 +0,0 @@ -#include "application.hpp" -#include "../can/can-decoder.hpp" -#include "../can/can-encoder.hpp" - -application_t::application_t() - : can_bus_manager_{utils::config_parser_t{"/etc/dev-mapping.conf"}} - , message_set_{ - {std::make_shared<message_set_t>(message_set_t{0,"Virtual J1939", - { // beginning message_definition_ vector - {std::make_shared<message_definition_t>(message_definition_t{"j1939",61442,"ETC1",8,4,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "Eng.Momentary.Overspeed.Enable",// generic_name - 32,// bit_position - 2,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {0,"MomentaryEngOverspeedIsDisabled"}, - {1,"MomentaryEngOverspeedIsEnabled"}, - {2,"Reserved"}, - {3,"TakeNoAction"} - },// states - true,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Momentary.Eng.Max.Power.Enable",// generic_name - 36,// bit_position - 2,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {2,"fault"}, - {1,"mmntarilyRqingMaxPowerAvailable"}, - {3,"notAvailable"}, - {0,"notRqingMaxPowerAvailable"} - },// states - true,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Percent.Clutch.Slip",// generic_name - 24,// bit_position - 8,// bit_size - 0.400000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "%"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Progressive.Shift.Disable",// generic_name - 34,// bit_position - 2,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {1,"ProgressiveShiftIsDisabled"}, - {0,"ProgressiveShiftIsNotDisabled"}, - {2,"Reserved"}, - {3,"TakeNoAction"} - },// states - true,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Src.Addrss.Of.Ctrllng.Dvc.Fr.Trns.Cntrl",// generic_name - 56,// bit_position - 8,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Trans.Driveline.Engaged",// generic_name - 0,// bit_position - 2,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {0,"DrivelineDisengaged"}, - {1,"DrivelineEngaged"}, - {2,"Error"}, - {3,"NotAvailable"} - },// states - true,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Trans.Input.Shaft.Speed",// generic_name - 40,// bit_position - 16,// bit_size - 0.125000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "rpm"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Trans.Output.Shaft.Speed",// generic_name - 8,// bit_position - 16,// bit_size - 0.125000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "rpm"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Trans.Shift.In.Process",// generic_name - 4,// bit_position - 2,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {2,"Error"}, - {3,"NotAvailable"}, - {1,"ShiftInProcess"}, - {0,"ShiftIsNotInProcess"} - },// states - true,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Trns.Trq.Cnvrtr.Lckp.Trnstn.In.Prcess",// generic_name - 6,// bit_position - 2,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {2,"Error"}, - {3,"NotAvailable"}, - {1,"TransitionIsInProcess"}, - {0,"TransitionIsNotInProcess"} - },// states - true,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Trns.Trque.Converter.Lockup.Engaged",// generic_name - 2,// bit_position - 2,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {2,"Error"}, - {3,"NotAvailable"}, - {0,"TorqueConverterLockupDisengaged"}, - {1,"TorqueConverterLockupEngaged"} - },// states - true,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"j1939",61444,"EEC1",8,4,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "Actl.Eng.Prcnt.Trque.High.Resolution",// generic_name - 4,// bit_position - 4,// bit_size - 0.125000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {0,"0000"}, - {1,"0125"}, - {7,"0875"}, - {8,"1111NotAvailable"} - },// states - false,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "%"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Actual.Eng.Percent.Torque",// generic_name - 16,// bit_position - 8,// bit_size - 1.00000f,// factor - -125.000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "%"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Drivers.Demand.Eng.Percent.Torque",// generic_name - 8,// bit_position - 8,// bit_size - 1.00000f,// factor - -125.000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "%"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Demand.Percent.Torque",// generic_name - 56,// bit_position - 8,// bit_size - 1.00000f,// factor - -125.000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "%"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Speed",// generic_name - 24,// bit_position - 16,// bit_size - 0.125000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "rpm"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Starter.Mode",// generic_name - 48,// bit_position - 4,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {9,"1011Reserved"}, - {14,"error"}, - {15,"notAvailable"}, - {0,"startNotRqed"}, - {2,"starterActiveGearEngaged"}, - {1,"starterActiveGearNotEngaged"}, - {12,"starterInhibitedReasonUnknown"}, - {3,"strtFnshdStrtrNtActvAftrHvngBnA"}, - {6,"strtrInhbtdDTDrvlnEnggdOthrTrns"}, - {5,"strtrInhbtdDTEngNtReadyForStart"}, - {7,"strtrInhbtdDToActiveImmobilizer"}, - {4,"strtrInhbtdDToEngAlreadyRunning"}, - {8,"strtrInhbtdDueToStarterOvertemp"} - },// states - false,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Torque.Mode",// generic_name - 0,// bit_position - 4,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {7,"ABS control"}, - {5,"ASR control"}, - {1,"Accelerator pedal/operator selec"}, - {10,"Braking system"}, - {2,"Cruise control"}, - {9,"High speed governor"}, - {0,"Low idle governor/no request (de"}, - {15,"Not available"}, - {3,"PTO governor"}, - {11,"Remote accelerator"}, - {4,"Road speed governor"}, - {8,"Torque limiting"}, - {6,"Transmission control"} - },// states - false,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Src.AddrssOf.Ctrllng.Dvc.Fr.Eng.Cntrl",// generic_name - 40,// bit_position - 8,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"j1939",61449,"VDC2",8,4,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "Lateral.Acceleration",// generic_name - 40,// bit_position - 16,// bit_size - 0.000488281f,// factor - -15.6870f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "m/s/s"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Longitudinal.Acceleration",// generic_name - 56,// bit_position - 8,// bit_size - 0.100000f,// factor - -12.5000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "m/s/s"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Steer.Wheel.Angle",// generic_name - 0,// bit_position - 16,// bit_size - 0.000976562f,// factor - -31.3740f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "rad"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Steer.Wheel.Angle.Sensor.Type",// generic_name - 22,// bit_position - 2,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {1,"AbsMeasuringPrinciple"}, - {3,"NotAvailable"}, - {0,"RelativeMeasuringPrinciple"}, - {2,"Reserved"} - },// states - false,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Steer.Wheel.Turn.Counter",// generic_name - 16,// bit_position - 6,// bit_size - 1.00000f,// factor - -32.0000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "turns"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Yaw.Rate",// generic_name - 24,// bit_position - 16,// bit_size - 0.000122070f,// factor - -3.92000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "rad/s"// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"j1939",65215,"EBC2",8,4,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "Front.Axle.Speed",// generic_name - 0,// bit_position - 16,// bit_size - 0.00390625f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "km/h"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Relative.Speed.Front.Axle.Left.Wheel",// generic_name - 16,// bit_position - 8,// bit_size - 0.0625000f,// factor - -7.81250f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "km/h"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Relative.Speed.Rear.Axle1.Left.Wheel",// generic_name - 32,// bit_position - 8,// bit_size - 0.0625000f,// factor - -7.81250f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "km/h"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Relative.Speed.Rear.Axle2.Left.Wheel",// generic_name - 48,// bit_position - 8,// bit_size - 0.0625000f,// factor - -7.81250f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "km/h"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Rlative.Speed.Front.Axle.Right.Wheel",// generic_name - 24,// bit_position - 8,// bit_size - 0.0625000f,// factor - -7.81250f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "km/h"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Rlative.Speed.Rear.Axle1.Right.Wheel",// generic_name - 40,// bit_position - 8,// bit_size - 0.0625000f,// factor - -7.81250f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "km/h"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Rlative.Speed.Rear.Axle2.Right.Wheel",// generic_name - 56,// bit_position - 8,// bit_size - 0.0625000f,// factor - -7.81250f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "km/h"// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"j1939",65253,"HOURS",8,4,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "Eng.Total.Hours.Of.Operation",// generic_name - 0,// bit_position - 32,// bit_size - 0.0500000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "hr"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Total.Revolutions",// generic_name - 32,// bit_position - 32,// bit_size - 1000.00f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "r"// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"j1939",65262,"ET1",8,4,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "Eng.Coolant.Temp",// generic_name - 0,// bit_position - 8,// bit_size - 0.0312500f,// factor - -273.000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "deg C"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Fuel.Temp1",// generic_name - 8,// bit_position - 8,// bit_size - 1.00000f,// factor - -40.0000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "deg C"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Intercooler.Temp",// generic_name - 48,// bit_position - 8,// bit_size - 1.00000f,// factor - -40.0000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "deg C"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Intercooler.Thermostat.Opening",// generic_name - 56,// bit_position - 8,// bit_size - 0.400000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "%"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Oil.Temp1",// generic_name - 16,// bit_position - 16,// bit_size - 0.0312500f,// factor - -273.000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "deg C"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Turbo.Oil.Temp",// generic_name - 32,// bit_position - 16,// bit_size - 0.0312500f,// factor - -273.000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "deg C"// unit - })} - } // end signals vector - })} // end message_definition entry - - }, // end message_definition vector - { // beginning diagnostic_messages_ vector - - } // end diagnostic_messages_ vector - })} // end message_set entry - } // end message_set vector -{ - for(std::shared_ptr<message_set_t> cms: message_set_) - { - std::vector<std::shared_ptr<message_definition_t>> messages_definition = cms->get_messages_definition(); - for(std::shared_ptr<message_definition_t> cmd : messages_definition) - { - cmd->set_parent(cms); - std::vector<std::shared_ptr<signal_t>> signals = cmd->get_signals(); - for(std::shared_ptr<signal_t> sig: signals) - { - sig->set_parent(cmd); - } - } - - std::vector<std::shared_ptr<diagnostic_message_t>> diagnostic_messages = cms->get_diagnostic_messages(); - for(std::shared_ptr<diagnostic_message_t> dm : diagnostic_messages) - { - dm->set_parent(cms); - } - } - } - -const std::string application_t::get_diagnostic_bus() const -{ - return ""; -} - - diff --git a/examples/tests/application-generated.cpp b/examples/tests/application-generated.cpp deleted file mode 100644 index 584514de..00000000 --- a/examples/tests/application-generated.cpp +++ /dev/null @@ -1,1951 +0,0 @@ -#include "application.hpp" -#include "../can/can-decoder.hpp" -#include "../can/can-encoder.hpp" - -application_t::application_t() - : can_bus_manager_{utils::config_parser_t{"/etc/dev-mapping.conf"}} - , message_set_{ - {std::make_shared<message_set_t>(message_set_t{0,"AGL Virtual Car", - { // beginning message_definition_ vector - {std::make_shared<message_definition_t>(message_definition_t{"ls",0x111,"",16,16,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "sig1.1",// generic_name - 0,// bit_position - 16,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "sig1.2",// generic_name - 16,// bit_position - 16,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "sig2.1",// generic_name - 32,// bit_position - 16,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "sig2.2",// generic_name - 48,// bit_position - 16,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "sig3.1",// generic_name - 64,// bit_position - 16,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "sig3.2",// generic_name - 80,// bit_position - 16,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "sig4.1",// generic_name - 96,// bit_position - 16,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "sig4.2",// generic_name - 112,// bit_position - 16,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"ls",0x30,"",8,0,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "hvac.fan.speed",// generic_name - 32,// bit_position - 8,// bit_size - 23.5294f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "hvac.temperature.left",// generic_name - 0,// bit_position - 8,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "hvac.temperature.right",// generic_name - 8,// bit_position - 8,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "hvac.temperature.average",// generic_name - 16,// bit_position - 8,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3D9,"",8,128,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "engine.speed",// generic_name - 16,// bit_position - 16,// bit_size - 0.250000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "fuel.level.low",// generic_name - 55,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "fuel.level",// generic_name - 8,// bit_position - 8,// bit_size - 0.392157f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3E9,"",8,0,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "vehicle.average.speed",// generic_name - 0,// bit_position - 15,// bit_size - 0.0156250f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x4D1,"",8,0,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "engine.oil.temp",// generic_name - 16,// bit_position - 8,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "engine.oil.temp.high",// generic_name - 7,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x620,"",8,0,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "doors.boot.open",// generic_name - 47,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "doors.front_left.open",// generic_name - 43,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "doors.front_right.open",// generic_name - 44,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "doors.rear_left.open",// generic_name - 46,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "doors.rear_right.open",// generic_name - 45,// bit_position - 4,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x799,"",8,0,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "windows.front_left.open",// generic_name - 43,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "windows.front_right.open",// generic_name - 44,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "windows.rear_left.open",// generic_name - 46,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "windows.rear_right.open",// generic_name - 45,// bit_position - 4,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"j1939",61442,"ETC1",8,4,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "Eng.Momentary.Overspeed.Enable",// generic_name - 32,// bit_position - 2,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {0,"MomentaryEngOverspeedIsDisabled"}, - {1,"MomentaryEngOverspeedIsEnabled"}, - {2,"Reserved"}, - {3,"TakeNoAction"} - },// states - true,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Momentary.Eng.Max.Power.Enable",// generic_name - 36,// bit_position - 2,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {2,"fault"}, - {1,"mmntarilyRqingMaxPowerAvailable"}, - {3,"notAvailable"}, - {0,"notRqingMaxPowerAvailable"} - },// states - true,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Percent.Clutch.Slip",// generic_name - 24,// bit_position - 8,// bit_size - 0.400000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "%"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Progressive.Shift.Disable",// generic_name - 34,// bit_position - 2,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {1,"ProgressiveShiftIsDisabled"}, - {0,"ProgressiveShiftIsNotDisabled"}, - {2,"Reserved"}, - {3,"TakeNoAction"} - },// states - true,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Src.Addrss.Of.Ctrllng.Dvc.Fr.Trns.Cntrl",// generic_name - 56,// bit_position - 8,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Trans.Driveline.Engaged",// generic_name - 0,// bit_position - 2,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {0,"DrivelineDisengaged"}, - {1,"DrivelineEngaged"}, - {2,"Error"}, - {3,"NotAvailable"} - },// states - true,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Trans.Input.Shaft.Speed",// generic_name - 40,// bit_position - 16,// bit_size - 0.125000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "rpm"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Trans.Output.Shaft.Speed",// generic_name - 8,// bit_position - 16,// bit_size - 0.125000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "rpm"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Trans.Shift.In.Process",// generic_name - 4,// bit_position - 2,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {2,"Error"}, - {3,"NotAvailable"}, - {1,"ShiftInProcess"}, - {0,"ShiftIsNotInProcess"} - },// states - true,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Trns.Trq.Cnvrtr.Lckp.Trnstn.In.Prcess",// generic_name - 6,// bit_position - 2,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {2,"Error"}, - {3,"NotAvailable"}, - {1,"TransitionIsInProcess"}, - {0,"TransitionIsNotInProcess"} - },// states - true,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Trns.Trque.Converter.Lockup.Engaged",// generic_name - 2,// bit_position - 2,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {2,"Error"}, - {3,"NotAvailable"}, - {0,"TorqueConverterLockupDisengaged"}, - {1,"TorqueConverterLockupEngaged"} - },// states - true,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"j1939",61444,"EEC1",8,4,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "Actl.Eng.Prcnt.Trque.High.Resolution",// generic_name - 4,// bit_position - 4,// bit_size - 0.125000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {0,"0000"}, - {1,"0125"}, - {7,"0875"}, - {8,"1111NotAvailable"} - },// states - false,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "%"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Actual.Eng.Percent.Torque",// generic_name - 16,// bit_position - 8,// bit_size - 1.00000f,// factor - -125.000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "%"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Drivers.Demand.Eng.Percent.Torque",// generic_name - 8,// bit_position - 8,// bit_size - 1.00000f,// factor - -125.000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "%"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Demand.Percent.Torque",// generic_name - 56,// bit_position - 8,// bit_size - 1.00000f,// factor - -125.000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "%"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Speed",// generic_name - 24,// bit_position - 16,// bit_size - 0.125000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "rpm"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Starter.Mode",// generic_name - 48,// bit_position - 4,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {9,"1011Reserved"}, - {14,"error"}, - {15,"notAvailable"}, - {0,"startNotRqed"}, - {2,"starterActiveGearEngaged"}, - {1,"starterActiveGearNotEngaged"}, - {12,"starterInhibitedReasonUnknown"}, - {3,"strtFnshdStrtrNtActvAftrHvngBnA"}, - {6,"strtrInhbtdDTDrvlnEnggdOthrTrns"}, - {5,"strtrInhbtdDTEngNtReadyForStart"}, - {7,"strtrInhbtdDToActiveImmobilizer"}, - {4,"strtrInhbtdDToEngAlreadyRunning"}, - {8,"strtrInhbtdDueToStarterOvertemp"} - },// states - false,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Torque.Mode",// generic_name - 0,// bit_position - 4,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {7,"ABS control"}, - {5,"ASR control"}, - {1,"Accelerator pedal/operator selec"}, - {10,"Braking system"}, - {2,"Cruise control"}, - {9,"High speed governor"}, - {0,"Low idle governor/no request (de"}, - {15,"Not available"}, - {3,"PTO governor"}, - {11,"Remote accelerator"}, - {4,"Road speed governor"}, - {8,"Torque limiting"}, - {6,"Transmission control"} - },// states - false,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Src.AddrssOf.Ctrllng.Dvc.Fr.Eng.Cntrl",// generic_name - 40,// bit_position - 8,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"j1939",61449,"VDC2",8,4,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "Lateral.Acceleration",// generic_name - 40,// bit_position - 16,// bit_size - 0.000488281f,// factor - -15.6870f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "m/s/s"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Longitudinal.Acceleration",// generic_name - 56,// bit_position - 8,// bit_size - 0.100000f,// factor - -12.5000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "m/s/s"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Steer.Wheel.Angle",// generic_name - 0,// bit_position - 16,// bit_size - 0.000976562f,// factor - -31.3740f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "rad"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Steer.Wheel.Angle.Sensor.Type",// generic_name - 22,// bit_position - 2,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {1,"AbsMeasuringPrinciple"}, - {3,"NotAvailable"}, - {0,"RelativeMeasuringPrinciple"}, - {2,"Reserved"} - },// states - false,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Steer.Wheel.Turn.Counter",// generic_name - 16,// bit_position - 6,// bit_size - 1.00000f,// factor - -32.0000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "turns"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Yaw.Rate",// generic_name - 24,// bit_position - 16,// bit_size - 0.000122070f,// factor - -3.92000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "rad/s"// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"j1939",65215,"EBC2",8,4,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "Front.Axle.Speed",// generic_name - 0,// bit_position - 16,// bit_size - 0.00390625f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "km/h"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Relative.Speed.Front.Axle.Left.Wheel",// generic_name - 16,// bit_position - 8,// bit_size - 0.0625000f,// factor - -7.81250f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "km/h"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Relative.Speed.Rear.Axle1.Left.Wheel",// generic_name - 32,// bit_position - 8,// bit_size - 0.0625000f,// factor - -7.81250f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "km/h"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Relative.Speed.Rear.Axle2.Left.Wheel",// generic_name - 48,// bit_position - 8,// bit_size - 0.0625000f,// factor - -7.81250f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "km/h"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Rlative.Speed.Front.Axle.Right.Wheel",// generic_name - 24,// bit_position - 8,// bit_size - 0.0625000f,// factor - -7.81250f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "km/h"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Rlative.Speed.Rear.Axle1.Right.Wheel",// generic_name - 40,// bit_position - 8,// bit_size - 0.0625000f,// factor - -7.81250f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "km/h"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Rlative.Speed.Rear.Axle2.Right.Wheel",// generic_name - 56,// bit_position - 8,// bit_size - 0.0625000f,// factor - -7.81250f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "km/h"// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"j1939",65253,"HOURS",8,4,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "Eng.Total.Hours.Of.Operation",// generic_name - 0,// bit_position - 32,// bit_size - 0.0500000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "hr"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Total.Revolutions",// generic_name - 32,// bit_position - 32,// bit_size - 1000.00f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "r"// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"j1939",65262,"ET1",8,4,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "Eng.Coolant.Temp",// generic_name - 0,// bit_position - 8,// bit_size - 0.0312500f,// factor - -273.000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "deg C"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Fuel.Temp1",// generic_name - 8,// bit_position - 8,// bit_size - 1.00000f,// factor - -40.0000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "deg C"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Intercooler.Temp",// generic_name - 48,// bit_position - 8,// bit_size - 1.00000f,// factor - -40.0000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "deg C"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Intercooler.Thermostat.Opening",// generic_name - 56,// bit_position - 8,// bit_size - 0.400000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "%"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Oil.Temp1",// generic_name - 16,// bit_position - 16,// bit_size - 0.0312500f,// factor - -273.000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "deg C"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Turbo.Oil.Temp",// generic_name - 32,// bit_position - 16,// bit_size - 0.0312500f,// factor - -273.000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "deg C"// unit - })} - } // end signals vector - })} // end message_definition entry - - }, // end message_definition vector - { // beginning diagnostic_messages_ vector - {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 4, - "engine.load", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 5, - "engine.coolant.temperature", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 10, - "fuel.pressure", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 11, - "intake.manifold.pressure", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 12, - "engine.speed", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 13, - "vehicle.speed", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 15, - "intake.air.temperature", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 16, - "mass.airflow", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 17, - "throttle.position", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 31, - "running.time", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 45, - "EGR.error", - 0, - 0, - UNIT::INVALID, - 0.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 47, - "fuel.level", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 51, - "barometric.pressure", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 70, - "ambient.air.temperature", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 76, - "commanded.throttle.position", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 82, - "ethanol.fuel.percentage", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 90, - "accelerator.pedal.position", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 91, - "hybrid.battery-pack.remaining.life", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 92, - "engine.oil.temperature", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 94, - "engine.fuel.rate", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 99, - "engine.torque", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} - - } // end diagnostic_messages_ vector - })} // end message_set entry - } // end message_set vector -{ - for(std::shared_ptr<message_set_t> cms: message_set_) - { - std::vector<std::shared_ptr<message_definition_t>> messages_definition = cms->get_messages_definition(); - for(std::shared_ptr<message_definition_t> cmd : messages_definition) - { - cmd->set_parent(cms); - std::vector<std::shared_ptr<signal_t>> signals = cmd->get_signals(); - for(std::shared_ptr<signal_t> sig: signals) - { - sig->set_parent(cmd); - } - } - - std::vector<std::shared_ptr<diagnostic_message_t>> diagnostic_messages = cms->get_diagnostic_messages(); - for(std::shared_ptr<diagnostic_message_t> dm : diagnostic_messages) - { - dm->set_parent(cms); - } - } - } - -const std::string application_t::get_diagnostic_bus() const -{ - return "hs"; -} - - diff --git a/examples/tests/default-signals.cpp b/examples/tests/default-signals.cpp new file mode 100644 index 00000000..a88e9c30 --- /dev/null +++ b/examples/tests/default-signals.cpp @@ -0,0 +1,1502 @@ +#include <binding/application.hpp> +#include <can/can-decoder.hpp> +#include <can/can-encoder.hpp> + +extern "C" { +CTLP_CAPI_REGISTER("agl-virtual-car"); + +std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set_t{0,"AGL Virtual Car", + { // beginning message_definition_ vector + {std::make_shared<message_definition_t>(message_definition_t{"ls",0x111,"",16,16,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "sig1.1",// generic_name + 0,// bit_position + 16,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "sig1.2",// generic_name + 16,// bit_position + 16,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "sig2.1",// generic_name + 32,// bit_position + 16,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "sig2.2",// generic_name + 48,// bit_position + 16,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "sig3.1",// generic_name + 64,// bit_position + 16,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "sig3.2",// generic_name + 80,// bit_position + 16,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "sig4.1",// generic_name + 96,// bit_position + 16,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "sig4.2",// generic_name + 112,// bit_position + 16,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"ls",0x30,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "hvac.fan.speed",// generic_name + 32,// bit_position + 8,// bit_size + 23.5294f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "hvac.temperature.left",// generic_name + 0,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "hvac.temperature.right",// generic_name + 8,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "hvac.temperature.average",// generic_name + 16,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3D9,"",8,2,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "engine.speed",// generic_name + 16,// bit_position + 16,// bit_size + 0.250000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "fuel.level.low",// generic_name + 55,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "fuel.level",// generic_name + 8,// bit_position + 8,// bit_size + 0.392157f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3E9,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "vehicle.average.speed",// generic_name + 0,// bit_position + 15,// bit_size + 0.0156250f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x4D1,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "engine.oil.temp",// generic_name + 16,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "engine.oil.temp.high",// generic_name + 7,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x620,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "doors.boot.open",// generic_name + 47,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "doors.front_left.open",// generic_name + 43,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "doors.front_right.open",// generic_name + 44,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "doors.rear_left.open",// generic_name + 46,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "doors.rear_right.open",// generic_name + 45,// bit_position + 4,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x799,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "windows.front_left.open",// generic_name + 43,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "windows.front_right.open",// generic_name + 44,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "windows.rear_left.open",// generic_name + 46,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "windows.rear_right.open",// generic_name + 45,// bit_position + 4,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"j1939",130306,"Wind.Data",8,392,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "Wind.Data.Reference",// generic_name + 40,// bit_position + 3,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {2,"Apparent"}, + {1,"Magnetic (ground referenced to Magnetic North)"}, + {3,"True (boat referenced)"}, + {0,"True (ground referenced to North)"}, + {4,"True (water referenced)"} + },// states + false,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Wind.Data.Reserved",// generic_name + 43,// bit_position + 21,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + decoder_t::decode_bytes,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Wind.Data.Sid",// generic_name + 0,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Wind.Data.Wind.Angle",// generic_name + 24,// bit_position + 16,// bit_size + 0.000100000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "rad"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Wind.Data.Wind.Speed",// generic_name + 8,// bit_position + 16,// bit_size + 0.0100000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "m/s"// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"j1939",61442,"ETC1",8,8,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "Eng.Momentary.Overspeed.Enable",// generic_name + 32,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {0,"MomentaryEngOverspeedIsDisabled"}, + {1,"MomentaryEngOverspeedIsEnabled"}, + {2,"Reserved"}, + {3,"TakeNoAction"} + },// states + true,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Momentary.Eng.Max.Power.Enable",// generic_name + 36,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {2,"fault"}, + {1,"mmntarilyRqingMaxPowerAvailable"}, + {3,"notAvailable"}, + {0,"notRqingMaxPowerAvailable"} + },// states + true,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Percent.Clutch.Slip",// generic_name + 24,// bit_position + 8,// bit_size + 0.400000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "%"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Progressive.Shift.Disable",// generic_name + 34,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {1,"ProgressiveShiftIsDisabled"}, + {0,"ProgressiveShiftIsNotDisabled"}, + {2,"Reserved"}, + {3,"TakeNoAction"} + },// states + true,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Src.Addrss.Of.Ctrllng.Dvc.Fr.Trns.Cntrl",// generic_name + 56,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Trans.Driveline.Engaged",// generic_name + 0,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {0,"DrivelineDisengaged"}, + {1,"DrivelineEngaged"}, + {2,"Error"}, + {3,"NotAvailable"} + },// states + true,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Trans.Input.Shaft.Speed",// generic_name + 40,// bit_position + 16,// bit_size + 0.125000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "rpm"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Trans.Output.Shaft.Speed",// generic_name + 8,// bit_position + 16,// bit_size + 0.125000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "rpm"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Trans.Shift.In.Process",// generic_name + 4,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {2,"Error"}, + {3,"NotAvailable"}, + {1,"ShiftInProcess"}, + {0,"ShiftIsNotInProcess"} + },// states + true,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Trns.Trq.Cnvrtr.Lckp.Trnstn.In.Prcess",// generic_name + 6,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {2,"Error"}, + {3,"NotAvailable"}, + {1,"TransitionIsInProcess"}, + {0,"TransitionIsNotInProcess"} + },// states + true,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Trns.Trque.Converter.Lockup.Engaged",// generic_name + 2,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {2,"Error"}, + {3,"NotAvailable"}, + {0,"TorqueConverterLockupDisengaged"}, + {1,"TorqueConverterLockupEngaged"} + },// states + true,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"j1939",61444,"EEC1",8,8,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "Actl.Eng.Prcnt.Trque.High.Resolution",// generic_name + 4,// bit_position + 4,// bit_size + 0.125000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {0,"0000"}, + {1,"0125"}, + {7,"0875"}, + {8,"1111NotAvailable"} + },// states + false,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "%"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Actual.Eng.Percent.Torque",// generic_name + 16,// bit_position + 8,// bit_size + 1.00000f,// factor + -125.000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "%"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Drivers.Demand.Eng.Percent.Torque",// generic_name + 8,// bit_position + 8,// bit_size + 1.00000f,// factor + -125.000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "%"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Eng.Demand.Percent.Torque",// generic_name + 56,// bit_position + 8,// bit_size + 1.00000f,// factor + -125.000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "%"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Eng.Speed",// generic_name + 24,// bit_position + 16,// bit_size + 0.125000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "rpm"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Eng.Starter.Mode",// generic_name + 48,// bit_position + 4,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {9,"1011Reserved"}, + {14,"error"}, + {15,"notAvailable"}, + {0,"startNotRqed"}, + {2,"starterActiveGearEngaged"}, + {1,"starterActiveGearNotEngaged"}, + {12,"starterInhibitedReasonUnknown"}, + {3,"strtFnshdStrtrNtActvAftrHvngBnA"}, + {6,"strtrInhbtdDTDrvlnEnggdOthrTrns"}, + {5,"strtrInhbtdDTEngNtReadyForStart"}, + {7,"strtrInhbtdDToActiveImmobilizer"}, + {4,"strtrInhbtdDToEngAlreadyRunning"}, + {8,"strtrInhbtdDueToStarterOvertemp"} + },// states + false,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Eng.Torque.Mode",// generic_name + 0,// bit_position + 4,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {7,"ABS control"}, + {5,"ASR control"}, + {1,"Accelerator pedal/operator selec"}, + {10,"Braking system"}, + {2,"Cruise control"}, + {9,"High speed governor"}, + {0,"Low idle governor/no request (de"}, + {15,"Not available"}, + {3,"PTO governor"}, + {11,"Remote accelerator"}, + {4,"Road speed governor"}, + {8,"Torque limiting"}, + {6,"Transmission control"} + },// states + false,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Src.AddrssOf.Ctrllng.Dvc.Fr.Eng.Cntrl",// generic_name + 40,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry + }, // end message_definition vector + { // beginning diagnostic_messages_ vector + {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 4, + "engine.load", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 5, + "engine.coolant.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 10, + "fuel.pressure", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 11, + "intake.manifold.pressure", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 12, + "engine.speed", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 13, + "vehicle.speed", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 15, + "intake.air.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 16, + "mass.airflow", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 17, + "throttle.position", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 31, + "running.time", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 45, + "EGR.error", + 0, + 0, + UNIT::INVALID, + 0.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 47, + "fuel.level", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 51, + "barometric.pressure", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 70, + "ambient.air.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 76, + "commanded.throttle.position", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 82, + "ethanol.fuel.percentage", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 90, + "accelerator.pedal.position", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 91, + "hybrid.battery-pack.remaining.life", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 92, + "engine.oil.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 94, + "engine.fuel.rate", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 99, + "engine.torque", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} + + } // end diagnostic_messages_ vector +}); // end message_set entry + +CTLP_ONLOAD(plugin, handle) { + afb_api_t api = (afb_api_t) plugin->api; + CtlConfigT* CtlConfig = (CtlConfigT*) afb_api_get_userdata(api); + application_t* app = (application_t*) getExternalData(CtlConfig); + + return app->add_message_set(cms); +} + + +} diff --git a/examples/tests/signal.json b/examples/tests/signal.json index ee7e467f..e74ed977 100644 --- a/examples/tests/signal.json +++ b/examples/tests/signal.json @@ -604,6 +604,8 @@ "is_fd": false, "is_extended": false, "is_j1939": true, + "byte_frame_is_big_endian": true, + "bit_position_reversed": true, "signals": { "Sid": { "bit_position": 0, diff --git a/examples/toyota/auris/application-generated.cpp b/examples/toyota/auris/application-generated.cpp deleted file mode 100644 index c0d55756..00000000 --- a/examples/toyota/auris/application-generated.cpp +++ /dev/null @@ -1,661 +0,0 @@ -#include "application.hpp" -#include "../can/can-decoder.hpp" -#include "../can/can-encoder.hpp" - -application_t::application_t() - : can_bus_manager_{utils::config_parser_t{"/etc/dev-mapping.conf"}} - , message_set_{ - {std::make_shared<message_set_t>(message_set_t{0,"example", - { // beginning message_definition_ vector - {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3D9,"",8,0,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "engine.speed",// generic_name - 16,// bit_position - 16,// bit_size - 0.250000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "fuel.level.low",// generic_name - 55,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "fuel.level",// generic_name - 8,// bit_position - 8,// bit_size - 0.392157f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3E9,"",8,0,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "vehicle.average.speed",// generic_name - 0,// bit_position - 15,// bit_size - 0.0156250f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x4D1,"",8,0,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "engine.oil.temp",// generic_name - 16,// bit_position - 8,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "engine.oil.temp.high",// generic_name - 7,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x620,"",8,0,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "doors.boot.open",// generic_name - 47,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "doors.front_left.open",// generic_name - 43,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "doors.front_right.open",// generic_name - 44,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "doors.rear_left.open",// generic_name - 46,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "doors.rear_right.open",// generic_name - 45,// bit_position - 4,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x799,"",8,0,true,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "windows.front_left.open",// generic_name - 43,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "windows.front_right.open",// generic_name - 44,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "windows.rear_left.open",// generic_name - 46,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "windows.rear_right.open",// generic_name - 45,// bit_position - 4,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - false,// is_big_endian - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry - - }, // end message_definition vector - { // beginning diagnostic_messages_ vector - {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 4, - "engine.load", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 5, - "engine.coolant.temperature", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 10, - "fuel.pressure", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 11, - "intake.manifold.pressure", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 12, - "engine.speed", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 13, - "vehicle.speed", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 15, - "intake.air.temperature", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 16, - "mass.airflow", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 17, - "throttle.position", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 31, - "running.time", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 45, - "EGR.error", - 0, - 0, - UNIT::INVALID, - 0.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 47, - "fuel.level", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 51, - "barometric.pressure", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 70, - "ambient.air.temperature", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 76, - "commanded.throttle.position", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 82, - "ethanol.fuel.percentage", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 90, - "accelerator.pedal.position", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 91, - "hybrid.battery-pack.remaining.life", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 92, - "engine.oil.temperature", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 94, - "engine.fuel.rate", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 99, - "engine.torque", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} - - } // end diagnostic_messages_ vector - })} // end message_set entry - } // end message_set vector -{ - for(std::shared_ptr<message_set_t> cms: message_set_) - { - std::vector<std::shared_ptr<message_definition_t>> messages_definition = cms->get_messages_definition(); - for(std::shared_ptr<message_definition_t> cmd : messages_definition) - { - cmd->set_parent(cms); - std::vector<std::shared_ptr<signal_t>> signals = cmd->get_signals(); - for(std::shared_ptr<signal_t> sig: signals) - { - sig->set_parent(cmd); - } - } - - std::vector<std::shared_ptr<diagnostic_message_t>> diagnostic_messages = cms->get_diagnostic_messages(); - for(std::shared_ptr<diagnostic_message_t> dm : diagnostic_messages) - { - dm->set_parent(cms); - } - } - } - -const std::string application_t::get_diagnostic_bus() const -{ - return "hs"; -} - - diff --git a/examples/toyota/auris/auris-signals.cpp b/examples/toyota/auris/auris-signals.cpp new file mode 100644 index 00000000..538066be --- /dev/null +++ b/examples/toyota/auris/auris-signals.cpp @@ -0,0 +1,627 @@ +#include <binding/application.hpp> +#include <can/can-decoder.hpp> +#include <can/can-encoder.hpp> + +extern "C" { +CTLP_CAPI_REGISTER("example"); + +std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set_t{0,"example", + { // beginning message_definition_ vector + {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3D9,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "engine.speed",// generic_name + 16,// bit_position + 16,// bit_size + 0.250000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "fuel.level.low",// generic_name + 55,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "fuel.level",// generic_name + 8,// bit_position + 8,// bit_size + 0.392157f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3E9,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "vehicle.average.speed",// generic_name + 0,// bit_position + 15,// bit_size + 0.0156250f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x4D1,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "engine.oil.temp",// generic_name + 16,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "engine.oil.temp.high",// generic_name + 7,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x620,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "doors.boot.open",// generic_name + 47,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "doors.front_left.open",// generic_name + 43,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "doors.front_right.open",// generic_name + 44,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "doors.rear_left.open",// generic_name + 46,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "doors.rear_right.open",// generic_name + 45,// bit_position + 4,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x799,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "windows.front_left.open",// generic_name + 43,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "windows.front_right.open",// generic_name + 44,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "windows.rear_left.open",// generic_name + 46,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "windows.rear_right.open",// generic_name + 45,// bit_position + 4,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry + }, // end message_definition vector + { // beginning diagnostic_messages_ vector + {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 4, + "engine.load", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 5, + "engine.coolant.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 10, + "fuel.pressure", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 11, + "intake.manifold.pressure", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 12, + "engine.speed", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 13, + "vehicle.speed", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 15, + "intake.air.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 16, + "mass.airflow", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 17, + "throttle.position", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 31, + "running.time", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 45, + "EGR.error", + 0, + 0, + UNIT::INVALID, + 0.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 47, + "fuel.level", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 51, + "barometric.pressure", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 70, + "ambient.air.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 76, + "commanded.throttle.position", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 82, + "ethanol.fuel.percentage", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 90, + "accelerator.pedal.position", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 91, + "hybrid.battery-pack.remaining.life", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 92, + "engine.oil.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 94, + "engine.fuel.rate", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 99, + "engine.torque", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} + + } // end diagnostic_messages_ vector +}); // end message_set entry + +CTLP_ONLOAD(plugin, handle) { + afb_api_t api = (afb_api_t) plugin->api; + CtlConfigT* CtlConfig = (CtlConfigT*) afb_api_get_userdata(api); + application_t* app = (application_t*) getExternalData(CtlConfig); + + return app->add_message_set(cms); +} + + +} diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 4794d2fa..eba9542f 100755 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -43,7 +43,7 @@ PROJECT_TARGET_ADD(agl-vcar-signals) ${link_libraries}) if(WITH_FEATURE_J1939) -PROJECT_TARGET_ADD(j1939-signals) +PROJECT_TARGET_ADD(default-signals) # Define targets ADD_LIBRARY(${TARGET_NAME} MODULE ${TARGET_NAME}.cpp) diff --git a/plugins/agl-vcar-signals.cpp b/plugins/agl-vcar-signals.cpp index 457e7bc9..22c851ac 100644 --- a/plugins/agl-vcar-signals.cpp +++ b/plugins/agl-vcar-signals.cpp @@ -2,716 +2,712 @@ #include <can/can-decoder.hpp> #include <can/can-encoder.hpp> -extern "C" -{ - -CTLP_CAPI_REGISTER("agl-vcar-signals"); +extern "C" { +CTLP_CAPI_REGISTER("agl-virtual-car"); std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set_t{0,"AGL Virtual Car", - { // beginning message_definition_ vector - {std::make_shared<message_definition_t>(message_definition_t{"ls",0x30,"",8,CAN_PROTOCOL,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "hvac.fan.speed",// generic_name - 32,// bit_position - 8,// bit_size - 23.5294f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "hvac.temperature.left",// generic_name - 0,// bit_position - 8,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "hvac.temperature.right",// generic_name - 8,// bit_position - 8,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "hvac.temperature.average",// generic_name - 16,// bit_position - 8,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3D9,"",8,CAN_PROTOCOL_WITH_FD_FRAME,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "engine.speed",// generic_name - 16,// bit_position - 16,// bit_size - 0.250000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "fuel.level.low",// generic_name - 55,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "fuel.level",// generic_name - 8,// bit_position - 8,// bit_size - 0.392157f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3E9,"",8,CAN_PROTOCOL,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "vehicle.average.speed",// generic_name - 0,// bit_position - 15,// bit_size - 0.0156250f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x4D1,"",8,CAN_PROTOCOL,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "engine.oil.temp",// generic_name - 16,// bit_position - 8,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "engine.oil.temp.high",// generic_name - 7,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x620,"",8,CAN_PROTOCOL,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "doors.boot.open",// generic_name - 47,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "doors.front_left.open",// generic_name - 43,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "doors.front_right.open",// generic_name - 44,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "doors.rear_left.open",// generic_name - 46,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "doors.rear_right.open",// generic_name - 45,// bit_position - 4,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x799,"",8,CAN_PROTOCOL,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "windows.front_left.open",// generic_name - 43,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "windows.front_right.open",// generic_name - 44,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "windows.rear_left.open",// generic_name - 46,// bit_position - 1,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "windows.rear_right.open",// generic_name - 45,// bit_position - 4,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - decoder_t::decode_boolean,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry - - }, // end message_definition vector - { // beginning diagnostic_messages_ vector - {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 4, - "engine.load", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 5, - "engine.coolant.temperature", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 10, - "fuel.pressure", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 11, - "intake.manifold.pressure", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 12, - "engine.speed", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 13, - "vehicle.speed", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 15, - "intake.air.temperature", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 16, - "mass.airflow", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false + { // beginning message_definition_ vector + {std::make_shared<message_definition_t>(message_definition_t{"ls",0x30,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "hvac.fan.speed",// generic_name + 32,// bit_position + 8,// bit_size + 23.5294f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "hvac.temperature.left",// generic_name + 0,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "hvac.temperature.right",// generic_name + 8,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "hvac.temperature.average",// generic_name + 16,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 17, - "throttle.position", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3D9,"",8,2,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "engine.speed",// generic_name + 16,// bit_position + 16,// bit_size + 0.250000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "fuel.level.low",// generic_name + 55,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "fuel.level",// generic_name + 8,// bit_position + 8,// bit_size + 0.392157f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 31, - "running.time", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3E9,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "vehicle.average.speed",// generic_name + 0,// bit_position + 15,// bit_size + 0.0156250f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 45, - "EGR.error", - 0, - 0, - UNIT::INVALID, - 0.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x4D1,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "engine.oil.temp",// generic_name + 16,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "engine.oil.temp.high",// generic_name + 7,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 47, - "fuel.level", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x620,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "doors.boot.open",// generic_name + 47,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "doors.front_left.open",// generic_name + 43,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "doors.front_right.open",// generic_name + 44,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "doors.rear_left.open",// generic_name + 46,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "doors.rear_right.open",// generic_name + 45,// bit_position + 4,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 51, - "barometric.pressure", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 70, - "ambient.air.temperature", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 76, - "commanded.throttle.position", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 82, - "ethanol.fuel.percentage", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 90, - "accelerator.pedal.position", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 91, - "hybrid.battery-pack.remaining.life", - 0, - 0, - UNIT::INVALID, - 5.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 92, - "engine.oil.temperature", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 94, - "engine.fuel.rate", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false - })} -, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ - 99, - "engine.torque", - 0, - 0, - UNIT::INVALID, - 1.00000f, - decoder_t::decode_obd2_response, - nullptr, - true, - false + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x799,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "windows.front_left.open",// generic_name + 43,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "windows.front_right.open",// generic_name + 44,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "windows.rear_left.open",// generic_name + 46,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "windows.rear_right.open",// generic_name + 45,// bit_position + 4,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit })} + } // end signals vector + })} // end message_definition entry + }, // end message_definition vector + { // beginning diagnostic_messages_ vector + {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 4, + "engine.load", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 5, + "engine.coolant.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 10, + "fuel.pressure", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 11, + "intake.manifold.pressure", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 12, + "engine.speed", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 13, + "vehicle.speed", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 15, + "intake.air.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 16, + "mass.airflow", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 17, + "throttle.position", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 31, + "running.time", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 45, + "EGR.error", + 0, + 0, + UNIT::INVALID, + 0.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 47, + "fuel.level", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 51, + "barometric.pressure", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 70, + "ambient.air.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 76, + "commanded.throttle.position", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 82, + "ethanol.fuel.percentage", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 90, + "accelerator.pedal.position", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 91, + "hybrid.battery-pack.remaining.life", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 92, + "engine.oil.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 94, + "engine.fuel.rate", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 99, + "engine.torque", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} - } // end diagnostic_messages_ vector - }); // end message_set entry + } // end diagnostic_messages_ vector +}); // end message_set entry -CTLP_ONLOAD(plugin, handle) -{ +CTLP_ONLOAD(plugin, handle) { afb_api_t api = (afb_api_t) plugin->api; CtlConfigT* CtlConfig = (CtlConfigT*) afb_api_get_userdata(api); application_t* app = (application_t*) getExternalData(CtlConfig); @@ -719,4 +715,5 @@ CTLP_ONLOAD(plugin, handle) return app->add_message_set(cms); } + } diff --git a/plugins/default-signals.cpp b/plugins/default-signals.cpp new file mode 100644 index 00000000..9f7111de --- /dev/null +++ b/plugins/default-signals.cpp @@ -0,0 +1,1502 @@ +#include <binding/application.hpp> +#include <can/can-decoder.hpp> +#include <can/can-encoder.hpp> + +extern "C" { +CTLP_CAPI_REGISTER("agl-virtual-car"); + +std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set_t{0,"AGL Virtual Car", + { // beginning message_definition_ vector +/* {std::make_shared<message_definition_t>(message_definition_t{"ls",0x111,"",16,16,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "sig1.1",// generic_name + 0,// bit_position + 16,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "sig1.2",// generic_name + 16,// bit_position + 16,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "sig2.1",// generic_name + 32,// bit_position + 16,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "sig2.2",// generic_name + 48,// bit_position + 16,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "sig3.1",// generic_name + 64,// bit_position + 16,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "sig3.2",// generic_name + 80,// bit_position + 16,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "sig4.1",// generic_name + 96,// bit_position + 16,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "sig4.2",// generic_name + 112,// bit_position + 16,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +,*/ {std::make_shared<message_definition_t>(message_definition_t{"ls",0x30,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "hvac.fan.speed",// generic_name + 32,// bit_position + 8,// bit_size + 23.5294f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "hvac.temperature.left",// generic_name + 0,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "hvac.temperature.right",// generic_name + 8,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "hvac.temperature.average",// generic_name + 16,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3D9,"",8,2,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "engine.speed",// generic_name + 16,// bit_position + 16,// bit_size + 0.250000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "fuel.level.low",// generic_name + 55,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "fuel.level",// generic_name + 8,// bit_position + 8,// bit_size + 0.392157f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3E9,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "vehicle.average.speed",// generic_name + 0,// bit_position + 15,// bit_size + 0.0156250f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x4D1,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "engine.oil.temp",// generic_name + 16,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "engine.oil.temp.high",// generic_name + 7,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x620,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "doors.boot.open",// generic_name + 47,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "doors.front_left.open",// generic_name + 43,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "doors.front_right.open",// generic_name + 44,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "doors.rear_left.open",// generic_name + 46,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "doors.rear_right.open",// generic_name + 45,// bit_position + 4,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x799,"",8,0,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "windows.front_left.open",// generic_name + 43,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "windows.front_right.open",// generic_name + 44,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "windows.rear_left.open",// generic_name + 46,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "windows.rear_right.open",// generic_name + 45,// bit_position + 4,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"j1939",130306,"Wind.Data",8,392,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "Wind.Data.Reference",// generic_name + 40,// bit_position + 3,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {2,"Apparent"}, + {1,"Magnetic (ground referenced to Magnetic North)"}, + {3,"True (boat referenced)"}, + {0,"True (ground referenced to North)"}, + {4,"True (water referenced)"} + },// states + false,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Wind.Data.Reserved",// generic_name + 43,// bit_position + 21,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + decoder_t::decode_bytes,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Wind.Data.Sid",// generic_name + 0,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Wind.Data.Wind.Angle",// generic_name + 24,// bit_position + 16,// bit_size + 0.000100000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "rad"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Wind.Data.Wind.Speed",// generic_name + 8,// bit_position + 16,// bit_size + 0.0100000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "m/s"// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"j1939",61442,"ETC1",8,8,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "Eng.Momentary.Overspeed.Enable",// generic_name + 32,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {0,"MomentaryEngOverspeedIsDisabled"}, + {1,"MomentaryEngOverspeedIsEnabled"}, + {2,"Reserved"}, + {3,"TakeNoAction"} + },// states + true,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Momentary.Eng.Max.Power.Enable",// generic_name + 36,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {2,"fault"}, + {1,"mmntarilyRqingMaxPowerAvailable"}, + {3,"notAvailable"}, + {0,"notRqingMaxPowerAvailable"} + },// states + true,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Percent.Clutch.Slip",// generic_name + 24,// bit_position + 8,// bit_size + 0.400000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "%"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Progressive.Shift.Disable",// generic_name + 34,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {1,"ProgressiveShiftIsDisabled"}, + {0,"ProgressiveShiftIsNotDisabled"}, + {2,"Reserved"}, + {3,"TakeNoAction"} + },// states + true,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Src.Addrss.Of.Ctrllng.Dvc.Fr.Trns.Cntrl",// generic_name + 56,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Trans.Driveline.Engaged",// generic_name + 0,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {0,"DrivelineDisengaged"}, + {1,"DrivelineEngaged"}, + {2,"Error"}, + {3,"NotAvailable"} + },// states + true,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Trans.Input.Shaft.Speed",// generic_name + 40,// bit_position + 16,// bit_size + 0.125000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "rpm"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Trans.Output.Shaft.Speed",// generic_name + 8,// bit_position + 16,// bit_size + 0.125000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "rpm"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Trans.Shift.In.Process",// generic_name + 4,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {2,"Error"}, + {3,"NotAvailable"}, + {1,"ShiftInProcess"}, + {0,"ShiftIsNotInProcess"} + },// states + true,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Trns.Trq.Cnvrtr.Lckp.Trnstn.In.Prcess",// generic_name + 6,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {2,"Error"}, + {3,"NotAvailable"}, + {1,"TransitionIsInProcess"}, + {0,"TransitionIsNotInProcess"} + },// states + true,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Trns.Trque.Converter.Lockup.Engaged",// generic_name + 2,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {2,"Error"}, + {3,"NotAvailable"}, + {0,"TorqueConverterLockupDisengaged"}, + {1,"TorqueConverterLockupEngaged"} + },// states + true,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"j1939",61444,"EEC1",8,8,frequency_clock_t(5.00000f),true, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "Actl.Eng.Prcnt.Trque.High.Resolution",// generic_name + 4,// bit_position + 4,// bit_size + 0.125000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {0,"0000"}, + {1,"0125"}, + {7,"0875"}, + {8,"1111NotAvailable"} + },// states + false,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "%"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Actual.Eng.Percent.Torque",// generic_name + 16,// bit_position + 8,// bit_size + 1.00000f,// factor + -125.000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "%"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Drivers.Demand.Eng.Percent.Torque",// generic_name + 8,// bit_position + 8,// bit_size + 1.00000f,// factor + -125.000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "%"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Eng.Demand.Percent.Torque",// generic_name + 56,// bit_position + 8,// bit_size + 1.00000f,// factor + -125.000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "%"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Eng.Speed",// generic_name + 24,// bit_position + 16,// bit_size + 0.125000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + "rpm"// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Eng.Starter.Mode",// generic_name + 48,// bit_position + 4,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {9,"1011Reserved"}, + {14,"error"}, + {15,"notAvailable"}, + {0,"startNotRqed"}, + {2,"starterActiveGearEngaged"}, + {1,"starterActiveGearNotEngaged"}, + {12,"starterInhibitedReasonUnknown"}, + {3,"strtFnshdStrtrNtActvAftrHvngBnA"}, + {6,"strtrInhbtdDTDrvlnEnggdOthrTrns"}, + {5,"strtrInhbtdDTEngNtReadyForStart"}, + {7,"strtrInhbtdDToActiveImmobilizer"}, + {4,"strtrInhbtdDToEngAlreadyRunning"}, + {8,"strtrInhbtdDueToStarterOvertemp"} + },// states + false,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Eng.Torque.Mode",// generic_name + 0,// bit_position + 4,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + {7,"ABS control"}, + {5,"ASR control"}, + {1,"Accelerator pedal/operator selec"}, + {10,"Braking system"}, + {2,"Cruise control"}, + {9,"High speed governor"}, + {0,"Low idle governor/no request (de"}, + {15,"Not available"}, + {3,"PTO governor"}, + {11,"Remote accelerator"}, + {4,"Road speed governor"}, + {8,"Torque limiting"}, + {6,"Transmission control"} + },// states + false,// writable + decoder_t::decode_state,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })}, + {std::make_shared<signal_t> (signal_t{ + "Src.AddrssOf.Ctrllng.Dvc.Fr.Eng.Cntrl",// generic_name + 40,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000f,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed + { + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + static_cast<sign_t>(0),// signed + -1,// bit_sign_position + ""// unit + })} + } // end signals vector + })} // end message_definition entry + }, // end message_definition vector + { // beginning diagnostic_messages_ vector + {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 4, + "engine.load", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 5, + "engine.coolant.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 10, + "fuel.pressure", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 11, + "intake.manifold.pressure", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 12, + "engine.speed", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 13, + "vehicle.speed", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 15, + "intake.air.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 16, + "mass.airflow", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 17, + "throttle.position", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 31, + "running.time", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 45, + "EGR.error", + 0, + 0, + UNIT::INVALID, + 0.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 47, + "fuel.level", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 51, + "barometric.pressure", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 70, + "ambient.air.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 76, + "commanded.throttle.position", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 82, + "ethanol.fuel.percentage", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 90, + "accelerator.pedal.position", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 91, + "hybrid.battery-pack.remaining.life", + 0, + 0, + UNIT::INVALID, + 5.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 92, + "engine.oil.temperature", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 94, + "engine.fuel.rate", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} +, {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ + 99, + "engine.torque", + 0, + 0, + UNIT::INVALID, + 1.00000f, + decoder_t::decode_obd2_response, + nullptr, + true, + false + })} + + } // end diagnostic_messages_ vector +}); // end message_set entry + +CTLP_ONLOAD(plugin, handle) { + afb_api_t api = (afb_api_t) plugin->api; + CtlConfigT* CtlConfig = (CtlConfigT*) afb_api_get_userdata(api); + application_t* app = (application_t*) getExternalData(CtlConfig); + + return app->add_message_set(cms); +} + + +} diff --git a/plugins/j1939-signals.cpp b/plugins/j1939-signals.cpp deleted file mode 100644 index d7d5c526..00000000 --- a/plugins/j1939-signals.cpp +++ /dev/null @@ -1,994 +0,0 @@ -#include <binding/application.hpp> -#include <can/can-decoder.hpp> -#include <can/can-encoder.hpp> - -extern "C" -{ - -CTLP_CAPI_REGISTER("j1939-signals"); - -std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set_t{0,"Virtual J1939", - { // beginning message_definition_ vector - {std::make_shared<message_definition_t>(message_definition_t{"j1939",61442,"ETC1",8,4,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "Eng.Momentary.Overspeed.Enable",// generic_name - 32,// bit_position - 2,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {0,"MomentaryEngOverspeedIsDisabled"}, - {1,"MomentaryEngOverspeedIsEnabled"}, - {2,"Reserved"}, - {3,"TakeNoAction"} - },// states - true,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Momentary.Eng.Max.Power.Enable",// generic_name - 36,// bit_position - 2,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {2,"fault"}, - {1,"mmntarilyRqingMaxPowerAvailable"}, - {3,"notAvailable"}, - {0,"notRqingMaxPowerAvailable"} - },// states - true,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Percent.Clutch.Slip",// generic_name - 24,// bit_position - 8,// bit_size - 0.400000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "%"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Progressive.Shift.Disable",// generic_name - 34,// bit_position - 2,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {1,"ProgressiveShiftIsDisabled"}, - {0,"ProgressiveShiftIsNotDisabled"}, - {2,"Reserved"}, - {3,"TakeNoAction"} - },// states - true,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Src.Addrss.Of.Ctrllng.Dvc.Fr.Trns.Cntrl",// generic_name - 56,// bit_position - 8,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Trans.Driveline.Engaged",// generic_name - 0,// bit_position - 2,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {0,"DrivelineDisengaged"}, - {1,"DrivelineEngaged"}, - {2,"Error"}, - {3,"NotAvailable"} - },// states - true,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Trans.Input.Shaft.Speed",// generic_name - 40,// bit_position - 16,// bit_size - 0.125000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "rpm"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Trans.Output.Shaft.Speed",// generic_name - 8,// bit_position - 16,// bit_size - 0.125000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - true,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "rpm"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Trans.Shift.In.Process",// generic_name - 4,// bit_position - 2,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {2,"Error"}, - {3,"NotAvailable"}, - {1,"ShiftInProcess"}, - {0,"ShiftIsNotInProcess"} - },// states - true,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Trns.Trq.Cnvrtr.Lckp.Trnstn.In.Prcess",// generic_name - 6,// bit_position - 2,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {2,"Error"}, - {3,"NotAvailable"}, - {1,"TransitionIsInProcess"}, - {0,"TransitionIsNotInProcess"} - },// states - true,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Trns.Trque.Converter.Lockup.Engaged",// generic_name - 2,// bit_position - 2,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {2,"Error"}, - {3,"NotAvailable"}, - {0,"TorqueConverterLockupDisengaged"}, - {1,"TorqueConverterLockupEngaged"} - },// states - true,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"j1939",61444,"EEC1",8,4,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "Actl.Eng.Prcnt.Trque.High.Resolution",// generic_name - 4,// bit_position - 4,// bit_size - 0.125000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {0,"0000"}, - {1,"0125"}, - {7,"0875"}, - {8,"1111NotAvailable"} - },// states - false,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "%"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Actual.Eng.Percent.Torque",// generic_name - 16,// bit_position - 8,// bit_size - 1.00000f,// factor - -125.000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "%"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Drivers.Demand.Eng.Percent.Torque",// generic_name - 8,// bit_position - 8,// bit_size - 1.00000f,// factor - -125.000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "%"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Demand.Percent.Torque",// generic_name - 56,// bit_position - 8,// bit_size - 1.00000f,// factor - -125.000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "%"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Speed",// generic_name - 24,// bit_position - 16,// bit_size - 0.125000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "rpm"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Starter.Mode",// generic_name - 48,// bit_position - 4,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {9,"1011Reserved"}, - {14,"error"}, - {15,"notAvailable"}, - {0,"startNotRqed"}, - {2,"starterActiveGearEngaged"}, - {1,"starterActiveGearNotEngaged"}, - {12,"starterInhibitedReasonUnknown"}, - {3,"strtFnshdStrtrNtActvAftrHvngBnA"}, - {6,"strtrInhbtdDTDrvlnEnggdOthrTrns"}, - {5,"strtrInhbtdDTEngNtReadyForStart"}, - {7,"strtrInhbtdDToActiveImmobilizer"}, - {4,"strtrInhbtdDToEngAlreadyRunning"}, - {8,"strtrInhbtdDueToStarterOvertemp"} - },// states - false,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Torque.Mode",// generic_name - 0,// bit_position - 4,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {7,"ABS control"}, - {5,"ASR control"}, - {1,"Accelerator pedal/operator selec"}, - {10,"Braking system"}, - {2,"Cruise control"}, - {9,"High speed governor"}, - {0,"Low idle governor/no request (de"}, - {15,"Not available"}, - {3,"PTO governor"}, - {11,"Remote accelerator"}, - {4,"Road speed governor"}, - {8,"Torque limiting"}, - {6,"Transmission control"} - },// states - false,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Src.AddrssOf.Ctrllng.Dvc.Fr.Eng.Cntrl",// generic_name - 40,// bit_position - 8,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"j1939",61449,"VDC2",8,4,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "Lateral.Acceleration",// generic_name - 40,// bit_position - 16,// bit_size - 0.000488281f,// factor - -15.6870f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "m/s/s"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Longitudinal.Acceleration",// generic_name - 56,// bit_position - 8,// bit_size - 0.100000f,// factor - -12.5000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "m/s/s"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Steer.Wheel.Angle",// generic_name - 0,// bit_position - 16,// bit_size - 0.000976562f,// factor - -31.3740f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "rad"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Steer.Wheel.Angle.Sensor.Type",// generic_name - 22,// bit_position - 2,// bit_size - 1.00000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - {1,"AbsMeasuringPrinciple"}, - {3,"NotAvailable"}, - {0,"RelativeMeasuringPrinciple"}, - {2,"Reserved"} - },// states - false,// writable - decoder_t::decode_state,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - ""// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Steer.Wheel.Turn.Counter",// generic_name - 16,// bit_position - 6,// bit_size - 1.00000f,// factor - -32.0000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "turns"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Yaw.Rate",// generic_name - 24,// bit_position - 16,// bit_size - 0.000122070f,// factor - -3.92000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "rad/s"// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"j1939",65215,"EBC2",8,4,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "Front.Axle.Speed",// generic_name - 0,// bit_position - 16,// bit_size - 0.00390625f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "km/h"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Relative.Speed.Front.Axle.Left.Wheel",// generic_name - 16,// bit_position - 8,// bit_size - 0.0625000f,// factor - -7.81250f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "km/h"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Relative.Speed.Rear.Axle1.Left.Wheel",// generic_name - 32,// bit_position - 8,// bit_size - 0.0625000f,// factor - -7.81250f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "km/h"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Relative.Speed.Rear.Axle2.Left.Wheel",// generic_name - 48,// bit_position - 8,// bit_size - 0.0625000f,// factor - -7.81250f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "km/h"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Rlative.Speed.Front.Axle.Right.Wheel",// generic_name - 24,// bit_position - 8,// bit_size - 0.0625000f,// factor - -7.81250f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "km/h"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Rlative.Speed.Rear.Axle1.Right.Wheel",// generic_name - 40,// bit_position - 8,// bit_size - 0.0625000f,// factor - -7.81250f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "km/h"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Rlative.Speed.Rear.Axle2.Right.Wheel",// generic_name - 56,// bit_position - 8,// bit_size - 0.0625000f,// factor - -7.81250f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "km/h"// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"j1939",65253,"HOURS",8,4,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "Eng.Total.Hours.Of.Operation",// generic_name - 0,// bit_position - 32,// bit_size - 0.0500000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "hr"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Total.Revolutions",// generic_name - 32,// bit_position - 32,// bit_size - 1000.00f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "r"// unit - })} - } // end signals vector - })} // end message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{"j1939",65262,"ET1",8,4,frequency_clock_t(5.00000f),true, - { // beginning signals vector - {std::make_shared<signal_t> (signal_t{ - "Eng.Coolant.Temp",// generic_name - 0,// bit_position - 8,// bit_size - 0.0312500f,// factor - -273.000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "deg C"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Fuel.Temp1",// generic_name - 8,// bit_position - 8,// bit_size - 1.00000f,// factor - -40.0000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "deg C"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Intercooler.Temp",// generic_name - 48,// bit_position - 8,// bit_size - 1.00000f,// factor - -40.0000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "deg C"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Intercooler.Thermostat.Opening",// generic_name - 56,// bit_position - 8,// bit_size - 0.400000f,// factor - 0.00000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "%"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Oil.Temp1",// generic_name - 16,// bit_position - 16,// bit_size - 0.0312500f,// factor - -273.000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "deg C"// unit - })}, - {std::make_shared<signal_t> (signal_t{ - "Eng.Turbo.Oil.Temp",// generic_name - 32,// bit_position - 16,// bit_size - 0.0312500f,// factor - -273.000f,// offset - 0,// min_value - 0,// max_value - frequency_clock_t(0.00000f),// frequency - true,// send_same - false,// force_send_changed - { - },// states - false,// writable - nullptr,// decoder - nullptr,// encoder - false,// received - std::make_pair<bool, int>(false, 0),// multiplex - static_cast<sign_t>(0),// signed - -1,// bit_sign_position - "deg C"// unit - })} - } // end signals vector - })} // end message_definition entry - }, // end message_definition vector - { // beginning diagnostic_messages_ vector - - } // end diagnostic_messages_ vector - }); - -CTLP_ONLOAD(plugin, handle) -{ - afb_api_t api = (afb_api_t) plugin->api; - CtlConfigT* CtlConfig = (CtlConfigT*) afb_api_get_userdata(api); - application_t* app = (application_t*) getExternalData(CtlConfig); - - return app->add_message_set(cms); -} - -} - diff --git a/test/afb-test/fixtures/testValueJ1939_1.canreplay b/test/afb-test/fixtures/testValueJ1939_1.canreplay index 4685c39b..d08971e3 100644 --- a/test/afb-test/fixtures/testValueJ1939_1.canreplay +++ b/test/afb-test/fixtures/testValueJ1939_1.canreplay @@ -1 +1 @@ -(1481581765.346271) can2 09FD0202#EC5D0087C2FAFFFF +(1481581765.346271) can0 09FD0202#EC5D0087C2FAFFFF diff --git a/test/afb-test/fixtures/testj1939.canreplay b/test/afb-test/fixtures/testj1939.canreplay index d73ee92c..90b89c9d 100644 --- a/test/afb-test/fixtures/testj1939.canreplay +++ b/test/afb-test/fixtures/testj1939.canreplay @@ -1 +1 @@ -(08255.460200) can2 0CF00203#CD402800043828FF +(08255.460200) can0 0CF00203#CD402800043828FF diff --git a/test/afb-test/tests/low-can_J1939Test.lua b/test/afb-test/tests/low-can_J1939Test.lua index 3e855366..121dbc44 100644 --- a/test/afb-test/tests/low-can_J1939Test.lua +++ b/test/afb-test/tests/low-can_J1939Test.lua @@ -21,9 +21,9 @@ _AFT.setBeforeAll(function() - local can = io.open("/sys/class/net/can2") + local can = io.open("/sys/class/net/can0") if can == nil then - print("# You do not have 'can2' device set. Please run the following command:\n### sudo modprobe vcan; sudo ip link add can2 type vcan; sudo ip link set can2 up ") + print("# You do not have 'can0' device set. Please run the following command:\n### sudo modprobe vcan; sudo ip link add can2 type vcan; sudo ip link set can2 up ") return -1 end return 0 diff --git a/test/afb-test/tests/low-can_ValueJ1939Test.lua b/test/afb-test/tests/low-can_ValueJ1939Test.lua index 7fd6da67..5a4add3e 100644 --- a/test/afb-test/tests/low-can_ValueJ1939Test.lua +++ b/test/afb-test/tests/low-can_ValueJ1939Test.lua @@ -22,9 +22,9 @@ _AFT.setBeforeAll(function() - local can = io.open("/sys/class/net/can2") + local can = io.open("/sys/class/net/can0") if can == nil then - print("# You do not have 'can2' device set. Please run the following command:\n### sudo modprobe vcan; sudo ip link add can2 type vcan; sudo ip link set can2 up ") + print("# You do not have 'can0' device set. Please run the following command:\n### sudo modprobe vcan; sudo ip link add can2 type vcan; sudo ip link set can2 up ") return -1 end return 0 diff --git a/test/afb-test/tests/low-can_ValueTestCan.lua b/test/afb-test/tests/low-can_ValueTestCan.lua index 093ccf95..b717dc02 100644 --- a/test/afb-test/tests/low-can_ValueTestCan.lua +++ b/test/afb-test/tests/low-can_ValueTestCan.lua @@ -22,9 +22,9 @@ _AFT.setBeforeAll(function() - local can = io.open("/sys/class/net/can2") + local can = io.open("/sys/class/net/can0") if can == nil then - print("# You do not have 'can2' device set. Please run the following command:\n### sudo modprobe vcan; sudo ip link add can2 type vcan; sudo ip link set can2 up ") + print("# You do not have 'can0' device set. Please run the following command:\n### sudo modprobe vcan; sudo ip link add can2 type vcan; sudo ip link set can2 up ") return -1 end return 0 |