aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/agl-signals.cpp
diff options
context:
space:
mode:
authorClément Bénier <clement.benier@iot.bzh>2019-11-15 11:20:34 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2020-01-09 14:40:41 +0100
commit6cc152447e74b1ce7fab6c7aa1f9b4e5e8232444 (patch)
tree2e4f9dd31136abd18e5c1c52c8bf2a0ec8921331 /plugins/agl-signals.cpp
parent03a4775eefeeba913f69d331e3930700a567c4c5 (diff)
sign: handle decode methods sign from can value
- add enumeration that represents the way of encoding: enum sign_t { UNSIGNED = 0, SIGN_BIT = 1, ONES_COMPLEMENT = 2, TWOS_COMPLEMENT = 3, SIGN_BIT_EXTERN = 4 }; - the function handle_sign allows to transform value if negative and return the sign of the value in order to be multiplied at the end ot the parcing Bug-AGL: SPEC-3021 Change-Id: I5766a286488170d930422474b4c4f3a8578ca726 Signed-off-by: Clément Bénier <clement.benier@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'plugins/agl-signals.cpp')
-rw-r--r--plugins/agl-signals.cpp61
1 files changed, 40 insertions, 21 deletions
diff --git a/plugins/agl-signals.cpp b/plugins/agl-signals.cpp
index e02b61ff..5f00e290 100644
--- a/plugins/agl-signals.cpp
+++ b/plugins/agl-signals.cpp
@@ -12,7 +12,7 @@ CTLP_LUA_REGISTER("TO-EDIT");
std::shared_ptr<message_set_t> 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, 0 ,false, frequency_clock_t(5.00000f), true,
+ {std::make_shared<message_definition_t>(message_definition_t{"ls", 0x30,"", 0, 0, false, frequency_clock_t(5.00000f), true,
{ // beginning signals vector
{std::make_shared<signal_t> (signal_t{
"hvac.fan.speed",// generic_name
@@ -33,7 +33,8 @@ std::shared_ptr<message_set_t> message_set =
false,// received
std::make_pair<bool, int>(false, 0),// multiplex
0,// is_big_endian
- 0,// is_signed
+ static_cast<sign_t>(0),// signed
+ -1,// bit_sign_position
""// unit
})},
{std::make_shared<signal_t> (signal_t{
@@ -55,7 +56,8 @@ std::shared_ptr<message_set_t> message_set =
false,// received
std::make_pair<bool, int>(false, 0),// multiplex
0,// is_big_endian
- 0,// is_signed
+ static_cast<sign_t>(0),// signed
+ -1,// bit_sign_position
""// unit
})},
{std::make_shared<signal_t> (signal_t{
@@ -77,7 +79,8 @@ std::shared_ptr<message_set_t> message_set =
false,// received
std::make_pair<bool, int>(false, 0),// multiplex
0,// is_big_endian
- 0,// is_signed
+ static_cast<sign_t>(0),// signed
+ -1,// bit_sign_position
""// unit
})},
{std::make_shared<signal_t> (signal_t{
@@ -99,7 +102,8 @@ std::shared_ptr<message_set_t> message_set =
false,// received
std::make_pair<bool, int>(false, 0),// multiplex
0,// is_big_endian
- 0,// is_signed
+ static_cast<sign_t>(0),// signed
+ -1,// bit_sign_position
""// unit
})}
} // end signals vector
@@ -125,7 +129,8 @@ std::shared_ptr<message_set_t> message_set =
false,// received
std::make_pair<bool, int>(false, 0),// multiplex
0,// is_big_endian
- 0,// is_signed
+ static_cast<sign_t>(0),// signed
+ -1,// bit_sign_position
""// unit
})},
{std::make_shared<signal_t> (signal_t{
@@ -147,7 +152,8 @@ std::shared_ptr<message_set_t> message_set =
false,// received
std::make_pair<bool, int>(false, 0),// multiplex
0,// is_big_endian
- 0,// is_signed
+ static_cast<sign_t>(0),// signed
+ -1,// bit_sign_position
""// unit
})},
{std::make_shared<signal_t> (signal_t{
@@ -169,12 +175,13 @@ std::shared_ptr<message_set_t> message_set =
false,// received
std::make_pair<bool, int>(false, 0),// multiplex
0,// is_big_endian
- 0,// is_signed
+ static_cast<sign_t>(0),// signed
+ -1,// bit_sign_position
""// unit
})}
} // end signals vector
})} // end message_definition entry
-, {std::make_shared<message_definition_t>(message_definition_t{"hs", 0x3E9,"", 0, 0,false, frequency_clock_t(5.00000f), true,
+, {std::make_shared<message_definition_t>(message_definition_t{"hs", 0x3E9,"", 0, 0, false, frequency_clock_t(5.00000f), true,
{ // beginning signals vector
{std::make_shared<signal_t> (signal_t{
"vehicle.average.speed",// generic_name
@@ -195,7 +202,8 @@ std::shared_ptr<message_set_t> message_set =
false,// received
std::make_pair<bool, int>(false, 0),// multiplex
0,// is_big_endian
- 0,// is_signed
+ static_cast<sign_t>(0),// signed
+ -1,// bit_sign_position
""// unit
})}
} // end signals vector
@@ -221,7 +229,8 @@ std::shared_ptr<message_set_t> message_set =
false,// received
std::make_pair<bool, int>(false, 0),// multiplex
0,// is_big_endian
- 0,// is_signed
+ static_cast<sign_t>(0),// signed
+ -1,// bit_sign_position
""// unit
})},
{std::make_shared<signal_t> (signal_t{
@@ -243,7 +252,8 @@ std::shared_ptr<message_set_t> message_set =
false,// received
std::make_pair<bool, int>(false, 0),// multiplex
0,// is_big_endian
- 0,// is_signed
+ static_cast<sign_t>(0),// signed
+ -1,// bit_sign_position
""// unit
})}
} // end signals vector
@@ -269,7 +279,8 @@ std::shared_ptr<message_set_t> message_set =
false,// received
std::make_pair<bool, int>(false, 0),// multiplex
0,// is_big_endian
- 0,// is_signed
+ static_cast<sign_t>(0),// signed
+ -1,// bit_sign_position
""// unit
})},
{std::make_shared<signal_t> (signal_t{
@@ -291,7 +302,8 @@ std::shared_ptr<message_set_t> message_set =
false,// received
std::make_pair<bool, int>(false, 0),// multiplex
0,// is_big_endian
- 0,// is_signed
+ static_cast<sign_t>(0),// signed
+ -1,// bit_sign_position
""// unit
})},
{std::make_shared<signal_t> (signal_t{
@@ -313,7 +325,8 @@ std::shared_ptr<message_set_t> message_set =
false,// received
std::make_pair<bool, int>(false, 0),// multiplex
0,// is_big_endian
- 0,// is_signed
+ static_cast<sign_t>(0),// signed
+ -1,// bit_sign_position
""// unit
})},
{std::make_shared<signal_t> (signal_t{
@@ -335,7 +348,8 @@ std::shared_ptr<message_set_t> message_set =
false,// received
std::make_pair<bool, int>(false, 0),// multiplex
0,// is_big_endian
- 0,// is_signed
+ static_cast<sign_t>(0),// signed
+ -1,// bit_sign_position
""// unit
})},
{std::make_shared<signal_t> (signal_t{
@@ -357,7 +371,8 @@ std::shared_ptr<message_set_t> message_set =
false,// received
std::make_pair<bool, int>(false, 0),// multiplex
0,// is_big_endian
- 0,// is_signed
+ static_cast<sign_t>(0),// signed
+ -1,// bit_sign_position
""// unit
})}
} // end signals vector
@@ -383,7 +398,8 @@ std::shared_ptr<message_set_t> message_set =
false,// received
std::make_pair<bool, int>(false, 0),// multiplex
0,// is_big_endian
- 0,// is_signed
+ static_cast<sign_t>(0),// signed
+ -1,// bit_sign_position
""// unit
})},
{std::make_shared<signal_t> (signal_t{
@@ -405,7 +421,8 @@ std::shared_ptr<message_set_t> message_set =
false,// received
std::make_pair<bool, int>(false, 0),// multiplex
0,// is_big_endian
- 0,// is_signed
+ static_cast<sign_t>(0),// signed
+ -1,// bit_sign_position
""// unit
})},
{std::make_shared<signal_t> (signal_t{
@@ -427,7 +444,8 @@ std::shared_ptr<message_set_t> message_set =
false,// received
std::make_pair<bool, int>(false, 0),// multiplex
0,// is_big_endian
- 0,// is_signed
+ static_cast<sign_t>(0),// signed
+ -1,// bit_sign_position
""// unit
})},
{std::make_shared<signal_t> (signal_t{
@@ -449,7 +467,8 @@ std::shared_ptr<message_set_t> message_set =
false,// received
std::make_pair<bool, int>(false, 0),// multiplex
0,// is_big_endian
- 0,// is_signed
+ static_cast<sign_t>(0),// signed
+ -1,// bit_sign_position
""// unit
})}
} // end signals vector