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

TCP driver. More...

#include <TcpDriver.h>

+ Inheritance diagram for TcpDriver:
+ Collaboration diagram for TcpDriver:

Detailed Description

TCP driver.

Note
TCP is much slower and less deterministic than UDP. When possible, it's strongly recommended that UDP be preferred over TCP.

Public Member Functions

 TcpDriver ()
 CTOR.
 
 ~TcpDriver ()
 DTOR. Closes any ongoing connection.
 
ErrorCode Connect (std::string_view ip, unsigned int timeout_ms)
 Connect to the ABS.
 
void Close () noexcept
 Close the connection to the ABS.
 
ErrorCode Write (std::string_view data, unsigned int timeout_ms) const
 Send data over TCP.
 
Result< std::string > ReadLine (unsigned int timeout_ms) const
 Read a line over TCP.
 
- 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

◆ Connect()

ErrorCode Connect ( std::string_view  ip,
unsigned int  timeout_ms 
)

Connect to the ABS.

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

◆ ReadLine()

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

Read a line over TCP.

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 TCP.

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: