A CAN Bus in its simplest (but effective) form, making use of nodeId() and other CAN functionalities to optimise and interpret the data flow. More...
#include <CANBus.hpp>
Public Member Functions | |
CANBus () | |
Create a CANBus instance with no devices attached to it. | |
void | setController (CANControllerInterface *contr) |
Specify the controller for this bus. | |
virtual bool | addDevice (CANDeviceInterface *dev) |
Register a CANDeviceInterface instance to the bus. | |
virtual bool | addListener (CANListenerInterface *dev) |
Register a CANListenerInterface instance to the bus. | |
virtual void | removeDevice (CANDeviceInterface *dev) |
Remove a CANDeviceInterface from the bus. | |
virtual void | removeListener (CANListenerInterface *dev) |
Remove a CANListenerInterface from the bus. | |
virtual void | write (const CANMessage *msg) |
Write a CANMessage to the bus. | |
CANControllerInterface * | getController () |
Get the controller for this bus. | |
Static Public Attributes | |
static const unsigned int | MAX_DEVICES = 127 |
Protected Attributes | |
list< CANDeviceInterface * > | devices |
list< CANListenerInterface * > | listeners |
CANControllerInterface * | controller |
A CAN Bus in its simplest (but effective) form, making use of nodeId() and other CAN functionalities to optimise and interpret the data flow.
Definition at line 51 of file CANBus.hpp.
CANBus | ( | ) | [inline] |
Create a CANBus instance with no devices attached to it.
A controller device needs to be added to put on and receive messages from the bus.
_controller | The Controller of the bus. |
Definition at line 62 of file CANBus.hpp.
virtual bool addDevice | ( | CANDeviceInterface * | dev | ) | [inline, virtual] |
Register a CANDeviceInterface instance to the bus.
dev | The device to be added to the bus. |
Implements CANBusInterface.
Definition at line 72 of file CANBus.hpp.
virtual bool addListener | ( | CANListenerInterface * | dev | ) | [inline, virtual] |
Register a CANListenerInterface instance to the bus.
dev | The listener to be added to the bus. |
Implements CANBusInterface.
Definition at line 81 of file CANBus.hpp.
virtual void removeDevice | ( | CANDeviceInterface * | dev | ) | [inline, virtual] |
Remove a CANDeviceInterface from the bus.
dev | The device to be removed from the bus. |
Implements CANBusInterface.
Definition at line 90 of file CANBus.hpp.
virtual void removeListener | ( | CANListenerInterface * | dev | ) | [inline, virtual] |
Remove a CANListenerInterface from the bus.
dev | The listener to be removed from the bus. |
Implements CANBusInterface.
Definition at line 98 of file CANBus.hpp.
virtual void write | ( | const CANMessage * | msg | ) | [inline, virtual] |
Write a CANMessage to the bus.
CANDevices can use this to put data on the CANBus. When this call returns, you are still the owner of msg.
msg | A CANMessage which will be put on the bus. |
Implements CANBusInterface.
Definition at line 106 of file CANBus.hpp.
References CANMessage::origin, and CANListenerInterface::process().