Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
MqttTopicRepresentation.cs
1using System.Text;
3
4namespace Waher.Things.Mqtt
5{
10 {
18 {
19 this.TopicString = TopicString;
20 this.Segments = Segments;
21 this.SegmentIndex = SegmentIndex;
22 }
23
27 public string TopicString { get; }
28
32 public string[] Segments { get; }
33
37 public int SegmentIndex { get; set; }
38
42 public string CurrentSegment => this.Segments[this.SegmentIndex];
43
47 public MqttTopic CurrentParentTopic { get; private set; }
48
52 public string ProcessedSegments
53 {
54 get
55 {
56 StringBuilder sb = new StringBuilder();
57 int i;
58
59 for (i = 0; i < this.SegmentIndex; i++)
60 {
61 sb.Append(this.Segments[i]);
62 sb.Append('/');
63 }
64
65 sb.Append(this.CurrentSegment);
66
67 return sb.ToString();
68 }
69 }
70
76 public bool MoveNext(MqttTopic NewParent)
77 {
78 this.CurrentParentTopic = NewParent;
79 this.SegmentIndex++;
80 return this.SegmentIndex < this.Segments.Length;
81 }
82 }
83}
MQTT Topic information.
Definition: MqttTopic.cs:19
Contains information about an MQTT topic
bool MoveNext(MqttTopic NewParent)
Moves to the next segment.
string CurrentSegment
Current segment being processed.
MqttTopicRepresentation(string TopicString, string[] Segments, int SegmentIndex)
Contains information about an MQTT topic
MqttTopic CurrentParentTopic
Current parent topic.
string[] Segments
Segments in topic string.