Instrument
public protocol Instrument : AnyObject
A type that can communicated with via VISA.
-
The session associated with the instrument.
Declaration
Swift
var session: Session { get } -
A unique identifier for the instrument.
Declaration
Swift
var identifier: String { get } -
The time in seconds to wait before timing out when performing operations with the instrument.
Declaration
Swift
var timeout: TimeInterval { get set } -
The delegate for the instrument – used for managing events.
Declaration
Swift
var delegate: InstrumentDelegate? { get } -
The instrument’s dispatch queue that allows for running instrument code on another thread. Each instrument has a unique dispatch queue.
It is reccomended to run all code that interfaces with the instrument on this dispatch queue to prevent blocking the main thread when reading/writing data to/from the instrument. Doing so will prevent GUI hangs and also allows for communicating with multiple instruments at the same time. If one or more instruments need to wait on another instrument before doing work, you can run the code for the instruments on a single instrument’s dispatch queue.
Declaration
Swift
var dispatchQueue: DispatchQueue { get }
-
clear()Extension methodPerforms an IEEE-488.1-style clear of the device.
Declaration
Swift
func clear() throws -
close()Extension methodCloses the specified insturment. After the instrument has been closed, no more operations can be performed with the instrument.
Declaration
Swift
func close() throws
-
lock(_:timeout:)Extension methodLocks the instrument with the specified lock type and timeout.
Throws
One of the followingVISAErrorerrors:.invalidSession.resourceLocked.invalidLockType.invalidAccessKey.timeout
Note
Locks can be nested.Declaration
Swift
func lock(_ type: LockState.LockType, timeout: TimeInterval) throwsParameters
typeThe lock type to use.
timeoutThe time in seconds to wait before timing out.
-
unlock()Extension methodUnlocks the instrument if it is locked.
Note
Locks can be nested.Declaration
Swift
func unlock() throws
Instrument Protocol Reference