THM1176InstrumentManager  1.0
Qt Object abstraction for Metrolab THM1176
MTL::Instrument::CVISAInstrument Class Reference

VISA instrument class. More...

#include <VISAInstrument.h>

Inheritance diagram for MTL::Instrument::CVISAInstrument:
Collaboration diagram for MTL::Instrument::CVISAInstrument:

Public Member Functions

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

Additional Inherited Members

- Protected Attributes inherited from MTL::Instrument::CIEEE488Instrument
CRecursiveMutex m_Lock
 Lock onto the class interface. More...
 
CIEEE488ResourceManagerm_rRrsrcMan
 Reference to the associated resource manager. More...
 
tResourceName m_Rsrc
 Resource name of the instrument. More...
 
I32 m_Status
 Status of last operation. More...
 
U32 m_Timeout
 Timeout for operations. More...
 

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]rRMVISA Resource Manager.
[out]RsrcVISA 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]ProtocolTrigger 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]rPortSettingsSerial port settings.
Returns
True if successful.

Definition at line 823 of file VISAInstrument.cpp.

◆ DisableEvent()

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

Disable notification of a specified event.

Parameters
[in]TypeLogical event identifier.
[in]MechanismHow to handle the event.
Returns
True if successful.

Definition at line 686 of file VISAInstrument.cpp.

◆ DiscardEvents()

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

Discard event occurrences for specified event types and mechanisms.

Parameters
[in]TypeLogical event identifier.
[in]MechanismHow to handle the event.
Returns
True if successful.

Definition at line 734 of file VISAInstrument.cpp.

◆ EnableEvent()

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

Enable notification of a specified event.

Parameters
[in]TypeLogical event identifier.
[in]MechanismHow to handle the event.
Returns
True if successful.

Definition at line 670 of file VISAInstrument.cpp.

◆ GetAttribute()

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

Retrieves the state of an attribute.

Parameters
[in]AttributeAttribute identifier (e.g. VI_ATTR_ASRL_PARITY).
[out]ValueAttribute value.
Returns
True if successful.

Definition at line 753 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]TimeoutTimeout 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]TimeoutTimeout value, in ms.
[in]RequestedKeyRequest this key for sharing with other sessions; can be VI_NULL.
[out]AccessKeyKey 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]AccessModeAccess mode (exclusive lock, no lock, load configuration).
[out]Timeout_msTimeout 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]rBufBuffer to receive the data.
[in]AppendWhether 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]ReadBufBuffer to receive the data.
[in]ReadLenNumber of bytes to read.
[out]rRetLenNumber 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]rSTBStatus byte.
Returns
True if successful.

Implements MTL::Instrument::CIEEE488Instrument.

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]TimeoutTimeout 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]StatusStatus 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]bmRequestTypebmRequestType parameter of setup stage of a USB control transfer.
[in]bRequestbRequest parameter of setup stage of a USB control transfer.
[in]wValuewValue parameter of setup stage of a USB control transfer.
[in]wIndexwIndex parameter of setup stage of a USB control transfer.
[in]wLengthwLength parameter of the setup stage of a USB control transfer.
[out]bufData buffer for optional data stage of the control transfer.
[out]rretCntNumber of bytes actually transferred in optional data stage of control transfer.
Returns
True if successful.

Definition at line 773 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]bmRequestTypebmRequestType parameter of setup stage of a USB control transfer.
[in]bRequestbRequest parameter of setup stage of a USB control transfer.
[in]wValuewValue parameter of setup stage of a USB control transfer.
[in]wIndexwIndex parameter of setup stage of a USB control transfer.
[in]wLengthwLength parameter of the setup stage of a USB control transfer.
[in]bufData buffer to be sent during optional data stage of the control transfer.
Returns
True if successful.

Definition at line 797 of file VISAInstrument.cpp.

◆ WaitOnAllEvents()

bool CVISAInstrument::WaitOnAllEvents ( ViUInt32  Timeout)

Wait for all events.

Parameters
[in]TimeoutTimeout, in ms.
Returns
True if successful.

Definition at line 718 of file VISAInstrument.cpp.

◆ WaitOnEvent()

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

Wait for a specified event.

Parameters
[in]TypeLogical event identifier.
[in]TimeoutTimeout, in ms.
Returns
True if successful.

Definition at line 702 of file VISAInstrument.cpp.

◆ Write() [1/4]

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

Write to a VISA instrument: C string variant.

Parameters
[in]StrData 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]rBufData 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]rStrData 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]WriteBufData to write.
[in]BuffLenNumber 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: