ngscopeclient 0.1-dev+51fbda87c
MilStd1553Decoder.h
Go to the documentation of this file.
1/***********************************************************************************************************************
2* *
3* libscopeprotocols *
4* *
5* Copyright (c) 2012-2022 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 MilStd1553Decoder_h
36#define MilStd1553Decoder_h
37
39{
40public:
41 enum stype
42 {
43 TYPE_SYNC_CTRL_STAT,
44 TYPE_SYNC_DATA,
45 TYPE_DATA,
46
47 TYPE_RT_ADDR,
48 TYPE_DIRECTION,
49 TYPE_SUB_ADDR,
50 TYPE_LENGTH,
51
52 TYPE_PARITY_OK,
53 TYPE_PARITY_BAD,
54
55 TYPE_MSG_OK,
56 TYPE_MSG_ERR,
57
58 TYPE_TURNAROUND,
59
60 TYPE_STATUS,
61
62 TYPE_ERROR
63 };
64
65 enum statbits
66 {
67 STATUS_SERVICE_REQUEST = 0x01,
68 STATUS_MALFORMED = 0x02,
69 STATUS_BROADCAST_ACK = 0x04,
70 STATUS_BUSY = 0x08,
71 STATUS_SUBSYS_FAULT = 0x10,
72 STATUS_DYN_ACCEPT = 0x20,
73 STATUS_RT_FAULT = 0x40,
74
75 STATUS_ANY_FAULT = STATUS_MALFORMED | STATUS_SUBSYS_FAULT | STATUS_RT_FAULT
76 };
77
79 {}
80
81 MilStd1553Symbol(stype t, uint16_t d)
82 : m_stype(t)
83 , m_data(d)
84 {}
85
86 stype m_stype;
87 uint16_t m_data;
88
89 bool operator== (const MilStd1553Symbol& s) const
90 {
91 return (m_stype == s.m_stype) && (m_data == s.m_data);
92 }
93};
94
95class MilStd1553Waveform : public SparseWaveform<MilStd1553Symbol>
96{
97public:
99 virtual std::string GetText(size_t) override;
100 virtual std::string GetColor(size_t) override;
101};
102
104{
105public:
106 MilStd1553Decoder(const std::string& color);
107 virtual ~MilStd1553Decoder();
108
109 virtual void Refresh() override;
110 static std::string GetProtocolName();
111
112 virtual bool ValidateChannel(size_t i, StreamDescriptor stream) override;
113
114 std::vector<std::string> GetHeaders() override;
115
116 PROTOCOL_DECODER_INITPROC(MilStd1553Decoder)
117};
118
119#endif
Definition: MilStd1553Decoder.h:104
virtual void Refresh() override
Evaluates a filter graph node.
Definition: MilStd1553Decoder.cpp:82
Definition: MilStd1553Decoder.h:39
Definition: MilStd1553Decoder.h:96
virtual std::string GetText(size_t) override
Returns the text representation of a given protocol sample.
Definition: MilStd1553Decoder.cpp:724
virtual std::string GetColor(size_t) override
Returns the displayed color (in HTML #rrggbb or #rrggbbaa notation) of a given protocol sample.
Definition: MilStd1553Decoder.cpp:685
Definition: PacketDecoder.h:85
A waveform sampled at irregular intervals.
Definition: Waveform.h:460
Descriptor for a single stream coming off a channel.
Definition: StreamDescriptor.h:46