24#ifndef LELY_IO2_WIN32_IXXAT_HPP_
25#define LELY_IO2_WIN32_IXXAT_HPP_
58 if (!ctrl) util::throw_errc(
"IxxatController");
63 int nominal,
int data = 0)
66 if (!ctrl) util::throw_errc(
"IxxatController");
76 IxxatController& operator=(
const IxxatController&) =
delete;
79 operator=(IxxatController&&
other)
noexcept {
81 swap(ctrl,
other.ctrl);
99 if (!chan) util::throw_errc(
"IxxatChannel");
105 other.chan =
nullptr;
109 IxxatChannel& operator=(
const IxxatChannel&) =
delete;
112 operator=(IxxatChannel&&
other)
noexcept {
114 swap(chan,
other.chan);
115 swap(dev,
other.dev);
129 ::std::error_code& ec)
noexcept {
135 ec = util::make_error_code();
143 ::std::error_code ec;
145 if (ec) throw ::std::system_error(ec,
"open");
151 ::std::error_code& ec)
noexcept {
157 ec = util::make_error_code();
164 ::std::error_code ec;
166 if (ec) throw ::std::system_error(ec,
"assign");
181 close(::std::error_code& ec)
noexcept {
187 ec = util::make_error_code();
194 ::std::error_code ec;
196 if (ec) throw ::std::system_error(ec,
"close");
A reference to an abstract CAN channel.
A reference to an abstract CAN controller.
void open(const io_can_ctrl_t *ctrl, UINT16 wRxFifoSize=0, UINT16 wTxFifoSize=0)
void close(::std::error_code &ec) noexcept
HANDLE get_handle() const noexcept
IxxatChannel(io_ctx_t *ctx, ev_exec_t *exec, int rxtimeo=0, int txtimeo=0)
void assign(HANDLE hCanChn, UINT32 dwTscClkFreq, UINT32 dwTscDivisor, ::std::error_code &ec) noexcept
void open(const io_can_ctrl_t *ctrl, UINT16 wRxFifoSize, UINT16 wTxFifoSize, ::std::error_code &ec) noexcept
void assign(HANDLE hCanChn, UINT32 dwTscClkFreq=0, UINT32 dwTscDivisor=0)
HANDLE release() noexcept
bool is_open() const noexcept
HANDLE get_handle() const noexcept
IxxatController(const LUID &rLuid, UINT32 dwCanNo, CanBusFlag flags, int nominal, int data=0)
IxxatController(UINT32 dwIndex, UINT32 dwCanNo, CanBusFlag flags, int nominal, int data=0)
A RAII-style wrapper around io_ixxat_init() and io_ixxat_fini().
const struct ev_exec_vtbl *const ev_exec_t
An abstract task executor.
const struct io_can_ctrl_vtbl *const io_can_ctrl_t
An abstract CAN controller.
This header file is part of the I/O library; it contains the C++ interface for the abstract CAN bus.
CanBusFlag
The CAN bus flags.
This header file is part of the I/O library; it contains the IXXAT CAN bus declarations for Windows.
io_can_ctrl_t * io_ixxat_ctrl_create_from_luid(const LUID *lpLuid, UINT32 dwCanNo, int flags, int nominal, int data)
Creates a new IXXAT CAN controller from a locally unique identifier (LUID).
HANDLE io_ixxat_ctrl_get_handle(const io_can_ctrl_t *ctrl)
Returns the native handle of the CAN controller.
io_can_ctrl_t * io_ixxat_ctrl_create_from_index(UINT32 dwIndex, UINT32 dwCanNo, int flags, int nominal, int data)
Creates a new IXXAT CAN controller from a device index.
io_can_chan_t * io_ixxat_chan_create(io_ctx_t *ctx, ev_exec_t *exec, int rxtimeo, int txtimeo)
Creates a new IXXAT CAN channel.
void io_ixxat_fini(void)
Frees the "vcinpl.dll" or "vcinpl2.dll" library and terminates the availability of the IXXAT function...
int io_ixxat_chan_assign(io_can_chan_t *chan, HANDLE hCanChn, UINT32 dwTscClkFreq, UINT32 dwTscDivisor)
Assigns an existing handle to a CAN channel, and activates the channel if necessary.
int io_ixxat_chan_open(io_can_chan_t *chan, const io_can_ctrl_t *ctrl, UINT16 wRxFifoSize, UINT16 wTxFifoSize)
Opens a CAN channel.
int io_ixxat_chan_close(io_can_chan_t *chan)
Closes a CAN channel.
void io_ixxat_ctrl_destroy(io_can_ctrl_t *ctrl)
Destroys an IXXAT CAN controller.
int io_ixxat_init(void)
Loads the "vcinpl.dll" or "vcinpl2.dll" library and makes the IXXAT functions available for use.
void io_ixxat_chan_destroy(io_can_chan_t *chan)
Destroys an IXXAT CAN channel.
int io_ixxat_chan_is_open(const io_can_chan_t *chan)
Returns 1 is the CAN channel is open and 0 if not.
HANDLE io_ixxat_chan_get_handle(const io_can_chan_t *chan)
Returns the native handle of the CAN channel, or NULL if the channel is closed.
HANDLE io_ixxat_chan_release(io_can_chan_t *chan)
Dissociates and returns the native handle from a CAN channel.