Utilities#
Common utility interface for every driver. Access it through driver.Utilities.
- RsSmw_Utilities Utilities#
var utils = driver.Utilities;
Utility functions common for all instrument drivers.
Status and synchronization#
- bool QueryOpc ( )#
// SCPI: *OPC? bool complete = driver.Utilities.QueryOpc();SCPI command
*OPC?. Waits until the instrument reports operation complete. Exceptions:VisaException,VisaTimeoutException.
- bool QueryOpc ( int visaTimeout )
// SCPI: *OPC? bool complete = driver.Utilities.QueryOpc(3000);Same as
QueryOpc().visaTimeoutis used only for this call, then the previous VISA timeout is restored. Exceptions:VisaException,VisaTimeoutException.
- bool InstrumentStatusChecking#
bool checking = driver.Utilities.InstrumentStatusChecking; driver.Utilities.InstrumentStatusChecking = true;
When true (default), driver methods send
SYST:ERR?after each command and throw if the instrument reports an error. Keep status checking on. Switch it off only when you need maximum speed.
- bool OpcQueryAfterEachSetting#
driver.Utilities.OpcQueryAfterEachSetting = true;
When true (default is false), the driver sends
*OPC?after every write. Queries are left unchanged. Use it when the sequence must run command after command.
- void ClearStatus ( )#
driver.Utilities.ClearStatus();
Clears the instrument status system, the session I/O buffers, and the instrument error queue. Exceptions:
VisaException,VisaTimeoutException,RsSmwException.
- string QueryOldestError ( )#
// SCPI: SYSTem:ERRor? string error = driver.Utilities.QueryOldestError();SCPI command
SYSTem:ERRor?. Reads and deletes the oldest error and returns its message. An empty queue returnsNo Error. Exceptions:VisaException,VisaTimeoutException.
- IEnumerable<string>QueryAllErrors ( )#
// SCPI: SYSTem:ERRor? IEnumerable<string> errors = driver.Utilities.QueryAllErrors();SCPI command
SYSTem:ERRor?. Reads and clears the error queue, from the oldest error to the newest. An empty queue returns an empty list. Exceptions:VisaException,VisaTimeoutException.
- void CheckStatus ( )#
driver.Utilities.CheckStatus();
Throws
InstrumentStatusExceptionwhen the instrument error queue is not empty. Exceptions:VisaException,VisaTimeoutException,InstrumentStatusException.
- void Reset ( )#
// SCPI: *RST driver.Utilities.Reset();SCPI command
*RST. Clears the status, sends the reset, waits until it finishes, and callsDefaultInstrumentSetup(). Exceptions:VisaException,VisaTimeoutException,RsSmwException,InstrumentStatusException.
- void DefaultInstrumentSetup ( )#
driver.Utilities.DefaultInstrumentSetup();
Custom steps performed when the session opens and when
Reset()is called.
- int SelfTest ( )#
// SCPI: *TST? int result = driver.Utilities.SelfTest();SCPI command
*TST?. Returns the self-test result code. 0 means the self-test passed. Exceptions:VisaException,VisaTimeoutException,RsSmwException,InstrumentStatusException.
- int SelfTest ( int selftestTimeout )
// SCPI: *TST? int result = driver.Utilities.SelfTest(60000);Same as
SelfTest(), with the timeout in milliseconds. Exceptions:VisaException,VisaTimeoutException,RsSmwException,InstrumentStatusException.
- int OpcTimeout#
int timeout = driver.Utilities.OpcTimeout; driver.Utilities.OpcTimeout = 10000;
Timeout in milliseconds for operations that use OPC synchronization.
- int VisaTimeout#
int timeout = driver.Utilities.VisaTimeout; driver.Utilities.VisaTimeout = 3000;
VISA session timeout in milliseconds.
- void ProcessAllPreviousCommands ( )#
// SCPI: *WAI driver.Utilities.ProcessAllPreviousCommands();SCPI command
*WAI. Stops further command processing until the instrument has executed the commands sent before*WAI. Exceptions:VisaException,RsSmwException,InstrumentStatusException.
- int IoSegmentSize#
int size = driver.Utilities.IoSegmentSize; driver.Utilities.IoSegmentSize = 100000;
Size of one transferred data segment. Larger transfers are split into segments of this size.
String I/O#
- void WriteString ( string command )#
driver.Utilities.WriteString("*RST");Writes a command. Exceptions:
VisaException,VisaTimeoutException,InstrumentStatusException.
- void Write ( string command )#
driver.Utilities.Write("*RST");Alias of
WriteString(). Exceptions:VisaException,VisaTimeoutException,InstrumentStatusException.
- void WriteStringWithOpc ( string command, Nullable<int>timeoutMs = null )#
driver.Utilities.WriteStringWithOpc("INIT", 3000);Writes a command and waits until it has been executed. If
timeoutMsis null, -1, or 0, the current OPC timeout is used. Exceptions:VisaException,VisaTimeoutException,OperationTimeoutException,InstrumentStatusException.
- void WriteWithOpc ( string command, Nullable<int>timeoutMs = null )#
driver.Utilities.WriteWithOpc("INIT", 3000);Alias of
WriteStringWithOpc(). IftimeoutMsis null, -1, or 0, the current OPC timeout is used. Exceptions:VisaException,VisaTimeoutException,OperationTimeoutException,InstrumentStatusException.
- string QueryString ( string query )#
string idn = driver.Utilities.QueryString("*IDN?");Sends a query and returns the response as a string. Trailing termination characters are removed. The response length is not limited.
- string Query ( string query )#
string idn = driver.Utilities.Query("*IDN?");Alias of
QueryString().
- List<string>QueryStringList ( string query )#
List<string> values = driver.Utilities.QueryStringList("SYST:ERR:ALL?");Sends a query and returns the comma-separated response as a string list. Each element is trimmed of paired quotes and trailing spaces. An empty response returns an empty list.
- string QueryStringWithOpc ( string query, Nullable<int>timeoutMs = null )#
string value = driver.Utilities.QueryStringWithOpc("FETCH:MEASUREMENT?", 3000);OPC-synchronized query. The response is a string with trailing termination characters removed. If
timeoutMsis null, -1, or 0, the current OPC timeout is used. Exceptions:VisaException,VisaTimeoutException,OperationTimeoutException,InstrumentStatusException.
- string QueryWithOpc ( string query, Nullable<int>timeoutMs = null )#
string value = driver.Utilities.QueryWithOpc("FETCH:MEASUREMENT?", 3000);Alias of
QueryStringWithOpc(). IftimeoutMsis null, -1, or 0, the current OPC timeout is used. Exceptions:VisaException,VisaTimeoutException,OperationTimeoutException,InstrumentStatusException.
- List<string>QueryStringListWithOpc ( string query, Nullable<int>timeoutMs = null )#
List<string> values = driver.Utilities.QueryStringListWithOpc("SYST:ERR:ALL?", 3000);OPC-synchronized query. The response is a string list. Each element is trimmed of paired quotes and trailing spaces. If
timeoutMsis null, -1, or 0, the current OPC timeout is used. An empty response returns an empty list.
- bool QueryBool ( string query )#
bool output = driver.Utilities.QueryBool("SOURCE:RF:OUTPUT:STATE?");Sends a query and returns the response as a boolean. Exceptions:
VisaException,VisaTimeoutException,InstrumentStatusException.
- List<bool>QueryBooleanList ( string query )#
List<bool> states = driver.Utilities.QueryBooleanList("SOURCE:RF:OUTPUT:STATE?");Sends a query and returns the comma-separated response as a boolean list.
- bool QueryBooleanWithOpc ( string query, Nullable<int>timeoutMs = null )#
bool output = driver.Utilities.QueryBooleanWithOpc("SOURCE:RF:OUTPUT:STATE?", 3000);OPC-synchronized query. The response is a boolean. If
timeoutMsis null, -1, or 0, the current OPC timeout is used. Exceptions:VisaException,VisaTimeoutException,OperationTimeoutException,InstrumentStatusException.
- List<bool>QueryBooleanListWithOpc ( string query, Nullable<int>timeoutMs = null )#
List<bool> states = driver.Utilities.QueryBooleanListWithOpc("SOURCE:RF:OUTPUT:STATE?", 3000);OPC-synchronized query. The response is a boolean list. If
timeoutMsis null, -1, or 0, the current OPC timeout is used. Exceptions:VisaException,VisaTimeoutException,OperationTimeoutException,InstrumentStatusException.
- double QueryDouble ( string query )#
double frequency = driver.Utilities.QueryDouble("SOURCE:RF:FREQUENCY?");Sends a query and returns the response as a double. Exceptions:
VisaException,VisaTimeoutException,InstrumentStatusException.
- double QueryDoubleWithOpc ( string query, Nullable<int>timeoutMs = null )#
double frequency = driver.Utilities.QueryDoubleWithOpc("SOURCE:RF:FREQUENCY?", 3000);OPC-synchronized query. The response is a double. If
timeoutMsis null, -1, or 0, the current OPC timeout is used. Exceptions:VisaException,VisaTimeoutException,OperationTimeoutException,InstrumentStatusException.
- int QueryInteger ( string query )#
int count = driver.Utilities.QueryInteger("SWEEP:COUNT?");Sends a query and returns the response as an integer. Exceptions:
VisaException,VisaTimeoutException,InstrumentStatusException.
- int QueryIntegerWithOpc ( string query, Nullable<int>timeoutMs = null )#
int count = driver.Utilities.QueryIntegerWithOpc("SWEEP:COUNT?", 3000);OPC-synchronized query. The response is an integer. If
timeoutMsis null, -1, or 0, the current OPC timeout is used. Exceptions:VisaException,VisaTimeoutException,InstrumentStatusException.
- string ReadString ( int maxLen, out bool moreDataAvailable )#
string text = driver.Utilities.ReadString(1024, out bool moreDataAvailable);
Reads from the instrument output buffer until a termination character or
maxLenis reached.moreDataAvailableis true when the buffer still holds data. Termination characters are kept, and instrument error checking is skipped.
- string ReadString ( int maxLen )
string text = driver.Utilities.ReadString(1024);
Reads from the instrument output buffer until a termination character or
maxLenis reached. Termination characters are kept, and instrument error checking is skipped.
- string Read ( int maxLen, out bool moreDataAvailable )#
string text = driver.Utilities.Read(1024, out bool moreDataAvailable);
Alias of
ReadString(int, out bool).
- string Read ( int maxLen )
string text = driver.Utilities.Read(1024);
Alias of
ReadString(int).
- string ReadString ( )
string text = driver.Utilities.ReadString();
Reads the instrument output buffer without sending a command. The response length is not limited. Use it only in special cases.
- string Read ( )
string text = driver.Utilities.Read();
Alias of
ReadString(). Use it only in special cases.
Session#
- bool HasOptionInstalled ( string option )#
bool installed = driver.Utilities.HasOptionInstalled("K0");Returns true when the instrument has the entered option installed.
- void AssignLock ( object locker )#
driver2.Utilities.AssignLock(driver.Utilities.GetLock());
Assigns the locking object used to synchronise several driver objects that share one instrument.
- object GetLock ( )#
object locker = driver.Utilities.GetLock();
Returns the locking object of this session.
- void GoToLocal ( )#
driver.Utilities.GoToLocal();
Switches the instrument to local.
- void GoToRemote ( )#
driver.Utilities.GoToRemote();
Switches the instrument to remote.
- bool IsConnectionActive ( )#
bool active = driver.Utilities.IsConnectionActive();
Returns true when the VISA connection is active and the instrument still answers.
- bool Reconnect ( bool forceClose )#
bool reconnected = driver.Utilities.Reconnect(false);
Reopens the session when the connection is down. When the connection is active and
forceCloseis false, the method does nothing. WhenforceCloseis true, the session is closed and opened again. Returns true when a reconnection was performed.
- uint ReadStb ( )#
uint stb = driver.Utilities.ReadStb();
Returns the raw status byte.
Identification#
driver.Utilities.Identification returns the driver and instrument identification.
- IdnGroup Identification#
var idn = driver.Utilities.Identification;
Identification members.
- class IdnGroup
Driver and instrument identification.
- Version DriverVersion#
Version version = driver.Utilities.Identification.DriverVersion;
Instrument driver version.
- Version CoreVersion#
Version version = driver.Utilities.Identification.CoreVersion;
Instrument core engine version.
- string IdnString#
// SCPI: *IDN? string idn = driver.Utilities.Identification.IdnString;Response of
*IDN?.
- string Manufacturer#
string manufacturer = driver.Utilities.Identification.Manufacturer;
Manufacturer of the instrument.
- string InstrumentFullName#
string name = driver.Utilities.Identification.InstrumentFullName;
Full instrument model name, for example
FSW26.
- string InstrumentName#
string name = driver.Utilities.Identification.InstrumentName;
Instrument family name, for example
FSW.
- string ResourceName#
string resource = driver.Utilities.Identification.ResourceName;
Resource name used to open the session.
- IEnumerable<string>SupportedModels#
IEnumerable<string> models = driver.Utilities.Identification.SupportedModels;
Instrument models supported by this driver.
- string InstrumentFirmwareVersion#
string firmware = driver.Utilities.Identification.InstrumentFirmwareVersion;
Instrument firmware revision.
- string InstrumentSerialNumber#
string serial = driver.Utilities.Identification.InstrumentSerialNumber;
Instrument serial number.
- IEnumerable<string>InstrumentOptions#
IEnumerable<string> options = driver.Utilities.Identification.InstrumentOptions;
Installed instrument options, sorted from K-options to B-options.
- string VisaManufacturer#
string vendor = driver.Utilities.Identification.VisaManufacturer;
Manufacturer of the VISA used by this session.
- string VisaDllName#
string dll = driver.Utilities.Identification.VisaDllName;
VISA DLL name, including the bitness.
Binary data#
driver.Utilities.Binary reads and writes binary data.
- BinaryGroup Binary#
var binary = driver.Utilities.Binary;
Binary data members.
- class BinaryGroup
Binary data I/O.
- InstrBinaryFloatNumbersFormat FloatNumbersFormat#
var format = driver.Utilities.Binary.FloatNumbersFormat; driver.Utilities.Binary.FloatNumbersFormat = InstrBinaryFloatNumbersFormat.Single4Bytes;
Coding of floating-point numbers in binary data. A swapped value means the instrument endianness differs from the control PC. Values:
Single4Bytes,Single4BytesSwapped,Double8Bytes,Double8BytesSwapped.
- InstrBinaryIntegerNumbersFormat IntegerNumbersFormat#
var format = driver.Utilities.Binary.IntegerNumbersFormat; driver.Utilities.Binary.IntegerNumbersFormat = InstrBinaryIntegerNumbersFormat.Integer324Bytes;
Coding of integer numbers in binary data. A swapped value means the instrument endianness differs from the control PC. Values:
Integer324Bytes,Integer324BytesSwapped,Integer162Bytes,Integer162BytesSwapped.
- void WriteData ( string command, byte[] binaryData )#
driver.Utilities.Binary.WriteData("MMEM:DATA '/var/user/data.bin',", data);Sends
command, a binary-data header, andbinaryData. Exceptions:VisaException,VisaTimeoutException,InstrumentStatusException.
- void WriteData ( string command, Stream stream )
driver.Utilities.Binary.WriteData("MMEM:DATA '/var/user/data.bin',", stream);Sends
command, a binary-data header, and the bytes fromstream. Exceptions:VisaException,VisaTimeoutException,InstrumentStatusException.
- void WriteBytes ( byte[] data )#
driver.Utilities.Binary.WriteBytes(data);
Writes
dataas it is, without a binary-data header. Instrument error checking is skipped.
- void ReadBytes ( Stream stream, int maxLen )#
driver.Utilities.Binary.ReadBytes(stream, 1024);
Reads up to
maxLenbytes intostream. Instrument error checking is skipped.
- byte[] ReadBytes ( int maxLen )
byte[] data = driver.Utilities.Binary.ReadBytes(1024);
Reads up to
maxLenbytes. Instrument error checking is skipped.
- void QueryData ( string query, Stream stream )#
driver.Utilities.Binary.QueryData("MMEM:DATA? '/var/user/data.bin'", stream);Queries binary data into
stream. Exceptions:VisaException,VisaTimeoutException,RsSmwException,InstrumentStatusException.
- byte[] QueryData ( string query )
byte[] data = driver.Utilities.Binary.QueryData("MMEM:DATA? '/var/user/data.bin'");Queries binary data and returns a byte array. Exceptions:
VisaException,VisaTimeoutException,RsSmwException,InstrumentStatusException.
- byte[] QueryDataWithOpc ( string query, Nullable<int>timeoutMs = null )#
byte[] data = driver.Utilities.Binary.QueryDataWithOpc("MMEM:DATA? '/var/user/data.bin'", 3000);Queries binary data with OPC synchronization. If
timeoutMsis null, -1, or 0, the current OPC timeout is used. Exceptions:VisaException,VisaTimeoutException,OperationTimeoutException,RsSmwException,InstrumentStatusException.
- void QueryDataWithOpc ( string query, Stream stream, Nullable<int>timeoutMs = null )
driver.Utilities.Binary.QueryDataWithOpc("MMEM:DATA? '/var/user/data.bin'", stream, 3000);Queries binary data with OPC synchronization and writes it to
stream. IftimeoutMsis null, -1, or 0, the current OPC timeout is used. Exceptions:VisaException,VisaTimeoutException,OperationTimeoutException,RsSmwException,InstrumentStatusException.
- double[] QueryBinOrAsciiFloatArray ( string query )#
double[] values = driver.Utilities.Binary.QueryBinOrAsciiFloatArray("TRAC? TRACE1");Queries floating-point numbers in ASCII or binary format and returns them as a double array. Exceptions:
VisaException,VisaTimeoutException,InstrumentStatusException.
- double[] QueryBinOrAsciiFloatArrayWithOpc ( string query, Nullable<int>timeoutMs = null )#
double[] values = driver.Utilities.Binary.QueryBinOrAsciiFloatArrayWithOpc("TRAC? TRACE1", 3000);Same as
QueryBinOrAsciiFloatArray(), with OPC synchronization. IftimeoutMsis null, -1, or 0, the current OPC timeout is used. Exceptions:VisaException,VisaTimeoutException,OperationTimeoutException,InstrumentStatusException.
- float[] QueryBinOrAsciiSingleFloatArray ( string query )#
float[] values = driver.Utilities.Binary.QueryBinOrAsciiSingleFloatArray("TRAC? TRACE1");Queries floating-point numbers in ASCII or binary format and returns them as a float array. Throws when
FloatNumbersFormatisDouble8BytesorDouble8BytesSwapped. Exceptions:VisaException,VisaTimeoutException,RsSmwException,InstrumentStatusException.
- float[] QueryBinOrAsciiSingleFloatArrayWithOpc ( string query, Nullable<int>timeoutMs = null )#
float[] values = driver.Utilities.Binary.QueryBinOrAsciiSingleFloatArrayWithOpc("TRAC? TRACE1", 3000);Same as
QueryBinOrAsciiSingleFloatArray(), with OPC synchronization. IftimeoutMsis null, -1, or 0, the current OPC timeout is used. Exceptions:VisaException,VisaTimeoutException,OperationTimeoutException,RsSmwException,InstrumentStatusException.
- int[] QueryBinOrAsciiIntegerArray ( string query )#
int[] values = driver.Utilities.Binary.QueryBinOrAsciiIntegerArray("TRAC? TRACE1");Queries integer numbers in ASCII or binary format and returns them as an int array. ASCII values are comma-separated. Binary values use
IntegerNumbersFormat. Exceptions:VisaException,VisaTimeoutException,RsSmwException,InstrumentStatusException.
- int[] QueryBinOrAsciiIntergerArrayWithOpc ( string query, Nullable<int>timeoutMs = null )#
int[] values = driver.Utilities.Binary.QueryBinOrAsciiIntergerArrayWithOpc("TRAC? TRACE1", 3000);Same as
QueryBinOrAsciiIntegerArray(), with OPC synchronization. IftimeoutMsis null, -1, or 0, the current OPC timeout is used. Exceptions:VisaException,VisaTimeoutException,OperationTimeoutException,RsSmwException,InstrumentStatusException.
Mixed data#
driver.Utilities.Mixed reads responses that start with an ASCII part and continue with binary data.
- MixedGroup Mixed#
var mixed = driver.Utilities.Mixed;
Mixed ASCII and binary data members.
- class MixedGroup
Mixed ASCII and binary data I/O.
- char AsciiBinDataSeparator#
char separator = driver.Utilities.Mixed.AsciiBinDataSeparator; driver.Utilities.Mixed.AsciiBinDataSeparator = ',';
Separator between the ASCII part and the binary part. The default is a comma.
- int MaxAsciiLength#
int length = driver.Utilities.Mixed.MaxAsciiLength; driver.Utilities.Mixed.MaxAsciiLength = 12;
Maximum size of the ASCII part. The default is 12 characters. Set this to 0 to treat the whole response as binary data.
- string ResponseAsciiPart#
string ascii = driver.Utilities.Mixed.ResponseAsciiPart;
ASCII part of the most recent mixed response.
- void QueryMixedData ( string query, Stream stream )#
driver.Utilities.Mixed.QueryMixedData("TRAC? TRACE1", stream);Queries mixed data and writes the binary part to
stream. Exceptions:VisaException,VisaTimeoutException,RsSmwException,InstrumentStatusException.
- byte[] QueryMixedData ( string query )
byte[] data = driver.Utilities.Mixed.QueryMixedData("TRAC? TRACE1");Queries mixed data and returns the binary part as a byte array. Exceptions:
VisaException,VisaTimeoutException,RsSmwException,InstrumentStatusException.
- byte[] QueryMixedDataWithOpc ( string query, Nullable<int>timeoutMs = null )#
byte[] data = driver.Utilities.Mixed.QueryMixedDataWithOpc("TRAC? TRACE1", 3000);Queries mixed data with OPC synchronization and returns the binary part. If
timeoutMsis null, -1, or 0, the current OPC timeout is used. Exceptions:VisaException,VisaTimeoutException,OperationTimeoutException,RsSmwException,InstrumentStatusException.
- void QueryMixedDataWithOpc ( string query, Stream stream, Nullable<int>timeoutMs = null )
driver.Utilities.Mixed.QueryMixedDataWithOpc("TRAC? TRACE1", stream, 3000);Queries mixed data with OPC synchronization and writes the binary part to
stream. IftimeoutMsis null, -1, or 0, the current OPC timeout is used. Exceptions:VisaException,VisaTimeoutException,OperationTimeoutException,RsSmwException,InstrumentStatusException.
- double[] QueryMixedBinOrAsciiFloatArray ( string query )#
double[] values = driver.Utilities.Mixed.QueryMixedBinOrAsciiFloatArray("TRAC? TRACE1");Queries floating-point numbers from a mixed response and returns them as a double array. Exceptions:
VisaException,VisaTimeoutException,InstrumentStatusException.
- double[] QueryMixedBinOrAsciiFloatArrayWithOpc ( string query, Nullable<int>timeoutMs = null )#
double[] values = driver.Utilities.Mixed.QueryMixedBinOrAsciiFloatArrayWithOpc("TRAC? TRACE1", 3000);Same as
QueryMixedBinOrAsciiFloatArray(), with OPC synchronization. IftimeoutMsis null, -1, or 0, the current OPC timeout is used. Exceptions:VisaException,VisaTimeoutException,OperationTimeoutException,InstrumentStatusException.
- float[] QueryMixedBinOrAsciiSingleFloatArray ( string query )#
float[] values = driver.Utilities.Mixed.QueryMixedBinOrAsciiSingleFloatArray("TRAC? TRACE1");Queries floating-point numbers from a mixed response and returns them as a float array. Throws when the binary float format is
Double8BytesorDouble8BytesSwapped. Exceptions:VisaException,VisaTimeoutException,RsSmwException,InstrumentStatusException.
- float[] QueryMixedBinOrAsciiSingleFloatArrayWithOpc ( string query, Nullable<int>timeoutMs = null )#
float[] values = driver.Utilities.Mixed.QueryMixedBinOrAsciiSingleFloatArrayWithOpc("TRAC? TRACE1", 3000);Same as
QueryMixedBinOrAsciiSingleFloatArray(), with OPC synchronization. IftimeoutMsis null, -1, or 0, the current OPC timeout is used. Exceptions:VisaException,VisaTimeoutException,OperationTimeoutException,RsSmwException,InstrumentStatusException.
- int[] QueryMixedBinOrAsciiIntegerArray ( string query )#
int[] values = driver.Utilities.Mixed.QueryMixedBinOrAsciiIntegerArray("TRAC? TRACE1");Queries integer numbers from a mixed response and returns them as an int array. ASCII values are comma-separated. Binary values use
IntegerNumbersFormat. Exceptions:VisaException,VisaTimeoutException,RsSmwException,InstrumentStatusException.
- int[] QueryMixedBinOrAsciiIntergerArrayWithOpc ( string query, Nullable<int>timeoutMs = null )#
int[] values = driver.Utilities.Mixed.QueryMixedBinOrAsciiIntergerArrayWithOpc("TRAC? TRACE1", 3000);Same as
QueryMixedBinOrAsciiIntegerArray(), with OPC synchronization. IftimeoutMsis null, -1, or 0, the current OPC timeout is used. Exceptions:VisaException,VisaTimeoutException,OperationTimeoutException,RsSmwException,InstrumentStatusException.
Events#
driver.Utilities.Events reports transfer progress and OPC completion.
- EventsGroup Events#
var events = driver.Utilities.Events;
Event members.
- class EventsGroup
Event handlers for data transfer and OPC completion.
- EventHandler<InstrSegmentEventArgs>ReadSegmentHandler#
driver.Utilities.Events.ReadSegmentHandler = MyHandler;
Called after each read segment. The segment size is
IoSegmentSize.
- EventHandler<InstrSegmentEventArgs>WriteSegmentHandler#
driver.Utilities.Events.WriteSegmentHandler = MyHandler;
Called after each write segment. The segment size is
IoSegmentSize.
- EventHandler<InstrEventArgs>WriteWithOpcHandler#
driver.Utilities.Events.WriteWithOpcHandler = MyHandler;
Handler for write-with-OPC events.
- EventHandler<InstrEventArgs>QueryWithOpcHandler#
driver.Utilities.Events.QueryWithOpcHandler = MyHandler;
Handler for query-with-OPC events. The response is in
InstrEventArgs.Data.
- EventHandler<InstrEventArgs>InstrumentErrorHandler#
driver.Utilities.Events.InstrumentErrorHandler = MyHandler;
Called when the instrument reports an error.
- EventHandler<InstrEventArgs>InstrumentOperationRegisterHandler#
driver.Utilities.Events.InstrumentOperationRegisterHandler = MyHandler;
Called when the operation status register generates an event.
- EventHandler<InstrEventArgs>InstrumentQuestionableRegisterHandler#
driver.Utilities.Events.InstrumentQuestionableRegisterHandler = MyHandler;
Called when the questionable status register generates an event.
- void WriteStringWithOpc ( string command )
driver.Utilities.Events.WriteStringWithOpc("INIT");Writes
commandand callsWriteWithOpcHandlerwhen the operation has completed.
- void QueryStringWithOpc ( string query )
driver.Utilities.Events.QueryStringWithOpc("*IDN?");Sends
queryand callsQueryWithOpcHandlerwhen the operation has completed. The response is inInstrEventArgs.Data.
- void QueryBinaryDataWithOpc ( string query )#
driver.Utilities.Events.QueryBinaryDataWithOpc("MMEM:DATA? '/var/user/data.bin'");Queries binary data and calls
QueryWithOpcHandlerwhen the operation has completed. The response is inInstrEventArgs.Data.
- void QueryBinaryOrAsciiFloatArrayWithOpc ( string query )#
driver.Utilities.Events.QueryBinaryOrAsciiFloatArrayWithOpc("TRAC? TRACE1");Queries a double array, in ASCII or binary format, and calls
QueryWithOpcHandlerwhen the response arrives.InstrEventArgs.Datais adouble[]. Binary decoding usesFloatNumbersFormat.
- void QueryBinaryOrAsciiSingleFloatArrayWithOpc ( string query )#
driver.Utilities.Events.QueryBinaryOrAsciiSingleFloatArrayWithOpc("TRAC? TRACE1");Queries a float array, in ASCII or binary format, and calls
QueryWithOpcHandlerwhen the response arrives.InstrEventArgs.Datais afloat[]. Binary decoding usesFloatNumbersFormat.
- void QueryBinaryOrAsciiIntgerArrayWithOpc ( string query )#
driver.Utilities.Events.QueryBinaryOrAsciiIntgerArrayWithOpc("TRAC? TRACE1");Queries an int array, in ASCII or binary format, and calls
QueryWithOpcHandlerwhen the response arrives.InstrEventArgs.Datais anint[]. ASCII values are comma-separated. Binary decoding usesIntegerNumbersFormat.
File transfer#
driver.Utilities.File copies files between the PC and the instrument.
- FileGroup File#
var file = driver.Utilities.File;
File-transfer members.
- class FileGroup
File transfer between the PC and the instrument.
- void FromStreamToInstrument ( Stream sourceStream, string targetInstrFile )#
// SCPI: MMEM:DATA driver.Utilities.File.FromStreamToInstrument(stream, "/var/user/setup.sav");SCPI command
MMEM:DATA. Sends the stream to a file on the instrument. Exceptions:VisaException,VisaTimeoutException,RsSmwException,InstrumentStatusException.
- void FromPcToInstrument ( string sourcePcFile, string targetInstrFile )#
// SCPI: MMEM:DATA driver.Utilities.File.FromPcToInstrument(@"c:\temp\setup.sav", "/var/user/setup.sav");SCPI command
MMEM:DATA. Sends a PC file to the instrument. Exceptions:VisaException,VisaTimeoutException,RsSmwException,InstrumentStatusException.
- void FromInstrumentToStream ( string sourceInstrFile, Stream targetStream )#
// SCPI: MMEM:DATA? driver.Utilities.File.FromInstrumentToStream("/var/user/setup.sav", stream);SCPI command
MMEM:DATA?. Reads an instrument file into the stream. Exceptions:VisaException,VisaTimeoutException,RsSmwException,InstrumentStatusException.
- void FromInstrumentToPc ( string sourceInstrFile, string targetPcFile, bool appendToPcFile = false )#
// SCPI: MMEM:DATA? driver.Utilities.File.FromInstrumentToPc("/var/user/screen.png", @"c:\temp\screen.png");SCPI command
MMEM:DATA?. Reads an instrument file to the PC.appendToPcFileappends to an existing file. Exceptions:VisaException,VisaTimeoutException,RsSmwException,InstrumentStatusException.
Logging#
driver.Utilities.Logging records the SCPI communication.
- LoggingGroup Logging#
var logging = driver.Utilities.Logging;
Logging members.
- class LoggingGroup
SCPI communication log.
- bool Logging
bool enabled = driver.Utilities.Logging.Logging; driver.Utilities.Logging.Logging = true;
Switches logging on or off. Attach a stream with
AddStreamLogger()before switching it on.
- void AddStreamLogger ( Stream stream )#
driver.Utilities.Logging.AddStreamLogger(stream);
Adds a stream that receives the log.
- void RemoveStreamLogger ( Stream stream )#
driver.Utilities.Logging.RemoveStreamLogger(stream);
Removes a logging stream.
- void WriteStringToLog ( string logMessage )#
driver.Utilities.Logging.WriteStringToLog("measurement started");Writes a custom message to the log.