AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
Loading...
Searching...
No Matches
innomaker_usb2can_windows_plugin.hpp
Go to the documentation of this file.
1//================================================================================================
10//================================================================================================
11#ifndef INNOMAKER_USB2CAN_PLUGIN_HPP
12#define INNOMAKER_USB2CAN_PLUGIN_HPP
13
14#include <cstdint>
15#include <memory>
16#include <string>
17
18#include "isobus/hardware_integration/InnoMakerUsb2CanLib.h"
22
23namespace isobus
24{
25 //================================================================================================
29 //================================================================================================
31 {
32 public:
53
58
61
64 bool get_is_valid() const override;
65
67 void close() override;
68
70 void open() override;
71
75 bool read_frame(isobus::CANMessageFrame &canFrame) override;
76
80 bool write_frame(const isobus::CANMessageFrame &canFrame) override;
81
82 private:
83 static constexpr InnoMakerUsb2CanLib::UsbCanMode CAN_MODE = InnoMakerUsb2CanLib::UsbCanModeNormal;
84 static constexpr std::uint32_t CAN_EFF_FLAG = 0x80000000;
85 static constexpr std::uint32_t CAN_SFF_MASK = 0x000007FF;
86 static constexpr std::uint32_t CAN_EFF_MASK = 0x1FFFFFFF;
87
88 static std::unique_ptr<InnoMakerUsb2CanLib> driverInstance;
89 const int channel;
90 const std::uint32_t baudrate;
91 std::unique_ptr<InnoMakerUsb2CanLib::innomaker_can> txContexts;
92 };
93}
94#endif // INNOMAKER_USB2CAN_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 InnoMaker USB2CAN devices.
static constexpr std::uint32_t CAN_EFF_MASK
The mask for extended frames.
static constexpr std::uint32_t CAN_SFF_MASK
The mask for standard frames.
InnoMakerUSB2CANWindowsPlugin(int channel, Baudrate baudrate=B250k)
Constructor for the Windows version of the InnoMaker USB2CAN Windows CAN driver.
std::unique_ptr< InnoMakerUsb2CanLib::innomaker_can > txContexts
Stores Tx tickets for the driver.
bool write_frame(const isobus::CANMessageFrame &canFrame) override
Writes a frame to the bus (synchronous)
static std::unique_ptr< InnoMakerUsb2CanLib > driverInstance
The driver itself.
Baudrate
The baudrates supported by the InnoMaker USB2CAN device.
void open() override
Connects to the hardware you specified in the constructor's channel argument.
const int channel
Stores the channel associated with this object.
static constexpr std::uint32_t CAN_EFF_FLAG
Set if the frame is extended.
virtual ~InnoMakerUSB2CANWindowsPlugin()
The destructor for InnoMakerUSB2CANWindowsPlugin.
bool read_frame(isobus::CANMessageFrame &canFrame) override
Returns a frame from the hardware (synchronous), or false if no frame can be read.
void close() override
Closes the connection to the hardware.
const std::uint32_t baudrate
Stores the baud rate associated with this object.
static constexpr InnoMakerUsb2CanLib::UsbCanMode CAN_MODE
The mode to use for the CAN 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...