![]() |
THM1176InstrumentDriver
1.0
C++ API for Metrolab THM1176
|
VISA instrument class. More...
#include <VISAInstrument.h>
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 ViSession & | Session () |
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... | |
![]() | |
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 | |
![]() | |
CRecursiveMutex | m_Lock |
Lock onto the class interface. More... | |
CIEEE488ResourceManager & | m_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... | |
VISA instrument class.
Definition at line 90 of file VISAInstrument.h.
CVISAInstrument::CVISAInstrument | ( | CVISAResourceManager & | rRM, |
tResourceName | Rsrc | ||
) |
Constructor.
[in] | rRM | VISA Resource Manager. |
[out] | Rsrc | VISA resource name. |
Definition at line 348 of file VISAInstrument.cpp.
|
virtual |
Destructor.
Definition at line 353 of file VISAInstrument.cpp.
bool CVISAInstrument::AssertTrigger | ( | eTriggerProtocol | Protocol | ) |
Assert a trigger.
[in] | Protocol | Trigger protocol (usually Default) |
Definition at line 598 of file VISAInstrument.cpp.
|
virtual |
Assert a trigger.
Implements MTL::Instrument::CIEEE488Instrument.
Definition at line 594 of file VISAInstrument.cpp.
|
virtual |
Clear the instrument.
Implements MTL::Instrument::CIEEE488Instrument.
Definition at line 533 of file VISAInstrument.cpp.
|
virtual |
Close session to this VISA instrument.
Implements MTL::Instrument::CIEEE488Instrument.
Definition at line 388 of file VISAInstrument.cpp.
bool CVISAInstrument::ConfigSerialPort | ( | const sSerialPortSettings & | rPortSettings | ) |
Set all the instrument attributes to configure the serial communication.
[in] | rPortSettings | Serial port settings. |
Definition at line 823 of file VISAInstrument.cpp.
bool CVISAInstrument::DisableEvent | ( | eEventType | Type, |
eEventMechanism | Mechanism | ||
) |
Disable notification of a specified event.
[in] | Type | Logical event identifier. |
[in] | Mechanism | How to handle the event. |
Definition at line 686 of file VISAInstrument.cpp.
bool CVISAInstrument::DiscardEvents | ( | eEventType | Type, |
eEventMechanism | Mechanism | ||
) |
Discard event occurrences for specified event types and mechanisms.
[in] | Type | Logical event identifier. |
[in] | Mechanism | How to handle the event. |
Definition at line 734 of file VISAInstrument.cpp.
bool CVISAInstrument::EnableEvent | ( | eEventType | Type, |
eEventMechanism | Mechanism | ||
) |
Enable notification of a specified event.
[in] | Type | Logical event identifier. |
[in] | Mechanism | How to handle the event. |
Definition at line 670 of file VISAInstrument.cpp.
bool CVISAInstrument::GetAttribute | ( | ViAttr | Attribute, |
void * | Value | ||
) |
Retrieves the state of an attribute.
[in] | Attribute | Attribute identifier (e.g. VI_ATTR_ASRL_PARITY). |
[out] | Value | Attribute value. |
Definition at line 753 of file VISAInstrument.cpp.
|
virtual |
Check whether a session to this instrument is open.
Implements MTL::Instrument::CIEEE488Instrument.
Definition at line 401 of file VISAInstrument.cpp.
|
virtual |
Check whether session is locked exclusively.
Implements MTL::Instrument::CIEEE488Instrument.
Definition at line 663 of file VISAInstrument.cpp.
|
virtual |
Obtain an exclusive lock for this session.
[in] | Timeout | Timeout value, in ms. |
Implements MTL::Instrument::CIEEE488Instrument.
Definition at line 610 of file VISAInstrument.cpp.
Obtain a shared lock for this session.
[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. |
Definition at line 628 of file VISAInstrument.cpp.
bool CVISAInstrument::Open | ( | eOpenAccessMode | AccessMode, |
ViUInt32 | Timeout_ms = 0 |
||
) |
Open a session to this VISA instrument.
[in] | AccessMode | Access mode (exclusive lock, no lock, load configuration). |
[out] | Timeout_ms | Timeout for operations during this session, in ms. |
Definition at line 366 of file VISAInstrument.cpp.
|
virtual |
Open a session to this VISA instrument.
Implements MTL::Instrument::CIEEE488Instrument.
Definition at line 362 of file VISAInstrument.cpp.
|
virtual |
Read from a VISA instrument: SCPI buffer class variant.
[in] | rBuf | Buffer to receive the data. |
[in] | Append | Whether to append to the existing data. |
Implements MTL::Instrument::CIEEE488Instrument.
Definition at line 475 of file VISAInstrument.cpp.
Read from a VISA instrument: VISA buffer variant.
[in] | ReadBuf | Buffer to receive the data. |
[in] | ReadLen | Number of bytes to read. |
[out] | rRetLen | Number of bytes actually read. |
Definition at line 501 of file VISAInstrument.cpp.
|
virtual |
Read status byte.
[out] | rSTB | Status byte. |
Implements MTL::Instrument::CIEEE488Instrument.
Definition at line 542 of file VISAInstrument.cpp.
const ViSession & CVISAInstrument::Session | ( | ) |
Return instrument session identifier.
Definition at line 422 of file VISAInstrument.cpp.
|
virtual |
Set the timeout for this instrument session.
[out] | Timeout | Timeout for operations during this session, in ms. |
Definition at line 521 of file VISAInstrument.cpp.
|
virtual |
Return description of status word.
[in] | Status | Status word. |
Implements MTL::Instrument::CIEEE488Instrument.
Definition at line 408 of file VISAInstrument.cpp.
|
virtual |
Last operation timed out.
Implements MTL::Instrument::CIEEE488Instrument.
Definition at line 428 of file VISAInstrument.cpp.
|
virtual |
Unlock the session.
Implements MTL::Instrument::CIEEE488Instrument.
Definition at line 645 of file VISAInstrument.cpp.
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.
[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. |
Definition at line 773 of file VISAInstrument.cpp.
bool CVISAInstrument::UsbControlOut | ( | ViInt16 | bmRequestType, |
ViInt16 | bRequest, | ||
ViUInt16 | wValue, | ||
ViUInt16 | wIndex, | ||
ViUInt16 | wLength, | ||
ViBuf | buf | ||
) |
Performs a USB control pipe transfer to the instrument.
[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. |
Definition at line 797 of file VISAInstrument.cpp.
bool CVISAInstrument::WaitOnAllEvents | ( | ViUInt32 | Timeout | ) |
Wait for all events.
[in] | Timeout | Timeout, in ms. |
Definition at line 718 of file VISAInstrument.cpp.
bool CVISAInstrument::WaitOnEvent | ( | eEventType | Type, |
ViUInt32 | Timeout | ||
) |
Wait for a specified event.
[in] | Type | Logical event identifier. |
[in] | Timeout | Timeout, in ms. |
Definition at line 702 of file VISAInstrument.cpp.
|
virtual |
Write to a VISA instrument: C string variant.
[in] | Str | Data to write. |
Implements MTL::Instrument::CIEEE488Instrument.
Definition at line 437 of file VISAInstrument.cpp.
|
virtual |
Write to a VISA instrument: SCPI buffer class variant.
[in] | rBuf | Data to write. |
Implements MTL::Instrument::CIEEE488Instrument.
Definition at line 449 of file VISAInstrument.cpp.
|
virtual |
Write to a VISA instrument: C++ string variant.
[in] | rStr | Data to write. |
Implements MTL::Instrument::CIEEE488Instrument.
Definition at line 443 of file VISAInstrument.cpp.
Write to a VISA instrument: VISA buffer variant.
[in] | WriteBuf | Data to write. |
[in] | BuffLen | Number of bytes to write. |
Definition at line 455 of file VISAInstrument.cpp.