From 0ccfb70f9122ea73ff198f3000cf11be12bcc9d2 Mon Sep 17 00:00:00 2001 From: Arthur Guyader Date: Fri, 24 May 2019 12:16:57 +0200 Subject: 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 Signed-off-by: Stephane Desneux Signed-off-by: Romain Forlot --- low-can-binding/binding/application.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'low-can-binding/binding/application.cpp') 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 > application_t::get_all_signals() return message_set_[active_message_set_]->get_all_signals(); } -std::vector > application_t::get_diagnostic_messages() +std::vector> application_t::get_diagnostic_messages() { return message_set_[active_message_set_]->get_diagnostic_messages(); } @@ -72,6 +72,23 @@ std::vector> application_t::get_messages_d return message_set_[active_message_set_]->get_messages_definition(); } + +std::shared_ptr application_t::get_message_definition(uint32_t id) +{ + std::shared_ptr ret = nullptr; + std::vector> messages_definition = get_messages_definition(); + for(std::shared_ptr &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(); -- cgit 1.2.3-korg