// Copyright Keysight Technologies 2012-2019
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at http://mozilla.org/MPL/2.0/.
using System;
using System.Text;
namespace OpenTap
{
///
/// Interface implemented by VISA libraries
///
[Obsolete($"Use {nameof(IVisaFunctionLoader)} instead.")]
public interface IVisa
{
/// Open default RM session
int viOpenDefaultRM(out int sesn);
/// Find device
int viFindRsrc(int sesn, string expr, out int vi, out int retCount, StringBuilder desc);
/// Find next device
int viFindNext(int vi, StringBuilder desc);
/// Parse resource string to get interface information
int viParseRsrc(int sesn, string desc, ref short intfType, ref short intfNum);
/// Parse resource string to get extended interface information
int viParseRsrcEx(int sesn, string desc, ref short intfType, ref short intfNum, StringBuilder rsrcClass, StringBuilder expandedUnaliasedName, StringBuilder aliasIfExists);
/// Open session
int viOpen(int sesn, string viDesc, int mode, int timeout, out int vi);
/// Close session
int viClose(int vi);
/// Get attribute, returning a byte
int viGetAttribute1(int vi, int attrName, out byte attrValue);
/// Get attribute, filling a pre-allocated StringBuilder buffer
int viGetAttribute2(int vi, int attrName, StringBuilder attrValue);
/// Get attribute, returning an int
int viGetAttribute3(int vi, int attrName, out int attrValue);
/// Set attribute, providing a byte value
int viSetAttribute1(int vi, int attrName, byte attrValue);
/// Set attribute, providing an int value
int viSetAttribute2(int vi, int attrName, int attrValue);
/// Get status code description
int viStatusDesc(int vi, int status, StringBuilder desc);
/// Enable event
int viEnableEvent(int vi, int eventType, short mechanism, int context);
/// Disable event
int viDisableEvent(int vi, int eventType, short mechanism);
/// Install handler
int viInstallHandler(int vi, int eventType, viEventHandler handler, int UserHandle);
/// Uninstall handler
int viUninstallHandler(int vi, int eventType, viEventHandler handler, int userHandle);
/// Read data from device
unsafe int viRead(int vi, ArraySegment buffer, int count, out int retCount);
/// Write data to device
unsafe int viWrite(int vi, ArraySegment buffer, int count, out int retCount);
/// Read status byte
int viReadSTB(int vi, ref short status);
/// Clear a device
int viClear(int vi);
/// Lock resource
int viLock(int vi, int lockType, int timeout, string requestedKey, StringBuilder accessKey);
/// Unlock resource
int viUnlock(int vi);
/// Event handler prototype
delegate int viEventHandler(int vi, int eventType, int context, int userHandle);
}
}