|
AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
|
A CAN Driver for using socket CAN remotely over TCP socket. More...
#include <socketcand_windows_network_client.hpp>
Public Member Functions | |
| SocketCANdNetworkInterface (std::string deviceName) | |
| Constructor for the socket CAN driver. | |
| SocketCANdNetworkInterface (std::string deviceName, const std::string ipAddress, std::uint16_t port=29536) | |
| Constructor for the socket CAN driver. | |
| virtual | ~SocketCANdNetworkInterface () |
| The destructor for SocketCANdNetworkInterface. | |
| bool | get_is_valid () const override |
| Returns if the connection is valid. | |
| std::string | get_device_name () const |
| Returns the device name the driver is using. | |
| const std::string | get_connected_ip_address () const |
| Returns the IP that the plugin is connected to. | |
| void | close () override |
| Closes the connection. | |
| void | open () override |
| Connects to the server. | |
| bool | read_frame (isobus::HardwareInterfaceCANFrame &canFrame) override |
Returns a frame from the hardware (synchronous), or false if no frame can be read. | |
| bool | write_frame (const isobus::HardwareInterfaceCANFrame &canFrame) override |
| Writes a frame to the bus (synchronous) | |
Public Member Functions inherited from isobus::CANHardwarePlugin | |
| virtual bool | read_frame (isobus::CANMessageFrame &canFrame)=0 |
| Reads one frame from the bus synchronously. | |
| virtual bool | write_frame (const isobus::CANMessageFrame &canFrame)=0 |
| Writes a frame to the bus (synchronous) | |
Private Member Functions | |
| void | initialize () |
| Initializes some class variables. | |
Static Private Attributes | |
| static constexpr std::uint32_t | MAX_RECV_LENGTH = 1024 |
A CAN Driver for using socket CAN remotely over TCP socket.
Definition at line 29 of file socketcand_windows_network_client.hpp.
|
explicit |
Constructor for the socket CAN driver.
This constructor will attempt to automatically detect a socketcand server and connect to it using its UDP beacon.
| [in] | deviceName | The CAN device to connect to on the server, such as "can0" |
Definition at line 15 of file socketcand_windows_network_client.cpp.
| isobus::SocketCANdNetworkInterface::SocketCANdNetworkInterface | ( | std::string | deviceName, |
| const std::string | ipAddress, | ||
| std::uint16_t | port = 29536 ) |
Constructor for the socket CAN driver.
This constructor explicitly sets a target IP address.
| [in] | deviceName | The CAN device to connect to on the server, such as "can0" |
| [in] | ipAddress | The ip address of the server to connect to (IPv4) |
| [in] | port | The TCP port to connect to. By default it's 29536 |
Definition at line 21 of file socketcand_windows_network_client.cpp.
|
overridevirtual |
Closes the connection.
Implements isobus::CANHardwarePlugin.
Definition at line 54 of file socketcand_windows_network_client.cpp.
| const std::string isobus::SocketCANdNetworkInterface::get_connected_ip_address | ( | ) | const |
Returns the IP that the plugin is connected to.
Definition at line 49 of file socketcand_windows_network_client.cpp.
| std::string isobus::SocketCANdNetworkInterface::get_device_name | ( | ) | const |
Returns the device name the driver is using.
Definition at line 44 of file socketcand_windows_network_client.cpp.
|
overridevirtual |
Returns if the connection is valid.
true if connected, false if not connected Implements isobus::CANHardwarePlugin.
Definition at line 39 of file socketcand_windows_network_client.cpp.
|
private |
Initializes some class variables.
Definition at line 29 of file socketcand_windows_network_client.cpp.
|
overridevirtual |
Connects to the server.
Implements isobus::CANHardwarePlugin.
Definition at line 58 of file socketcand_windows_network_client.cpp.
|
override |
Returns a frame from the hardware (synchronous), or false if no frame can be read.
| [in,out] | canFrame | The CAN frame that was read |
true if a CAN frame was read, otherwise false Definition at line 85 of file socketcand_windows_network_client.cpp.
|
override |
Writes a frame to the bus (synchronous)
| [in] | canFrame | The frame to write to the bus |
true if the frame was written, otherwise false Definition at line 92 of file socketcand_windows_network_client.cpp.
|
staticconstexprprivate |
Definition at line 80 of file socketcand_windows_network_client.hpp.