ngscopeclient 0.1-dev+51fbda87c
SwitchMatrix.h
Go to the documentation of this file.
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
38#ifndef SwitchMatrix_h
39#define SwitchMatrix_h
40
46class SwitchMatrix : public virtual Instrument
47{
48public:
50 virtual ~SwitchMatrix();
51
52 virtual unsigned int GetInstrumentTypes() const override;
53
57 virtual void SetMuxPath(size_t dstchan, size_t srcchan) =0;
58
64 virtual void SetMuxPathOpen(size_t dstchan) =0;
65
69 virtual bool MuxHasConfigurableDrive(size_t dstchan) =0;
70
74 virtual float GetMuxOutputDrive(size_t dstchan) =0;
75
79 virtual void SetMuxOutputDrive(size_t dstchan, float v) =0;
80
84 virtual bool MuxHasConfigurableThreshold(size_t dstchan) =0;
85
89 virtual float GetMuxInputThreshold(size_t dstchan) =0;
90
94 virtual void SetMuxInputThreshold(size_t dstchan, float v) =0;
95
96protected:
100 void DoSerializeConfiguration(YAML::Node& node, IDTable& table);
101
105 void DoLoadConfiguration(int version, const YAML::Node& node, IDTable& idmap);
106
110 void DoPreLoadConfiguration(int version, const YAML::Node& node, IDTable& idmap, ConfigWarningList& list);
111};
112
113#endif
All warnings generated by a configuration we're in the process of loading.
Definition: ConfigWarningList.h:90
Bidirectional table mapping integer IDs in scopesession files to object pointers.
Definition: IDTable.h:49
An arbitrary lab instrument. Oscilloscope, LA, PSU, DMM, etc.
Definition: Instrument.h:58
Base class for switch matrixes.
Definition: SwitchMatrix.h:47
void DoLoadConfiguration(int version, const YAML::Node &node, IDTable &idmap)
Load instrument and channel configuration from a save file.
Definition: SwitchMatrix.cpp:211
virtual bool MuxHasConfigurableDrive(size_t dstchan)=0
Checks if an output channel has configurable voltage level.
virtual unsigned int GetInstrumentTypes() const override
Returns a bitfield describing the set of instrument types that this instrument supports.
Definition: SwitchMatrix.cpp:55
void DoPreLoadConfiguration(int version, const YAML::Node &node, IDTable &idmap, ConfigWarningList &list)
Validate instrument and channel configuration from a save file.
Definition: SwitchMatrix.cpp:120
virtual void SetMuxOutputDrive(size_t dstchan, float v)=0
Sets the drive level of an output channel.
virtual bool MuxHasConfigurableThreshold(size_t dstchan)=0
Checks if an input channel has configurable voltage level.
virtual void SetMuxPathOpen(size_t dstchan)=0
Removes a mux path for an output channel.
void DoSerializeConfiguration(YAML::Node &node, IDTable &table)
Serializes this oscilloscope's configuration to a YAML node.
Definition: SwitchMatrix.cpp:63
virtual void SetMuxPath(size_t dstchan, size_t srcchan)=0
Sets the mux selector for an output channel.
virtual float GetMuxInputThreshold(size_t dstchan)=0
Gets the threshold level of an input channel.
virtual void SetMuxInputThreshold(size_t dstchan, float v)=0
Sets the threshold level of an input channel.
virtual float GetMuxOutputDrive(size_t dstchan)=0
Gets the drive level of an output channel.