AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
Loading...
Searching...
No Matches
sys_tec_windows_plugin.hpp
Go to the documentation of this file.
1//================================================================================================
10//================================================================================================
11#ifndef SYS_TEC_WINDOWS_PLUGIN_HPP
12#define SYS_TEC_WINDOWS_PLUGIN_HPP
13
17
18// These needs to be included before Usbcan32.h for definitions of
19// anachronistic Microsoft C types like WORD, DWORD, and TCHAR
20#include <Windows.h>
21#include <tchar.h>
22
23#include "isobus/hardware_integration/Usbcan32.h"
24
25namespace isobus
26{
29 {
30 public:
34 SysTecWindowsPlugin(std::uint8_t channel = USBCAN_CHANNEL_CH0, std::uint32_t baudrate = USBCAN_BAUD_250kBit);
35
39 SysTecWindowsPlugin(std::uint32_t serialNumber, std::uint32_t baudrate = USBCAN_BAUD_250kBit);
40
42 virtual ~SysTecWindowsPlugin();
43
46 bool get_is_valid() const override;
47
49 void close() override;
50
52 void open() override;
53
57 bool read_frame(isobus::CANMessageFrame &canFrame) override;
58
62 bool write_frame(const isobus::CANMessageFrame &canFrame) override;
63
64 private:
65 std::uint32_t serialNumber = 0;
66 std::uint16_t baudrateConstant = USBCAN_BAUD_250kBit;
67 std::uint8_t channelIndex = 0;
68 std::uint8_t handle = USBCAN_INVALID_HANDLE;
69 bool openResult = false;
70 };
71}
72#endif // SYS_TEC_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 SYS TEC electronic AG USB CAN modules.
SysTecWindowsPlugin(std::uint8_t channel=USBCAN_CHANNEL_CH0, std::uint32_t baudrate=USBCAN_BAUD_250kBit)
Constructor for the Windows SYS TEC plugin.
virtual ~SysTecWindowsPlugin()
The destructor for PCANBasicWindowsPlugin.
std::uint32_t serialNumber
The serial number to connect to, or 0 if not used.
std::uint16_t baudrateConstant
The constant used to configure the adapter's baudrate.
bool write_frame(const isobus::CANMessageFrame &canFrame) override
Writes a frame to the bus (synchronous)
void open() override
Connects to the hardware you specified in the constructor's channel argument.
std::uint8_t handle
The handle for the device, used to interact with the DLL.
bool read_frame(isobus::CANMessageFrame &canFrame) override
Returns a frame from the hardware (synchronous), or false if no frame can be read.
bool openResult
Stores the result of the call to begin CAN communication. Used for is_valid check later.
void close() override
Closes the connection to the hardware.
std::uint8_t channelIndex
The channel for the device, used if you have a multi-channel device.
bool get_is_valid() const override
Returns if the connection with the hardware is valid.
This namespace encompasses all of the ISO11783 stack's functionality to reduce global namespace pollu...