|
rohdeschwarz
0.2.0
TCPIP socket library for Rohde & Schwarz instrument control
|
Object-oriented R&S Instrument control. More...
#include <instrument.hpp>
Public Member Functions | |
| bool | isOpen () const |
| Check for an open connection to an instrument. More... | |
| bool | openVisa (std::string resource, unsigned int timeout_ms=2000) |
| Open VISA connection to instrument. More... | |
| bool | openTcp (std::string host, unsigned int timeout_ms=2000) |
| Open tcp socket connection to an instrument. More... | |
| void | close () |
| Close the connection to the instrument. More... | |
| std::size_t | bufferSize_B () const |
| void | setBufferSize (std::size_t size_bytes) |
| std::vector< unsigned char > * | buffer () |
| const std::vector< unsigned char > * | buffer () const |
| std::vector< unsigned char > | takeData () |
| int | timeout_ms () |
| Query IO timeout time, in milliseconds. More... | |
| bool | setTimeout (int timeout_ms) |
| Set IO timeout time. More... | |
| bool | readData (unsigned char *buffer, std::size_t bufferSize, std::size_t *readSize=nullptr) |
| bool | writeData (const unsigned char *data, std::size_t dataSize, std::size_t *writeSize=nullptr) |
| bool | readData (std::size_t *readSize=nullptr) |
| std::string | read () |
| template<class... Args> | |
| bool | write (std::string scpi_command, Args &&... args) |
| template<class... Args> | |
| std::string | query (std::string scpi_command, Args &&... args) |
| template<class OutputType > | |
| OutputType | readValue () |
| template<class OutputType , class... Args> | |
| OutputType | queryValue (std::string scpi_command, Args &&... args) |
| bool | readScpiBool () |
| template<class... Args> | |
| bool | queryScpiBool (std::string scpi_command, Args &&... args) |
| std::vector< double > | readAsciiVector () |
| reads ascii data and parses it into vector <double> More... | |
| std::vector< std::complex< double > > | readAsciiComplexVector () |
| reads ascii data and parses it into vector <complex <double>> More... | |
| scpi::BlockData | readBlockData () |
| Read Block Data. More... | |
| std::vector< double > | read64BitVector () |
| Reads block data and parses it into vector <double> More... | |
| std::vector< std::complex< double > > | read64BitComplexVector () |
| Reads block data and parses it into vector <complex <double>> More... | |
| bool | isBusError () const |
| Checks the bus status for an error. More... | |
| std::string | busStatus () const |
| Gets the bus status as a human-readable string. More... | |
| std::string | id () |
| Queries instrument ID string. More... | |
| std::string | options () |
| Queries instrument options string. More... | |
| void | clearErrors () |
| Clears SCPI errors. More... | |
| void | preset () |
| Perform instrument preset. More... | |
| void | wait () |
| Instructs instrument to perform previous SCPI commands before proceeding. More... | |
| bool | blockUntilOperationComplete (unsigned int timeout_ms=2000) |
| Queries *OPC? - block until operation complete. More... | |
Object-oriented R&S Instrument control.
rohdeschwarz::instruments::Instrument is a class for controlling any general purpose instrument with VISA and SCPI. It manages the VISA connection to the instrument. It also contains methods that wrap common SCPI commands that apply to all general purpose instruments.
Here is an example which demonstrates basic use:
Definition at line 52 of file instrument.hpp.
| bool Instrument::blockUntilOperationComplete | ( | unsigned int | timeout_ms = 2000 | ) |
Queries *OPC? - block until operation complete.
Definition at line 286 of file instrument.cpp.
| std::vector< unsigned char > * Instrument::buffer | ( | ) |
Definition at line 95 of file instrument.cpp.
| const std::vector< unsigned char > * Instrument::buffer | ( | ) | const |
Definition at line 100 of file instrument.cpp.
| std::size_t Instrument::bufferSize_B | ( | ) | const |
Definition at line 83 of file instrument.cpp.
| std::string Instrument::busStatus | ( | ) | const |
Gets the bus status as a human-readable string.
Definition at line 250 of file instrument.cpp.
| void Instrument::clearErrors | ( | ) |
Clears SCPI errors.
clearErrors sends SCPI command *CLS
Definition at line 268 of file instrument.cpp.
| void Instrument::close | ( | ) |
Close the connection to the instrument.
Definition at line 77 of file instrument.cpp.
| std::string Instrument::id | ( | ) |
Queries instrument ID string.
id uses SCPI query *IDN?
Definition at line 256 of file instrument.cpp.
| bool Instrument::isBusError | ( | ) | const |
Checks the bus status for an error.
Definition at line 244 of file instrument.cpp.
| bool Instrument::isOpen | ( | ) | const |
Check for an open connection to an instrument.
Definition at line 31 of file instrument.cpp.
| bool Instrument::openTcp | ( | std::string | host, |
| unsigned int | timeout_ms = 2000 |
||
| ) |
Open tcp socket connection to an instrument.
Attempts to connect to the instrument at host with a TCP socket on port 5025.
| [in] | host | host name or ip address |
| [in] | timeout_ms | open timeout time, in milliseconds |
true on success; false otherwise Definition at line 57 of file instrument.cpp.
| bool Instrument::openVisa | ( | std::string | resource, |
| unsigned int | timeout_ms = 2000 |
||
| ) |
Open VISA connection to instrument.
| [in] | resource | VISA resource string as a C++ style string |
| [in] | timeout_ms | open timeout time, in milliseconds |
true on success; false otherwise Definition at line 37 of file instrument.cpp.
| std::string Instrument::options | ( | ) |
Queries instrument options string.
options uses SCPI query *OPT?
Definition at line 262 of file instrument.cpp.
| void Instrument::preset | ( | ) |
Perform instrument preset.
reset sends SCPI command *RST
Definition at line 274 of file instrument.cpp.
|
inline |
Definition at line 173 of file instrument.hpp.
|
inline |
Definition at line 207 of file instrument.hpp.
|
inline |
Definition at line 197 of file instrument.hpp.
| std::string Instrument::read | ( | ) |
Definition at line 141 of file instrument.cpp.
| std::vector< std::complex< double > > Instrument::read64BitComplexVector | ( | ) |
Reads block data and parses it into vector <complex <double>>
Definition at line 229 of file instrument.cpp.
| std::vector< double > Instrument::read64BitVector | ( | ) |
Reads block data and parses it into vector <double>
Definition at line 214 of file instrument.cpp.
| std::vector< std::complex< double > > Instrument::readAsciiComplexVector | ( | ) |
reads ascii data and parses it into vector <complex <double>>
Definition at line 164 of file instrument.cpp.
| std::vector< double > Instrument::readAsciiVector | ( | ) |
reads ascii data and parses it into vector <double>
Definition at line 157 of file instrument.cpp.
| scpi::BlockData Instrument::readBlockData | ( | ) |
Read Block Data.
readBlockData reads data in IEEE 488.2 Block Data format.
Definition at line 171 of file instrument.cpp.
| bool Instrument::readData | ( | std::size_t * | readSize = nullptr | ) |
Definition at line 135 of file instrument.cpp.
| bool Instrument::readData | ( | unsigned char * | buffer, |
| std::size_t | bufferSize, | ||
| std::size_t * | readSize = nullptr |
||
| ) |
Definition at line 123 of file instrument.cpp.
| bool rohdeschwarz::instruments::Instrument::readScpiBool | ( | ) |
|
inline |
Definition at line 190 of file instrument.hpp.
| void Instrument::setBufferSize | ( | std::size_t | size_bytes | ) |
Definition at line 89 of file instrument.cpp.
| bool Instrument::setTimeout | ( | int | timeout_ms | ) |
Set IO timeout time.
| [in] | timeout_ms | timeout, in milliseconds |
Definition at line 117 of file instrument.cpp.
| std::vector< unsigned char > Instrument::takeData | ( | ) |
Definition at line 105 of file instrument.cpp.
| int Instrument::timeout_ms | ( | ) |
Query IO timeout time, in milliseconds.
Definition at line 111 of file instrument.cpp.
| void Instrument::wait | ( | ) |
Instructs instrument to perform previous SCPI commands before proceeding.
wait sends SCPI command *WAI
Definition at line 280 of file instrument.cpp.
|
inline |
Definition at line 142 of file instrument.hpp.
| bool Instrument::writeData | ( | const unsigned char * | data, |
| std::size_t | dataSize, | ||
| std::size_t * | writeSize = nullptr |
||
| ) |
Definition at line 129 of file instrument.cpp.