Class VisaModule
- Namespace
- Loehnert.Lisrt.Communication.Visa
- Assembly
- Loehnert.Lisrt.Communication.Visa.dll
Represents a LisRT module for a VISA connection.
public class VisaModule : LisrtModule, ICommunication, ILisrtModule, IInitializable, INotifyPropertyChangedEx, INotifyPropertyChanged, IHasServiceView
- Inheritance
-
PropertyChangedBaseVisaModule
- Implements
-
INotifyPropertyChangedEx
- Inherited Members
-
PropertyChangedBase.Refresh()PropertyChangedBase.IsNotifyingPropertyChangedBase.PropertyChanged
Remarks
Important
A VISA implementation must be installed.
Constructors
VisaModule(string)
Initializes a new instance of the VisaModule class.
public VisaModule(string name)
Parameters
name
stringModule name.
Remarks
Calls the VisaModule(string, IShell) constructor. IShell is resolved by the Caliburn.Micro.IoC.
VisaModule(string, IShell)
Initializes a new instance of the VisaModule class.
public VisaModule(string name, IShell shell)
Parameters
Exceptions
- ArgumentNullException
Thrown when
shell
is null.
Properties
CommunicationLogIsEnabled
Gets or sets a value indicating whether the communication log is enabled.
[Configuration(false, Description = "Enables the LisRT communication log")]
public bool CommunicationLogIsEnabled { get; set; }
Property Value
Encoding
Gets or sets the encoding for the communication.
public Encoding Encoding { get; set; }
Property Value
Remarks
Default is null.
Exceptions
- NotSupportedException
Throw when you try to set the property.
EndDelimiter
Throws a NotImplementedException.
public byte[] EndDelimiter { get; set; }
Property Value
- byte[]
Exceptions
- NotImplementedException
Throw when you try to get or set the property.
InitializationState
Gets the actual initialization state.
public InitializationState InitializationState { get; }
Property Value
IsConnected
Gets a value indicating whether the module is connected.
public bool IsConnected { get; }
Property Value
ResourceName
Gets or sets the resource name.
[Configuration("NotSet", Description = "Example: 'TCPIP::127.0.0.1::INSTR', http://zone.ni.com/reference/en-XX/help/370131S-01/ni-visa/visaresourcesyntaxandexamples/")]
public string ResourceName { get; set; }
Property Value
StartDelimiter
Throws a NotImplementedException.
public byte[] StartDelimiter { get; set; }
Property Value
- byte[]
Exceptions
- NotImplementedException
Throw when you try to get or set the property.
Timeout
Gets or sets the timeout in milliseconds.
[Configuration(5000, Unit = "ms")]
public int Timeout { get; set; }
Property Value
Methods
Close()
Closes the session.
public void Close()
Exit()
Exits the module and closes the session.
public void Exit()
Initialize()
Initializes the module.
public void Initialize()
Open()
Opens the session.
public void Open()
Exceptions
- NotSupportedException
Thrown when the Visa session is not of type Ivi.Visa.IMessageBasedSession.
Query(byte[], string)
Clears the received buffer, sends data and returns received data as bytes.
public byte[] Query(byte[] data, string logComment = "")
Parameters
Returns
- byte[]
The result data bytes.
Exceptions
- InvalidOperationException
Thrown when the Visa connection is not connected.
QueryString(string, string)
Clears the received buffer, sends data and returns received data.
public string QueryString(string data, string logComment = "")
Parameters
Returns
- string
The result data.
Exceptions
- InvalidOperationException
Thrown when the Visa connection is not connected.
Receive()
Receives the data bytes.
public byte[] Receive()
Returns
- byte[]
The received data bytes if buffer is not empty.
Exceptions
- InvalidOperationException
Thrown when the Visa connection is not connected.
ReceiveString()
Receives the data.
public string ReceiveString()
Returns
- string
The read data.
Exceptions
- InvalidOperationException
Thrown when the Visa connection is not connected.
Send(byte[], string)
Sends the raw data.
public void Send(byte[] data, string logComment = "")
Parameters
Exceptions
- InvalidOperationException
Thrown when the Visa connection is not connected.
SendString(string, string)
Sends the data.
public void SendString(string data, string logComment = "")
Parameters
Exceptions
- InvalidOperationException
Thrown when the Visa connection is not connected.
ShowServiceView()
Shows the service window.
public void ShowServiceView()
Events
DataReceived
This event will never be fired.
public event EventHandler<DataReceivedEventArgs> DataReceived