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
{
///
/// Represents a base transport message.
///
internal abstract class TransportMessageBase : ExtendedObject
{
///
/// Gets or sets a value indicating whether this instance is multi response.
///
public bool IsContinuous { get; set; }
///
/// Gets or sets the message token.
///
public String Token { get; set; }
///
/// Gets or sets the message direction.
///
public TransportMessageDirection Direction { get; set; }
///
/// Gets or sets method to serial the message to byte array.
///
public Func Serialize { get; set; }
///
/// Gets or sets the activate timeout callback.
///
public Action ActivateTimeout { get; set; }
///
/// Gets or sets the message.
///
public Object Message { get; set; }
///
/// Notifies the message observer of the new result.
///
/// The result.
public abstract void SetResult(object result, bool completed);
///
/// Notifies the message observer of an exception.
///
/// The ex.
public abstract void SetException(Exception ex);
///
/// Initializes a new instance of the class.
///
/// The token.
/// The message.
/// The direction.
/// To bytes.
public TransportMessageBase(String token, object message, TransportMessageDirection direction, Func toBytes)
{
Token = token;
Message = message;
Direction = direction;
Serialize = toBytes;
}
}
}