ngscopeclient 0.1-dev+51fbda87c
Public Types | Public Member Functions | Public Attributes | Protected Attributes | List of all members
Instrument Class Referenceabstract

An arbitrary lab instrument. Oscilloscope, LA, PSU, DMM, etc. More...

#include <Instrument.h>

Inheritance diagram for Instrument:
Inheritance graph
[legend]
Collaboration diagram for Instrument:
Collaboration graph
[legend]

Public Types

enum  InstrumentTypes {
  INST_OSCILLOSCOPE = 0x01 , INST_DMM = 0x02 , INST_PSU = 0x04 , INST_FUNCTION = 0x08 ,
  INST_RF_GEN = 0x10 , INST_LOAD = 0x20 , INST_BERT = 0x40 , INST_MISC = 0x80 ,
  INST_SWITCH_MATRIX = 0x100
}
 

Public Member Functions

virtual unsigned int GetInstrumentTypes () const =0
 Returns a bitfield describing the set of instrument types that this instrument supports. More...
 
virtual std::string GetName () const =0
 
virtual std::string GetVendor () const =0
 
virtual std::string GetSerial () const =0
 
virtual std::string GetTransportConnectionString ()=0
 Gets the connection string for our transport. More...
 
virtual std::string GetTransportName ()=0
 Gets the name of our transport. More...
 
virtual uint32_t GetInstrumentTypesForChannel (size_t i) const =0
 Returns a bitfield describing the set of instrument types that a given channel supports. More...
 
size_t GetChannelCount () const
 Gets the number of channels (of any type) this instrument has.
 
InstrumentChannelGetChannel (size_t i) const
 Gets a given channel on the instrument. More...
 
virtual std::string GetChannelDisplayName (size_t i)
 Gets the hardware display name for a channel. This is an arbitrary user-selected string. More...
 
virtual void SetChannelDisplayName (size_t i, std::string name)
 Sets the hardware display name for a channel. This is an arbitrary user-selected string. More...
 
InstrumentChannelGetChannelByDisplayName (const std::string &name)
 Gets a channel given the display name.
 
InstrumentChannelGetChannelByHwName (const std::string &name)
 Gets a channel given the hardware name.
 
virtual bool AcquireData ()=0
 Pull data from the instrument. More...
 
virtual YAML::Node SerializeConfiguration (IDTable &table) const
 Serializes this instrument's configuration to a YAML node. More...
 
virtual void LoadConfiguration (int version, const YAML::Node &node, IDTable &idmap)
 Load instrument and channel configuration from a save file. More...
 
virtual void PreLoadConfiguration (int version, const YAML::Node &node, IDTable &idmap, ConfigWarningList &warnings)
 Parse a limited subset of instrument configuration but do not apply it. More...
 

Public Attributes

std::string m_nickname
 Optional user-selected nickname of the instrument. More...
 

Protected Attributes

std::list< sigc::slot< void(YAML::Node &, IDTable &)> > m_serializers
 List of methods which need to be called to serialize this node's configuration.
 
std::list< sigc::slot< void(int, const YAML::Node &, IDTable &)> > m_loaders
 List of methods which need to be called to deserialize this node's configuration.
 
std::list< sigc::slot< void(int, const YAML::Node &, IDTable &, ConfigWarningList &)> > m_preloaders
 List of methods which need to be called to pre-load this node's configuration.
 
std::vector< InstrumentChannel * > m_channels
 Set of all channels on this instrument.
 

Detailed Description

An arbitrary lab instrument. Oscilloscope, LA, PSU, DMM, etc.

An instrument has one or more channels (theoretically zero is allowed, but this would make little sense), each of which may have different capabilities. For example, an oscilloscope might have four oscilloscope channels which can also be used as multimeter inputs, and one function/arbitrary waveform generator output, for a total of five channels.

Math, memory, and other non-acquisition channels are generally not exposed in the API unless they provide features which are not possible to implement clientside.

All channels regardless of type occupy a single zero-based namespace.

Member Function Documentation

◆ AcquireData()

virtual bool Instrument::AcquireData ( )
pure virtual

◆ GetChannel()

InstrumentChannel * Instrument::GetChannel ( size_t  i) const
inline

Gets a given channel on the instrument.

Derived classes typically implement a GetXChannel() helper function which casts the channel to the requested type.

Parameters
iChannel index

◆ GetChannelDisplayName()

string Instrument::GetChannelDisplayName ( size_t  i)
virtual

Gets the hardware display name for a channel. This is an arbitrary user-selected string.

Some instruments allow displaying channel names in the GUI or on probes. If this is supported, the driver should override this function.

This function does not implement any caching, so calling it directly in performance critical code is not advisable. Instead, call InstrumentChannel::GetDisplayName(), which caches clientside and calls this function only on a cache miss.

The default implementation is a no-op.

Parameters
iZero-based index of channel

Reimplemented in LeCroyOscilloscope, SiglentSCPIOscilloscope, and TektronixOscilloscope.

◆ GetInstrumentTypes()

virtual unsigned int Instrument::GetInstrumentTypes ( ) const
pure virtual

◆ GetInstrumentTypesForChannel()

virtual uint32_t Instrument::GetInstrumentTypesForChannel ( size_t  i) const
pure virtual

◆ GetTransportConnectionString()

virtual std::string Instrument::GetTransportConnectionString ( )
pure virtual

Gets the connection string for our transport.

Implemented in SCPIInstrument, AntikernelLogicAnalyzer, DemoOscilloscope, and MockOscilloscope.

◆ GetTransportName()

virtual std::string Instrument::GetTransportName ( )
pure virtual

Gets the name of our transport.

Implemented in SCPIInstrument, AntikernelLogicAnalyzer, DemoOscilloscope, and MockOscilloscope.

◆ LoadConfiguration()

void Instrument::LoadConfiguration ( int  version,
const YAML::Node &  node,
IDTable idmap 
)
virtual

Load instrument and channel configuration from a save file.

Reimplemented in DemoOscilloscope.

◆ PreLoadConfiguration()

void Instrument::PreLoadConfiguration ( int  version,
const YAML::Node &  node,
IDTable idmap,
ConfigWarningList warnings 
)
virtual

Parse a limited subset of instrument configuration but do not apply it.

This is an optional method intended to be called prior to loading a file in order to identify potential problems with the setup being loaded (for example, attenuation or output voltage settings wildly different from the current configuration).

◆ SerializeConfiguration()

YAML::Node Instrument::SerializeConfiguration ( IDTable table) const
virtual

Serializes this instrument's configuration to a YAML node.

Returns
YAML block with this instrument's configuration

◆ SetChannelDisplayName()

void Instrument::SetChannelDisplayName ( size_t  i,
std::string  name 
)
virtual

Sets the hardware display name for a channel. This is an arbitrary user-selected string.

Some instruments allow displaying channel names in the GUI or on probes. If this is supported, the driver should override this function.

This function directly updates hardware without caching. In most cases, you should call InstrumentChannel::SetDisplayName(), which updates the clientside cache and then calls this function.

The default function returns the hardware name.

Parameters
iZero-based index of channel
nameName of the channel

Reimplemented in AntikernelLabsTriggerCrossbar, LeCroyOscilloscope, SiglentSCPIOscilloscope, and TektronixOscilloscope.

Member Data Documentation

◆ m_nickname

std::string Instrument::m_nickname

Optional user-selected nickname of the instrument.

(for display purposes if multiple similar devices are in use)


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