diff options
-rw-r--r-- | examples/OBD2/application-generated.cpp | 32 | ||||
-rw-r--r-- | examples/agl-vcar/application-generated.cpp | 764 | ||||
-rw-r--r-- | examples/basic/application-generated.cpp | 221 | ||||
-rw-r--r-- | examples/engine/application-generated.cpp | 272 | ||||
-rw-r--r-- | examples/hvac/application-generated.cpp | 184 | ||||
-rw-r--r-- | examples/j1939/Source | 2 | ||||
-rw-r--r-- | examples/j1939/application-generated.cpp | 672 | ||||
-rw-r--r-- | examples/j1939/j1939_parse.json | 576 | ||||
-rw-r--r-- | examples/toyota/auris/application-generated.cpp | 612 | ||||
-rw-r--r-- | low-can-binding/binding/application-generated.cpp | 910 |
10 files changed, 2787 insertions, 1458 deletions
diff --git a/examples/OBD2/application-generated.cpp b/examples/OBD2/application-generated.cpp index 5475db61..f5788d9b 100644 --- a/examples/OBD2/application-generated.cpp +++ b/examples/OBD2/application-generated.cpp @@ -4,11 +4,11 @@ application_t::application_t() : can_bus_manager_{utils::config_parser_t{"/etc/dev-mapping.conf"}} - , can_message_set_{ - {std::make_shared<can_message_set_t>(can_message_set_t{0,"example", - { // beginning can_message_definition_ vector + , message_set_{ + {std::make_shared<message_set_t>(message_set_t{0,"example", + { // beginning message_definition_ vector - }, // end can_message_definition vector + }, // end message_definition vector { // beginning diagnostic_messages_ vector {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ 4, @@ -264,26 +264,26 @@ application_t::application_t() })} } // end diagnostic_messages_ vector - })} // end can_message_set entry - } // end can_message_set vector + })} // end message_set entry + } // end message_set vector { - for(auto& cms: can_message_set_) + for(std::shared_ptr<message_set_t> cms: message_set_) { - std::vector<std::shared_ptr<can_message_definition_t> >& can_messages_definition = cms->get_can_message_definition(); - for(auto& cmd : can_messages_definition) + 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.get()); - std::vector<std::shared_ptr<can_signal_t> >& can_signals = cmd->get_can_signals(); - for(auto& sig: can_signals) + 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.get()); + sig->set_parent(cmd); } } - std::vector<std::shared_ptr<diagnostic_message_t> >& diagnostic_messages = cms->get_diagnostic_messages(); - for(auto& dm : diagnostic_messages) + 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.get()); + dm->set_parent(cms); } } } diff --git a/examples/agl-vcar/application-generated.cpp b/examples/agl-vcar/application-generated.cpp index 5a67d86e..38d26cc1 100644 --- a/examples/agl-vcar/application-generated.cpp +++ b/examples/agl-vcar/application-generated.cpp @@ -4,377 +4,453 @@ application_t::application_t() : can_bus_manager_{utils::config_parser_t{"/etc/dev-mapping.conf"}} - , can_message_set_{ - {std::make_shared<can_message_set_t>(can_message_set_t{0,"AGL Virtual Car", - { // beginning can_message_definition_ vector - {std::make_shared<can_message_definition_t>(can_message_definition_t{"ls",0x30,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true, - { // beginning can_signals vector - {std::make_shared<can_signal_t> (can_signal_t{ - "hvac.fan.speed", - 32, - 8, - 23.5294f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + , 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",0x30,0,message_format_t::STANDARD,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.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "hvac.temperature.left", - 0, - 8, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "hvac.temperature.left",// generic_name + 0,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - true, - nullptr, - nullptr, - false + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "hvac.temperature.right", - 8, - 8, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "hvac.temperature.right",// generic_name + 8,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - true, - nullptr, - nullptr, - false + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "hvac.temperature.average", - 16, - 8, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "hvac.temperature.average",// generic_name + 16,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - true, - nullptr, - nullptr, - false + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })} - } // end can_signals vector - })} // end can_message_definition entry -, {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x3D9,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true, - { // beginning can_signals vector - {std::make_shared<can_signal_t> (can_signal_t{ - "engine.speed", - 16, - 16, - 0.250000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3D9,0,message_format_t::STANDARD,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.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "fuel.level.low", - 55, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "fuel.level.low",// generic_name + 55,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "fuel.level", - 8, - 8, - 0.392157f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "fuel.level",// generic_name + 8,// bit_position + 8,// bit_size + 0.392157f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })} - } // end can_signals vector - })} // end can_message_definition entry -, {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x3E9,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true, - { // beginning can_signals vector - {std::make_shared<can_signal_t> (can_signal_t{ - "vehicle.average.speed", - 0, - 15, - 0.0156250f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3E9,0,message_format_t::STANDARD,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.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })} - } // end can_signals vector - })} // end can_message_definition entry -, {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x4D1,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true, - { // beginning can_signals vector - {std::make_shared<can_signal_t> (can_signal_t{ - "engine.oil.temp", - 16, - 8, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x4D1,0,message_format_t::STANDARD,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.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "engine.oil.temp.high", - 7, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "engine.oil.temp.high",// generic_name + 7,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })} - } // end can_signals vector - })} // end can_message_definition entry -, {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x620,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true, - { // beginning can_signals vector - {std::make_shared<can_signal_t> (can_signal_t{ - "doors.boot.open", - 47, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x620,0,message_format_t::STANDARD,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.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "doors.front_left.open", - 43, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "doors.front_left.open",// generic_name + 43,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "doors.front_right.open", - 44, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "doors.front_right.open",// generic_name + 44,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "doors.rear_left.open", - 46, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "doors.rear_left.open",// generic_name + 46,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "doors.rear_right.open", - 45, - 4, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "doors.rear_right.open",// generic_name + 45,// bit_position + 4,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })} - } // end can_signals vector - })} // end can_message_definition entry -, {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x799,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true, - { // beginning can_signals vector - {std::make_shared<can_signal_t> (can_signal_t{ - "windows.front_left.open", - 43, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x799,0,message_format_t::STANDARD,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.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "windows.front_right.open", - 44, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "windows.front_right.open",// generic_name + 44,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "windows.rear_left.open", - 46, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "windows.rear_left.open",// generic_name + 46,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "windows.rear_right.open", - 45, - 4, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "windows.rear_right.open",// generic_name + 45,// bit_position + 4,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })} - } // end can_signals vector - })} // end can_message_definition entry + } // end signals vector + })} // end message_definition entry - }, // end can_message_definition vector + }, // end message_definition vector { // beginning diagnostic_messages_ vector {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ 4, @@ -630,26 +706,26 @@ application_t::application_t() })} } // end diagnostic_messages_ vector - })} // end can_message_set entry - } // end can_message_set vector + })} // end message_set entry + } // end message_set vector { - for(auto& cms: can_message_set_) + for(std::shared_ptr<message_set_t> cms: message_set_) { - std::vector<std::shared_ptr<can_message_definition_t> >& can_messages_definition = cms->get_can_message_definition(); - for(auto& cmd : can_messages_definition) + 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.get()); - std::vector<std::shared_ptr<can_signal_t> >& can_signals = cmd->get_can_signals(); - for(auto& sig: can_signals) + 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.get()); + sig->set_parent(cmd); } } - std::vector<std::shared_ptr<diagnostic_message_t> >& diagnostic_messages = cms->get_diagnostic_messages(); - for(auto& dm : diagnostic_messages) + 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.get()); + dm->set_parent(cms); } } } diff --git a/examples/basic/application-generated.cpp b/examples/basic/application-generated.cpp index f4fddf0a..e05397ad 100644 --- a/examples/basic/application-generated.cpp +++ b/examples/basic/application-generated.cpp @@ -2,6 +2,7 @@ #include "../can/can-decoder.hpp" #include "../can/can-encoder.hpp" + // >>>>> handlers.cpp >>>>> #include "can/canread.h" @@ -30,40 +31,44 @@ void myLooper() { application_t::application_t() : can_bus_manager_{utils::config_parser_t{"/etc/dev-mapping.conf"}} - , can_message_set_{ - {std::make_shared<can_message_set_t>(can_message_set_t{0,"example", - { // beginning can_message_definition_ vector - {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x128,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true, - { // beginning can_signals vector - {std::make_shared<can_signal_t> (can_signal_t{ - "engine_speed", - 12, - 8, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(15.0000f), - true, - false, + , 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,0,0,message_format_t::STANDARD,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.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(15.0000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "GearshiftPosition", - 41, - 3, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "GearshiftPosition",// generic_name + 41,// bit_position + 3,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { {1,"FIRST"}, {4,"FOURTH"}, @@ -71,70 +76,86 @@ application_t::application_t() {5,"REVERSE"}, {2,"SECOND"}, {3,"THIRD"} - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "SteeringWheelAngle", - 52, - 12, - 0.153920f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "SteeringWheelAngle",// generic_name + 52,// bit_position + 12,// bit_size + 0.153920f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - handleUnsignedSteeringWheelAngle, - nullptr, - false + },// states + false,// writable + handleUnsignedSteeringWheelAngle,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "steering_wheel_angle_error", - 44, - 12, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "steering_wheel_angle_error",// generic_name + 44,// bit_position + 12,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - ignoreDecoder, - nullptr, - false + },// states + false,// writable + ignoreDecoder,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "steering_angle_sign", - 52, - 12, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "steering_angle_sign",// generic_name + 52,// bit_position + 12,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - ignoreDecoder, - nullptr, - false + },// states + false,// writable + ignoreDecoder,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })} - } // end can_signals vector - })} // end can_message_definition entry + } // end signals vector + })} // end message_definition entry - }, // end can_message_definition vector + }, // end message_definition vector { // beginning diagnostic_messages_ vector {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ 12, @@ -174,26 +195,26 @@ application_t::application_t() })} } // end diagnostic_messages_ vector - })} // end can_message_set entry - } // end can_message_set vector + })} // end message_set entry + } // end message_set vector { - for(auto& cms: can_message_set_) + for(std::shared_ptr<message_set_t> cms: message_set_) { - std::vector<std::shared_ptr<can_message_definition_t> >& can_messages_definition = cms->get_can_message_definition(); - for(auto& cmd : can_messages_definition) + 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.get()); - std::vector<std::shared_ptr<can_signal_t> >& can_signals = cmd->get_can_signals(); - for(auto& sig: can_signals) + 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.get()); + sig->set_parent(cmd); } } - std::vector<std::shared_ptr<diagnostic_message_t> >& diagnostic_messages = cms->get_diagnostic_messages(); - for(auto& dm : diagnostic_messages) + 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.get()); + dm->set_parent(cms); } } } diff --git a/examples/engine/application-generated.cpp b/examples/engine/application-generated.cpp index c8e6a1e5..3b9ecfde 100644 --- a/examples/engine/application-generated.cpp +++ b/examples/engine/application-generated.cpp @@ -4,154 +4,178 @@ application_t::application_t() : can_bus_manager_{utils::config_parser_t{"/etc/dev-mapping.conf"}} - , can_message_set_{ - {std::make_shared<can_message_set_t>(can_message_set_t{0,"example", - { // beginning can_message_definition_ vector - {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x3D9,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true, - { // beginning can_signals vector - {std::make_shared<can_signal_t> (can_signal_t{ - "engine.speed", - 16, - 16, - 0.250000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + , 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,0,0,message_format_t::STANDARD,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.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "fuel.level.low", - 55, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "fuel.level.low",// generic_name + 55,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "fuel.level", - 8, - 8, - 0.392157f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "fuel.level",// generic_name + 8,// bit_position + 8,// bit_size + 0.392157f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })} - } // end can_signals vector - })} // end can_message_definition entry -, {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x3E9,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true, - { // beginning can_signals vector - {std::make_shared<can_signal_t> (can_signal_t{ - "vehicle.average.speed", - 0, - 15, - 0.0156250f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3E9,0,0,message_format_t::STANDARD,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.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })} - } // end can_signals vector - })} // end can_message_definition entry -, {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x4D1,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true, - { // beginning can_signals vector - {std::make_shared<can_signal_t> (can_signal_t{ - "engine.oil.temp", - 16, - 8, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x4D1,0,0,message_format_t::STANDARD,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.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "engine.oil.temp.high", - 7, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "engine.oil.temp.high",// generic_name + 7,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })} - } // end can_signals vector - })} // end can_message_definition entry + } // end signals vector + })} // end message_definition entry - }, // end can_message_definition vector + }, // end message_definition vector { // beginning diagnostic_messages_ vector } // end diagnostic_messages_ vector - })} // end can_message_set entry - } // end can_message_set vector + })} // end message_set entry + } // end message_set vector { - for(auto& cms: can_message_set_) + for(std::shared_ptr<message_set_t> cms: message_set_) { - std::vector<std::shared_ptr<can_message_definition_t> >& can_messages_definition = cms->get_can_message_definition(); - for(auto& cmd : can_messages_definition) + 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.get()); - std::vector<std::shared_ptr<can_signal_t> >& can_signals = cmd->get_can_signals(); - for(auto& sig: can_signals) + 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.get()); + sig->set_parent(cmd); } } - std::vector<std::shared_ptr<diagnostic_message_t> >& diagnostic_messages = cms->get_diagnostic_messages(); - for(auto& dm : diagnostic_messages) + 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.get()); + dm->set_parent(cms); } } } diff --git a/examples/hvac/application-generated.cpp b/examples/hvac/application-generated.cpp index f0912ac2..de8f2240 100644 --- a/examples/hvac/application-generated.cpp +++ b/examples/hvac/application-generated.cpp @@ -4,110 +4,126 @@ application_t::application_t() : can_bus_manager_{utils::config_parser_t{"/etc/dev-mapping.conf"}} - , can_message_set_{ - {std::make_shared<can_message_set_t>(can_message_set_t{0,"example", - { // beginning can_message_definition_ vector - {std::make_shared<can_message_definition_t>(can_message_definition_t{"ls",0x30,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true, - { // beginning can_signals vector - {std::make_shared<can_signal_t> (can_signal_t{ - "hvac.fan.speed", - 32, - 8, - 23.5294f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + , 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,0,0,message_format_t::STANDARD,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.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "hvac.temperature.left", - 0, - 8, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "hvac.temperature.left",// generic_name + 0,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "hvac.temperature.right", - 8, - 8, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "hvac.temperature.right",// generic_name + 8,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "hvac.temperature.average", - 16, - 8, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "hvac.temperature.average",// generic_name + 16,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })} - } // end can_signals vector - })} // end can_message_definition entry + } // end signals vector + })} // end message_definition entry - }, // end can_message_definition vector + }, // end message_definition vector { // beginning diagnostic_messages_ vector } // end diagnostic_messages_ vector - })} // end can_message_set entry - } // end can_message_set vector + })} // end message_set entry + } // end message_set vector { - for(auto& cms: can_message_set_) + for(std::shared_ptr<message_set_t> cms: message_set_) { - std::vector<std::shared_ptr<can_message_definition_t> >& can_messages_definition = cms->get_can_message_definition(); - for(auto& cmd : can_messages_definition) + 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.get()); - std::vector<std::shared_ptr<can_signal_t> >& can_signals = cmd->get_can_signals(); - for(auto& sig: can_signals) + 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.get()); + sig->set_parent(cmd); } } - std::vector<std::shared_ptr<diagnostic_message_t> >& diagnostic_messages = cms->get_diagnostic_messages(); - for(auto& dm : diagnostic_messages) + 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.get()); + dm->set_parent(cms); } } } diff --git a/examples/j1939/Source b/examples/j1939/Source new file mode 100644 index 00000000..9539d4f8 --- /dev/null +++ b/examples/j1939/Source @@ -0,0 +1,2 @@ +The json file is inspired by the following folder : +https://github.com/tomahawkins/ecu
\ No newline at end of file diff --git a/examples/j1939/application-generated.cpp b/examples/j1939/application-generated.cpp new file mode 100644 index 00000000..ebb580a6 --- /dev/null +++ b/examples/j1939/application-generated.cpp @@ -0,0 +1,672 @@ +#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,"J1939", + { // beginning message_definition_ vector + + {std::make_shared<message_definition_t>(message_definition_t{"j1939",61442,0,message_format_t::J1939,frequency_clock_t(5.00000f),true,8, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "EngMomentaryOverspeedEnable",// generic_name + 32,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000,// 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 + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "",// unit + "Command signal used to indicate that the engine speed may be boosted up to the maximum engine overspeed value to"// comment + })}, + {std::make_shared<signal_t> (signal_t{ + "MomentaryEngMaxPowerEnable",// generic_name + 36,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000,// 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 + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "",// unit + "Momentarily Requesting highest torque map from the engine control"// comment + })}, + {std::make_shared<signal_t> (signal_t{ + "PercentClutchSlip",// generic_name + 24,// bit_position + 8,// bit_size + 0.400000f,// factor + 0.00000,// 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 + 0,// is_big_endian + 0,// is_signed + "%",// unit + "Parameter which represents the ratio of input shaft speed to current engine speed (in percent)."// comment + })}, + {std::make_shared<signal_t> (signal_t{ + "ProgressiveShiftDisable",// generic_name + 34,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000,// 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 + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "",// unit + "Command signal used to indicate that progressive shifting by the engine should be disallowed."// comment + })}, + {std::make_shared<signal_t> (signal_t{ + "SrcAddrssOfCtrllngDvcFrTrnsCntrl",// generic_name + 56,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000,// 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 + 0,// is_big_endian + 0,// is_signed + "",// unit + "The source address of the SAE J1939 device currently controlling the transmission."// comment + })}, + {std::make_shared<signal_t> (signal_t{ + "TransDrivelineEngaged",// generic_name + 0,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000,// 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 + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "",// unit + "Driveline engaged indicates the transmission controlled portion of the driveline is engaged sufficiently to allow a transfer"// comment + })}, + {std::make_shared<signal_t> (signal_t{ + "TransInputShaftSpeed",// generic_name + 40,// bit_position + 16,// bit_size + 0.125000f,// factor + 0.00000,// 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 + 0,// is_big_endian + 0,// is_signed + "rpm",// unit + "Rotational velocity of the primary shaft transferring power into the transmission."// comment + })}, + {std::make_shared<signal_t> (signal_t{ + "TransOutputShaftSpeed",// generic_name + 8,// bit_position + 16,// bit_size + 0.125000f,// factor + 0.00000,// 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 + 0,// is_big_endian + 0,// is_signed + "rpm",// unit + "Calculated speed of the transmission output shaft."// comment + })}, + {std::make_shared<signal_t> (signal_t{ + "TransShiftInProcess",// generic_name + 4,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000,// 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 + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "",// unit + "Indicates that the transmission is in process of shifting from the current gear to the selected gear."// comment + })}, + {std::make_shared<signal_t> (signal_t{ + "TrnsTrqCnvrtrLckpTrnstnInPrcess",// generic_name + 6,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000,// 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 + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "",// unit + "State signal indicating whether or not the transmission torque converter lock up clutch is transitioning between being"// comment + })}, + {std::make_shared<signal_t> (signal_t{ + "TrnsTrqueConverterLockupEngaged",// generic_name + 2,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000,// 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 + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "",// unit + "State signal which indicates whether the torque converter lockup is engaged."// comment + })} + } // end signals vector + })}, // end message_definition entry + + {std::make_shared<message_definition_t>(message_definition_t{"j1939",61449,0,message_format_t::J1939,frequency_clock_t(5.00000f),true,8, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "LateralAcceleration",// generic_name + 40,// bit_position + 16,// bit_size + 0.000488281f,// factor + -15.6870,// 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 + 0,// is_big_endian + 0,// is_signed + "m/s/s",// unit + "Indicates a lateral acceleration of the vehicle."// comment + })}, + {std::make_shared<signal_t> (signal_t{ + "LongitudinalAcceleration",// generic_name + 56,// bit_position + 8,// bit_size + 0.100000f,// factor + -12.5000,// 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 + 0,// is_big_endian + 0,// is_signed + "m/s/s",// unit + "Indicates the longitudinal acceleration of the vehicle."// comment + })}, + {std::make_shared<signal_t> (signal_t{ + "SteerWheelAngle",// generic_name + 0,// bit_position + 16,// bit_size + 0.000976562f,// factor + -31.3740,// 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 + 0,// is_big_endian + 0,// is_signed + "rad",// unit + "The main operator`s steering wheel angle (on the steering column, not the actual wheel angle)."// comment + })}, + {std::make_shared<signal_t> (signal_t{ + "SteerWheelAngleSensorType",// generic_name + 22,// bit_position + 2,// bit_size + 1.00000f,// factor + 0.00000,// 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 + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "",// unit + "Indicates whether the steering wheel angle sensor is capable of absolute measuring of the number of steering wheel"// comment + })}, + {std::make_shared<signal_t> (signal_t{ + "SteerWheelTurnCounter",// generic_name + 16,// bit_position + 6,// bit_size + 1.00000f,// factor + -32.0000,// 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 + 0,// is_big_endian + 0,// is_signed + "turns",// unit + "Indicates number of steering wheel turns, absolute position or relative position at ignition on."// comment + })}, + {std::make_shared<signal_t> (signal_t{ + "YawRate",// generic_name + 24,// bit_position + 16,// bit_size + 0.000122070f,// factor + -3.92000,// 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 + 0,// is_big_endian + 0,// is_signed + "rad/s",// unit + "Indicates the rotation about the vertical axis."// comment + })} + } // end signals vector + })}, // end message_definition entry + + {std::make_shared<message_definition_t>(message_definition_t{"j1939",65253,0,message_format_t::J1939,frequency_clock_t(5.00000f),true,8, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "EngTotalHoursOfOperation",// generic_name + 0,// bit_position + 32,// bit_size + 0.0500000f,// factor + 0.00000,// 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 + 0,// is_big_endian + 0,// is_signed + "hr",// unit + "Accumulated time of operation of engine."// comment + })}, + {std::make_shared<signal_t> (signal_t{ + "EngTotalRevolutions",// generic_name + 32,// bit_position + 32,// bit_size + 1000.00f,// factor + 0.00000,// 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 + 0,// is_big_endian + 0,// is_signed + "r",// unit + "Accumulated number of revolutions of engine crankshaft during its operation."// comment + })} + } // end signals vector + })}, // end message_definition entry + + + {std::make_shared<message_definition_t>(message_definition_t{"j1939",65262,0,message_format_t::J1939,frequency_clock_t(5.00000f),true,8, + { // beginning signals vector + {std::make_shared<signal_t> (signal_t{ + "EngCoolantTemp",// generic_name + 0,// bit_position + 8,// bit_size + 0.0312500f,// factor + -273.000,// 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 + 0,// is_big_endian + 0,// is_signed + "deg C",// unit + "Temperature of liquid found in engine cooling system."// comment + })}, + {std::make_shared<signal_t> (signal_t{ + "EngFuelTemp1",// generic_name + 8,// bit_position + 8,// bit_size + 1.00000f,// factor + -40.0000,// 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 + 0,// is_big_endian + 0,// is_signed + "deg C",// unit + "Temperature of fuel (or gas) passing through the first fuel control system."// comment + })}, + {std::make_shared<signal_t> (signal_t{ + "EngIntercoolerTemp",// generic_name + 48,// bit_position + 8,// bit_size + 1.00000f,// factor + -40.0000,// 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 + 0,// is_big_endian + 0,// is_signed + "deg C",// unit + "Temperature of liquid found in the intercooler located after the turbocharger."// comment + })}, + {std::make_shared<signal_t> (signal_t{ + "EngIntercoolerThermostatOpening",// generic_name + 56,// bit_position + 8,// bit_size + 0.400000f,// factor + 0.00000,// 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 + 0,// is_big_endian + 0,// is_signed + "%",// unit + "The current position of the thermostat used to regulate the temperature of the engine intercooler."// comment + })}, + {std::make_shared<signal_t> (signal_t{ + "EngOilTemp1",// generic_name + 16,// bit_position + 16,// bit_size + 0.0312500f,// factor + -273.000,// 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 + 0,// is_big_endian + 0,// is_signed + "deg C",// unit + "Temperature of the engine lubricant."// comment + })}, + {std::make_shared<signal_t> (signal_t{ + "EngTurboOilTemp",// generic_name + 32,// bit_position + 16,// bit_size + 0.0312500f,// factor + -273.000,// 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 + 0,// is_big_endian + 0,// is_signed + "deg C",// unit + "Temperature of the turbocharger lubricant."// comment + })} + } // 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/j1939/j1939_parse.json b/examples/j1939/j1939_parse.json new file mode 100644 index 00000000..fd4c3fc2 --- /dev/null +++ b/examples/j1939/j1939_parse.json @@ -0,0 +1,576 @@ + +{ "name": "Virtual J1939", + "extra_sources": [], + "initializers": [], + "loopers": [], + "buses": {}, + "commands": [], + "messages": { + "61442": { + "comment": "Electronic Transmission Controller 1", + "length": 8, + "name": "ETC1", + "bus" : "j1939", + "is_j1939" : true, + "signals" : { + "TrnsTrqueConverterLockupEngaged" : { + "generic_name": "TrnsTrqueConverterLockupEngaged", + "bit_position": 2, + "bit_size": 2, + "factor": 1, + "offset": 0, + "comment": "State signal which indicates whether the torque converter lockup is engaged.", + "is_big_endian": false, + "is_signed": false, + "states": { + "TorqueConverterLockupDisengaged": [0], + "TorqueConverterLockupEngaged": [1], + "Error": [2], + "NotAvailable": [3] + } + }, + "TrnsTrqCnvrtrLckpTrnstnInPrcess" : { + "generic_name": "TrnsTrqCnvrtrLckpTrnstnInPrcess", + "bit_position": 6, + "bit_size": 2, + "factor": 1, + "offset": 0, + "comment": "State signal indicating whether or not the transmission torque converter lock up clutch is transitioning between being", + "is_big_endian": false, + "is_signed": false, + "states": { + "TransitionIsNotInProcess": [0], + "TransitionIsInProcess": [1], + "Error": [2], + "NotAvailable": [3] + } + }, + "SrcAddrssOfCtrllngDvcFrTrnsCntrl" : { + "generic_name": "SrcAddrssOfCtrllngDvcFrTrnsCntrl", + "bit_position": 56, + "bit_size": 8, + "factor": 1, + "offset": 0, + "comment": "The source address of the SAE J1939 device currently controlling the transmission.", + "is_big_endian": false, + "is_signed": false + }, + "MomentaryEngMaxPowerEnable" : { + "generic_name": "MomentaryEngMaxPowerEnable", + "bit_position": 36, + "bit_size": 2, + "factor": 1, + "offset": 0, + "comment": "Momentarily Requesting highest torque map from the engine control", + "is_big_endian": false, + "is_signed": false, + "states": { + "notRqingMaxPowerAvailable": [0], + "mmntarilyRqingMaxPowerAvailable": [1], + "fault": [2], + "notAvailable": [3] + } + }, + "TransInputShaftSpeed" : { + "generic_name": "TransInputShaftSpeed", + "bit_position": 40, + "bit_size": 16, + "factor": 0.125, + "offset": 0, + "comment": "Rotational velocity of the primary shaft transferring power into the transmission.", + "unit": "rpm", + "is_big_endian": false, + "is_signed": false + }, + "ProgressiveShiftDisable" : { + "generic_name": "ProgressiveShiftDisable", + "bit_position": 34, + "bit_size": 2, + "factor": 1, + "offset": 0, + "comment": "Command signal used to indicate that progressive shifting by the engine should be disallowed.", + "is_big_endian": false, + "is_signed": false, + "states": { + "ProgressiveShiftIsNotDisabled": [0], + "ProgressiveShiftIsDisabled": [1], + "Reserved": [2], + "TakeNoAction": [3] + } + }, + "EngMomentaryOverspeedEnable" : { + "generic_name": "EngMomentaryOverspeedEnable", + "bit_position": 32, + "bit_size": 2, + "factor": 1, + "offset": 0, + "comment": "Command signal used to indicate that the engine speed may be boosted up to the maximum engine overspeed value to", + "is_big_endian": false, + "is_signed": false, + "states": { + "MomentaryEngOverspeedIsDisabled": [0], + "MomentaryEngOverspeedIsEnabled": [1], + "Reserved": [2], + "TakeNoAction": [3] + } + }, + "PercentClutchSlip" : { + "generic_name": "PercentClutchSlip", + "bit_position": 24, + "bit_size": 8, + "factor": 0.4, + "offset": 0, + "comment": "Parameter which represents the ratio of input shaft speed to current engine speed (in percent).", + "unit": "%", + "is_big_endian": false, + "is_signed": false + }, + "TransOutputShaftSpeed" : { + "generic_name": "TransOutputShaftSpeed", + "bit_position": 8, + "bit_size": 16, + "factor": 0.125, + "offset": 0, + "comment": "Calculated speed of the transmission output shaft.", + "unit": "rpm", + "is_big_endian": false, + "is_signed": false + }, + "TransShiftInProcess" : { + "generic_name": "TransShiftInProcess", + "bit_position": 4, + "bit_size": 2, + "factor": 1, + "offset": 0, + "comment": "Indicates that the transmission is in process of shifting from the current gear to the selected gear.", + "is_big_endian": false, + "is_signed": false, + "states": { + "ShiftIsNotInProcess": [0], + "ShiftInProcess": [1], + "Error": [2], + "NotAvailable": [3] + } + }, + "TransDrivelineEngaged" : { + "generic_name": "TransDrivelineEngaged", + "bit_position": 0, + "bit_size": 2, + "factor": 1, + "offset": 0, + "comment": "Driveline engaged indicates the transmission controlled portion of the driveline is engaged sufficiently to allow a transfer", + "is_big_endian": false, + "is_signed": false, + "states": { + "DrivelineDisengaged": [0], + "DrivelineEngaged": [1], + "Error": [2], + "NotAvailable": [3] + } + } + } + }, + "61444": { + "comment": "Electronic Engine Controller 1", + "length": 8, + "name": "EEC1", + "bus" : "j1939", + "is_j1939" : true, + "signals" : { + "SrcAddrssOfCtrllngDvcFrEngCntrl" : { + "generic_name": "SrcAddrssOfCtrllngDvcFrEngCntrl", + "bit_position": 40, + "bit_size": 8, + "factor": 1, + "offset": 0, + "comment": "The source address of the SAE J1939 device currently controlling the engine.", + "is_big_endian": false, + "is_signed": false + }, + "ActlEngPrcntTrqueHighResolution" : { + "generic_name": "ActlEngPrcntTrqueHighResolution", + "bit_position": 4, + "bit_size": 4, + "factor": 0.125, + "offset": 0, + "comment": "This parameter displays an additional torque in percent of the reference engine torque.", + "unit": "%", + "is_big_endian": false, + "is_signed": false, + "states": { + "0000": [0], + "0125": [1], + "0875": [7], + "1111NotAvailable": [8] + } + }, + "EngDemandPercentTorque" : { + "generic_name": "EngDemandPercentTorque", + "bit_position": 56, + "bit_size": 8, + "factor": 1, + "offset": -125, + "comment": "The requested torque output of the engine by all dynamic internal inputs, including smoke control, noise control and low", + "unit": "%", + "is_big_endian": false, + "is_signed": false + }, + "EngStarterMode" : { + "generic_name": "EngStarterMode", + "bit_position": 48, + "bit_size": 4, + "factor": 1, + "offset": 0, + "comment": "There are several phases in a starting action and different reasons why a start cannot take place.", + "is_big_endian": false, + "is_signed": false, + "states": { + "startNotRqed": [0], + "starterActiveGearNotEngaged": [1], + "starterActiveGearEngaged": [2], + "strtFnshdStrtrNtActvAftrHvngBnA": [3], + "strtrInhbtdDToEngAlreadyRunning": [4], + "strtrInhbtdDTEngNtReadyForStart": [5], + "strtrInhbtdDTDrvlnEnggdOthrTrns": [6], + "strtrInhbtdDToActiveImmobilizer": [7], + "strtrInhbtdDueToStarterOvertemp": [8], + "1011Reserved": [9], + "starterInhibitedReasonUnknown": [12], + "error": [14], + "notAvailable": [15] + } + }, + "EngSpeed" : { + "generic_name": "EngSpeed", + "bit_position": 24, + "bit_size": 16, + "factor": 0.125, + "offset": 0, + "comment": "Actual engine speed which is calculated over a minimum crankshaft angle of 720 degrees divided by the number of cylinders.", + "unit": "rpm", + "is_big_endian": false, + "is_signed": false + }, + "ActualEngPercentTorque" : { + "generic_name": "ActualEngPercentTorque", + "bit_position": 16, + "bit_size": 8, + "factor": 1, + "offset": -125, + "comment": "The calculated output torque of the engine.", + "unit": "%", + "is_big_endian": false, + "is_signed": false + }, + "DriversDemandEngPercentTorque" : { + "generic_name": "DriversDemandEngPercentTorque", + "bit_position": 8, + "bit_size": 8, + "factor": 1, + "offset": -125, + "comment": "The requested torque output of the engine by the driver.", + "unit": "%", + "is_big_endian": false, + "is_signed": false + }, + "EngTorqueMode" : { + "generic_name": "EngTorqueMode", + "bit_position": 0, + "bit_size": 4, + "factor": 1, + "offset": 0, + "comment": "State signal which indicates which engine torque mode is currently generating, limiting, or controlling the torque.", + "is_big_endian": false, + "is_signed": false, + "states": { + "Low idle governor/no request (de": [0], + "Accelerator pedal/operator selec": [1], + "Cruise control": [2], + "PTO governor": [3], + "Road speed governor": [4], + "ASR control": [5], + "Transmission control": [6], + "ABS control": [7], + "Torque limiting": [8], + "High speed governor": [9], + "Braking system": [10], + "Remote accelerator": [11], + "Not available": [15] + } + } + } + }, + "65253": { + "comment": "Engine Hours, Revolutions", + "length": 8, + "name": "HOURS", + "bus" : "j1939", + "is_j1939" : true, + "signals" : { + "EngTotalRevolutions" : { + "generic_name": "EngTotalRevolutions", + "bit_position": 32, + "bit_size": 32, + "factor": 1000, + "offset": 0, + "comment": "Accumulated number of revolutions of engine crankshaft during its operation.", + "unit": "r", + "is_big_endian": false, + "is_signed": false + }, + "EngTotalHoursOfOperation" : { + "generic_name": "EngTotalHoursOfOperation", + "bit_position": 0, + "bit_size": 32, + "factor": 0.05, + "offset": 0, + "comment": "Accumulated time of operation of engine.", + "unit": "hr", + "is_big_endian": false, + "is_signed": false + } + } + }, + "61449": { + "comment": "Vehicle Dynamic Stability Control 2", + "length": 8, + "name": "VDC2", + "bus" : "j1939", + "is_j1939" : true, + "signals" : { + "SteerWheelAngle" : { + "generic_name": "SteerWheelAngle", + "bit_position": 0, + "bit_size": 16, + "factor": 0.0009765625, + "offset": -31.374, + "comment": "The main operator`s steering wheel angle (on the steering column, not the actual wheel angle).", + "unit": "rad", + "is_big_endian": false, + "is_signed": false + }, + "LongitudinalAcceleration" : { + "generic_name": "LongitudinalAcceleration", + "bit_position": 56, + "bit_size": 8, + "factor": 0.1, + "offset": -12.5, + "comment": "Indicates the longitudinal acceleration of the vehicle.", + "unit": "m/s/s", + "is_big_endian": false, + "is_signed": false + }, + "LateralAcceleration" : { + "generic_name": "LateralAcceleration", + "bit_position": 40, + "bit_size": 16, + "factor": 0.00048828125, + "offset": -15.687, + "comment": "Indicates a lateral acceleration of the vehicle.", + "unit": "m/s/s", + "is_big_endian": false, + "is_signed": false + }, + "YawRate" : { + "generic_name": "YawRate", + "bit_position": 24, + "bit_size": 16, + "factor": 0.0001220703125, + "offset": -3.92, + "comment": "Indicates the rotation about the vertical axis.", + "unit": "rad/s", + "is_big_endian": false, + "is_signed": false + }, + "SteerWheelAngleSensorType" : { + "generic_name": "SteerWheelAngleSensorType", + "bit_position": 22, + "bit_size": 2, + "factor": 1, + "offset": 0, + "comment": "Indicates whether the steering wheel angle sensor is capable of absolute measuring of the number of steering wheel", + "is_big_endian": false, + "is_signed": false, + "states": { + "RelativeMeasuringPrinciple": [0], + "AbsMeasuringPrinciple": [1], + "Reserved": [2], + "NotAvailable": [3] + } + }, + "SteerWheelTurnCounter" : { + "generic_name": "SteerWheelTurnCounter", + "bit_position": 16, + "bit_size": 6, + "factor": 1, + "offset": -32, + "comment": "Indicates number of steering wheel turns, absolute position or relative position at ignition on.", + "unit": "turns", + "is_big_endian": false, + "is_signed": false + } + } + }, + "65215": { + "comment": "Wheel Speed Information", + "length": 8, + "name": "EBC2", + "bus" : "j1939", + "is_j1939" : true, + "signals" : { + "RlativeSpeedRearAxle2RightWheel" : { + "generic_name": "RlativeSpeedRearAxle2RightWheel", + "bit_position": 56, + "bit_size": 8, + "factor": 0.0625, + "offset": -7.8125, + "comment": "The speed of the rear axle #2, right wheel relative to the front axle speed, SPN 904.", + "unit": "km/h", + "is_big_endian": false, + "is_signed": false + }, + "RelativeSpeedRearAxle2LeftWheel" : { + "generic_name": "RelativeSpeedRearAxle2LeftWheel", + "bit_position": 48, + "bit_size": 8, + "factor": 0.0625, + "offset": -7.8125, + "comment": "The speed of the rear axle #2, left wheel relative to the front axle speed, SPN 904.", + "unit": "km/h", + "is_big_endian": false, + "is_signed": false + }, + "RlativeSpeedRearAxle1RightWheel" : { + "generic_name": "RlativeSpeedRearAxle1RightWheel", + "bit_position": 40, + "bit_size": 8, + "factor": 0.0625, + "offset": -7.8125, + "comment": "The speed of the rear axle #1, right wheel relative to the front axle speed, SPN 904.", + "unit": "km/h", + "is_big_endian": false, + "is_signed": false + }, + "RelativeSpeedRearAxle1LeftWheel" : { + "generic_name": "RelativeSpeedRearAxle1LeftWheel", + "bit_position": 32, + "bit_size": 8, + "factor": 0.0625, + "offset": -7.8125, + "comment": "The speed of the rear axle #1, left wheel relative to the front axle speed, SPN 904.", + "unit": "km/h", + "is_big_endian": false, + "is_signed": false + }, + "RlativeSpeedFrontAxleRightWheel" : { + "generic_name": "RlativeSpeedFrontAxleRightWheel", + "bit_position": 24, + "bit_size": 8, + "factor": 0.0625, + "offset": -7.8125, + "comment": "The speed of the front axle, right wheel relative to the front axle speed, SPN 904.", + "unit": "km/h", + "is_big_endian": false, + "is_signed": false + }, + "RelativeSpeedFrontAxleLeftWheel" : { + "generic_name": "RelativeSpeedFrontAxleLeftWheel", + "bit_position": 16, + "bit_size": 8, + "factor": 0.0625, + "offset": -7.8125, + "comment": "The speed of the front axle, left wheel relative to the front axle speed, SPN 904.", + "unit": "km/h", + "is_big_endian": false, + "is_signed": false + }, + "FrontAxleSpeed" : { + "generic_name": "FrontAxleSpeed", + "bit_position": 0, + "bit_size": 16, + "factor": 0.00390625, + "offset": 0, + "comment": "The average speed of the two front wheels.", + "unit": "km/h", + "is_big_endian": false, + "is_signed": false + } + } + }, + "65262": { + "comment": "Engine Temperature 1", + "length": 8, + "name": "ET1", + "bus" : "j1939", + "is_j1939" : true, + "signals" : { + "EngFuelTemp1" : { + "generic_name": "EngFuelTemp1", + "bit_position": 8, + "bit_size": 8, + "factor": 1, + "offset": -40, + "comment": "Temperature of fuel (or gas) passing through the first fuel control system.", + "unit": "deg C", + "is_big_endian": false, + "is_signed": false + }, + "EngIntercoolerThermostatOpening" : { + "generic_name": "EngIntercoolerThermostatOpening", + "bit_position": 56, + "bit_size": 8, + "factor": 0.4, + "offset": 0, + "comment": "The current position of the thermostat used to regulate the temperature of the engine intercooler.", + "unit": "%", + "is_big_endian": false, + "is_signed": false + }, + "EngIntercoolerTemp" : { + "generic_name": "EngIntercoolerTemp", + "bit_position": 48, + "bit_size": 8, + "factor": 1, + "offset": -40, + "comment": "Temperature of liquid found in the intercooler located after the turbocharger.", + "unit": "deg C", + "is_big_endian": false, + "is_signed": false + }, + "EngTurboOilTemp" : { + "generic_name": "EngTurboOilTemp", + "bit_position": 32, + "bit_size": 16, + "factor": 0.03125, + "offset": -273, + "comment": "Temperature of the turbocharger lubricant.", + "unit": "deg C", + "is_big_endian": false, + "is_signed": false + }, + "EngOilTemp1" : { + "generic_name": "EngOilTemp1", + "bit_position": 16, + "bit_size": 16, + "factor": 0.03125, + "offset": -273, + "comment": "Temperature of the engine lubricant.", + "unit": "deg C", + "is_big_endian": false, + "is_signed": false + }, + "EngCoolantTemp" : { + "generic_name": "EngCoolantTemp", + "bit_position": 0, + "bit_size": 8, + "factor": 0.03125, + "offset": -273, + "comment": "Temperature of liquid found in engine cooling system.", + "unit": "deg C", + "is_big_endian": false, + "is_signed": false + } + } + } + } +} diff --git a/examples/toyota/auris/application-generated.cpp b/examples/toyota/auris/application-generated.cpp index 25b4a1d3..f635e2bd 100644 --- a/examples/toyota/auris/application-generated.cpp +++ b/examples/toyota/auris/application-generated.cpp @@ -4,301 +4,361 @@ application_t::application_t() : can_bus_manager_{utils::config_parser_t{"/etc/dev-mapping.conf"}} - , can_message_set_{ - {std::make_shared<can_message_set_t>(can_message_set_t{0,"example", - { // beginning can_message_definition_ vector - {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x3D9,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true, - { // beginning can_signals vector - {std::make_shared<can_signal_t> (can_signal_t{ - "engine.speed", - 16, - 16, - 0.250000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + , 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,0,0,message_format_t::STANDARD,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.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "fuel.level.low", - 55, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "fuel.level.low",// generic_name + 55,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "fuel.level", - 8, - 8, - 0.392157f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "fuel.level",// generic_name + 8,// bit_position + 8,// bit_size + 0.392157f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })} - } // end can_signals vector - })} // end can_message_definition entry -, {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x3E9,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true, - { // beginning can_signals vector - {std::make_shared<can_signal_t> (can_signal_t{ - "vehicle.average.speed", - 0, - 15, - 0.0156250f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3E9,0,0,message_format_t::STANDARD,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.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })} - } // end can_signals vector - })} // end can_message_definition entry -, {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x4D1,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true, - { // beginning can_signals vector - {std::make_shared<can_signal_t> (can_signal_t{ - "engine.oil.temp", - 16, - 8, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x4D1,0,0,message_format_t::STANDARD,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.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "engine.oil.temp.high", - 7, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "engine.oil.temp.high",// generic_name + 7,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })} - } // end can_signals vector - })} // end can_message_definition entry -, {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x620,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true, - { // beginning can_signals vector - {std::make_shared<can_signal_t> (can_signal_t{ - "doors.boot.open", - 47, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x620,0,0,message_format_t::STANDARD,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.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "doors.front_left.open", - 43, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "doors.front_left.open",// generic_name + 43,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "doors.front_right.open", - 44, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "doors.front_right.open",// generic_name + 44,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "doors.rear_left.open", - 46, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "doors.rear_left.open",// generic_name + 46,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "doors.rear_right.open", - 45, - 4, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "doors.rear_right.open",// generic_name + 45,// bit_position + 4,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })} - } // end can_signals vector - })} // end can_message_definition entry -, {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x799,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true, - { // beginning can_signals vector - {std::make_shared<can_signal_t> (can_signal_t{ - "windows.front_left.open", - 43, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x799,0,0,message_format_t::STANDARD,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.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "windows.front_right.open", - 44, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "windows.front_right.open",// generic_name + 44,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "windows.rear_left.open", - 46, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "windows.rear_left.open",// generic_name + 46,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })}, - {std::make_shared<can_signal_t> (can_signal_t{ - "windows.rear_right.open", - 45, - 4, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + {std::make_shared<signal_t> (signal_t{ + "windows.rear_right.open",// generic_name + 45,// bit_position + 4,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + ""// unit })} - } // end can_signals vector - })} // end can_message_definition entry + } // end signals vector + })} // end message_definition entry - }, // end can_message_definition vector + }, // end message_definition vector { // beginning diagnostic_messages_ vector {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ 4, @@ -554,26 +614,26 @@ application_t::application_t() })} } // end diagnostic_messages_ vector - })} // end can_message_set entry - } // end can_message_set vector + })} // end message_set entry + } // end message_set vector { - for(auto& cms: can_message_set_) + for(std::shared_ptr<message_set_t> cms: message_set_) { - std::vector<std::shared_ptr<can_message_definition_t> >& can_messages_definition = cms->get_can_message_definition(); - for(auto& cmd : can_messages_definition) + 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.get()); - std::vector<std::shared_ptr<can_signal_t> >& can_signals = cmd->get_can_signals(); - for(auto& sig: can_signals) + 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.get()); + sig->set_parent(cmd); } } - std::vector<std::shared_ptr<diagnostic_message_t> >& diagnostic_messages = cms->get_diagnostic_messages(); - for(auto& dm : diagnostic_messages) + 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.get()); + dm->set_parent(cms); } } } diff --git a/low-can-binding/binding/application-generated.cpp b/low-can-binding/binding/application-generated.cpp index de7d6a17..8db26224 100644 --- a/low-can-binding/binding/application-generated.cpp +++ b/low-can-binding/binding/application-generated.cpp @@ -6,567 +6,451 @@ 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 can_message_definition_ vector - {std::make_shared<message_definition_t>(message_definition_t{ - "ls", - 0x30, - false, - message_format_t::EXTENDED, - frequency_clock_t(5.00000f), - true, - { // beginning can_signals vector + { // beginning message_definition_ vector + {std::make_shared<message_definition_t>(message_definition_t{"ls",0x30,0,message_format_t::STANDARD,frequency_clock_t(5.00000f),true, + { // beginning signals vector {std::make_shared<signal_t> (signal_t{ - "hvac.fan.speed", - 32, - 8, - 23.5294f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + "hvac.fan.speed",// generic_name + 32,// bit_position + 8,// bit_size + 23.5294f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "" // unit })}, {std::make_shared<signal_t> (signal_t{ - "hvac.temperature.left", - 0, - 8, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + "hvac.temperature.left",// generic_name + 0,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - true, - nullptr, - nullptr, - false + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "" // unit })}, {std::make_shared<signal_t> (signal_t{ - "hvac.temperature.right", - 8, - 8, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + "hvac.temperature.right",// generic_name + 8,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - true, - nullptr, - nullptr, - false + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "" // unit })}, {std::make_shared<signal_t> (signal_t{ - "hvac.temperature.average", - 16, - 8, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + "hvac.temperature.average",// generic_name + 16,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - true, - nullptr, - nullptr, - false + },// states + true,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "" // unit })} - } // end can_signals vector - })} // end can_message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{ - "hs", - 0x3D9, - true, - message_format_t::STANDARD, - frequency_clock_t(5.00000f), - true, - { // beginning can_signals vector + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3D9,0,message_format_t::STANDARD,frequency_clock_t(5.00000f),true, + { // beginning signals vector {std::make_shared<signal_t> (signal_t{ - "engine.speed", - 16, - 16, - 0.250000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + "engine.speed",// generic_name + 16,// bit_position + 16,// bit_size + 0.250000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "" // unit })}, {std::make_shared<signal_t> (signal_t{ - "fuel.level.low", - 55, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + "fuel.level.low",// generic_name + 55,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "" // unit })}, {std::make_shared<signal_t> (signal_t{ - "fuel.level", - 8, - 8, - 0.392157f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + "fuel.level",// generic_name + 8,// bit_position + 8,// bit_size + 0.392157f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "" // unit })} - } // end can_signals vector - })} // end can_message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{ - "hs", - 0x3E9, - false, - message_format_t::EXTENDED, - frequency_clock_t(5.00000f), - true, - { // beginning can_signals vector + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x3E9,0,message_format_t::STANDARD,frequency_clock_t(5.00000f),true, + { // beginning signals vector {std::make_shared<signal_t> (signal_t{ - "vehicle.average.speed", - 0, - 15, - 0.0156250f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + "vehicle.average.speed",// generic_name + 0,// bit_position + 15,// bit_size + 0.0156250f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "" // unit })} - } // end can_signals vector - })} // end can_message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{ - "hs", - 0x4D1, - false, - message_format_t::STANDARD, - frequency_clock_t(5.00000f), - true, - { // beginning can_signals vector + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x4D1,0,message_format_t::STANDARD,frequency_clock_t(5.00000f),true, + { // beginning signals vector {std::make_shared<signal_t> (signal_t{ - "engine.oil.temp", - 16, - 8, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + "engine.oil.temp",// generic_name + 16,// bit_position + 8,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + nullptr,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "" // unit })}, {std::make_shared<signal_t> (signal_t{ - "engine.oil.temp.high", - 7, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + "engine.oil.temp.high",// generic_name + 7,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "" // unit })} - } // end can_signals vector - })} // end can_message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{ - "hs", - 0x5D1, - false, - message_format_t::STANDARD, - frequency_clock_t(5.00000f), - true, - { // beginning can_signals vector + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x620,0,message_format_t::STANDARD,frequency_clock_t(5.00000f),true, + { // beginning signals vector {std::make_shared<signal_t> (signal_t{ - "accelerator.pedal.position", - 16, - 8, - 0.500000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + "doors.boot.open",// generic_name + 47,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "" // unit })}, {std::make_shared<signal_t> (signal_t{ - "steering.wheel.angle", - 4, - 12, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + "doors.front_left.open",// generic_name + 43,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false - })} - } // end can_signals vector - })} // end can_message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{ - "hs", - 0x5D2, - false, - message_format_t::STANDARD, - frequency_clock_t(5.00000f), - true, - { // beginning can_signals vector - {std::make_shared<signal_t> (signal_t{ - "transmission.gearinfo", - 20, - 4, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, - { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "" // unit })}, {std::make_shared<signal_t> (signal_t{ - "transmission.mode", - 16, - 4, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, - { - }, - false, - nullptr, - nullptr, - false - })} - } // end can_signals vector - })} // end can_message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{ - "hs", - 0x5D3, - false, - message_format_t::STANDARD, - frequency_clock_t(5.00000f), - true, - { // beginning can_signals vector - {std::make_shared<signal_t> (signal_t{ - "turnsignal.status", - 26, - 3, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + "doors.front_right.open",// generic_name + 44,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - nullptr, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "" // unit })}, {std::make_shared<signal_t> (signal_t{ - "lightstatus.brake", - 7, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + "doors.rear_left.open",// generic_name + 46,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "" // unit })}, {std::make_shared<signal_t> (signal_t{ - "parking.brake.status", - 8, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + "doors.rear_right.open",// generic_name + 45,// bit_position + 4,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "" // unit })} - } // end can_signals vector - })} // end can_message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{ - "hs", - 0x620, - false, - message_format_t::STANDARD, - frequency_clock_t(5.00000f), - true, - { // beginning can_signals vector + } // end signals vector + })} // end message_definition entry +, {std::make_shared<message_definition_t>(message_definition_t{"hs",0x799,0,message_format_t::STANDARD,frequency_clock_t(5.00000f),true, + { // beginning signals vector {std::make_shared<signal_t> (signal_t{ - "doors.boot.open", - 47, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + "windows.front_left.open",// generic_name + 43,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "" // unit })}, {std::make_shared<signal_t> (signal_t{ - "doors.front_left.open", - 43, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + "windows.front_right.open",// generic_name + 44,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "" // unit })}, {std::make_shared<signal_t> (signal_t{ - "doors.front_right.open", - 44, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + "windows.rear_left.open",// generic_name + 46,// bit_position + 1,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "" // unit })}, {std::make_shared<signal_t> (signal_t{ - "doors.rear_left.open", - 46, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, + "windows.rear_right.open",// generic_name + 45,// bit_position + 4,// bit_size + 1.00000f,// factor + 0.00000,// offset + 0,// min_value + 0,// max_value + frequency_clock_t(0.00000f),// frequency + true,// send_same + false,// force_send_changed { - }, - false, - decoder_t::decode_boolean, - nullptr, - false - })}, - {std::make_shared<signal_t> (signal_t{ - "doors.rear_right.open", - 45, - 4, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, - { - }, - false, - decoder_t::decode_boolean, - nullptr, - false + },// states + false,// writable + decoder_t::decode_boolean,// decoder + nullptr,// encoder + false,// received + std::make_pair<bool, int>(false, 0),// multiplex + 0,// is_big_endian + 0,// is_signed + "" // unit })} - } // end can_signals vector - })} // end can_message_definition entry -, {std::make_shared<message_definition_t>(message_definition_t{ - "hs", - 0x799, - false, - message_format_t::STANDARD, - frequency_clock_t(5.00000f), - true, - { // beginning can_signals vector - {std::make_shared<signal_t> (signal_t{ - "windows.front_left.open", - 43, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, - { - }, - false, - decoder_t::decode_boolean, - nullptr, - false - })}, - {std::make_shared<signal_t> (signal_t{ - "windows.front_right.open", - 44, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, - { - }, - false, - decoder_t::decode_boolean, - nullptr, - false - })}, - {std::make_shared<signal_t> (signal_t{ - "windows.rear_left.open", - 46, - 1, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, - { - }, - false, - decoder_t::decode_boolean, - nullptr, - false - })}, - {std::make_shared<signal_t> (signal_t{ - "windows.rear_right.open", - 45, - 4, - 1.00000f, - 0.00000, - 0, - 0, - frequency_clock_t(0.00000f), - true, - false, - { - }, - false, - decoder_t::decode_boolean, - nullptr, - false - })} - } // end can_signals vector - })} // end can_message_definition entry + } // end signals vector + })} // end message_definition entry - }, // end can_message_definition vector + }, // end message_definition vector { // beginning diagnostic_messages_ vector {std::make_shared<diagnostic_message_t>(diagnostic_message_t{ 4, @@ -822,24 +706,24 @@ application_t::application_t() })} } // end diagnostic_messages_ vector - })} // end can_message_set entry - } // end can_message_set vector + })} // end message_set entry + } // end message_set vector { - for(auto& cms: message_set_) + for(std::shared_ptr<message_set_t> cms: message_set_) { - std::vector<std::shared_ptr<message_definition_t> >& can_messages_definition = cms->get_messages_definition(); - for(auto& cmd : can_messages_definition) + 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> >& can_signals = cmd->get_signals(); - for(auto& sig: can_signals) + 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(auto& dm : diagnostic_messages) + 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); } @@ -850,5 +734,3 @@ const std::string application_t::get_diagnostic_bus() const { return "hs"; } - - |