ngscopeclient v0.3
Loading...
Searching...
No Matches
TriggerGroup.h
Go to the documentation of this file.
1/***********************************************************************************************************************
2* *
3* ngscopeclient *
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
35#ifndef TriggerGroup_h
36#define TriggerGroup_h
37
38#include "../../lib/scopehal/PausableFilter.h"
39
55{
56public:
57 enum TriggerType
58 {
59 TRIGGER_TYPE_SINGLE,
60 TRIGGER_TYPE_FORCED,
61 TRIGGER_TYPE_AUTO,
62 TRIGGER_TYPE_NORMAL,
63
64 //Force acquisition on an auto trigger
65 TRIGGER_TYPE_AUTO_FORCE
66 };
67
68 TriggerGroup(std::shared_ptr<Oscilloscope> primary, Session* session);
69 virtual ~TriggerGroup();
70
71 void RemoveScope(std::shared_ptr<Oscilloscope> scope);
72 void RemoveFilter(PausableFilter* f);
73
74 void MakePrimary(std::shared_ptr<Oscilloscope> scope);
75 void AddSecondary(std::shared_ptr<Oscilloscope> scope);
77
78 void Arm(TriggerType type);
79 void Stop();
81 void DownloadWaveforms();
82 void RearmIfMultiScopeOrAutoTrigger();
83
84 bool empty()
85 { return m_secondaries.empty() && (m_primary == nullptr) && m_filters.empty(); }
86
87 bool HasScopes()
88 { return !m_secondaries.empty() || (m_primary != nullptr); }
89
90 bool HasSecondaries()
91 { return !m_secondaries.empty(); }
92
93 std::shared_ptr<Oscilloscope> m_primary;
94 std::vector<std::shared_ptr<Oscilloscope>> m_secondaries;
95
96 std::vector<PausableFilter*> m_filters;
97
98 std::string GetDescription();
99
102
103protected:
104 void DetachAllWaveforms(std::shared_ptr<Oscilloscope> scope);
105
106 void RefreshAutoTrigger();
107
108 Session* m_session;
109
112
115
117 double m_armTime;
118};
119
120#endif
Definition AcceleratorBuffer.h:204
Definition AddFilter.h:41
A filter which may be started and stopped.
Definition PausableFilter.h:46
Definition SerializableObject.h:40
A Session stores all of the instrument configuration and other state the user has open.
Definition Session.h:126
A trigger group is a set of oscilloscopes that all trigger in lock-step.
Definition TriggerGroup.h:55
bool m_default
True if we should be activated when the start/stop toolbar button is clicked.
Definition TriggerGroup.h:101
void Arm(TriggerType type)
Arm the trigger for the group.
Definition TriggerGroup.cpp:145
bool m_multiScopeFreeRun
True if we have multiple scopes and are in normal trigger mode.
Definition TriggerGroup.h:111
double m_armTime
Time that the trigger group was armed.
Definition TriggerGroup.h:117
void MakePrimary(std::shared_ptr< Oscilloscope > scope)
Make a scope (which must currently be a secondary) the primary.
Definition TriggerGroup.cpp:58
bool m_autoTriggerArmed
True if the group is in auto-trigger mode.
Definition TriggerGroup.h:114
bool CheckForPendingWaveforms()
Return true if all of the scopes in the group have triggered.
Definition TriggerGroup.cpp:329
void AddSecondary(std::shared_ptr< Oscilloscope > scope)
Adds a secondary scope to this group.
Definition TriggerGroup.cpp:80
void DownloadWaveforms()
Grab waveforms from the group.
Definition TriggerGroup.cpp:391
void RefreshAutoTrigger()
Checks on the status of auto trigger.
Definition TriggerGroup.cpp:488
void Stop()
Stop the trigger for the group.
Definition TriggerGroup.cpp:305