Reference Information for Remote Control
R&S
®
SMA100B
529
User Manual 1178.3834.02 ─ 03
A.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.
A.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
SMA100B 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 HostInfoStruct;
Telnet program examples