We are trying to compile the console app at .html (also reproducing below in case the link goes dead in the future). However we are not able to find any (public) nuget package that contains the Ivi.Visa.Interop
namespace that is used in this program.
Searching for Ivi.Visa.Interop
gives us nothing, while searching for Ivi.Visa
gives
Kelary.Ivi.Visa
Ldx.Ni.Visa
IviFoundation.Visa
hyf.Ivi.Visa
but none of them contains the Ivi.Visa.Interop
namespace.
using System;
using System.IO;
using System.Net.Mail;
using Ivi.Visa.Interop;
namespace GetScreenshot_CSharp
{
class Program
{
// ***WARRANT DISCLAIMER*** --> This example is provided as an illustration "as is", and Keysight Technologies
// makes no warranty of any kind with regard to this example.
//This program uses the VISA-COM library which is installed with the Keysight IO Libraries Suite.
//The IO Suite can be found at www.keysight/find/iosuite
//You must add a reference to the VISA COM 3.0 (OR 5.2 or newer depending on IO Suite version) Type library by
//right-clicking on the project and selecting Add Reference.
//Modify the address to match your instrument.
//Address Examples (GPIB, RS-232, USB or LAN):
// GPIB0::22::INSTR
// ASRL1::INSTR
// USB0::0x0957::0x2007::MY49002286::0::INSTR
// TCPIP0::159.149.151.62::inst0::INSTR
// Address can also be a VISA Alias
// This example just saves the screenshot directly to your desktop and will overwrite any file with the same name.
//
// ****This example will work on the Keysight 3446xA DMM's, 33500/33600 ARB's and the 53200 series counters.****
public static void Main()
{
Ivi.Visa.Interop.ResourceManager rm = new Ivi.Visa.Interop.ResourceManager();
Ivi.Visa.Interop.FormattedIO488 ioobj = new Ivi.Visa.Interop.FormattedIO488();
string idnStr = null;
byte[] myImage = null;
string desktop = null;
try
{
//Open a session and get the IDN string
ioobj.IO = (Ivi.Visa.Interop.IMessage)rm.Open("USB0::0x0957::0x2C07::MY52814625::0::INSTR",
Ivi.Visa.Interop.AccessMode.EXCLUSIVE_LOCK, 0, "");
ioobj.WriteString("*IDN?", true);
idnStr = ioobj.ReadString();
Console.WriteLine("IDN response = " + idnStr);
Console.WriteLine("Hit Enter to Continue and get ARB screenshot");
Console.ReadLine();
//Upload the screenshot and write to a file on the desktop names test1.bmp
ioobj.WriteString("HCOPy:SDUMp:DATA:FORMat BMP", true);
ioobj.WriteString("HCOPy:SDUMp:DATA?", true);
myImage = ioobj.ReadIEEEBlock(Ivi.Visa.Interop.IEEEBinaryType.BinaryType_UI1);
desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
using (BinaryWriter writer = new BinaryWriter(File.Open((desktop + "\\test1.bmp"), FileMode.Create)))
{
foreach (byte value in myImage)
{
writer.Write(value);
}
}
Console.WriteLine("Hit Enter to Exit");
Console.ReadLine();
}
catch (Exception e)
{
Console.WriteLine("An error occurred: " + e.Message);
Console.WriteLine("Ensure you have the correct address for your instrument");
Console.WriteLine("Hit Enter to Exit");
Console.ReadLine();
}
finally
{
try { ioobj.IO.Close(); }
catch { }
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(ioobj);
}
catch { }
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(rm);
}
catch { }
}
}
}
}
How can we locate the nuget package corresponding to the Ivi.Visa.Interop
namespace?
Thanks in advance for the help
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744991030a4604905.html
评论列表(0条)