A Controller which interacts with the PCAN linux driver to address the physical controller. More...
#include <PCANController.hpp>
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 PCANController * | controller [PCAN_CHANNEL_MAX] |
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.
PCANController | ( | int | priority, | |
unsigned int | minor = 0 , |
|||
WORD | bitrate = CAN_BAUD_500K , |
|||
int | CANMsgType = CAN_INIT_TYPE_EX | |||
) |
Create a PCAN Controller.
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??? |
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.
void process | ( | const CANMessage * | msg | ) | [virtual] |
This method instructs the CANDeviceInterface instance to process a certain CANMessage.
You are not the owner of msg.
msg | The message to be processed by this instance. |
Implements CANListenerInterface.
Definition at line 123 of file PCANController.cpp.
References CANMessage::getData(), CANMessage::getDLC(), and CANMessage::isRemote().