CANBus Class Reference

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>

Inheritance diagram for CANBus:
CANBusInterface

List of all members.

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.
CANControllerInterfacegetController ()
 Get the controller for this bus.

Static Public Attributes

static const unsigned int MAX_DEVICES = 127

Protected Attributes

list< CANDeviceInterface * > devices
list< CANListenerInterface * > listeners
CANControllerInterfacecontroller

Detailed Description

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.


Constructor & Destructor Documentation

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.

Parameters:
_controller The Controller of the bus.

Definition at line 62 of file CANBus.hpp.


Member Function Documentation

virtual bool addDevice ( CANDeviceInterface dev  )  [inline, virtual]

Register a CANDeviceInterface instance to the bus.

Parameters:
dev The device to be added to the bus.
Returns:
True if the operation succeeded, false otherwise.
Postcondition:
The device will receive all messages on 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.

Parameters:
dev The listener to be added to the bus.
Returns:
True if the operation succeeded, false otherwise.
Postcondition:
The listener will receive all messages on 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.

Parameters:
dev The device to be removed from the bus.
Postcondition:
The device will no longer receive messages from the bus.
Invariant:
During a process(), the device may only remove itself.

Implements CANBusInterface.

Definition at line 90 of file CANBus.hpp.

virtual void removeListener ( CANListenerInterface dev  )  [inline, virtual]

Remove a CANListenerInterface from the bus.

Parameters:
dev The listener to be removed from the bus.
Postcondition:
The listener will no longer receive messages from the bus.
Invariant:
During a process(), the listener may only remove itself.

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.

Parameters:
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().


The documentation for this class was generated from the following file:
Generated on Thu Dec 23 15:05:29 2010 for OrocosComponentLibrary by  doxygen 1.6.3