AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
Loading...
Searching...
No Matches
mac_can_pcan_plugin.hpp
Go to the documentation of this file.
1//================================================================================================
9//================================================================================================
10#ifndef MAC_CAN_PCAN_PLUGIN_HPP
11#define MAC_CAN_PCAN_PLUGIN_HPP
12
13#include <string>
14
15#include "isobus/hardware_integration/PCBUSB.h"
19
20namespace isobus
21{
22 //================================================================================================
26 //================================================================================================
28 {
29 public:
32 explicit MacCANPCANPlugin(WORD channel);
33
35 virtual ~MacCANPCANPlugin();
36
39 bool get_is_valid() const override;
40
42 void close() override;
43
45 void open() override;
46
50 bool read_frame(isobus::CANMessageFrame &canFrame) override;
51
55 bool write_frame(const isobus::CANMessageFrame &canFrame) override;
56
57 private:
58 TPCANHandle handle;
59 TPCANStatus openResult;
60 };
61}
62#endif // MAC_CAN_PCAN_PLUGIN_HPP
An abstraction between this CAN stack and any hardware layer.
A base class for a CAN driver. Can be derived into your platform's required interface.
A classical CAN frame, with 8 data bytes.
An abstract base class for a CAN driver.
A CAN frame for interfacing with a hardware layer, like socket CAN or other interface.
A Mac OS CAN Driver for PEAK PCAN Devices.
TPCANHandle handle
The handle as defined in the PCAN driver API.
bool write_frame(const isobus::CANMessageFrame &canFrame) override
Writes a frame to the bus (synchronous)
MacCANPCANPlugin(WORD channel)
Constructor for the MacCAN PCAN plugin.
void close() override
Closes the connection to the hardware.
TPCANStatus openResult
Stores the result of the call to begin CAN communication. Used for is_valid check later.
bool get_is_valid() const override
Returns if the connection with the hardware is valid.
virtual ~MacCANPCANPlugin()
The destructor for MacCANPCANPlugin.
bool read_frame(isobus::CANMessageFrame &canFrame) override
Returns a frame from the hardware (synchronous), or false if no frame can be read.
void open() override
Connects to the hardware you specified in the constructor's channel argument.
This namespace encompasses all of the ISO11783 stack's functionality to reduce global namespace pollu...