From: Romain Forlot Date: Wed, 8 Mar 2017 20:58:46 +0000 (+0100) Subject: Clean old C struct, now as C++ class X-Git-Tag: 3.99.1~356 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=6546d8b0438b7f483b43ed35c957c979723305bf;p=apps%2Flow-level-can-service.git Clean old C struct, now as C++ class Change-Id: Iba4c4a47b140c53d766c348064857069feefdb19 Signed-off-by: Romain Forlot --- diff --git a/src/can/can-message.cpp b/src/can/can-message.cpp index eec19d9..5409373 100644 --- a/src/can/can-message.cpp +++ b/src/can/can-message.cpp @@ -245,3 +245,19 @@ canfd_frame can_message_t::convert_to_canfd_frame() return frame; } + +/******************************************************************************** +* +* can_message_definition_t method implementation +* +*********************************************************************************/ + +can_message_definition_t::can_message_definition_t() + : last_value_(CAN_MESSAGE_SIZE) +{} + +uint32_t get_id() const +{ + return id_; +} +} diff --git a/src/can/can-message.hpp b/src/can/can-message.hpp index 5d45b98..a458126 100644 --- a/src/can/can-message.hpp +++ b/src/can/can-message.hpp @@ -37,18 +37,6 @@ class enum CanMessageFormat { ERROR, /*!< ERROR - ERROR code used at initialization to signify that it isn't usable'*/ }; -/************************* - * old CanMessage struct * - ************************* -struct CanMessage { - uint32_t id; - CanMessageFormat format; - uint8_t data[CAN_MESSAGE_SIZE]; - uint8_t length; -}; -typedef struct CanMessage CanMessage; -*/ - /** * @class can_message_t * @@ -85,27 +73,12 @@ class can_message_t { }; /** - * @struct CanMessageDefinition + * @class can_message_definition_t * * @brief The definition of a CAN message. This includes a lot of metadata, so * to save memory this struct should not be used for storing incoming and * outgoing CAN messages. */ -struct CanMessageDefinition { - //can_bus_dev_t bus; /*!< bus - A pointer to the bus this message is on. */ - uint32_t id; /*!< id - The ID of the message.*/ - CanMessageFormat format; /*!< format - the format of the message's ID.*/ - FrequencyClock frequencyClock; /*!< clock - an optional frequency clock to control the output of this - * message, if sent raw, or simply to mark the max frequency for custom - * handlers to retriec++ if ? syntaxve.*/ - bool forceSendChanged; /*!< forceSendChanged - If true, regardless of the frequency, it will send CAN - * message if it has changed when using raw passthrough.*/ - uint8_t lastValue[CAN_MESSAGE_SIZE]; /*!< lastValue - The last received value of the message. Defaults to undefined. - * This is required for the forceSendChanged functionality, as the stack - * needs to compare an incoming CAN message with the previous frame.*/ -}; -typedef struct CanMessageDefinition CanMessageDefinition; - class can_message_definition_t { private: @@ -113,36 +86,25 @@ class can_message_definition_t uint32_t id_; /*!< id_ - The ID of the message.*/ CanMessageFormat format_; /*!< format_ - the format of the message's ID.*/ FrequencyClock clock_; /*!< clock_ - an optional frequency clock to control the output of this - * message, if sent raw, or simply to mark the max frequency for custom - * handlers to retriec++ if ? syntaxve.*/ + * message, if sent raw, or simply to mark the max frequency for custom + * handlers to retrieve.*/ bool force_send_changed_; /*!< force_send_changed_ - If true, regardless of the frequency, it will send CAN * message if it has changed when using raw passthrough.*/ - uint8_t last_value_[CAN_MESSAGE_SIZE]; /*!< last_value_ - The last received value of the message. Defaults to undefined. + std::vector last_value_; /*!< last_value_ - The last received value of the message. Defaults to undefined. * This is required for the forceSendChanged functionality, as the stack * needs to compare an incoming CAN message with the previous frame.*/ public: + can_message_definition_t(); uint32_t get_id() const; }; /** - * @struct CanMessageSet + * @class can_message_set_t * * @brief A parent wrapper for a particular set of CAN messages and associated * CAN buses(e.g. a vehicle or program). */ - typedef struct { - uint8_t index; /*!