-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy pathObservationRegistration.cs
58 lines (51 loc) · 1.44 KB
/
ObservationRegistration.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
using System;
using Waher.Networking.CoAP.Transport;
namespace Waher.Networking.CoAP
{
/// <summary>
/// Represents a registration on an observable resource.
/// </summary>
public class ObservationRegistration
{
private readonly ClientBase client;
private readonly CoapEndpoint endpoint;
private readonly CoapMessage request;
private uint seqNr = 0;
/// <summary>
/// Represents a registration on an observable resource.
/// </summary>
/// <param name="Client">UDP Client on which the request was received.</param>
/// <param name="Endpoint">CoAP Endpoint managing the resource.</param>
/// <param name="Request">Request message.</param>
internal ObservationRegistration(ClientBase Client, CoapEndpoint Endpoint,
CoapMessage Request)
{
this.client = Client;
this.endpoint = Endpoint;
this.request = Request;
}
/// <summary>
/// Client on which the request was received.
/// </summary>
internal ClientBase Client => this.client;
/// <summary>
/// CoAP Endpoint managing the resource.
/// </summary>
public CoapEndpoint Endpoint => this.endpoint;
/// <summary>
/// Request message.
/// </summary>
public CoapMessage Request => this.request;
/// <summary>
/// Sequence number.
/// </summary>
public uint SequenceNumber => this.seqNr;
/// <summary>
/// Increases the sequence number.
/// </summary>
internal void IncSeqNr()
{
this.seqNr = (this.seqNr + 1) & 0xffffff;
}
}
}