Table of Contents

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
PropertyChangedBase
VisaModule
Implements
INotifyPropertyChangedEx
Inherited Members
PropertyChangedBase.Refresh()
PropertyChangedBase.IsNotifying
PropertyChangedBase.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 string

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.

public VisaModule(string name, IShell shell)

Parameters

name string

Module name.

shell IShell

Shell where the service view is shown.

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

bool

Encoding

Gets or sets the encoding for the communication.

public Encoding Encoding { get; set; }

Property Value

Encoding

Remarks

Default is null.

Exceptions

NotSupportedException

Throw when you try to set the property.

EndDelimiter

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

InitializationState

IsConnected

Gets a value indicating whether the module is connected.

public bool IsConnected { get; }

Property Value

bool

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

string

StartDelimiter

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

int

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

data byte[]

The data bytes to send.

logComment string

A comment for the communication log.

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

data string

The data to send.

logComment string

A comment for the communication log.

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

data byte[]

The raw data bytes to send.

logComment string

A comment for the communication log.

Exceptions

InvalidOperationException

Thrown when the Visa connection is not connected.

SendString(string, string)

Sends the data.

public void SendString(string data, string logComment = "")

Parameters

data string

The data to send.

logComment string

A comment for the communication log.

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

Event Type

EventHandler<DataReceivedEventArgs>