Class VisaModule
Represents a LisRT module for a VISA connection.
Implements
Inherited Members
Namespace: Loehnert.Lisrt.Communication.Visa
Assembly: Loehnert.Lisrt.Communication.Visa.dll
Syntax
public class VisaModule : LisrtModule, ICommunication, ILisrtModule, IInitializable, INotifyPropertyChangedEx, INotifyPropertyChanged, IHasServiceView
Remarks
Important
A VISA implementation must be installed.
Constructors
VisaModule(String)
Initializes a new instance of the VisaModule class.
Declaration
public VisaModule(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Module 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.
Declaration
public VisaModule(string name, IShell shell)
Parameters
Type | Name | Description |
---|---|---|
String | name | Module name. |
IShell | shell | Shell where the service view is shown. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
Properties
CommunicationLogIsEnabled
Gets or sets a value indicating whether the communication log is enabled.
Declaration
[Configuration(false, Description = "Enables the LisRT communication log")]
public bool CommunicationLogIsEnabled { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Encoding
Gets or sets the encoding for the communication.
Declaration
public Encoding Encoding { get; set; }
Property Value
Type | Description |
---|---|
System.Text.Encoding |
Remarks
Default is null.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Throw when you try to set the property. |
EndDelimiter
Throws a System.NotImplementedException.
Declaration
public byte[] EndDelimiter { get; set; }
Property Value
Type | Description |
---|---|
System.Byte[] |
Exceptions
Type | Condition |
---|---|
System.NotImplementedException | Throw when you try to get or set the property. |
InitializationState
Gets the actual initialization state.
Declaration
public InitializationState InitializationState { get; }
Property Value
Type | Description |
---|---|
InitializationState |
IsConnected
Gets a value indicating whether the module is connected.
Declaration
public bool IsConnected { get; }
Property Value
Type | Description |
---|---|
Boolean |
ResourceName
Gets or sets the resource name.
Declaration
[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
Type | Description |
---|---|
String |
StartDelimiter
Throws a System.NotImplementedException.
Declaration
public byte[] StartDelimiter { get; set; }
Property Value
Type | Description |
---|---|
System.Byte[] |
Exceptions
Type | Condition |
---|---|
System.NotImplementedException | Throw when you try to get or set the property. |
Timeout
Gets or sets the timeout in milliseconds.
Declaration
[Configuration(5000, Unit = "ms")]
public int Timeout { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
Close()
Closes the session.
Declaration
public void Close()
Exit()
Exits the module and closes the session.
Declaration
public void Exit()
Initialize()
Initializes the module.
Declaration
public void Initialize()
Open()
Opens the session.
Declaration
public void Open()
Exceptions
Type | Condition |
---|---|
System.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.
Declaration
public byte[] Query(byte[] data, string logComment = "")
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The data bytes to send. |
String | logComment | A comment for the communication log. |
Returns
Type | Description |
---|---|
System.Byte[] | The result data bytes. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when the Visa connection is not connected. |
QueryString(String, String)
Clears the received buffer, sends data and returns received data.
Declaration
public string QueryString(string data, string logComment = "")
Parameters
Type | Name | Description |
---|---|---|
String | data | The data to send. |
String | logComment | A comment for the communication log. |
Returns
Type | Description |
---|---|
String | The result data. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when the Visa connection is not connected. |
Receive()
Receives the data bytes.
Declaration
public byte[] Receive()
Returns
Type | Description |
---|---|
System.Byte[] | The received data bytes if buffer is not empty. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when the Visa connection is not connected. |
ReceiveString()
Receives the data.
Declaration
public string ReceiveString()
Returns
Type | Description |
---|---|
String | The read data. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when the Visa connection is not connected. |
Send(Byte[], String)
Sends the raw data.
Declaration
public void Send(byte[] data, string logComment = "")
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The raw data bytes to send. |
String | logComment | A comment for the communication log. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when the Visa connection is not connected. |
SendString(String, String)
Sends the data.
Declaration
public void SendString(string data, string logComment = "")
Parameters
Type | Name | Description |
---|---|---|
String | data | The data to send. |
String | logComment | A comment for the communication log. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when the Visa connection is not connected. |
ShowServiceView()
Shows the service window.
Declaration
public void ShowServiceView()
Events
DataReceived
This event will never be fired.
Declaration
public event EventHandler<DataReceivedEventArgs> DataReceived
Event Type
Type | Description |
---|---|
System.EventHandler<DataReceivedEventArgs> |