ngscopeclient 0.1-dev+51fbda87c
ngscopeclient.h
1/***********************************************************************************************************************
2* *
3* ngscopeclient *
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#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#include <shared_mutex>
47
48#include "BERTState.h"
49#include "PowerSupplyState.h"
51#include "MultimeterState.h"
52#include "LoadState.h"
53#include "GuiLogSink.h"
54#include "Event.h"
55
56class Session;
57
59{
60public:
61 InstrumentThreadArgs(std::shared_ptr<SCPIInstrument> p, Session* sess)
62 : inst(p)
63 , session(sess)
64 {}
65
66 std::shared_ptr<SCPIInstrument> inst;
67 std::atomic<bool>* shuttingDown;
68 Session* session;
69
70 //Additional per-instrument-type state we can add
71 std::shared_ptr<LoadState> loadstate;
72 std::shared_ptr<MultimeterState> meterstate;
73 std::shared_ptr<BERTState> bertstate;
74 std::shared_ptr<PowerSupplyState> psustate;
75 std::shared_ptr<FunctionGeneratorState> awgstate;
76};
77
78void InstrumentThread(InstrumentThreadArgs args);
79void WaveformThread(Session* session, std::atomic<bool>* shuttingDown);
80
81void RightJustifiedText(const std::string& str);
82
83extern std::shared_mutex g_vulkanActivityMutex;
84
85bool RectIntersect(ImVec2 posA, ImVec2 sizeA, ImVec2 posB, ImVec2 sizeB);
86bool RectContains(ImVec2 posA, ImVec2 sizeA, ImVec2 posB, ImVec2 sizeB);
87
88#endif
Declaration of BERTState.
Declaration of FunctionGeneratorState.
Declaration of GuiLogSink.
Declaration of LoadState.
Declaration of MultimeterState.
Declaration of PowerSupplyState.
std::shared_mutex g_vulkanActivityMutex
Mutex for controlling access to background Vulkan activity.
Definition: WaveformThread.cpp:62
Definition: ngscopeclient.h:59
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:211
void RightJustifiedText(const string &str)
Helper function for right justified text in a table.
Definition: main.cpp:156
bool RectIntersect(ImVec2 posA, ImVec2 sizeA, ImVec2 posB, ImVec2 sizeB)
Check if two rectangles intersect.
Definition: main.cpp:173