From fee3b49099fb39731e15f9e26ad5a873bc109f59 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Tue, 26 Nov 2019 16:19:35 +0100 Subject: Replace all enum types with masks This commit allows to change all enum types by masks. Now to implement new protocol you don't need to add more attribute in class. All can be contained in the flags field. Bug-AGL : SPEC-2779 Bug-AGL: SPEC-2976 Change-Id: I814d0052139be5d5efefc9ff1b4b558f46b85e90 Signed-off-by: Arthur Guyader Signed-off-by: Romain Forlot --- examples/agl-vcar/application-generated.cpp | 42 ++++++++++++++--------------- examples/agl-vcar/signals.json | 32 ++++++++++++++++++---- 2 files changed, 48 insertions(+), 26 deletions(-) (limited to 'examples/agl-vcar') diff --git a/examples/agl-vcar/application-generated.cpp b/examples/agl-vcar/application-generated.cpp index 35d847b7..bfe3d861 100644 --- a/examples/agl-vcar/application-generated.cpp +++ b/examples/agl-vcar/application-generated.cpp @@ -7,7 +7,7 @@ application_t::application_t() , message_set_{ {std::make_shared(message_set_t{0,"AGL Virtual Car", { // beginning message_definition_ vector - {std::make_shared(message_definition_t{"ls",0x30,"",0,false,message_format_t::EXTENDED,frequency_clock_t(5.00000f),true, + {std::make_shared(message_definition_t{"ls",0x30,"",8,4,frequency_clock_t(5.00000f),true, { // beginning signals vector {std::make_shared (signal_t{ "hvac.fan.speed",// generic_name @@ -22,7 +22,7 @@ application_t::application_t() false,// force_send_changed { },// states - false,// writable + true,// writable nullptr,// decoder nullptr,// encoder false,// received @@ -99,7 +99,7 @@ application_t::application_t() })} } // end signals vector })} // end message_definition entry -, {std::make_shared(message_definition_t{"hs",0x3D9,"",0,true,message_format_t::STANDARD,frequency_clock_t(5.00000f),true, +, {std::make_shared(message_definition_t{"hs",0x3D9,"",8,2050,frequency_clock_t(5.00000f),true, { // beginning signals vector {std::make_shared (signal_t{ "engine.speed",// generic_name @@ -114,7 +114,7 @@ application_t::application_t() false,// force_send_changed { },// states - false,// writable + true,// writable nullptr,// decoder nullptr,// encoder false,// received @@ -136,7 +136,7 @@ application_t::application_t() false,// force_send_changed { },// states - false,// writable + true,// writable decoder_t::decode_boolean,// decoder nullptr,// encoder false,// received @@ -158,7 +158,7 @@ application_t::application_t() false,// force_send_changed { },// states - false,// writable + true,// writable nullptr,// decoder nullptr,// encoder false,// received @@ -169,7 +169,7 @@ application_t::application_t() })} } // end signals vector })} // end message_definition entry -, {std::make_shared(message_definition_t{"hs",0x3E9,"",0,false,message_format_t::STANDARD,frequency_clock_t(5.00000f),true, +, {std::make_shared(message_definition_t{"hs",0x3E9,"",8,2,frequency_clock_t(5.00000f),true, { // beginning signals vector {std::make_shared (signal_t{ "vehicle.average.speed",// generic_name @@ -195,7 +195,7 @@ application_t::application_t() })} } // end signals vector })} // end message_definition entry -, {std::make_shared(message_definition_t{"hs",0x4D1,"",0,false,message_format_t::STANDARD,frequency_clock_t(5.00000f),true, +, {std::make_shared(message_definition_t{"hs",0x4D1,"",8,2,frequency_clock_t(5.00000f),true, { // beginning signals vector {std::make_shared (signal_t{ "engine.oil.temp",// generic_name @@ -210,7 +210,7 @@ application_t::application_t() false,// force_send_changed { },// states - false,// writable + true,// writable nullptr,// decoder nullptr,// encoder false,// received @@ -232,7 +232,7 @@ application_t::application_t() false,// force_send_changed { },// states - false,// writable + true,// writable decoder_t::decode_boolean,// decoder nullptr,// encoder false,// received @@ -243,7 +243,7 @@ application_t::application_t() })} } // end signals vector })} // end message_definition entry -, {std::make_shared(message_definition_t{"hs",0x620,"",0,false,message_format_t::STANDARD,frequency_clock_t(5.00000f),true, +, {std::make_shared(message_definition_t{"hs",0x620,"",8,2,frequency_clock_t(5.00000f),true, { // beginning signals vector {std::make_shared (signal_t{ "doors.boot.open",// generic_name @@ -258,7 +258,7 @@ application_t::application_t() false,// force_send_changed { },// states - false,// writable + true,// writable decoder_t::decode_boolean,// decoder nullptr,// encoder false,// received @@ -280,7 +280,7 @@ application_t::application_t() false,// force_send_changed { },// states - false,// writable + true,// writable decoder_t::decode_boolean,// decoder nullptr,// encoder false,// received @@ -302,7 +302,7 @@ application_t::application_t() false,// force_send_changed { },// states - false,// writable + true,// writable decoder_t::decode_boolean,// decoder nullptr,// encoder false,// received @@ -324,7 +324,7 @@ application_t::application_t() false,// force_send_changed { },// states - false,// writable + true,// writable decoder_t::decode_boolean,// decoder nullptr,// encoder false,// received @@ -346,7 +346,7 @@ application_t::application_t() false,// force_send_changed { },// states - false,// writable + true,// writable decoder_t::decode_boolean,// decoder nullptr,// encoder false,// received @@ -357,7 +357,7 @@ application_t::application_t() })} } // end signals vector })} // end message_definition entry -, {std::make_shared(message_definition_t{"hs",0x799,"",0,false,message_format_t::STANDARD,frequency_clock_t(5.00000f),true, +, {std::make_shared(message_definition_t{"hs",0x799,"",8,2,frequency_clock_t(5.00000f),true, { // beginning signals vector {std::make_shared (signal_t{ "windows.front_left.open",// generic_name @@ -372,7 +372,7 @@ application_t::application_t() false,// force_send_changed { },// states - false,// writable + true,// writable decoder_t::decode_boolean,// decoder nullptr,// encoder false,// received @@ -394,7 +394,7 @@ application_t::application_t() false,// force_send_changed { },// states - false,// writable + true,// writable decoder_t::decode_boolean,// decoder nullptr,// encoder false,// received @@ -416,7 +416,7 @@ application_t::application_t() false,// force_send_changed { },// states - false,// writable + true,// writable decoder_t::decode_boolean,// decoder nullptr,// encoder false,// received @@ -438,7 +438,7 @@ application_t::application_t() false,// force_send_changed { },// states - false,// writable + true,// writable decoder_t::decode_boolean,// decoder nullptr,// encoder false,// received diff --git a/examples/agl-vcar/signals.json b/examples/agl-vcar/signals.json index 679ab68e..ecf635ca 100644 --- a/examples/agl-vcar/signals.json +++ b/examples/agl-vcar/signals.json @@ -10,6 +10,7 @@ "is_fd" : false, "is_extended": false, "is_j1939" : false, + "length" : 8, "signals": { "doors.driver.open": { "generic_name": "doors.front_left.open", @@ -17,6 +18,7 @@ "bit_size": 1, "factor": 1.0, "offset": 0, + "writable": true, "decoder": "decoder_t::decode_boolean"}, "doors.passenger.open": { "generic_name": "doors.front_right.open", @@ -24,6 +26,7 @@ "bit_size": 1, "factor": 1.0, "offset": 0, + "writable": true, "decoder": "decoder_t::decode_boolean"}, "doors.rearleft.open": { "generic_name": "doors.rear_left.open", @@ -31,6 +34,7 @@ "bit_size": 1, "factor": 1.0, "offset": 0, + "writable": true, "decoder": "decoder_t::decode_boolean"}, "doors.rearright.open": { "generic_name": "doors.rear_right.open", @@ -38,6 +42,7 @@ "bit_size": 4, "factor": 1.0, "offset": 0, + "writable": true, "decoder": "decoder_t::decode_boolean"}, "doors.coffer.open": { "generic_name": "doors.boot.open", @@ -45,6 +50,7 @@ "bit_size": 1, "factor": 1.0, "offset": 0, + "writable": true, "decoder": "decoder_t::decode_boolean"} } }, @@ -53,6 +59,7 @@ "is_fd" : false, "is_extended": false, "is_j1939" : false, + "length" : 8, "signals": { "windows.driver.open": { "generic_name": "windows.front_left.open", @@ -60,6 +67,7 @@ "bit_size": 1, "factor": 1.0, "offset": 0, + "writable": true, "decoder": "decoder_t::decode_boolean"}, "windows.passenger.open": { "generic_name": "windows.front_right.open", @@ -67,6 +75,7 @@ "bit_size": 1, "factor": 1.0, "offset": 0, + "writable": true, "decoder": "decoder_t::decode_boolean"}, "windows.rearleft.open": { "generic_name": "windows.rear_left.open", @@ -74,6 +83,7 @@ "bit_size": 1, "factor": 1.0, "offset": 0, + "writable": true, "decoder": "decoder_t::decode_boolean"}, "windows.rearright.open": { "generic_name": "windows.rear_right.open", @@ -81,6 +91,7 @@ "bit_size": 4, "factor": 1.0, "offset": 0, + "writable": true, "decoder": "decoder_t::decode_boolean"} } }, @@ -89,20 +100,23 @@ "is_fd" : true, "is_extended": false, "is_j1939" : false, + "length" : 8, "signals": { "PT_FuelLevelPct": { "generic_name": "fuel.level", "bit_position": 8, "bit_size": 8, "factor": 0.392157, - "offset": 0 + "offset": 0, + "writable": true }, "PT_EngineSpeed": { "generic_name": "engine.speed", "bit_position": 16, "bit_size": 16, "factor": 0.25, - "offset": 0 + "offset": 0, + "writable": true }, "PT_FuelLevelLow": { "generic_name": "fuel.level.low", @@ -110,6 +124,7 @@ "bit_size": 1, "factor": 1, "offset": 0, + "writable": true, "decoder": "decoder_t::decode_boolean" } } @@ -119,6 +134,7 @@ "is_fd" : false, "is_extended": false, "is_j1939" : false, + "length" : 8, "signals": { "PT_EngineOilTempHigh": { "generic_name": "engine.oil.temp.high", @@ -126,6 +142,7 @@ "bit_size": 1, "factor": 1, "offset": 0, + "writable": true, "decoder": "decoder_t::decode_boolean" }, "PT_EngineOilTemp": { @@ -133,7 +150,8 @@ "bit_position": 16, "bit_size": 8, "factor": 1, - "offset": 0 + "offset": 0, + "writable": true } } }, @@ -142,13 +160,15 @@ "is_fd" : false, "is_extended": false, "is_j1939" : false, + "length" : 8, "signals": { "PT_VehicleAvgSpeed": { "generic_name": "vehicle.average.speed", "bit_position": 0, "bit_size": 15, "factor": 0.015625, - "offset": 0 + "offset": 0, + "writable": false } } }, @@ -157,6 +177,7 @@ "is_fd" : false, "is_extended": true, "is_j1939" : false, + "length" : 8, "signals": { "LeftTemperature": { "generic_name": "hvac.temperature.left", @@ -187,7 +208,8 @@ "bit_position": 32, "bit_size": 8, "factor": 23.529411765, - "offset": 0 + "offset": 0, + "writable": true } } } -- cgit 1.2.3-korg