| Using VISA.NET > API Structure > Namespaces |
A full VISA.NET implementation, such as Keysight VISA.NET, includes two parts. One part is the standard API provided by the IVI Foundation. The other is the implementation, which may be provided by one of several test and measurement software vendors – in this case, by Keysight. Note that the IVI Foundation does not provide an implementation of VISA.NET.
In .NET, namespaces are used to remove any ambiguity about two elements that may have the same name. For example, if two software libraries (LibraryA and LibraryB) from different companies both define a class called IO, the two classes can be distinguished by prepending their namespace designations. Thus CompanyA.LibraryA.IO is distinguished from CompanyB.LibraryB.IO, and a single program can use both classes unambiguously. In this case, the namespaces also clearly indicate which company defined each class.
The IVI Foundation provides a standard API that defines a common programming experience for test system programmers across I/O protocols and vendors. This API is defined in the Ivi.Visa namespace. The Ivi.Visa namespace is contained in the Ivi.Visa.dll assembly which is distributed as part of the IVI Foundation VISA.NET Shared Components, which are installed by the Keysight IO Libraries Suite.
The Ivi.Visa namespace defines the standard VISA.NET API, which includes enumerations, interfaces, exceptions, events, and other API elements. It also includes a few classes that provide common functionality across vendor implementations. While at least one vendor's VISA.NET implementation (e.g., Keysight VISA.NET) must be installed in order for programs to use the Ivi.Visa API, a calling program can connect to a device by referencing only the IVI API defined in the Ivi.Visa namespace.
Keysight provides an implementation of the VISA.NET standard in the Keysight.Visa namespace. The Keysight.Visa namespace is contained in the Keysight.Visa.dll assembly, which is part of the Keysight IO Libraries Suite (version 17.2 or higher).
While it is possible for a calling program to connect to a device by referencing only the Ivi.Visa API, the actual communication with the device happens in the Keysight.Visa implementation code. The Keysight.Visa implementation exposes its functionality via the standard Ivi.Visa API, but all of the real work needed to communicate with a device happens in the Keysight.Visa implementation code.
In addition to supporting the Ivi.Visa API, Keysight VISA.NET also exposes some API features that are specific to the Keysight implementation. These specific features are defined in the Keysight.Visa namespace. Programs that wish to access these features usually need to reference both the Ivi.Visa and Keysight.Visa namespaces, because the Keysight specific features reference the IVI API extensively.
Note that the Getting Started Sample Code references both the Ivi.Visa and Keysight.Visa namespaces. The GpibSession class is defined in the Keysight.Visa namespace, while the IMessageBasedFormattedIO interface is part of the Ivi.Visa API.
The following code illustrates how the Getting Started Sample Code could be rewritten to access only the Ivi.Visa API. The operation and output are exactly the same. The GlobalResourceManager class is explained in more detail in Resource Managers and the GRM. You would write your code this way if you needed it to be portable across multiple vendors' VISA.NET implementations.