ngscopeclient v0.2.1
Loading...
Searching...
No Matches
SerialTrigger.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
35#ifndef SerialTrigger_h
36#define SerialTrigger_h
37
41class SerialTrigger : public Trigger
42{
43public:
45 virtual ~SerialTrigger();
46
47 enum Radix
48 {
49 RADIX_ASCII,
50 RADIX_HEX,
51 RADIX_BINARY
52 };
53
54 void SetCondition(Condition cond)
55 { m_condition.SetIntVal(cond); }
56
57 Condition GetCondition()
58 { return (Condition) m_condition.GetIntVal(); }
59
60 void SetRadix(Radix rad)
61 { m_radix.SetIntVal(rad); }
62
63 Radix GetRadix()
64 { return (Radix) m_radix.GetIntVal(); }
65
66 void SetPatterns(const std::string& p1, const std::string& p2, bool ignore_p2);
67
68 std::string GetPattern1()
69 { return FormatPattern(m_pattern.ToString()); }
70
71 std::string GetPattern2()
72 { return FormatPattern(m_pattern2.ToString()); }
73
74protected:
75
76 std::string FormatPattern(const std::string& str);
77
78 FilterParameter m_radix;
79 FilterParameter m_condition;
80 FilterParameter m_pattern;
81 FilterParameter m_pattern2;
82};
83
84#endif
Definition AcceleratorBuffer.h:204
A parameter to a filter.
Definition FilterParameter.h:86
void SetIntVal(int64_t i)
Sets the parameter to an integer value.
Definition FilterParameter.cpp:307
int64_t GetIntVal() const
Returns the value of the parameter interpreted as an integer.
Definition FilterParameter.h:119
std::string ToString(bool useDisplayLocale=true, int sigfigs=-1) const
Returns a pretty-printed representation of the parameter's value.
Definition FilterParameter.cpp:225
Generic representation of an oscilloscope, logic analyzer, or spectrum analyzer.
Definition Oscilloscope.h:51
Abstract base class for serial protocol triggers with pattern matching.
Definition SerialTrigger.h:42
void SetPatterns(const std::string &p1, const std::string &p2, bool ignore_p2)
Converts a pattern from ASCII ternary (0-1-x) to a more display-friendly format.
Definition SerialTrigger.cpp:77
std::string FormatPattern(const std::string &str)
Converts a pattern in the current radix back to ASCII ternary.
Definition SerialTrigger.cpp:197
Abstract base class for oscilloscope / logic analyzer trigger inputs.
Definition Trigger.h:46
Condition
Conditions for triggers that perform logical comparisons of values.
Definition Trigger.h:85