ABS SCPI Driver 0.2.0
ABS SCPI driver library
Loading...
Searching...
No Matches
CommDriver Class Referenceabstract

Base class for all ABS SCPI comm drivers. More...

#include <CommDriver.h>

+ Inheritance diagram for CommDriver:

Detailed Description

Base class for all ABS SCPI comm drivers.

Public Member Functions

virtual ErrorCode Write (std::string_view data, unsigned int timeout_ms) const =0
 Write data with a timeout.
 
virtual Result< std::string > ReadLine (unsigned int timeout_ms) const =0
 Read a line from the device with a timeout.
 
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

◆ GetDeviceID()

virtual unsigned int GetDeviceID ( ) const
inlinevirtual

Get the target device ID.

Not implemented by most drivers.

Returns
The target device ID.

Reimplemented in SerialDriver.

◆ IsSendOnly()

virtual bool IsSendOnly ( ) const
inlinevirtual

Determines whether a driver is send-only in the average case.

UDP multicast is always send-only, and RS-485 is send-only depending on the device ID.

Returns
Whether the driver is send-only.

Reimplemented in SerialDriver, and UdpMcastDriver.

◆ ReadLine()

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

Read a line from the device with a timeout.

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

Implemented in SerialDriver, TcpDriver, UdpDriver, and UdpMcastDriver.

◆ SetDeviceID()

virtual void SetDeviceID ( unsigned int  id)
inlinevirtual

Set the target device ID.

Not implemented by most drivers.

Parameters
[in]idthe device's serial ID 0-31, or 32+ to broadcast to all devices on the bus

Reimplemented in SerialDriver.

◆ Write()

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

Write data with a timeout.

The concrete driver type may or may not support a write timeout feature.

Parameters
[in]datadata to send
[in]timeout_mssend timeout in milliseconds (may be ignored by some drivers)
Returns
An error code.

Implemented in SerialDriver, TcpDriver, UdpDriver, and UdpMcastDriver.


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