Lely core libraries
2.3.4
|
Go to the documentation of this file.
24 #ifndef LELY_IO2_WIN32_IXXAT_HPP_
25 #define LELY_IO2_WIN32_IXXAT_HPP_
57 dwIndex, dwCanNo, static_cast<int>(flags), nominal, data)) {
58 if (!ctrl) util::throw_errc(
"IxxatController");
63 int nominal,
int data = 0)
65 &rLuid, dwCanNo, static_cast<int>(flags), nominal, data)) {
66 if (!ctrl) util::throw_errc(
"IxxatController");
81 swap(ctrl, other.ctrl);
99 if (!chan) util::throw_errc(
"IxxatChannel");
105 other.chan =
nullptr;
114 swap(chan, other.chan);
115 swap(dev, other.dev);
129 ::std::error_code& ec) noexcept {
130 DWORD dwErrCode = GetLastError();
136 SetLastError(dwErrCode);
142 UINT16 wTxFifoSize = 0) {
143 ::std::error_code ec;
144 open(ctrl, wRxFifoSize, wTxFifoSize, ec);
145 if (ec) throw ::std::system_error(ec,
"open");
150 assign(HANDLE hCanChn, UINT32 dwTscClkFreq, UINT32 dwTscDivisor,
151 ::std::error_code& ec) noexcept {
152 DWORD dwErrCode = GetLastError();
158 SetLastError(dwErrCode);
163 assign(HANDLE hCanChn, UINT32 dwTscClkFreq = 0, UINT32 dwTscDivisor = 0) {
164 ::std::error_code ec;
165 assign(hCanChn, dwTscClkFreq, dwTscDivisor, ec);
166 if (ec) throw ::std::system_error(ec,
"assign");
181 close(::std::error_code& ec) noexcept {
182 DWORD dwErrCode = GetLastError();
188 SetLastError(dwErrCode);
194 ::std::error_code ec;
196 if (ec) throw ::std::system_error(ec,
"close");
203 #endif // !LELY_IO2_WIN32_IXXAT_HPP_
A RAII-style wrapper around io_ixxat_init() and io_ixxat_fini().
HANDLE io_ixxat_ctrl_get_handle(const io_can_ctrl_t *ctrl)
Returns the native handle of the CAN controller.
const struct ev_exec_vtbl *const ev_exec_t
An abstract task executor.
IxxatController(UINT32 dwIndex, UINT32 dwCanNo, CanBusFlag flags, int nominal, int data=0)
void io_ixxat_fini(void)
Frees the "vcinpl.dll" or "vcinpl2.dll" library and terminates the availability of the IXXAT function...
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 close(::std::error_code &ec) noexcept
HANDLE get_handle() const noexcept
void assign(HANDLE hCanChn, UINT32 dwTscClkFreq=0, UINT32 dwTscDivisor=0)
A reference to an abstract 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.
CanBusFlag
The CAN bus flags.
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.
void io_ixxat_chan_destroy(io_can_chan_t *chan)
Destroys an IXXAT CAN channel.
HANDLE io_ixxat_chan_release(io_can_chan_t *chan)
Dissociates and returns the native handle from a CAN channel.
void assign(HANDLE hCanChn, UINT32 dwTscClkFreq, UINT32 dwTscDivisor, ::std::error_code &ec) noexcept
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).
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.
IxxatChannel(io_ctx_t *ctx, ev_exec_t *exec, int rxtimeo=0, int txtimeo=0)
IxxatController(const LUID &rLuid, UINT32 dwCanNo, CanBusFlag flags, int nominal, int data=0)
HANDLE release() noexcept
void io_ixxat_ctrl_destroy(io_can_ctrl_t *ctrl)
Destroys an IXXAT CAN controller.
A reference to an abstract CAN controller.
void open(const io_can_ctrl_t *ctrl, UINT16 wRxFifoSize=0, UINT16 wTxFifoSize=0)
::std::error_code make_error_code(SdoErrc e) noexcept
Creates an error code corresponding to an SDO abort code.
int io_ixxat_init(void)
Loads the "vcinpl.dll" or "vcinpl2.dll" library and makes the IXXAT functions available for use.
bool is_open() const noexcept
void open(const io_can_ctrl_t *ctrl, UINT16 wRxFifoSize, UINT16 wTxFifoSize, ::std::error_code &ec) noexcept
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_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.
const struct io_can_ctrl_vtbl *const io_can_ctrl_t
An abstract CAN controller.
HANDLE get_handle() const noexcept
int io_ixxat_chan_close(io_can_chan_t *chan)
Closes a CAN channel.