summaryrefslogtreecommitdiffstats
path: root/low-can-binding/binding/application.cpp
diff options
context:
space:
mode:
authorArthur Guyader <arthur.guyader@iot.bzh>2019-05-24 12:16:57 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2019-06-26 18:06:54 +0200
commit0ccfb70f9122ea73ff198f3000cf11be12bcc9d2 (patch)
treee184d62322c7322ff7892ca5a09ca8af827c6bda /low-can-binding/binding/application.cpp
parent2f60d294b3fa4e243fa67a738f9b82a0b428a7fc (diff)
Add the possibility to subscribe an id or a pgn
The commit allows at the time of subscription to do: -> low-can subscribe {"id": 48} -> low-can subscribe {"pgn": 61442} The generation of event_filter has been extracted in a separate function. Bug-AGL: SPEC-2386 Change-Id: I592e668c63be448562b27c81fcdc111cd34f3676 Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh> Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'low-can-binding/binding/application.cpp')
-rw-r--r--low-can-binding/binding/application.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/low-can-binding/binding/application.cpp b/low-can-binding/binding/application.cpp
index 5e0a6537..f0f008c5 100644
--- a/low-can-binding/binding/application.cpp
+++ b/low-can-binding/binding/application.cpp
@@ -62,7 +62,7 @@ std::vector<std::shared_ptr<signal_t> > application_t::get_all_signals()
return message_set_[active_message_set_]->get_all_signals();
}
-std::vector<std::shared_ptr<diagnostic_message_t> > application_t::get_diagnostic_messages()
+std::vector<std::shared_ptr<diagnostic_message_t>> application_t::get_diagnostic_messages()
{
return message_set_[active_message_set_]->get_diagnostic_messages();
}
@@ -72,6 +72,23 @@ std::vector<std::shared_ptr<message_definition_t>> application_t::get_messages_d
return message_set_[active_message_set_]->get_messages_definition();
}
+
+std::shared_ptr<message_definition_t> application_t::get_message_definition(uint32_t id)
+{
+ std::shared_ptr<message_definition_t> ret = nullptr;
+ std::vector<std::shared_ptr<message_definition_t>> messages_definition = get_messages_definition();
+ for(std::shared_ptr<message_definition_t> &msg_def : messages_definition)
+ {
+ if(msg_def->get_id() == id)
+ {
+ ret = msg_def;
+ break;
+ }
+ }
+ return ret;
+}
+
+
uint32_t application_t::get_signal_id(diagnostic_message_t& sig) const
{
return sig.get_pid();