From d253ada94487232ccd33b68a69fd44ff7840fab7 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Wed, 10 May 2017 18:39:25 +0200 Subject: Use a tree instead of separated object lists. WIP Now we respect JSON description file, which is can_message_set contains can_message_definition which contains can_signals. Diagnostic messages aren't processed for now. Change-Id: I94aaf5eded14dd84395bd4fd749df58dee5f533e Signed-off-by: Romain Forlot --- CAN-binder/low-can-binding/can/can-message-set.cpp | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'CAN-binder/low-can-binding/can/can-message-set.cpp') diff --git a/CAN-binder/low-can-binding/can/can-message-set.cpp b/CAN-binder/low-can-binding/can/can-message-set.cpp index a9f8cf23..1877f3a2 100644 --- a/CAN-binder/low-can-binding/can/can-message-set.cpp +++ b/CAN-binder/low-can-binding/can/can-message-set.cpp @@ -25,7 +25,8 @@ can_message_set_t::can_message_set_t( unsigned short can_message_count, unsigned short can_signal_count, unsigned short can_command_count, - unsigned short obd2_signal_count) + unsigned short obd2_signal_count, + std::vector > can_messages_definition) : index_{index} , name_{name} , can_bus_count_{can_bus_count} @@ -33,5 +34,30 @@ can_message_set_t::can_message_set_t( , can_signal_count_{can_signal_count} , can_command_count_{can_command_count} , obd2_signal_count_{obd2_signal_count} + , can_messages_definition_{can_messages_definition} { + for(auto& cmd : can_messages_definition_) + { + cmd->set_parent(std::make_shared(this)); + } } + +/// @brief Return vector holding all message definition handled by this message set. +std::vector > can_message_set_t::get_can_message_definition() +{ + return can_messages_definition_; +} + +std::vector > can_message_set_t::get_can_signals() const +{ + std::vector > can_signals(can_signal_count_); + for(const auto& cmd: can_messages_definition_) + { + can_signals.insert( can_signals.end(), + cmd->get_can_signals().begin(), + cmd->get_can_signals().end() + ); + } + + return can_signals; +} \ No newline at end of file -- cgit 1.2.3-korg