General Programming Recommendations; Telnet Program Examples - R&S SGT100A User Manual

Sgma vector rf source
Table of Contents

Advertisement

®
R&S
SGT100A

15.1.6 General Programming Recommendations

Initial instrument status before changing settings
Manual operation is designed for maximum possible operating convenience. In con-
trast, the priority of remote control is the "predictability" of the instrument status. Thus,
when a command attempts to define incompatible settings, the command is ignored
and the instrument status remains unchanged, i.e. other settings are not automatically
adapted. Therefore, control programs should always define an initial instrument status
(e.g. using the *RST command) and then implement the required settings.
Command sequence
As a general rule, send commands and queries in different program messages. Other-
wise, the result of the query may vary depending on which operation is performed first
(see also Preventing Overlapping Execution).
Reacting to malfunctions
The service request is the only possibility for the instrument to become active on its
own. Each controller program should instruct the instrument to initiate a service
request in case of malfunction. The program should react appropriately to the service
request.
Error queues
The error queue should be queried after every service request in the controller pro-
gram as the entries describe the cause of an error more precisely than the status regis-
ters. Especially in the test phase of a controller program the error queue should be
queried regularly since faulty commands from the controller to the instrument are
recorded there as well.

15.2 Telnet program examples

The following program example shows a simple TcpClient class that is intended to
explain on how to get started with programming of sockets.
The example sets up a socket communication to R&S SGT and opens a simple user
interface, very similar to the telnet, which allows input of commands. To enable real
automation, further development of the program is required.
TcpClient.h
#include <string>
//defines structs for socket handling
#include <netinet/in.h>
using namespace std;
typedef struct sockaddr_in SockAddrStruct;
typedef struct hostent
User Manual 1176.8674.02 ─ 07
HostInfoStruct;
Annex
Telnet program examples
546

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents