ngscopeclient 0.1-dev+51fbda87c
RemoteBridgeOscilloscope.h
1/***********************************************************************************************************************
2* *
3* libscopehal *
4* *
5* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors *
6* All rights reserved. *
7* *
8* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
9* following conditions are met: *
10* *
11* * Redistributions of source code must retain the above copyright notice, this list of conditions, and the *
12* following disclaimer. *
13* *
14* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the *
15* following disclaimer in the documentation and/or other materials provided with the distribution. *
16* *
17* * Neither the name of the author nor the names of any contributors may be used to endorse or promote products *
18* derived from this software without specific prior written permission. *
19* *
20* THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
21* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL *
22* THE AUTHORS BE HELD LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR *
24* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
25* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
26* POSSIBILITY OF SUCH DAMAGE. *
27* *
28***********************************************************************************************************************/
29
30#ifndef RemoteBridgeOscilloscope_h
31#define RemoteBridgeOscilloscope_h
32
33#include "EdgeTrigger.h"
34
40{
41public:
42 RemoteBridgeOscilloscope(SCPITransport* transport, bool identify = true);
44
45 // Channel Configuration
46 virtual bool IsChannelEnabled(size_t i) override;
47 virtual void EnableChannel(size_t i) override;
48 virtual void DisableChannel(size_t i) override;
49
50 virtual OscilloscopeChannel::CouplingType GetChannelCoupling(size_t i) override;
51 virtual void SetChannelCoupling(size_t i, OscilloscopeChannel::CouplingType type) override;
52
53 virtual float GetChannelVoltageRange(size_t i, size_t stream) override;
54 virtual void SetChannelVoltageRange(size_t i, size_t stream, float range) override;
55
56 virtual float GetChannelOffset(size_t i, size_t stream) override;
57 virtual void SetChannelOffset(size_t i, size_t stream, float offset) override;
58
59 // Triggering
60 virtual void Start() override;
61 virtual void StartSingleTrigger() override;
62 virtual void ForceTrigger() override;
63 virtual void Stop() override;
64 virtual void PushTrigger() override;
65 virtual void PullTrigger() override;
66 virtual bool IsTriggerArmed() override;
67 virtual bool PeekTriggerArmed() override;
68
69 // Timebase
70 virtual void SetTriggerOffset(int64_t offset) override;
71 virtual int64_t GetTriggerOffset() override;
72 virtual uint64_t GetSampleRate() override;
73 virtual uint64_t GetSampleDepth() override;
74 virtual void SetSampleDepth(uint64_t depth) override;
75 virtual void SetSampleRate(uint64_t rate) override;
76
77protected:
78 bool m_triggerArmed;
79 bool m_triggerOneShot;
80 int64_t m_triggerOffset;
81
82 uint64_t m_srate;
83 uint64_t m_mdepth;
84
85 std::map<int, bool> m_channelsEnabled;
86 std::map<size_t, OscilloscopeChannel::CouplingType> m_channelCouplings;
87 std::map<size_t, float> m_channelOffsets;
88 std::map<size_t, float> m_channelVoltageRanges;
89
90 void PushEdgeTrigger(EdgeTrigger* trig);
91};
92
93#endif
94
95
Declaration of EdgeTrigger.
Simple edge trigger.
Definition: EdgeTrigger.h:44
An oscilloscope connected over a SDK-to-SCPI bridge that follows our pattern (i.e....
Definition: RemoteBridgeOscilloscope.h:40
virtual void PushTrigger() override
Pushes changes made to m_trigger to the instrument.
Definition: RemoteBridgeOscilloscope.cpp:132
virtual void Start() override
Starts the instrument in continuous trigger mode.
Definition: RemoteBridgeOscilloscope.cpp:51
virtual void SetSampleDepth(uint64_t depth) override
Sets the sample depth of the scope.
Definition: RemoteBridgeOscilloscope.cpp:116
virtual bool PeekTriggerArmed() override
Checks if the trigger is armed directly on the instrument, without altering internal state or touchin...
Definition: RemoteBridgeOscilloscope.cpp:184
virtual void SetSampleRate(uint64_t rate) override
Sets the sample rate of the scope, in Hz.
Definition: RemoteBridgeOscilloscope.cpp:123
virtual void Stop() override
Stops triggering.
Definition: RemoteBridgeOscilloscope.cpp:69
virtual float GetChannelVoltageRange(size_t i, size_t stream) override
Gets the range of the current channel configuration.
Definition: RemoteBridgeOscilloscope.cpp:272
virtual void EnableChannel(size_t i) override
Turn a channel on, given the index.
Definition: RemoteBridgeOscilloscope.cpp:207
virtual OscilloscopeChannel::CouplingType GetChannelCoupling(size_t i) override
Gets the coupling used for an input channel.
Definition: RemoteBridgeOscilloscope.cpp:229
virtual int64_t GetTriggerOffset() override
Gets the trigger offset.
Definition: RemoteBridgeOscilloscope.cpp:101
virtual void SetChannelOffset(size_t i, size_t stream, float offset) override
Sets the offset for a given channel.
Definition: RemoteBridgeOscilloscope.cpp:297
virtual bool IsTriggerArmed() override
Checks if the trigger is currently armed.
Definition: RemoteBridgeOscilloscope.cpp:194
void PushEdgeTrigger(EdgeTrigger *trig)
Pushes settings for an edge trigger to the instrument.
Definition: RemoteBridgeOscilloscope.cpp:147
virtual void PullTrigger() override
Updates m_trigger with any changes made from the instrument side.
Definition: RemoteBridgeOscilloscope.cpp:85
virtual void ForceTrigger() override
Forces a single acquisition as soon as possible.
Definition: RemoteBridgeOscilloscope.cpp:77
virtual void DisableChannel(size_t i) override
Turn a channel off, given the index.
Definition: RemoteBridgeOscilloscope.cpp:218
virtual uint64_t GetSampleRate() override
Gets the current sampling rate (in Hz) of this scope.
Definition: RemoteBridgeOscilloscope.cpp:106
virtual bool IsChannelEnabled(size_t i) override
Checks if a channel is enabled in hardware.
Definition: RemoteBridgeOscilloscope.cpp:201
virtual void SetTriggerOffset(int64_t offset) override
Sets the trigger offset.
Definition: RemoteBridgeOscilloscope.cpp:90
virtual uint64_t GetSampleDepth() override
Gets the current sample depth of this scope.
Definition: RemoteBridgeOscilloscope.cpp:111
virtual void StartSingleTrigger() override
Arms the trigger for a single acquistion.
Definition: RemoteBridgeOscilloscope.cpp:60
virtual void SetChannelVoltageRange(size_t i, size_t stream, float range) override
Sets the range of the current channel configuration.
Definition: RemoteBridgeOscilloscope.cpp:278
virtual float GetChannelOffset(size_t i, size_t stream) override
Gets the offset, in volts, for a given channel.
Definition: RemoteBridgeOscilloscope.cpp:291
virtual void SetChannelCoupling(size_t i, OscilloscopeChannel::CouplingType type) override
Sets the coupling used for an input channel.
Definition: RemoteBridgeOscilloscope.cpp:235
An SCPI-based oscilloscope.
Definition: SCPIOscilloscope.h:38
Abstraction of a transport layer for moving SCPI data between endpoints.
Definition: SCPITransport.h:47