PCANController Class Reference

A Controller which interacts with the PCAN linux driver to address the physical controller. More...

#include <PCANController.hpp>

Inheritance diagram for PCANController:
CANControllerInterface CANDeviceInterface CANListenerInterface

List of all members.

Public Member Functions

 PCANController (int priority, unsigned int minor=0, WORD bitrate=CAN_BAUD_500K, int CANMsgType=CAN_INIT_TYPE_EX)
 Create a PCAN Controller.
bool initialize ()
void loop ()
bool breakLoop ()
void finalize ()
virtual void addBus (unsigned int chan, CANBusInterface *_bus)
virtual void process (const CANMessage *msg)
 This method instructs the CANDeviceInterface instance to process a certain CANMessage.
virtual unsigned int nodeId () const
bool readFromBuffer (CANMessage &msg)
bool writeToBuffer (const CANMessage *msg)
DWORD status () const
HANDLE handle () const

Protected Attributes

HANDLE _handle
DWORD _status
WORD _bitrate
int _CANMsgType
int _channel
CANBusInterface_bus
CANMessage _CANMsg
unsigned int total_recv
unsigned int total_trns
unsigned int failed_recv
unsigned int failed_trns
bool exit

Static Protected Attributes

static PCANControllercontroller [PCAN_CHANNEL_MAX]

Detailed Description

A Controller which interacts with the PCAN linux driver to address the physical controller.

This controller uses the NON-REALTIME CAN driver from Peak Systems (See http://www.peak-system.com/linux/) and should support all their boards, although it's only tested with their PCI card.

Definition at line 53 of file PCANController.hpp.


Constructor & Destructor Documentation

PCANController ( int  priority,
unsigned int  minor = 0,
WORD  bitrate = CAN_BAUD_500K,
int  CANMsgType = CAN_INIT_TYPE_EX 
)

Create a PCAN Controller.

Parameters:
priority the priority of the activity that mirrors the physical and software CAN bus
period the priority of the activity that mirrors the physical and software CAN bus
minor minor number of the CAN device node. E.g. if you are using /dev/pcan1, minor is 1
bitrate bitrate of the CAN bus. Possible values are ranging from CAN_BAUD_5K (5 kbits/s) to CAN_BAUD_1M (1 Mbit/s). See libpcan.h for an exhaustive list. Defaults to CAN_BAUD_500K.
CANMsgType Standard or Extended frames CAN_INIT_TYPE_EX CAN_INIT_TYPE_ST. Defaults to CAN_INIT_TYPE_EX FIXME Klaas Gadeyne. Does CAN_INIT_TYPE_ST or CAN_INIT_TYPE_EX means the controller can either send standard or extended frames here???
Bug:

This constructor should throw an exception if LINUX_CAN_Open returns NULL

The node id of the controller is always 0 currently

Definition at line 36 of file PCANController.cpp.


Member Function Documentation

void process ( const CANMessage msg  )  [virtual]

This method instructs the CANDeviceInterface instance to process a certain CANMessage.

You are not the owner of msg.

Parameters:
msg The message to be processed by this instance.
Invariant:
Only this may be removed from the CANBusInterface during process.

Implements CANListenerInterface.

Definition at line 123 of file PCANController.cpp.

References CANMessage::getData(), CANMessage::getDLC(), and CANMessage::isRemote().


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