forked from PeterWaher/IoTGateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
InteroperabilityServerEventArgs.cs
110 lines (96 loc) · 2.88 KB
/
InteroperabilityServerEventArgs.cs
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
102
103
104
105
106
107
108
109
110
using System;
using System.Collections.Generic;
using System.Text;
using Waher.Things;
namespace Waher.Networking.XMPP.Interoperability
{
/// <summary>
/// Delegate for interoperability interfaces event handlers.
/// </summary>
/// <param name="Sender">Sender of event.</param>
/// <param name="e">Event arguments.</param>
public delegate void InteroperabilityServerInterfacesEventHandler(object Sender, InteroperabilityServerEventArgs e);
/// <summary>
/// Event arguments for interoperability interface requests.
/// </summary>
public class InteroperabilityServerEventArgs : EventArgs
{
private List<string> interfaces = new List<string>();
private ThingReference thingRef = null;
private string nodeId;
private string sourceId;
private string partition;
private string serviceToken;
private string deviceToken;
private string userToken;
/// <summary>
/// Event arguments for interoperability interface requests.
/// </summary>
/// <param name="NodeId">Node ID</param>
/// <param name="SourceId">Source ID</param>
/// <param name="Partition">Partition</param>
/// <param name="ServiceToken">Service Token</param>
/// <param name="DeviceToken">Device Token</param>
/// <param name="UserToken">User Token</param>
public InteroperabilityServerEventArgs(string NodeId, string SourceId, string Partition, string ServiceToken, string DeviceToken, string UserToken)
{
this.nodeId = NodeId;
this.sourceId = SourceId;
this.partition = Partition;
this.serviceToken = ServiceToken;
this.deviceToken = DeviceToken;
this.userToken = UserToken;
}
/// <summary>
/// Node ID
/// </summary>
public string NodeId { get { return this.nodeId; } }
/// <summary>
/// Source ID
/// </summary>
public string SourceId { get { return this.sourceId; } }
/// <summary>
/// Partition
/// </summary>
public string Partition { get { return this.partition; } }
/// <summary>
/// Service Token
/// </summary>
public string ServiceToken { get { return this.serviceToken; } }
/// <summary>
/// Device Token
/// </summary>
public string DeviceToken { get { return this.deviceToken; } }
/// <summary>
/// User Token
/// </summary>
public string UserToken { get { return this.userToken; } }
/// <summary>
/// Thing reference.
/// </summary>
public ThingReference ThingReference
{
get
{
if (this.thingRef == null)
this.thingRef = new ThingReference(this.nodeId, this.sourceId, this.partition);
return this.thingRef;
}
}
/// <summary>
/// Adds interoperability interfaces to the response.
/// </summary>
/// <param name="Interfaces">Interfaces</param>
public void Add(params string[] Interfaces)
{
this.interfaces.AddRange(Interfaces);
}
/// <summary>
/// Reported Interoperability Interfaces.
/// </summary>
public string[] Interfaces
{
get { return this.interfaces.ToArray(); }
}
}
}