forked from PeterWaher/IoTGateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPubSubItem.cs
More file actions
101 lines (91 loc) · 2.09 KB
/
PubSubItem.cs
File metadata and controls
101 lines (91 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
using System;
using System.Collections.Generic;
using System.Xml;
using Waher.Content.Xml;
namespace Waher.Networking.XMPP.PubSub
{
/// <summary>
/// Represents a published item.
/// </summary>
public class PubSubItem
{
private string itemId = string.Empty;
private string node = string.Empty;
private string serviceAddress = string.Empty;
private string publisher = string.Empty;
private string payload = string.Empty;
private XmlElement item;
private object tag = null;
/// <summary>
/// Represents a published item.
/// </summary>
/// <param name="ServiceAddress">Service address</param>
/// <param name="Node">Node name.</param>
/// <param name="Xml">XML definition.</param>
public PubSubItem(string ServiceAddress, string Node, XmlElement Xml)
{
this.node = Node;
this.serviceAddress = ServiceAddress;
this.item = Xml;
this.itemId = XML.Attribute(Xml, "id");
this.publisher = XML.Attribute(Xml, "publisher");
this.payload = Xml.InnerXml;
}
/// <summary>
/// Item ID.
/// </summary>
public string ItemId
{
get { return this.itemId; }
set { this.itemId = value; }
}
/// <summary>
/// Name of node.
/// </summary>
public string Node
{
get { return this.node; }
set { this.node = value; }
}
/// <summary>
/// Address of service hosting the node.
/// </summary>
public string ServiceAddress
{
get { return this.serviceAddress; }
set { this.serviceAddress = value; }
}
/// <summary>
/// Publisher of content.
/// </summary>
public string Publisher
{
get { return this.publisher; }
set { this.publisher = value; }
}
/// <summary>
/// Payload
/// </summary>
public string Payload
{
get { return this.payload; }
set { this.payload = value; }
}
/// <summary>
/// Item XML Element.
/// </summary>
public XmlElement Item
{
get { return this.item; }
set { this.item = value; }
}
/// <summary>
/// Can be used to tag an object to the item on the client side.
/// </summary>
public object Tag
{
get { return this.tag; }
set { this.tag = value; }
}
}
}