rohdeschwarz  0.2.0
TCPIP socket library for Rohde & Schwarz instrument control
Typedefs | Functions
main.cpp File Reference

conan test package source More...

#include "rohdeschwarz/busses/socket/socket.hpp"
#include "rohdeschwarz/instruments/instrument.hpp"
#include "rohdeschwarz/helpers.hpp"
#include <iostream>

Go to the source code of this file.

Typedefs

using system_error = rohdeschwarz::busses::socket::system_error
 
using Instrument = rohdeschwarz::instruments::Instrument
 

Functions

int main ()
 

Detailed Description

conan test package source

This source file is part of a conan test package for rohdeschwarz

// rohdeschwarz
// std lib
#include <iostream>
int main()
{
// connect to instrument
Instrument instrument;
if (instrument.openTcp("localhost"))
{
// connected
// get id
const auto id = rohdeschwarz::trim(instrument.id());
// print for debug
#ifndef NDEBUG
std::cout << "connected: " << id << std::endl;
#endif
}
else
{
// connection failed
// print for debug
#ifndef NDEBUG
std::cout << "error: connection to localhost failed" << std::endl;
#endif
}
return 0;
} // main
Object-oriented R&S Instrument control.
Definition: instrument.hpp:53
std::string id()
Queries instrument ID string.
Definition: instrument.cpp:256
bool openTcp(std::string host, unsigned int timeout_ms=2000)
Open tcp socket connection to an instrument.
Definition: instrument.cpp:57
void main()
Definition: main.cpp:19
rohdeschwarz helper function definition
rohdeschwarz::instruments::Instrument definition
boost::system::system_error system_error
System error exception.
Definition: socket.hpp:32
std::string trim(const std::string &text)
Trims whitespace beginning and end of string.
Definition: helpers.cpp:56
rohdeschwarz::busses::socket::Socket class definition
rohdeschwarz::busses::socket::system_error system_error
Definition: main.cpp:15
rohdeschwarz::instruments::Instrument Instrument
Definition: main.cpp:16

Definition in file main.cpp.

Typedef Documentation

◆ Instrument

Definition at line 16 of file main.cpp.

◆ system_error

Definition at line 15 of file main.cpp.

Function Documentation

◆ main()

int main ( )

Definition at line 23 of file main.cpp.