Class FilteredCanInterface

Inheritance Relationships

Base Type

Derived Types

Class Documentation

class FilteredCanInterface : public hi_can::CanInterface

Inheritance diagram for hi_can::FilteredCanInterface:

Collaboration diagram for hi_can::FilteredCanInterface:

A variant of CanInterface which contains a whitelist of filters. In the event that there are no filters, all packets are accepted.

Subclassed by hi_can::RawCanInterface, hi_can::SoftwareFilteredCanInterface, hi_can::TwaiInterface

Public Functions

virtual FilteredCanInterface &add_filter(const addressing::filter_t &filter)

Add a filter to the interface.

Returns:

Itself for chaining

virtual FilteredCanInterface &remove_filter(const addressing::filter_t &filter)

Remove a filter from the interface.

Returns:

Itself for chaining

inline virtual const std::set<addressing::filter_t> &get_filters() const

Get the currently active filters.

Returns:

The set of active filters

virtual std::optional<addressing::filter_t> find_matching_filter(const addressing::flagged_address_t &address) const

Find the first filter which matches the given address.

Parameters:
const addressing::flagged_address_t &address

The address to search for

Returns:

The matching filter if found, otherwise std::nullopt

virtual bool address_matches_filters(const addressing::flagged_address_t &address) const

Check if an address matches any of the filters.

Parameters:
const addressing::flagged_address_t &address

The address to check

Returns:

Whether the address matches a filter

Protected Attributes

std::set<addressing::filter_t> _filters

List of currently applied filters.