Class for abstracting lower level interactions with the CAN interfaces. A concrete implementation may "talk" to the underlying OS to query the current state of a CAN interface, request a configuration change for a CAN interface or list all available CAN interfaces.
#include <can_adapter_interface.h>
Class for abstracting lower level interactions with the CAN interfaces. A concrete implementation may "talk" to the underlying OS to query the current state of a CAN interface, request a configuration change for a CAN interface or list all available CAN interfaces.
◆ can_adapter_interface()
| vsdk::comms::can_adapter_interface::can_adapter_interface |
( |
std::string_view | if_name | ) |
|
|
inlineexplicit |
Constructor that uses the device interface name.
- Parameters
-
| if_name | The name of the interface (as reported by ip link show type can). |
◆ get_config()
| virtual void vsdk::comms::can_adapter_interface::get_config |
( |
can_parameters & | param | ) |
|
|
pure virtual |
Get the config for the interface.
- Parameters
-
| [out] | param | The structure containing the current configuration for this interface. |
- Exceptions
-
| std::system_error | if the interface does not exist on the system or problem occurred within the OS |
◆ list_adapters()
| virtual std::vector< std::tuple< std::string, can_type > > vsdk::comms::can_adapter_interface::list_adapters |
( |
| ) |
|
|
pure virtual |
List all available CAN adapters' names.
- Note
- : This method is not static to allow concrete implementations to override the way the interfaces are retrieved. Except for mock implementations, it should not use the instance's if_name() at all.
◆ restart_adapter()
| virtual bool vsdk::comms::can_adapter_interface::restart_adapter |
( |
| ) |
|
|
pure virtual |
Restart the CAN interface.
- Returns
- true if successfully restarted, false otherwise.
◆ set_config()
| virtual bool vsdk::comms::can_adapter_interface::set_config |
( |
const can_parameters & | param | ) |
|
|
pure virtual |
Modify the config for the interface.
- Parameters
-
| [in] | param | The structure containing the configurations to modify. |
- Returns
- true if configuration was modified successfully, false otherwise
- Note
- : Only set the fields that should be modified. Fields which aren't set won't be affected.
◆ type()
| virtual can_type vsdk::comms::can_adapter_interface::type |
( |
| ) |
|
|
pure virtual |
The type of the interface: physical or virtual.
- Returns
- can_type
The documentation for this class was generated from the following file: