ngscopeclient v0.1-rc1
RGBLEDDecoder.h
Go to the documentation of this file.
1/***********************************************************************************************************************
2* *
3* libscopeprotocols *
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
36#ifndef RGBLEDDecoder_h
37#define RGBLEDDecoder_h
38
39#include "PacketDecoder.h"
40
42{
43public:
44
45 RGBLEDSymbol() {}
46
47 RGBLEDSymbol(uint32_t d) : m_data(d) {}
48
49 uint32_t m_data;
50
51 bool operator==(const RGBLEDSymbol& s) const { return (m_data == s.m_data); }
52};
53
54class RGBLEDWaveform : public SparseWaveform<RGBLEDSymbol>
55{
56public:
59 , m_scale(1)
60 {};
61 virtual std::string GetText(size_t) override;
62 virtual std::string GetColor(size_t) override;
63
64 float m_scale;
65};
66
68{
69public:
70 RGBLEDDecoder(const std::string& color);
71
72 virtual void Refresh(vk::raii::CommandBuffer& cmdBuf, std::shared_ptr<QueueHandle> queue) override;
73
74 static std::string GetProtocolName();
75
76 virtual bool GetShowImageColumn() override;
77 virtual std::vector<std::string> GetHeaders() override;
78
79 virtual bool ValidateChannel(size_t i, StreamDescriptor stream) override;
80
81 PROTOCOL_DECODER_INITPROC(RGBLEDDecoder)
82
83 float GetScale()
84 { return m_displayscale.GetFloatVal(); }
85
86protected:
87 enum pwidth_t
88 {
89 SHORT,
90 LONG,
91 AMBIGUOUS
92 };
93
94 enum type_t
95 {
96 TYPE_19_C47, //Everlight 19-C47/RSGHBC-5V01/2T and similar
97 TYPE_WS2812
98 };
99
100 FilterParameter& m_type;
101
102 FilterParameter& m_displayscale;
103};
104
105#endif
A parameter to a filter.
Definition: FilterParameter.h:86
float GetFloatVal() const
Returns the value of the parameter interpreted as a floating point number.
Definition: FilterParameter.h:125
virtual void Refresh() override
Evaluates a filter graph node.
Definition: Filter.cpp:823
Definition: PacketDecoder.h:85
Definition: RGBLEDDecoder.h:68
Definition: RGBLEDDecoder.h:42
Definition: RGBLEDDecoder.h:55
virtual std::string GetText(size_t) override
Returns the text representation of a given protocol sample.
Definition: RGBLEDDecoder.cpp:335
virtual std::string GetColor(size_t) override
Returns the displayed color (in HTML #rrggbb or #rrggbbaa notation) of a given protocol sample.
Definition: RGBLEDDecoder.cpp:313
A waveform sampled at irregular intervals.
Definition: Waveform.h:469
Descriptor for a single stream coming off a channel.
Definition: StreamDescriptor.h:46