Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
TedsId.cs
1using System;
2using System.Collections.Generic;
3using System.Text;
7
9{
13 public class TedsId : TedsRecord
14 {
18 public TedsId()
19 : base()
20 {
21 }
22
45 public TedsId(byte FamilyMember, byte FamilySubMember, byte Class, byte Version,
46 byte TupleLength)
47 : base(Class, 3, new byte[] { FamilyMember, FamilySubMember, Class, Version, TupleLength })
48 {
49 this.FamilyMember = FamilyMember;
50 this.FamilySubMember = FamilySubMember;
51 this.Class = Class;
52 this.Version = Version;
53 this.TupleLength = TupleLength;
54 }
55
60 public byte FamilyMember { get; set; }
61
67 public byte FamilySubMember { get; set; }
68
75 public byte Version { get; set; }
76
88 public byte TupleLength { get; set; }
89
95 public override Grade Supports(ClassTypePair RecordTypeId)
96 {
97 return RecordTypeId.Type == 3 ? Grade.Perfect : Grade.NotAtAll;
98 }
99
107 public override TedsRecord Parse(ClassTypePair RecordTypeId, Binary RawValue, ParsingState State)
108 {
109 return new TedsId()
110 {
111 Type = RecordTypeId.Type,
112 RawValue = RawValue.Body,
113 FamilyMember = RawValue.NextUInt8(nameof(this.FamilyMember)),
114 FamilySubMember = RawValue.NextUInt8(nameof(this.FamilySubMember)),
115 Class = RawValue.NextUInt8(nameof(this.Class)),
116 Version = RawValue.NextUInt8(nameof(this.Version)),
117 TupleLength = RawValue.NextUInt8(nameof(this.TupleLength))
118 };
119 }
120
128 public override void AddFields(ThingReference Thing, DateTime Timestamp, List<Field> Fields, Teds Teds)
129 {
130 Fields.Add(new StringField(Thing, Timestamp, "Family", this.FamilyName,
131 FieldType.Identity, FieldQoS.AutomaticReadout));
132
133 Fields.Add(new BooleanField(Thing, Timestamp, ((TedsAccessCode)this.Class).ToString(), true,
134 FieldType.Identity, FieldQoS.AutomaticReadout));
135
136 Fields.Add(new Int32Field(Thing, Timestamp, "TEDS Version", this.Version,
137 FieldType.Identity, FieldQoS.AutomaticReadout));
138 }
139
143 public string FamilyName
144 {
145 get
146 {
147 StringBuilder sb = new StringBuilder();
148
149 sb.Append("IEEE 1451.");
150 sb.Append(this.FamilyMember.ToString());
151
152 if (this.FamilySubMember != 0xff)
153 {
154 sb.Append('.');
155 sb.Append(this.FamilySubMember.ToString());
156 }
157
158 return sb.ToString();
159 }
160 }
161
166 public override void AppendDetails(StringBuilder SnifferOutput)
167 {
168 SnifferOutput.Append("Family=");
169 SnifferOutput.Append(this.FamilyName);
170 SnifferOutput.Append(", TEDSVersion=");
171 SnifferOutput.AppendLine(this.Version.ToString());
172 }
173 }
174}
byte NextUInt8(string Name)
Gets the next byte
Definition: Binary.cs:153
TEDS identification header (§6.3)
Definition: TedsId.cs:14
override void AppendDetails(StringBuilder SnifferOutput)
Appends record details to sniffer output.
Definition: TedsId.cs:166
override void AddFields(ThingReference Thing, DateTime Timestamp, List< Field > Fields, Teds Teds)
Adds fields to a collection of fields.
Definition: TedsId.cs:128
TedsId()
TEDS identification header (§6.3)
Definition: TedsId.cs:18
override TedsRecord Parse(ClassTypePair RecordTypeId, Binary RawValue, ParsingState State)
Parses a TEDS record.
Definition: TedsId.cs:107
byte TupleLength
This field gives the number of octets in the length field of all tuples in the TEDS except this tuple...
Definition: TedsId.cs:88
TedsId(byte FamilyMember, byte FamilySubMember, byte Class, byte Version, byte TupleLength)
TEDS identification header (§6.3)
Definition: TedsId.cs:45
byte FamilyMember
This field identifies the member of the IEEE 1451 family of standards that defines this TEDS....
Definition: TedsId.cs:60
byte FamilySubMember
This field identifies the submember of the IEEE 1451 family of standards that defines this TEDS....
Definition: TedsId.cs:67
byte Version
This field identifies the TEDS version. The value is the version number identified in the standard....
Definition: TedsId.cs:75
override Grade Supports(ClassTypePair RecordTypeId)
How well the class supports a specific TEDS field type.
Definition: TedsId.cs:95
Represents one record in a TEDS
Definition: TedsRecord.cs:16
override string ToString()
Object.ToString()
Definition: TedsRecord.cs:113
byte Class
This field identifies the TEDS being accessed. The value is the TEDS access code found in Table 72.
Definition: TedsRecord.cs:42
Represents a boolean value that can be either true or false.
Definition: BooleanField.cs:11
Represents a 32-bit integer value.
Definition: Int32Field.cs:10
Represents a string value.
Definition: StringField.cs:10
Contains a reference to a thing
Grade
Grade enumeration
Definition: Grade.cs:7
FieldQoS
Field Quality of Service flags
Definition: FieldQoS.cs:10
FieldType
Field Type flags
Definition: FieldType.cs:10