AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
Loading...
Searching...
No Matches
pcan_basic_windows_plugin.hpp
Go to the documentation of this file.
1//================================================================================================
10//================================================================================================
11#ifndef PCAN_BASIC_WINDOWS_PLUGIN_HPP
12#define PCAN_BASIC_WINDOWS_PLUGIN_HPP
13
14#include <string>
15
16// This needs to be included before PCANBasic for definitions of
17// anachronistic windows C types like WORD, DWORD etc
18#include <Windows.h>
19
20#include "isobus/hardware_integration/PCANBasic.h"
24
25namespace isobus
26{
27 //================================================================================================
31 //================================================================================================
33 {
34 public:
37 explicit PCANBasicWindowsPlugin(WORD channel);
38
41
44 bool get_is_valid() const override;
45
47 void close() override;
48
50 void open() override;
51
55 bool read_frame(isobus::CANMessageFrame &canFrame) override;
56
60 bool write_frame(const isobus::CANMessageFrame &canFrame) override;
61
62 private:
63 TPCANHandle handle;
64 TPCANStatus openResult;
65 };
66}
67#endif // PCAN_BASIC_WINDOWS_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 Windows CAN Driver for PEAK PCAN Devices.
TPCANStatus openResult
Stores the result of the call to begin CAN communication. Used for is_valid check later.
TPCANHandle handle
The handle as defined in the PCAN driver API.
void open() override
Connects to the hardware you specified in the constructor's channel argument.
void close() override
Closes the connection to the hardware.
bool write_frame(const isobus::CANMessageFrame &canFrame) override
Writes a frame to the bus (synchronous)
bool get_is_valid() const override
Returns if the connection with the hardware is valid.
bool read_frame(isobus::CANMessageFrame &canFrame) override
Returns a frame from the hardware (synchronous), or false if no frame can be read.
PCANBasicWindowsPlugin(WORD channel)
Constructor for the Windows version of the PEAK PCAN Basic CAN driver.
virtual ~PCANBasicWindowsPlugin()
The destructor for PCANBasicWindowsPlugin.
This namespace encompasses all of the ISO11783 stack's functionality to reduce global namespace pollu...