AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
isobus::MacCANPCANPlugin Class Reference

A Mac OS CAN Driver for PEAK PCAN Devices. More...

#include <mac_can_pcan_plugin.hpp>

Inheritance diagram for isobus::MacCANPCANPlugin:
[legend]
Collaboration diagram for isobus::MacCANPCANPlugin:
[legend]

Public Member Functions

 MacCANPCANPlugin (WORD channel)
 Constructor for the MacCAN PCAN plugin.
 
virtual ~MacCANPCANPlugin ()
 The destructor for MacCANPCANPlugin.
 
bool get_is_valid () const override
 Returns if the connection with the hardware is valid.
 
void close () override
 Closes the connection to the hardware.
 
void open () override
 Connects to the hardware you specified in the constructor's channel argument.
 
bool read_frame (isobus::CANMessageFrame &canFrame) override
 Returns a frame from the hardware (synchronous), or false if no frame can be read.
 
bool write_frame (const isobus::CANMessageFrame &canFrame) override
 Writes a frame to the bus (synchronous)
 

Private Attributes

TPCANHandle handle
 The handle as defined in the PCAN driver API.
 
TPCANStatus openResult
 Stores the result of the call to begin CAN communication. Used for is_valid check later.
 

Detailed Description

A Mac OS CAN Driver for PEAK PCAN Devices.

Definition at line 27 of file mac_can_pcan_plugin.hpp.

Constructor & Destructor Documentation

◆ MacCANPCANPlugin()

isobus::MacCANPCANPlugin::MacCANPCANPlugin ( WORD channel)
explicit

Constructor for the MacCAN PCAN plugin.

Parameters
[in]channelThe channel to use. See definitions in PCBUSB.h such as PCAN_USBBUS1

Definition at line 18 of file mac_can_pcan_plugin.cpp.

◆ ~MacCANPCANPlugin()

isobus::MacCANPCANPlugin::~MacCANPCANPlugin ( )
virtual

The destructor for MacCANPCANPlugin.

Definition at line 24 of file mac_can_pcan_plugin.cpp.

Member Function Documentation

◆ close()

void isobus::MacCANPCANPlugin::close ( )
overridevirtual

Closes the connection to the hardware.

Implements isobus::CANHardwarePlugin.

Definition at line 33 of file mac_can_pcan_plugin.cpp.

◆ get_is_valid()

bool isobus::MacCANPCANPlugin::get_is_valid ( ) const
overridevirtual

Returns if the connection with the hardware is valid.

Returns
true if connected, false if not connected

Implements isobus::CANHardwarePlugin.

Definition at line 28 of file mac_can_pcan_plugin.cpp.

◆ open()

void isobus::MacCANPCANPlugin::open ( )
overridevirtual

Connects to the hardware you specified in the constructor's channel argument.

Implements isobus::CANHardwarePlugin.

Definition at line 38 of file mac_can_pcan_plugin.cpp.

◆ read_frame()

bool isobus::MacCANPCANPlugin::read_frame ( isobus::CANMessageFrame & canFrame)
overridevirtual

Returns a frame from the hardware (synchronous), or false if no frame can be read.

Parameters
[in,out]canFrameThe CAN frame that was read
Returns
true if a CAN frame was read, otherwise false

Implements isobus::CANHardwarePlugin.

Definition at line 48 of file mac_can_pcan_plugin.cpp.

◆ write_frame()

bool isobus::MacCANPCANPlugin::write_frame ( const isobus::CANMessageFrame & canFrame)
overridevirtual

Writes a frame to the bus (synchronous)

Parameters
[in]canFrameThe frame to write to the bus
Returns
true if the frame was written, otherwise false

Implements isobus::CANHardwarePlugin.

Definition at line 73 of file mac_can_pcan_plugin.cpp.

Member Data Documentation

◆ handle

TPCANHandle isobus::MacCANPCANPlugin::handle
private

The handle as defined in the PCAN driver API.

Definition at line 58 of file mac_can_pcan_plugin.hpp.

◆ openResult

TPCANStatus isobus::MacCANPCANPlugin::openResult
private

Stores the result of the call to begin CAN communication. Used for is_valid check later.

Definition at line 59 of file mac_can_pcan_plugin.hpp.


The documentation for this class was generated from the following files: