Send a SCPI command string to a device that is defined in the configuration file.

The section name of the device is used as the name of the device.

Parameters:

name

The name of the SCPI device as defined in the configuration file.

command

The SCPI command string to send to the device.

responseTimeout

The amount of time as a TimeSpan to wait for a response. This parameter is optional and if left out will use the default response timeout defined in the configuration file for the device. If the default response timeout is not included in the configuration file it is defaulted to 60 seconds.

Return Value:

The response from the SCPI command.

Note: While ATE Systems cal devices always respond with at least an "Ack" the PNA does not. Therefore calling this function using the name of a PNA will prefix the call with "*WAI"  and suffix the call with "*OPC?" in order to force a response from the PNA if the command does not end in a '?'.

Interface Signature:

string SendScpi(string name, string command, TimeSpan? responseTimeout = null);


An example of how this function is used is shown below.

using System;

namespace Example
{
   /// <summary>
   /// An simple example of how to send a SCPI command
   /// </summary>
   public class ExampleClass
   {
       /// <summary>
       /// Get the a identity string from a device
       /// </summary>
       public static string GetDeviceIdentity(string deviceName)
       {
           // Get a reference to the API interface
           AteSystems.InCal.IApi api = AteSystems.InCal.API.Initialize(@"C:\Temp\MyConfig.ini", catchExceptions:false);
           // Call the API function
           return api.SendScpi(deviceName, "*IDN?");
       }
   }
}