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
Properties
ChannelName
The name of the channel
public string ChannelName { get; }
Property Value
DateTime
The last available message DateTime associated to the data (UTC).
public DateTime DateTime { get; }
Property Value
Offset
The last available message offset associated to the data
public long Offset { get; }
Property Value
Timestamp
The last available message timestamp associated to the data: Milliseconds since epoch (UTC).
public long Timestamp { get; }
Property Value
Methods
ChangeChannelDirection(DDM_CHANNEL_DIRECTION)
Changes channel direction
public OPERATION_RESULT ChangeChannelDirection(DDM_CHANNEL_DIRECTION direction)
Parameters
direction
DDM_CHANNEL_DIRECTION
Returns
~SmartDataDistributionChannel()
Finalizer
protected ~SmartDataDistributionChannel()
GetParameter(DDM_GENERAL_PARAMETER)
Set parameter on channel
public string GetParameter(DDM_GENERAL_PARAMETER paramId)
Parameters
paramId
DDM_GENERAL_PARAMETERDDM_GENERAL_PARAMETER parameter to set
Returns
- string
Parameter value
GetParameter(string)
Set parameter on channel
public string GetParameter(string paramName)
Parameters
paramName
stringParameter to set
Returns
- string
Parameter value
Lock(uint)
Lock the channel
public OPERATION_RESULT Lock(uint timeout)
Parameters
timeout
uintTimeout to acuire lock in ms
Returns
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_RESULTThe error code reported
nativeCode
intThe native code associated to the error if available
subSystemReason
stringA string with a reason from subsystem
OnDataAvailable(string, byte[])
Called when a data is available
public virtual void OnDataAvailable(string key, byte[] buffer)
Parameters
ReadFromChannel(long, long, out byte[])
Reads data from channel
public OPERATION_RESULT ReadFromChannel(long offset, long length, out byte[] buffer)
Parameters
offset
longPosition where read begins
length
longNumber of elements to read
buffer
byte[]Result buffer
Returns
SeekChannel(DateTime)
Seek the channel to an absolute timestamp
public OPERATION_RESULT SeekChannel(DateTime position)
Parameters
position
DateTimeSeek timestamp to an absolute poisition
Returns
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
longSeek offset poisition
context
DDM_SEEKCONTEXTDDM_SEEKCONTEXT to use. Default is OFFSET
kind
DDM_SEEKKINDDDM_SEEKKIND to use. Default is ABSOLUTE
Returns
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
longSeek offset poisition
kind
DDM_SEEKKINDDDM_SEEKKIND to use. Default is ABSOLUTE
Returns
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
TimeSpanSeek timestamp relative poisition
Returns
SetParameter(DDM_GENERAL_PARAMETER, string)
Set parameter on channel
public void SetParameter(DDM_GENERAL_PARAMETER paramId, string paramValue)
Parameters
paramId
DDM_GENERAL_PARAMETERDDM_GENERAL_PARAMETER parameter to set
paramValue
stringValue to set
SetParameter(string, string)
Set parameter on channel
public void SetParameter(string paramName, string paramValue)
Parameters
StartChannel(uint)
Starts the channel
public OPERATION_RESULT StartChannel(uint timeout)
Parameters
timeout
uintTimeout in ms
Returns
StopChannel(uint)
Stops the channel
public OPERATION_RESULT StopChannel(uint timeout)
Parameters
timeout
uintTimeout in ms
Returns
Unlock()
Unlock the channel
public OPERATION_RESULT Unlock()
Returns
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
boolWait a complete acknowledge from the peers
timestamp
longtimestamp to associated to the message
Returns
WriteOnChannel(string, bool, long)
Writes in the channel
public OPERATION_RESULT WriteOnChannel(string value, bool waitAll = false, long timestamp = -1)
Parameters
value
stringThe string to write in the channel
waitAll
boolWait a complete acknowledge from the peers
timestamp
longtimestamp to associated to the message
Returns
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
stringKey to use in the channel message
buffer
byte[]The data buffer in the channel message
waitAll
boolWait a complete acknowledge from the peers
timestamp
longtimestamp to associated to the message
Returns
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
stringKey to use in the channel message
value
stringThe string to write in the channel
waitAll
boolWait a complete acknowledge from the peers
timestamp
longtimestamp to associated to the message
Returns
Events
ConditionOrError
Event to receive condition or errors
public event EventHandler<ConditionOrErrorEventArgs> ConditionOrError
Event Type
DataAvailable
Event to receive messages when data are available
public event EventHandler<DataAvailableEventArgs> DataAvailable