|
Veethree D7 SDK
|
Convenience wrapper class around a CAN socket.
#include <can_socket.h>
Public Member Functions | |
| std::errc | bind (const can_adapter &adapter) |
| Open the socket and bind to an adapter. | |
| std::optional< can_adapter > | adapter () const |
| Get the adapter this socket is bound to. | |
| std::errc | close () |
| Close the socket. | |
| bool | is_open () |
| Check if the socket is open. | |
| std::errc | send (const can_msg_frame &frame) const |
| Send a CAN frame. | |
| std::errc | set_nonblocking () |
| Make the socket non-blocking. | |
| std::errc | set_blocking () |
| Make the socket blocking. | |
| std::errc | disable_error_frames () |
| Filter out Error CAN frames. | |
| std::errc | enable_error_frames () |
| Allow CAN Error Frames to pass up to the application via this socket. | |
| void | set_receive_callback (const can_socket_recv_callback &cb) |
| Set the receive callback object. See can_socket::receive. | |
| receive_result | receive (can_msg_frame &frame, std::chrono::milliseconds timeout=std::chrono::milliseconds::zero()) const |
| Receive a CAN frame. | |
| can_socket () | |
| Constructors and assignment operators. | |
| can_socket (can_socket &&)=default | |
| Constructors and assignment operators. | |
| can_socket (const can_socket &)=default | |
| Constructors and assignment operators. | |
| can_socket & | operator= (const can_socket &)=default |
| Constructors and assignment operators. | |
| can_socket & | operator= (can_socket &&)=default |
| Constructors and assignment operators. | |
Static Public Member Functions | |
| static select_result_can | select_receive_timeout (const std::vector< can_socket > &sockets, std::chrono::milliseconds timeout) |
| Listen on an array of sockets until one of them receives a CAN frame or the timeout expires. | |
Friends | |
| class | can_socket_impl |
Convenience wrapper class around a CAN socket.
| std::optional< can_adapter > vsdk::comms::can_socket::adapter | ( | ) | const |
Get the adapter this socket is bound to.
| std::errc vsdk::comms::can_socket::bind | ( | const can_adapter & | adapter | ) |
Open the socket and bind to an adapter.
| adapter | The adapter to bind the socket on. |
| std::errc vsdk::comms::can_socket::close | ( | ) |
Close the socket.
| std::errc vsdk::comms::can_socket::disable_error_frames | ( | ) |
Filter out Error CAN frames.
| std::errc vsdk::comms::can_socket::enable_error_frames | ( | ) |
Allow CAN Error Frames to pass up to the application via this socket.
| bool vsdk::comms::can_socket::is_open | ( | ) |
Check if the socket is open.
| receive_result vsdk::comms::can_socket::receive | ( | can_msg_frame & | frame, |
| std::chrono::milliseconds | timeout = std::chrono::milliseconds::zero() ) const |
Receive a CAN frame.
| [out] | frame | The frame that was received. |
| [in] | timeout | The timeout for receiving a CAN frame. 0 for waiting indefinitely. |
|
static |
Listen on an array of sockets until one of them receives a CAN frame or the timeout expires.
| sockets | The list of sockets to listen on. |
| timeout | The timeout in milliseconds. |
| std::errc vsdk::comms::can_socket::send | ( | const can_msg_frame & | frame | ) | const |
Send a CAN frame.
| frame | The frame to send. |
| std::errc vsdk::comms::can_socket::set_blocking | ( | ) |
Make the socket blocking.
| std::errc vsdk::comms::can_socket::set_nonblocking | ( | ) |
Make the socket non-blocking.
| void vsdk::comms::can_socket::set_receive_callback | ( | const can_socket_recv_callback & | cb | ) |
Set the receive callback object. See can_socket::receive.
| cb | The callback function. |