-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMessages.cs
More file actions
74 lines (62 loc) · 1.91 KB
/
Copy pathMessages.cs
File metadata and controls
74 lines (62 loc) · 1.91 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
using Newtonsoft.Json.Linq;
namespace net.vieapps.Services
{
/// <summary>
/// Presents a base message for updating information
/// </summary>
public class BaseMessage
{
public BaseMessage() { }
/// <summary>
/// Gets or sets type of the message
/// </summary>
public string Type { get; set; } = "";
/// <summary>
/// Gets or sets data of the message
/// </summary>
public JToken Data { get; set; } = new JObject();
}
// --------------------------------------------------------------------------------------------
/// <summary>
/// Presents a message for updating via RTU (Real-Time Update)
/// </summary>
public class UpdateMessage : BaseMessage
{
public UpdateMessage() : this(null) { }
public UpdateMessage(BaseMessage message) : base()
{
this.Type = message?.Type ?? "";
this.Data = message?.Data ?? new JObject();
}
/// <summary>
/// Gets or sets identity of device that received the message
/// </summary>
public string DeviceID { get; set; } = "";
/// <summary>
/// Gets or sets the identity of excluded devices
/// </summary>
public string ExcludedDeviceID { get; set; } = "";
}
// --------------------------------------------------------------------------------------------
/// <summary>
/// Presents a message for communicating between services
/// </summary>
public class CommunicateMessage : BaseMessage
{
public CommunicateMessage() : this(null) { }
public CommunicateMessage(string serviceName, BaseMessage message = null) : base()
{
this.ServiceName = serviceName ?? "";
this.Type = message?.Type ?? "";
this.Data = message?.Data ?? new JObject();
}
/// <summary>
/// Gets or sets name of the service that received and processed the message
/// </summary>
public string ServiceName { get; set; }
/// <summary>
/// Gets or sets the identity of excluded node
/// </summary>
public string ExcludedNodeID { get; set; } = "";
}
}