#include <cstdint>
#include <linux/can.h>
-#include "utils/timer.hpp"
+#include "../utils/timer.hpp"
+#include "can-message-set.hpp"
#define CAN_MESSAGE_SIZE 8
static can_message_t convert_from_canfd_frame(const struct canfd_frame& frame, size_t nbytes);
canfd_frame convert_to_canfd_frame();
};
-
-/**
- * @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.
- */
-class can_message_definition_t
-{
- private:
- can_bus_dev_t& bus_; /*!< bus_ - A pointer to the bus this message is on. */
- uint32_t id_; /*!< id_ - The ID of the message.*/
- can_message_format_t format_; /*!< format_ - the format of the message's ID.*/
- frequency_clock_t 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 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.*/
- std::vector<uint8_t> 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(can_bus_dev_t& cbd);
- uint32_t get_id() const;
-};
-
-/**
- * @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).
- */
-class can_message_set_t
-{
- private:
- uint8_t index_; /*!<index_ - A numerical ID for the message set, ideally the index in an array
- * for fast lookup*/
- const std::string name_; /*!< name_ - The name of the message set.*/
- uint8_t can_bus_count_; /*!< can_bus_count_ - The number of CAN buses defined for this message set.*/
- unsigned short can_message_count_; /*!< can_message_count_ - The number of CAN messages (across all buses) defined for
- * this message set.*/
- unsigned short can_signal_count_; /*!< can_signal_count_ - The number of CAN signals (across all messages) defined for
- * this message set.*/
- unsigned short can_command_count_; /*!< can_command_count_ - The number of CanCommmands defined for this message set.*/
- unsigned short obd2_signal_count_; /*!< obd2_signal_count_ - The number of obd2 signals defined for this message set.*/
-};
-
-/** Public: Retrive a list of all possible CAN configurations.
- *
- * Returns a pointer to an array of all configurations.
- */
-can_message_set_t* getMessageSets();
-
-/** Public: Return the length of the array returned by getMessageSets() */
-int getMessageSetCount();
-
-/* Public: Return an array of all CAN messages to be processed in the active
- * configuration.
- */
-can_message_definition_t* getMessages();
-
-/* Public: Return the length of the array returned by getMessages(). */
-int getMessageCount();
\ No newline at end of file