Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ChannelAddress.cs
1using System.Text;
4
6{
10 public class ChannelAddress
11 {
15 public byte[] ApplicationId;
16
20 public byte[] NcapId;
21
25 public byte[] TimId;
26
30 public ushort ChannelId;
31
37 public string GetTopic(string BaseTopic)
38 {
39 StringBuilder sb = new StringBuilder();
40
41 sb.Append(BaseTopic);
42 sb.Append('/');
43 sb.Append(Hashes.BinaryToString(this.NcapId));
44
45 if (!MessageSwitch.IsZero(this.TimId))
46 {
47 sb.Append('/');
48 sb.Append(Hashes.BinaryToString(this.TimId));
49
50 if (this.ChannelId != 0)
51 {
52 sb.Append('/');
53 sb.Append(this.ChannelId.ToString());
54 }
55 }
56
57 return sb.ToString();
58 }
59 }
60}
Contains methods for simple hash calculations.
Definition: Hashes.cs:59
static string BinaryToString(byte[] Data)
Converts an array of bytes to a string with their hexadecimal representations (in lower case).
Definition: Hashes.cs:65
string GetTopic(string BaseTopic)
Gets the topic name of the corresponding node.
Helps connect IEEE 1451.1.6 requests and responses across MQTT topics.
static bool IsZero(byte[] A)
Checks if an ID is "zero", i.e. contains only zero bytes.