ngscopeclient v0.2
Loading...
Searching...
No Matches
MockInstrument.h
Go to the documentation of this file.
1/***********************************************************************************************************************
2* *
3* libscopehal *
4* *
5* Copyright (c) 2012-2026 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
37#ifndef MockInstrument_h
38#define MockInstrument_h
39
43class MockInstrument: public virtual SCPIInstrument
44{
45public:
47 const std::string& name,
48 const std::string& vendor,
49 const std::string& serial,
50 const std::string& transport,
51 const std::string& driver,
52 const std::string& args
53 );
54 virtual ~MockInstrument();
55
56 //Device information
57 virtual bool IsOffline() override;
58
59 virtual std::string GetTransportConnectionString() override;
60 virtual void SetTransportConnectionString(const std::string& args);
61 virtual std::string GetTransportName() override;
62
63 virtual std::string GetName() const override;
64 virtual std::string GetVendor() const override;
65 virtual std::string GetSerial() const override;
66
67 // Serialization
68
69 //This is called by Instrument::m_serializers and is not virtual
70 //cppcheck-suppress duplInheritedMember
71 void DoSerializeConfiguration(YAML::Node& node, IDTable& table);
72
73 void ClearWarnings(int version, const YAML::Node& node, IDTable& idmap, ConfigWarningList& warnings);
74
75 // SCPI
76 virtual void BackgroundProcessing() override {}
77
78protected:
79
80 //Simulated transport information
81 std::string m_transportName;
82 std::string m_driver;
83 std::string m_args;
84
85public:
86 virtual std::string GetDriverName() const override
87 { return m_driver; }
88};
89
90#endif
Definition AcceleratorBuffer.h:204
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
Base class for simulated instruments.
Definition MockInstrument.h:44
virtual bool IsOffline() override
Checks if the instrument is currently online.
Definition MockInstrument.cpp:90
virtual std::string GetTransportName() override
Gets the name of our transport.
Definition MockInstrument.cpp:95
virtual std::string GetTransportConnectionString() override
Gets the connection string for our transport.
Definition MockInstrument.cpp:100
virtual void BackgroundProcessing() override
Run various background processing typically done by a second thread (e.g. InstrumentThread)
Definition MockInstrument.h:76
An SCPI-based oscilloscope.
Definition SCPIInstrument.h:72