ABS SCPI Driver 0.2.0
ABS SCPI driver library
|
UDP multicast driver for addressing multiple units at the same time. More...
#include <UdpMulticastDriver.h>
UDP multicast driver for addressing multiple units at the same time.
Classes | |
struct | AddressedResponse |
Structure containing a response and the IP from which it was received. More... | |
Public Member Functions | |
UdpMcastDriver () | |
CTOR. | |
~UdpMcastDriver () | |
DTOR. | |
ErrorCode | Open (std::string_view interface_ip) |
Open a socket for communication with the ABS. | |
void | Close () noexcept |
Close the socket. | |
ErrorCode | Write (std::string_view data, unsigned int timeout_ms) const |
Send data over UDP multicast. | |
Result< std::string > | ReadLine (unsigned int timeout_ms) const |
Read a line over UDP multicast. | |
Result< AddressedResponse > | ReadLineFrom (unsigned int timeout_ms) const |
Read a line over UDP multicast, returning the line and the sender's IP address. | |
bool | IsSendOnly () const |
Whether the device is send-only in the general case. | |
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. | |
|
inlinevirtual |
Whether the device is send-only in the general case.
Always true for multicast devices.
Reimplemented from CommDriver.
ErrorCode Open | ( | std::string_view | interface_ip | ) |
Open a socket for communication with the ABS.
[in] | interface_ip | address of local interface to bind to |
|
virtual |
Read a line over UDP multicast.
This is not a very useful function with multicast, as there may be many responses to one query. See ReadLineFrom() for a more useful function.
[in] | timeout_ms | read timeout in milliseconds |
Implements CommDriver.
Result< AddressedResponse > ReadLineFrom | ( | unsigned int | timeout_ms | ) | const |
Read a line over UDP multicast, returning the line and the sender's IP address.
This is primarily intended to be used for device discovery.
[in] | timeout_ms | read timeout in milliseconds |
|
virtual |
Send data over UDP multicast.
[in] | data | data to send |
[in] | timeout_ms | send timeout in milliseconds |
Implements CommDriver.