ngscopeclient 0.1-dev+51fbda87c
TriggerGroup.h
Go to the documentation of this file.
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
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
65 TriggerGroup(std::shared_ptr<Oscilloscope> primary, Session* session);
66 virtual ~TriggerGroup();
67
68 void RemoveScope(std::shared_ptr<Oscilloscope> scope);
69 void RemoveFilter(PausableFilter* f);
70
71 void MakePrimary(std::shared_ptr<Oscilloscope> scope);
72 void AddSecondary(std::shared_ptr<Oscilloscope> scope);
74
75 void Arm(TriggerType type);
76 void Stop();
78 void DownloadWaveforms();
79 void RearmIfMultiScope();
80
81 bool empty()
82 { return m_secondaries.empty() && (m_primary == nullptr) && m_filters.empty(); }
83
84 bool HasScopes()
85 { return !m_secondaries.empty() || (m_primary != nullptr); }
86
87 bool HasSecondaries()
88 { return !m_secondaries.empty(); }
89
90 std::shared_ptr<Oscilloscope> m_primary;
91 std::vector<std::shared_ptr<Oscilloscope>> m_secondaries;
92
93 std::vector<PausableFilter*> m_filters;
94
95 std::string GetDescription();
96
99
100protected:
101 void DetachAllWaveforms(std::shared_ptr<Oscilloscope> scope);
102
103 Session* m_session;
104
107};
108
109#endif
Definition: AddFilter.h:41
A filter which may be started and stopped.
Definition: PausableFilter.h:46
A Session stores all of the instrument configuration and other state the user has open.
Definition: Session.h:95
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:98
void Arm(TriggerType type)
Arm the trigger for the group.
Definition: TriggerGroup.cpp:144
bool m_multiScopeFreeRun
True if we have multiple scopes and are in normal trigger mode.
Definition: TriggerGroup.h:106
void MakePrimary(std::shared_ptr< Oscilloscope > scope)
Make a scope (which must currently be a secondary) the primary.
Definition: TriggerGroup.cpp:57
bool CheckForPendingWaveforms()
Return true if all of the scopes in the group have triggered.
Definition: TriggerGroup.cpp:296
void AddSecondary(std::shared_ptr< Oscilloscope > scope)
Adds a secondary scope to this group.
Definition: TriggerGroup.cpp:79
void DownloadWaveforms()
Grab waveforms from the group.
Definition: TriggerGroup.cpp:354
void Stop()
Stop the trigger for the group.
Definition: TriggerGroup.cpp:273