Table of Contents

Class SmartDataDistributionChannel

Namespace
MASES.DataDistributionManager.Bindings
Assembly
DataDistributionManagerNet.dll

Main class managing channel

public class SmartDataDistributionChannel : ISmartDataDistributionChannel, ISmartDataDistributionChannelInfo
Inheritance
SmartDataDistributionChannel
Implements
Inherited Members

Constructors

SmartDataDistributionChannel()

Ctor

public SmartDataDistributionChannel()

Fields

DDM_NO_TIMESTAMP

No timestamp value

public const long DDM_NO_TIMESTAMP = -1

Field Value

long

Properties

ChannelName

The name of the channel

public string ChannelName { get; }

Property Value

string

DateTime

The last available message DateTime associated to the data (UTC).

public DateTime DateTime { get; }

Property Value

DateTime

Offset

The last available message offset associated to the data

public long Offset { get; }

Property Value

long

Timestamp

The last available message timestamp associated to the data: Milliseconds since epoch (UTC).

public long Timestamp { get; }

Property Value

long

Methods

ChangeChannelDirection(DDM_CHANNEL_DIRECTION)

Changes channel direction

public OPERATION_RESULT ChangeChannelDirection(DDM_CHANNEL_DIRECTION direction)

Parameters

direction DDM_CHANNEL_DIRECTION

New DDM_CHANNEL_DIRECTION

Returns

OPERATION_RESULT

OPERATION_RESULT

~SmartDataDistributionChannel()

Finalizer

protected ~SmartDataDistributionChannel()

GetParameter(DDM_GENERAL_PARAMETER)

Set parameter on channel

public string GetParameter(DDM_GENERAL_PARAMETER paramId)

Parameters

paramId DDM_GENERAL_PARAMETER

DDM_GENERAL_PARAMETER parameter to set

Returns

string

Parameter value

GetParameter(string)

Set parameter on channel

public string GetParameter(string paramName)

Parameters

paramName string

Parameter to set

Returns

string

Parameter value

Lock(uint)

Lock the channel

public OPERATION_RESULT Lock(uint timeout)

Parameters

timeout uint

Timeout to acuire lock in ms

Returns

OPERATION_RESULT

OPERATION_RESULT

OnConditionOrError(OPERATION_RESULT, int, string)

Called when an event condition is raised from subsystem

public virtual void OnConditionOrError(OPERATION_RESULT errorCode, int nativeCode, string subSystemReason)

Parameters

errorCode OPERATION_RESULT

The error code reported

nativeCode int

The native code associated to the error if available

subSystemReason string

A string with a reason from subsystem

OnDataAvailable(string, byte[])

Called when a data is available

public virtual void OnDataAvailable(string key, byte[] buffer)

Parameters

key string

Message key

buffer byte[]

Message buffer

ReadFromChannel(long, long, out byte[])

Reads data from channel

public OPERATION_RESULT ReadFromChannel(long offset, long length, out byte[] buffer)

Parameters

offset long

Position where read begins

length long

Number of elements to read

buffer byte[]

Result buffer

Returns

OPERATION_RESULT

OPERATION_RESULT

SeekChannel(DateTime)

Seek the channel to an absolute timestamp

public OPERATION_RESULT SeekChannel(DateTime position)

Parameters

position DateTime

Seek timestamp to an absolute poisition

Returns

OPERATION_RESULT

OPERATION_RESULT

SeekChannel(long, DDM_SEEKCONTEXT, DDM_SEEKKIND)

Seek the channel using absolute or relative offset

public OPERATION_RESULT SeekChannel(long position, DDM_SEEKCONTEXT context = DDM_SEEKCONTEXT.OFFSET, DDM_SEEKKIND kind = DDM_SEEKKIND.ABSOLUTE)

Parameters

position long

Seek offset poisition

context DDM_SEEKCONTEXT

DDM_SEEKCONTEXT to use. Default is OFFSET

kind DDM_SEEKKIND

DDM_SEEKKIND to use. Default is ABSOLUTE

Returns

OPERATION_RESULT

OPERATION_RESULT

SeekChannel(long, DDM_SEEKKIND)

Seek the channel using absolute or relative offset

public OPERATION_RESULT SeekChannel(long position, DDM_SEEKKIND kind = DDM_SEEKKIND.ABSOLUTE)

Parameters

position long

Seek offset poisition

kind DDM_SEEKKIND

DDM_SEEKKIND to use. Default is ABSOLUTE

Returns

OPERATION_RESULT

OPERATION_RESULT

SeekChannel(TimeSpan)

Seek the channel by a relative time expressed as TimeSpan starting from latest known timestamp

public OPERATION_RESULT SeekChannel(TimeSpan position)

Parameters

position TimeSpan

Seek timestamp relative poisition

Returns

OPERATION_RESULT

OPERATION_RESULT

SetParameter(DDM_GENERAL_PARAMETER, string)

Set parameter on channel

public void SetParameter(DDM_GENERAL_PARAMETER paramId, string paramValue)

Parameters

paramId DDM_GENERAL_PARAMETER

DDM_GENERAL_PARAMETER parameter to set

paramValue string

Value to set

SetParameter(string, string)

Set parameter on channel

public void SetParameter(string paramName, string paramValue)

Parameters

paramName string

Parameter to set

paramValue string

Value to set

StartChannel(uint)

Starts the channel

public OPERATION_RESULT StartChannel(uint timeout)

Parameters

timeout uint

Timeout in ms

Returns

OPERATION_RESULT

OPERATION_RESULT

StopChannel(uint)

Stops the channel

public OPERATION_RESULT StopChannel(uint timeout)

Parameters

timeout uint

Timeout in ms

Returns

OPERATION_RESULT

OPERATION_RESULT

Unlock()

Unlock the channel

public OPERATION_RESULT Unlock()

Returns

OPERATION_RESULT

OPERATION_RESULT

WriteOnChannel(byte[], bool, long)

Writes in the channel

public OPERATION_RESULT WriteOnChannel(byte[] buffer, bool waitAll = false, long timestamp = -1)

Parameters

buffer byte[]

The data buffer in the channel message

waitAll bool

Wait a complete acknowledge from the peers

timestamp long

timestamp to associated to the message

Returns

OPERATION_RESULT

WriteOnChannel(string, bool, long)

Writes in the channel

public OPERATION_RESULT WriteOnChannel(string value, bool waitAll = false, long timestamp = -1)

Parameters

value string

The string to write in the channel

waitAll bool

Wait a complete acknowledge from the peers

timestamp long

timestamp to associated to the message

Returns

OPERATION_RESULT

WriteOnChannel(string, byte[], bool, long)

Writes in the channel

public OPERATION_RESULT WriteOnChannel(string key, byte[] buffer, bool waitAll = false, long timestamp = -1)

Parameters

key string

Key to use in the channel message

buffer byte[]

The data buffer in the channel message

waitAll bool

Wait a complete acknowledge from the peers

timestamp long

timestamp to associated to the message

Returns

OPERATION_RESULT

WriteOnChannel(string, string, bool, long)

Writes in the channel

public OPERATION_RESULT WriteOnChannel(string key, string value, bool waitAll = false, long timestamp = -1)

Parameters

key string

Key to use in the channel message

value string

The string to write in the channel

waitAll bool

Wait a complete acknowledge from the peers

timestamp long

timestamp to associated to the message

Returns

OPERATION_RESULT

Events

ConditionOrError

Event to receive condition or errors

public event EventHandler<ConditionOrErrorEventArgs> ConditionOrError

Event Type

EventHandler<ConditionOrErrorEventArgs>

DataAvailable

Event to receive messages when data are available

public event EventHandler<DataAvailableEventArgs> DataAvailable

Event Type

EventHandler<DataAvailableEventArgs>