ngscopeclient v0.1-rc1
ngscopeclient.h
1/***********************************************************************************************************************
2* *
3* ngscopeclient *
4* *
5* Copyright (c) 2012-2025 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#ifndef ngscopeclient_h
30#define ngscopeclient_h
31
32#include "../scopehal/scopehal.h"
33
34#define GLFW_INCLUDE_NONE
35#define GLFW_INCLUDE_VULKAN
36#include <GLFW/glfw3.h>
37#define IMGUI_DEFINE_MATH_OPERATORS
38#include <imgui.h>
39#include <misc/cpp/imgui_stdlib.h>
40#include <backends/imgui_impl_glfw.h>
41#include <backends/imgui_impl_vulkan.h>
42
43#include "ImGuiDisabler.h"
44
45#include <atomic>
46
47#include "BERTState.h"
48#include "PowerSupplyState.h"
50#include "MultimeterState.h"
51#include "LoadState.h"
52#include "GuiLogSink.h"
53#include "Event.h"
54
55class Session;
56
58{
59public:
60 InstrumentThreadArgs(std::shared_ptr<SCPIInstrument> p, Session* sess)
61 : inst(p)
62 , session(sess)
63 {}
64
65 std::shared_ptr<SCPIInstrument> inst;
66 std::atomic<bool>* shuttingDown;
67 Session* session;
68
69 //Additional per-instrument-type state we can add
70 std::shared_ptr<LoadState> loadstate;
71 std::shared_ptr<MultimeterState> meterstate;
72 std::shared_ptr<BERTState> bertstate;
73 std::shared_ptr<PowerSupplyState> psustate;
74 std::shared_ptr<FunctionGeneratorState> awgstate;
75};
76
77void InstrumentThread(InstrumentThreadArgs args);
78void WaveformThread(Session* session, std::atomic<bool>* shuttingDown);
79
80void RightJustifiedText(const std::string& str);
81
82bool RectIntersect(ImVec2 posA, ImVec2 sizeA, ImVec2 posB, ImVec2 sizeB);
83bool RectContains(ImVec2 posA, ImVec2 sizeA, ImVec2 posB, ImVec2 sizeB);
84
85#endif
Declaration of BERTState.
Declaration of FunctionGeneratorState.
Declaration of GuiLogSink.
Declaration of LoadState.
Declaration of MultimeterState.
Declaration of PowerSupplyState.
Definition: ngscopeclient.h:58
A Session stores all of the instrument configuration and other state the user has open.
Definition: Session.h:95
bool RectContains(ImVec2 posA, ImVec2 sizeA, ImVec2 posB, ImVec2 sizeB)
Check if a rectangle is completely within the other one.
Definition: main.cpp:217
void RightJustifiedText(const string &str)
Helper function for right justified text in a table.
Definition: main.cpp:162
bool RectIntersect(ImVec2 posA, ImVec2 sizeA, ImVec2 posB, ImVec2 sizeB)
Check if two rectangles intersect.
Definition: main.cpp:179