Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
SelfTestTime.cs
1using System;
2using System.Collections.Generic;
3using System.Text;
4using Waher.Content;
8
10{
14 public class SelfTestTime : TedsRecord
15 {
19 public SelfTestTime()
20 : base()
21 {
22 }
23
28 public float Time { get; set; }
29
35 public override Grade Supports(ClassTypePair RecordTypeId)
36 {
37 return RecordTypeId.Class == 1 && RecordTypeId.Type == 12 ? Grade.Perfect : Grade.NotAtAll;
38 }
39
47 public override TedsRecord Parse(ClassTypePair RecordTypeId, Binary RawValue, ParsingState State)
48 {
49 return new SelfTestTime()
50 {
51 Class = RecordTypeId.Class,
52 Type = RecordTypeId.Type,
53 RawValue = RawValue.Body,
54 Time = RawValue.NextSingle(nameof(SelfTestTime))
55 };
56 }
57
65 public override void AddFields(ThingReference Thing, DateTime Timestamp, List<Field> Fields, Teds Teds)
66 {
67 Fields.Add(new QuantityField(Thing, Timestamp, "Self-Test Time",
68 this.Time, Math.Min(CommonTypes.GetNrDecimals(this.Time), (byte)2), "s",
69 FieldType.Status, FieldQoS.AutomaticReadout));
70 }
71
76 public override void AppendDetails(StringBuilder SnifferOutput)
77 {
78 SnifferOutput.Append("SelfTestTime=");
79 SnifferOutput.AppendLine(this.Time.ToString());
80 }
81 }
82}
Helps with parsing of commong data types.
Definition: CommonTypes.cs:13
static byte GetNrDecimals(double x)
Calculates the number of decimals of a floating-point number.
Definition: CommonTypes.cs:903
TEDS Transducer module self-test time requirement (§6.4.2.6)
Definition: SelfTestTime.cs:15
override void AppendDetails(StringBuilder SnifferOutput)
Appends record details to sniffer output.
Definition: SelfTestTime.cs:76
override TedsRecord Parse(ClassTypePair RecordTypeId, Binary RawValue, ParsingState State)
Parses a TEDS record.
Definition: SelfTestTime.cs:47
SelfTestTime()
TEDS Transducer module self-test time requirement (§6.4.2.6)
Definition: SelfTestTime.cs:19
override void AddFields(ThingReference Thing, DateTime Timestamp, List< Field > Fields, Teds Teds)
Adds fields to a collection of fields.
Definition: SelfTestTime.cs:65
override Grade Supports(ClassTypePair RecordTypeId)
How well the class supports a specific TEDS field type.
Definition: SelfTestTime.cs:35
Represents one record in a TEDS
Definition: TedsRecord.cs:16
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 physical quantity value.
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
Time representation in IEEE 1451.0
Definition: Time.cs:10