| THM1176InstrumentDriver 1.2 C++ API for Metrolab THM1176

Loading...
Searching...
No Matches
MTL::Instrument::CVISAInstrument Class Reference

VISA instrument class. More...

`#include <VISAInstrument.h>`

Inheritance diagram for MTL::Instrument::CVISAInstrument:
[legend]
Collaboration diagram for MTL::Instrument::CVISAInstrument:
[legend]

## Public Member Functions
| CVISAInstrument (CVISAResourceManager &rRM, tResourceName Rsrc)
| Constructor.
virtual | ~CVISAInstrument ()
| Destructor.
virtual bool | Open (void)
| Open a session to this VISA instrument.
bool | Open (eOpenAccessMode AccessMode, ViUInt32 Timeout_ms=0)
| Open a session to this VISA instrument.
virtual void | Close ()
| Close session to this VISA instrument.
virtual bool | IsOpen ()
| Check whether a session to this instrument is open.
virtual std::string | StatusDescription (I32 Status)
| Return description of status word.
const ViSession & | Session ()
| Return instrument session identifier.
virtual bool | Timeout ()
| Last operation timed out.
virtual bool | Write (const char *Str)
| Write to a VISA instrument: C string variant.
virtual bool | Write (const std::string &rStr)
| Write to a VISA instrument: C++ string variant.
virtual bool | Write (const CSCPIBuffer &rBuf)
| Write to a VISA instrument: SCPI buffer class variant.
bool | Write (const ViBuf WriteBuf, ViUInt32 BuffLen)
| Write to a VISA instrument: VISA buffer variant.
virtual bool | Read (CSCPIBuffer &rBuf, bool Append=false)
| Read from a VISA instrument: SCPI buffer class variant.
bool | Read (ViPBuf ReadBuf, ViUInt32 ReadLen, ViUInt32 &rRetLen)
| Read from a VISA instrument: VISA buffer variant.
virtual bool | SetTimeout (ViUInt32 Timeout)
| Set the timeout for this instrument session.
virtual bool | Clear ()
| Clear the instrument.
virtual bool | ReadSTB (ViUInt16 &rSTB)
| Read status byte.
virtual bool | AssertTrigger (void)
| Assert a trigger.
bool | AssertTrigger (eTriggerProtocol Protocol)
| Assert a trigger.
virtual bool | LockExclusive (U32 Timeout)
| Obtain an exclusive lock for this session.
bool | LockShared (ViUInt32 Timeout, ViKeyId RequestedKey, ViChar AccessKey[])
| Obtain a shared lock for this session.
virtual bool | Unlock ()
| Unlock the session.
virtual bool | LockedExclusive ()
| Check whether session is locked exclusively.
virtual bool | EnableEvent (void)
| Enable service requests.
virtual bool | DisableEvent (void)
| Disable service requests.
virtual bool | WaitOnEvent (U32 Timeout)
| Wait for a service request.
virtual bool | DiscardEvents (void)
| Discard service requests.
bool | EnableEvent (eEventType Type, eEventMechanism Mechanism)
| Enable notification of a specified event.
bool | DisableEvent (eEventType Type, eEventMechanism Mechanism)
| Disable notification of a specified event.
bool | WaitOnEvent (eEventType Type, ViUInt32 Timeout)
| Wait for a specified event.
bool | WaitOnAllEvents (ViUInt32 Timeout)
| Wait for all events.
bool | DiscardEvents (eEventType Type, eEventMechanism Mechanism)
| Discard event occurrences for specified event types and mechanisms.
bool | GetAttribute (ViAttr Attribute, void *Value)
| Retrieves the state of an attribute.
bool | UsbControlIn (ViInt16 bmRequestType, ViInt16 bRequest, ViUInt16 wValue, ViUInt16 wIndex, ViUInt16 wLength, ViPBuf buf, ViUInt16 &rretCnt)
| Performs a USB control pipe transfer from the instrument.
bool | UsbControlOut (ViInt16 bmRequestType, ViInt16 bRequest, ViUInt16 wValue, ViUInt16 wIndex, ViUInt16 wLength, ViBuf buf)
| Performs a USB control pipe transfer to the instrument.
bool | ConfigSerialPort (const sSerialPortSettings &rPortSettings)
| Set all the instrument attributes to configure the serial communication.
Public Member Functions inherited from MTL::Instrument::CIEEE488Instrument
| CIEEE488Instrument (CIEEE488ResourceManager &rRM, tResourceName Rsrc)
| Constructor.
virtual | ~CIEEE488Instrument ()
I32 | Status (void)
bool | SetTimeout (U32 Timeout)
| Set the timeout for this instrument.
U32 | GetTimeout (void)
| Return the timeout for this instrument.
virtual bool | ReadSTB (U16 &rSTB)=0
| Read status byte.

## Additional Inherited Members
Protected Attributes inherited from MTL::Instrument::CIEEE488Instrument
CRecursiveMutex | m_Lock
| Lock onto the class interface.
CIEEE488ResourceManager & | m_rRrsrcMan
| Reference to the associated resource manager.
tResourceName | m_Rsrc
| Resource name of the instrument.
I32 | m_Status
| Status of last operation.
U32 | m_Timeout
| Timeout for operations.
Static Protected Attributes inherited from MTL::Instrument::CIEEE488Instrument
static const I32 | IEEE488_DEFAULT_TIMEOUT = 100
| Default timeout (ms).

## Detailed Description

VISA instrument class.

Definition at line 90 of file VISAInstrument.h.

## Constructor & Destructor Documentation

## ◆ CVISAInstrument()

CVISAInstrument::CVISAInstrument | ( | CVISAResourceManager & | rRM,
|  | tResourceName | Rsrc )

Constructor.

Parameters

  [in] | rRM | VISA Resource Manager.
  [out] | Rsrc | VISA resource name.

Definition at line 348 of file VISAInstrument.cpp.

## ◆ ~CVISAInstrument()

CVISAInstrument::~CVISAInstrument | ( |  | ) |
| virtual

Destructor.

Definition at line 353 of file VISAInstrument.cpp.

## Member Function Documentation

## ◆ AssertTrigger() [1/2]

bool CVISAInstrument::AssertTrigger | ( | eTriggerProtocol | Protocol | ) |

Assert a trigger.

Parameters

  [in] | Protocol | Trigger protocol (usually Default)

Returns
  True if successful.

Definition at line 598 of file VISAInstrument.cpp.

## ◆ AssertTrigger() [2/2]

bool CVISAInstrument::AssertTrigger | ( | void |  | ) |
| virtual

Assert a trigger.

Returns
  True if successful.

Implements MTL::Instrument::CIEEE488Instrument.

Definition at line 594 of file VISAInstrument.cpp.

## ◆ Clear()

bool CVISAInstrument::Clear | ( | void |  | ) |
| virtual

Clear the instrument.

Implements MTL::Instrument::CIEEE488Instrument.

Definition at line 533 of file VISAInstrument.cpp.

## ◆ Close()

void CVISAInstrument::Close | ( | void |  | ) |
| virtual

Close session to this VISA instrument.

Implements MTL::Instrument::CIEEE488Instrument.

Definition at line 388 of file VISAInstrument.cpp.

## ◆ ConfigSerialPort()

bool CVISAInstrument::ConfigSerialPort | ( | const sSerialPortSettings & | rPortSettings | ) |

Set all the instrument attributes to configure the serial communication.

Parameters

  [in] | rPortSettings | Serial port settings.

Returns
  True if successful.

Definition at line 839 of file VISAInstrument.cpp.

## ◆ DisableEvent() [1/2]

bool CVISAInstrument::DisableEvent | ( | eEventType | Type,
|  | eEventMechanism | Mechanism )

Disable notification of a specified event.

Parameters

  [in] | Type | Logical event identifier.
  [in] | Mechanism | How to handle the event.

Returns
  True if successful.

Definition at line 702 of file VISAInstrument.cpp.

## ◆ DisableEvent() [2/2]

bool CVISAInstrument::DisableEvent | ( | void |  | ) |
| virtual

Disable service requests.

Returns
  True if successful.

Implements MTL::Instrument::CIEEE488Instrument.

Definition at line 674 of file VISAInstrument.cpp.

## ◆ DiscardEvents() [1/2]

bool CVISAInstrument::DiscardEvents | ( | eEventType | Type,
|  | eEventMechanism | Mechanism )

Discard event occurrences for specified event types and mechanisms.

Parameters

  [in] | Type | Logical event identifier.
  [in] | Mechanism | How to handle the event.

Returns
  True if successful.

Definition at line 750 of file VISAInstrument.cpp.

## ◆ DiscardEvents() [2/2]

bool CVISAInstrument::DiscardEvents | ( | void |  | ) |
| virtual

Discard service requests.

Returns
  True if successful.

Implements MTL::Instrument::CIEEE488Instrument.

Definition at line 682 of file VISAInstrument.cpp.

## ◆ EnableEvent() [1/2]

bool CVISAInstrument::EnableEvent | ( | eEventType | Type,
|  | eEventMechanism | Mechanism )

Enable notification of a specified event.

Parameters

  [in] | Type | Logical event identifier.
  [in] | Mechanism | How to handle the event.

Returns
  True if successful.

Definition at line 686 of file VISAInstrument.cpp.

## ◆ EnableEvent() [2/2]

bool CVISAInstrument::EnableEvent | ( | void |  | ) |
| virtual

Enable service requests.

Returns
  True if successful.

Implements MTL::Instrument::CIEEE488Instrument.

Definition at line 670 of file VISAInstrument.cpp.

## ◆ GetAttribute()

bool CVISAInstrument::GetAttribute | ( | ViAttr | Attribute,
|  | void * | Value )

Retrieves the state of an attribute.

Parameters

  [in] | Attribute | Attribute identifier (e.g. VI_ATTR_ASRL_PARITY).
  [out] | Value | Attribute value.

Returns
  True if successful.

Definition at line 769 of file VISAInstrument.cpp.

## ◆ IsOpen()

bool CVISAInstrument::IsOpen | ( | void |  | ) |
| virtual

Check whether a session to this instrument is open.

Implements MTL::Instrument::CIEEE488Instrument.

Definition at line 401 of file VISAInstrument.cpp.

## ◆ LockedExclusive()

bool CVISAInstrument::LockedExclusive | ( | void |  | ) |
| virtual

Check whether session is locked exclusively.

Implements MTL::Instrument::CIEEE488Instrument.

Definition at line 663 of file VISAInstrument.cpp.

## ◆ LockExclusive()

bool CVISAInstrument::LockExclusive | ( | U32 | Timeout | ) |
| virtual

Obtain an exclusive lock for this session.

Parameters

  [in] | Timeout | Timeout value, in ms.

Returns
  True if successful.

Implements MTL::Instrument::CIEEE488Instrument.

Definition at line 610 of file VISAInstrument.cpp.

## ◆ LockShared()

bool CVISAInstrument::LockShared | ( | ViUInt32 | Timeout,
|  | ViKeyId | RequestedKey,
|  | ViChar | AccessKey[] )

Obtain a shared lock for this session.

Parameters

  [in] | Timeout | Timeout value, in ms.
  [in] | RequestedKey | Request this key for sharing with other sessions; can be VI_NULL.
  [out] | AccessKey | Key for sharing with other sessions, returned by VISA; at least 256 bytes.

Returns
  True if successful.

Definition at line 628 of file VISAInstrument.cpp.

## ◆ Open() [1/2]

bool CVISAInstrument::Open | ( | eOpenAccessMode | AccessMode,
|  | ViUInt32 | Timeout_ms = 0 )

Open a session to this VISA instrument.

Parameters

  [in] | AccessMode | Access mode (exclusive lock, no lock, load configuration).
  [out] | Timeout_ms | Timeout for operations during this session, in ms.

Returns
  True if successful.

Definition at line 366 of file VISAInstrument.cpp.

## ◆ Open() [2/2]

bool CVISAInstrument::Open | ( | void |  | ) |
| virtual

Open a session to this VISA instrument.

Returns
  True if successful.

Implements MTL::Instrument::CIEEE488Instrument.

Definition at line 362 of file VISAInstrument.cpp.

## ◆ Read() [1/2]

bool CVISAInstrument::Read | ( | CSCPIBuffer & | rBuf,
|  | bool | Append = false )
| virtual

Read from a VISA instrument: SCPI buffer class variant.

Parameters

  [in] | rBuf | Buffer to receive the data.
  [in] | Append | Whether to append to the existing data.

Returns
  True if successful.

Implements MTL::Instrument::CIEEE488Instrument.

Definition at line 475 of file VISAInstrument.cpp.

## ◆ Read() [2/2]

bool CVISAInstrument::Read | ( | ViPBuf | ReadBuf,
|  | ViUInt32 | ReadLen,
|  | ViUInt32 & | rRetLen )

Read from a VISA instrument: VISA buffer variant.

Parameters

  [in] | ReadBuf | Buffer to receive the data.
  [in] | ReadLen | Number of bytes to read.
  [out] | rRetLen | Number of bytes actually read.

Returns
  True if successful.

Definition at line 501 of file VISAInstrument.cpp.

## ◆ ReadSTB()

bool CVISAInstrument::ReadSTB | ( | ViUInt16 & | rSTB | ) |
| virtual

Read status byte.

Parameters

  [out] | rSTB | Status byte.

Returns
  True if successful.

Definition at line 542 of file VISAInstrument.cpp.

## ◆ Session()

const ViSession & CVISAInstrument::Session | ( |  | ) |

Return instrument session identifier.

Definition at line 422 of file VISAInstrument.cpp.

## ◆ SetTimeout()

bool CVISAInstrument::SetTimeout | ( | ViUInt32 | Timeout | ) |
| virtual

Set the timeout for this instrument session.

Parameters

  [out] | Timeout | Timeout for operations during this session, in ms.

Returns
  True if successful.

Definition at line 521 of file VISAInstrument.cpp.

## ◆ StatusDescription()

std::string CVISAInstrument::StatusDescription | ( | I32 | Status | ) |
| virtual

Return description of status word.

Parameters

  [in] | Status | Status word.

Returns
  Status description.

Implements MTL::Instrument::CIEEE488Instrument.

Definition at line 408 of file VISAInstrument.cpp.

## ◆ Timeout()

bool CVISAInstrument::Timeout | ( | void |  | ) |
| virtual

Last operation timed out.

Implements MTL::Instrument::CIEEE488Instrument.

Definition at line 428 of file VISAInstrument.cpp.

## ◆ Unlock()

bool CVISAInstrument::Unlock | ( | void |  | ) |
| virtual

Unlock the session.

Implements MTL::Instrument::CIEEE488Instrument.

Definition at line 645 of file VISAInstrument.cpp.

## ◆ UsbControlIn()

bool CVISAInstrument::UsbControlIn | ( | ViInt16 | bmRequestType,
|  | ViInt16 | bRequest,
|  | ViUInt16 | wValue,
|  | ViUInt16 | wIndex,
|  | ViUInt16 | wLength,
|  | ViPBuf | buf,
|  | ViUInt16 & | rretCnt )

Performs a USB control pipe transfer from the instrument.

Parameters

  [in] | bmRequestType | bmRequestType parameter of setup stage of a USB control transfer.
  [in] | bRequest | bRequest parameter of setup stage of a USB control transfer.
  [in] | wValue | wValue parameter of setup stage of a USB control transfer.
  [in] | wIndex | wIndex parameter of setup stage of a USB control transfer.
  [in] | wLength | wLength parameter of the setup stage of a USB control transfer.
  [out] | buf | Data buffer for optional data stage of the control transfer.
  [out] | rretCnt | Number of bytes actually transferred in optional data stage of control transfer.

Returns
  True if successful.

Definition at line 789 of file VISAInstrument.cpp.

## ◆ UsbControlOut()

bool CVISAInstrument::UsbControlOut | ( | ViInt16 | bmRequestType,
|  | ViInt16 | bRequest,
|  | ViUInt16 | wValue,
|  | ViUInt16 | wIndex,
|  | ViUInt16 | wLength,
|  | ViBuf | buf )

Performs a USB control pipe transfer to the instrument.

Parameters

  [in] | bmRequestType | bmRequestType parameter of setup stage of a USB control transfer.
  [in] | bRequest | bRequest parameter of setup stage of a USB control transfer.
  [in] | wValue | wValue parameter of setup stage of a USB control transfer.
  [in] | wIndex | wIndex parameter of setup stage of a USB control transfer.
  [in] | wLength | wLength parameter of the setup stage of a USB control transfer.
  [in] | buf | Data buffer to be sent during optional data stage of the control transfer.

Returns
  True if successful.

Definition at line 813 of file VISAInstrument.cpp.

## ◆ WaitOnAllEvents()

bool CVISAInstrument::WaitOnAllEvents | ( | ViUInt32 | Timeout | ) |

Wait for all events.

Parameters

  [in] | Timeout | Timeout, in ms.

Returns
  True if successful.

Definition at line 734 of file VISAInstrument.cpp.

## ◆ WaitOnEvent() [1/2]

bool CVISAInstrument::WaitOnEvent | ( | eEventType | Type,
|  | ViUInt32 | Timeout )

Wait for a specified event.

Parameters

  [in] | Type | Logical event identifier.
  [in] | Timeout | Timeout, in ms.

Returns
  True if successful.

Definition at line 718 of file VISAInstrument.cpp.

## ◆ WaitOnEvent() [2/2]

bool CVISAInstrument::WaitOnEvent | ( | U32 | Timeout | ) |
| virtual

Wait for a service request.

Parameters

  [in] | Timeout | Timeout value, in ms. No timeout if == 0.

Returns
  True if successful.

Implements MTL::Instrument::CIEEE488Instrument.

Definition at line 678 of file VISAInstrument.cpp.

## ◆ Write() [1/4]

bool CVISAInstrument::Write | ( | const char * | Str | ) |
| virtual

Write to a VISA instrument: C string variant.

Parameters

  [in] | Str | Data to write.

Returns
  True if successful.

Implements MTL::Instrument::CIEEE488Instrument.

Definition at line 437 of file VISAInstrument.cpp.

## ◆ Write() [2/4]

bool CVISAInstrument::Write | ( | const CSCPIBuffer & | rBuf | ) |
| virtual

Write to a VISA instrument: SCPI buffer class variant.

Parameters

  [in] | rBuf | Data to write.

Returns
  True if successful.

Implements MTL::Instrument::CIEEE488Instrument.

Definition at line 449 of file VISAInstrument.cpp.

## ◆ Write() [3/4]

bool CVISAInstrument::Write | ( | const std::string & | rStr | ) |
| virtual

Write to a VISA instrument: C++ string variant.

Parameters

  [in] | rStr | Data to write.

Returns
  True if successful.

Implements MTL::Instrument::CIEEE488Instrument.

Definition at line 443 of file VISAInstrument.cpp.

## ◆ Write() [4/4]

bool CVISAInstrument::Write | ( | const ViBuf | WriteBuf,
|  | ViUInt32 | BuffLen )

Write to a VISA instrument: VISA buffer variant.

Parameters

  [in] | WriteBuf | Data to write.
  [in] | BuffLen | Number of bytes to write.

Returns
  True if successful.

Definition at line 455 of file VISAInstrument.cpp.

The documentation for this class was generated from the following files:

- Common/VISAInstrument/include/VISAInstrument.h
- Common/VISAInstrument/src/VISAInstrument.cpp