X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=CAN-binder%2Flow-can-binding%2Fcan%2Fcan-message-set.cpp;h=46dc448ad8f9c8c2ade9de7216b2debeaa6f61e0;hb=22d0b16875926bdb0a39aa44de2bdde57825127c;hp=a9f8cf23f1259b8c54dbe80bf0bd1ba33e086300;hpb=f44a5b1549bc4c8a84d0dedf4a8b1e4220a34f42;p=apps%2Flow-level-can-service.git 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 a9f8cf2..46dc448 100644 --- a/CAN-binder/low-can-binding/can/can-message-set.cpp +++ b/CAN-binder/low-can-binding/can/can-message-set.cpp @@ -21,17 +21,34 @@ can_message_set_t::can_message_set_t( uint8_t index, const std::string& name, - uint8_t can_bus_count, - unsigned short can_message_count, - unsigned short can_signal_count, - unsigned short can_command_count, - unsigned short obd2_signal_count) + std::vector > can_messages_definition) : index_{index} , name_{name} - , can_bus_count_{can_bus_count} - , can_message_count_{can_message_count} - , 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; + for(const auto& cmd: can_messages_definition_) + { + std::vector > cmd_signals = cmd->get_can_signals(); + can_signals.insert( can_signals.end(), + cmd_signals.begin(), + cmd_signals.end() + ); + } + + return can_signals; +} \ No newline at end of file