blob: 849317b9bbd0bb41c33bc65d5f76002580aeba78 (
plain)
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
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Subjects;
using System.Text;
using System.Threading.Tasks;
using Tango.Core;
namespace Tango.Transport
{
/// <summary>
/// Represents a base transport message.
/// </summary>
internal abstract class TransportMessageBase : ExtendedObject
{
public bool AtLeastOneResponseReceived { get; set; }
public String TransportComponentName { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is multi response.
/// </summary>
public bool IsContinuous { get; set; }
/// <summary>
/// Gets or sets the message token.
/// </summary>
public String Token { get; set; }
/// <summary>
/// Gets or sets the message direction.
/// </summary>
public TransportMessageDirection Direction { get; set; }
/// <summary>
/// Gets or sets method to serial the message to byte array.
/// </summary>
public Func<byte[]> Serialize { get; set; }
/// <summary>
/// Gets or sets the activate timeout callback.
/// </summary>
public Action ActivateTimeout { get; set; }
/// <summary>
/// Gets or sets the message.
/// </summary>
public Object Message { get; set; }
/// <summary>
/// Gets or sets a value indicating whether log the message before sending.
/// </summary>
public bool ShouldLog { get; set; }
/// <summary>
/// Notifies the message observer of the new result.
/// </summary>
/// <param name="result">The result.</param>
public abstract void SetResult(object result, bool completed);
/// <summary>
/// Notifies the message observer of an exception.
/// </summary>
/// <param name="ex">The ex.</param>
public abstract void SetException(Exception ex);
public abstract String GetActualMessageTypeName();
public abstract Object GetActualMessage();
/// <summary>
/// Initializes a new instance of the <see cref="TransportMessageBase"/> class.
/// </summary>
/// <param name="token">The token.</param>
/// <param name="message">The message.</param>
/// <param name="direction">The direction.</param>
/// <param name="toBytes">To bytes.</param>
public TransportMessageBase(String token, object message, TransportMessageDirection direction, Func<byte[]> toBytes)
{
Token = token;
Message = message;
Direction = direction;
Serialize = toBytes;
}
}
}
|