37#ifndef MockOscilloscope_h
38#define MockOscilloscope_h
48 const std::string& name,
49 const std::string& vendor,
50 const std::string& serial,
51 const std::string& transport,
52 const std::string& driver,
53 const std::string& args
59 Unit::UnitType units[7] = {
76 virtual std::string
IDPing()
override;
81 virtual std::string GetName()
const override;
82 virtual std::string GetVendor()
const override;
83 virtual std::string GetSerial()
const override;
90 virtual void SetChannelCoupling(
size_t i, OscilloscopeChannel::CouplingType type)
override;
100 virtual void SetChannelOffset(
size_t i,
size_t stream,
float offset)
override;
105 virtual void Start()
override;
107 virtual void Stop()
override;
115 virtual std::set<InterleaveConflict> GetInterleaveConflicts()
override;
129 void DoLoadConfiguration(
int version,
const YAML::Node& node,
IDTable& idmap);
130 void DoSerializeConfiguration(YAML::Node& node,
IDTable& table);
138 std::string m_vendor;
139 std::string m_serial;
140 std::string m_fwVersion;
144 std::map<size_t, bool> m_channelsEnabled;
145 std::map<size_t, OscilloscopeChannel::CouplingType> m_channelCoupling;
146 std::map<size_t, double> m_channelAttenuation;
147 std::map<size_t, unsigned int> m_channelBandwidth;
148 std::map<std::pair<size_t, size_t>,
float> m_channelVoltageRange;
149 std::map<std::pair<size_t, size_t>,
float> m_channelOffset;
154 std::string m_transport;
155 std::string m_driver;
158 uint64_t m_sampleRate;
159 uint64_t m_sampleDepth;
163 virtual std::string GetDriverName()
Bidirectional table mapping integer IDs in scopesession files to object pointers.
Definition: IDTable.h:49
std::vector< InstrumentChannel * > m_channels
Set of all channels on this instrument.
Definition: Instrument.h:259
Fake oscilloscope driver used for offline waveform analysis.
Definition: MockOscilloscope.h:45
virtual std::vector< uint64_t > GetSampleRatesInterleaved() override
Get the legal sampling rates (in Hz) for this scope in combined-channels mode.
Definition: MockOscilloscope.cpp:328
virtual void SetChannelVoltageRange(size_t i, size_t stream, float range) override
Sets the range of the current channel configuration.
Definition: MockOscilloscope.cpp:301
virtual std::vector< OscilloscopeChannel::CouplingType > GetAvailableCouplings(size_t i) override
Gets the set of legal coupling values for an input channel.
Definition: MockOscilloscope.cpp:255
virtual uint64_t GetSampleRate() override
Gets the current sampling rate (in Hz) of this scope.
Definition: MockOscilloscope.cpp:356
virtual void SetChannelAttenuation(size_t i, double atten) override
Sets the probe attenuation used for an input channel.
Definition: MockOscilloscope.cpp:281
virtual int64_t GetTriggerOffset() override
Gets the trigger offset.
Definition: MockOscilloscope.cpp:381
virtual std::vector< uint64_t > GetSampleRatesNonInterleaved() override
Get the legal sampling rates (in Hz) for this scope in all-channels mode.
Definition: MockOscilloscope.cpp:321
virtual float GetChannelOffset(size_t i, size_t stream) override
Gets the offset, in volts, for a given channel.
Definition: MockOscilloscope.cpp:311
virtual uint32_t GetInstrumentTypesForChannel(size_t i) const override
Returns a bitfield describing the set of instrument types that a given channel supports.
Definition: MockOscilloscope.cpp:100
virtual void DisableChannel(size_t i) override
Turn a channel off, given the index.
Definition: MockOscilloscope.cpp:250
virtual bool IsInterleaving() override
Checks if the scope is currently combining channels.
Definition: MockOscilloscope.cpp:387
virtual bool AcquireData() override
Pull data from the instrument.
Definition: MockOscilloscope.cpp:129
virtual void PushTrigger() override
Pushes changes made to m_trigger to the instrument.
Definition: MockOscilloscope.cpp:397
virtual OscilloscopeChannel::CouplingType GetChannelCoupling(size_t i) override
Gets the coupling used for an input channel.
Definition: MockOscilloscope.cpp:266
virtual Oscilloscope::TriggerMode PollTrigger() override
Checks the curent trigger status.
Definition: MockOscilloscope.cpp:123
virtual void PullTrigger() override
Updates m_trigger with any changes made from the instrument side.
Definition: MockOscilloscope.cpp:402
virtual void Stop() override
Stops triggering.
Definition: MockOscilloscope.cpp:150
virtual uint64_t GetSampleDepth() override
Gets the current sample depth of this scope.
Definition: MockOscilloscope.cpp:361
virtual bool SetInterleaving(bool combine) override
Configures the scope to combine channels.
Definition: MockOscilloscope.cpp:392
void AutoscaleVertical()
Calculate min/max of each channel and adjust gain/offset accordingly.
Definition: MockOscilloscope.cpp:410
virtual void SetChannelBandwidthLimit(size_t i, unsigned int limit_mhz) override
Sets the bandwidth limit for an input channel.
Definition: MockOscilloscope.cpp:291
virtual std::string IDPing() override
Returns the instrument's identification string.
Definition: MockOscilloscope.cpp:80
virtual void EnableChannel(size_t i) override
Turn a channel on, given the index.
Definition: MockOscilloscope.cpp:245
virtual unsigned int GetChannelBandwidthLimit(size_t i) override
Gets the bandwidth limit for an input channel.
Definition: MockOscilloscope.cpp:286
virtual std::string GetTransportConnectionString() override
Gets the connection string for our transport.
Definition: MockOscilloscope.cpp:90
virtual void SetTriggerOffset(int64_t offset) override
Sets the trigger offset.
Definition: MockOscilloscope.cpp:376
virtual bool IsOffline() override
Checks if the instrument is currently online.
Definition: MockOscilloscope.cpp:75
virtual bool IsTriggerArmed() override
Checks if the trigger is currently armed.
Definition: MockOscilloscope.cpp:160
virtual OscilloscopeChannel * GetExternalTrigger() override
Returns the external trigger input channel, if we have one.
Definition: MockOscilloscope.cpp:306
virtual bool IsChannelEnabled(size_t i) override
Checks if a channel is enabled in hardware.
Definition: MockOscilloscope.cpp:240
virtual float GetChannelVoltageRange(size_t i, size_t stream) override
Gets the range of the current channel configuration.
Definition: MockOscilloscope.cpp:296
virtual void SetChannelOffset(size_t i, size_t stream, float offset) override
Sets the offset for a given channel.
Definition: MockOscilloscope.cpp:316
virtual void ForceTrigger() override
Forces a single acquisition as soon as possible.
Definition: MockOscilloscope.cpp:155
virtual void StartSingleTrigger() override
Arms the trigger for a single acquistion.
Definition: MockOscilloscope.cpp:140
virtual std::vector< uint64_t > GetSampleDepthsNonInterleaved() override
Get the legal memory depths for this scope in all-channels mode.
Definition: MockOscilloscope.cpp:342
virtual std::vector< uint64_t > GetSampleDepthsInterleaved() override
Get the legal memory depths for this scope in combined-channels mode.
Definition: MockOscilloscope.cpp:349
virtual void SetChannelCoupling(size_t i, OscilloscopeChannel::CouplingType type) override
Sets the coupling used for an input channel.
Definition: MockOscilloscope.cpp:271
virtual unsigned int GetInstrumentTypes() const override
Returns a bitfield describing the set of instrument types that this instrument supports.
Definition: MockOscilloscope.cpp:95
virtual std::string GetTransportName() override
Gets the name of our transport.
Definition: MockOscilloscope.cpp:85
virtual void SetSampleRate(uint64_t rate) override
Sets the sample rate of the scope, in Hz.
Definition: MockOscilloscope.cpp:371
virtual void Start() override
Starts the instrument in continuous trigger mode.
Definition: MockOscilloscope.cpp:145
virtual void SetSampleDepth(uint64_t depth) override
Sets the sample depth of the scope.
Definition: MockOscilloscope.cpp:366
virtual double GetChannelAttenuation(size_t i) override
Gets the probe attenuation for an input channel.
Definition: MockOscilloscope.cpp:276
A single channel on an oscilloscope.
Definition: OscilloscopeChannel.h:49
Generic representation of an oscilloscope, logic analyzer, or spectrum analyzer.
Definition: Oscilloscope.h:50
TriggerMode
Definition: Oscilloscope.h:411