ABS SCPI Driver 0.2.0
ABS SCPI driver library
Loading...
Searching...
No Matches
UdpDriver Class Referencefinal

UDP driver. More...

#include <UdpDriver.h>

+ Inheritance diagram for UdpDriver:
+ Collaboration diagram for UdpDriver:

Detailed Description

UDP driver.

Public Member Functions

 UdpDriver ()
 CTOR.
 
 ~UdpDriver ()
 DTOR.
 
ErrorCode Open (std::string_view ip)
 Open a socket for communication with the ABS.
 
ErrorCode Open (std::string_view local_ip, std::string_view target_ip)
 Open a socket for communication with the ABS bound to a specific local IP address.
 
void Close () noexcept
 Close the socket.
 
ErrorCode Write (std::string_view data, unsigned int timeout_ms) const
 Send data over UDP.
 
Result< std::string > ReadLine (unsigned int timeout_ms) const
 Read a line over UDP.
 
- Public Member Functions inherited from CommDriver
virtual void SetDeviceID (unsigned int id)
 Set the target device ID.
 
virtual unsigned int GetDeviceID () const
 Get the target device ID.
 
virtual bool IsSendOnly () const
 Determines whether a driver is send-only in the average case.
 

Member Function Documentation

◆ Open() [1/2]

ErrorCode Open ( std::string_view  ip)

Open a socket for communication with the ABS.

Parameters
[in]ipdevice IP address
Returns
An error code.

◆ Open() [2/2]

ErrorCode Open ( std::string_view  local_ip,
std::string_view  target_ip 
)

Open a socket for communication with the ABS bound to a specific local IP address.

Prefer this function if you have more than one NIC.

Parameters
[in]local_iplocal interface IP to bind to
[in]target_ipdevice IP address
Returns
An error code.

◆ ReadLine()

Result< std::string > ReadLine ( unsigned int  timeout_ms) const
virtual

Read a line over UDP.

Parameters
[in]timeout_msread timeout in milliseconds
Returns
Result containing the line read or an error code.

Implements CommDriver.

◆ Write()

ErrorCode Write ( std::string_view  data,
unsigned int  timeout_ms 
) const
virtual

Send data over UDP.

Parameters
[in]datadata to send
[in]timeout_mssend timeout in milliseconds
Returns
An error code.

Implements CommDriver.


The documentation for this class was generated from the following file: