C# Class GSF.TimeSeries.Transport.DataSubscriber

Inheritance: GSF.TimeSeries.Adapters.InputAdapterBase
显示文件 Open project: GridProtectionAlliance/gsf Class Usage Examples

Private Properties

Property Type Description
DataSubscriber_ConnectionAuthenticated void
DataSubscriber_MetaDataReceived void
DeserializeMetadata System.Data.DataSet
DeserializeSignalIndexCache SignalIndexCache
DisconnectClient void
FixExpectedMeasurementCounts void
FromLocallySynchronizedInfo GSF.TimeSeries.Transport.UnsynchronizedSubscriptionInfo
GetAuthorizedSignalIDs System.Guid[]
GetCharacterEncoding System.Text.Encoding
GetDataGapRecoverySubscriptionStatus string
GetFramesPerSecond int
GetLocalCertificate string
GetUnauthorizedSignalIDs System.Guid[]
HandleDeviceStatisticsRegistration void
HandleSocketException bool
InitSyncProgress void
IsUserCommand bool
LocallySynchronizedSubscribe bool
OnExceededParsingExceptionThreshold void
ParseTSSCMeasurements void
ProcessServerResponse void
RefreshMetadata void
RegisterDeviceStatistics void
RemoteCertificateExists bool
RemotelySynchronizedSubscribe bool
ResetLifetimeCounters void
ResetMeasurementsPerSecondCounters void
Restart void
StartSubscription void
SubscribeToOutputMeasurements void
SubscribedDevicesTimer_Elapsed void
SynchronizedMetadataChanged bool
TryFilterOutputMeasurements void
UnregisterDeviceStatistics void
UnsynchronizedSubscribe bool
UpdateMeasurementsPerSecond void
UpdateOutputMeasurements bool
UpdateStatisticsHelpers void
UpdateSyncProgress void
m_commandChannel_ConnectionAttempt void
m_commandChannel_ConnectionEstablished void
m_commandChannel_ConnectionException void
m_commandChannel_ConnectionTerminated void
m_commandChannel_ReceiveData void
m_commandChannel_ReceiveDataException void
m_commandChannel_SendDataException void
m_dataChannel_ConnectionAttempt void
m_dataChannel_ConnectionException void
m_dataChannel_ReceiveData void
m_dataChannel_ReceiveDataException void
m_dataGapRecoverer_ProcessException void
m_dataGapRecoverer_RecoveredMeasurements void
m_dataGapRecoverer_StatusMessage void
m_dataStreamMonitor_Elapsed void
m_localConcentrator_ProcessException void
m_runTimeLog_ProcessException void

Public Methods

Method Description
Authenticate ( string sharedSecret, string authenticationID ) : bool

Authenticates subscriber to a data publisher.

DataSubscriber ( ) : System

Creates a new DataSubscriber.

GetShortStatus ( int maxLength ) : string

Gets a short one-line status of this DataSubscriber.

Initialize ( ) : void

Initializes DataSubscriber.

SendServerCommand ( ServerCommand commandCode, byte data = null ) : bool

Sends a server command to the publisher connection.

SendServerCommand ( ServerCommand commandCode, string message ) : bool

Sends a server command to the publisher connection with associated message data.

Subscribe ( GSF.TimeSeries.Transport.SubscriptionInfo info ) : bool

Subscribes (or re-subscribes) to a data publisher for a set of data points.

Subscribe ( bool remotelySynchronized, bool compactFormat, string connectionString ) : bool

Subscribes (or re-subscribes) to a data publisher for a set of data points.

SynchronizeMetadata ( DataSet metadata ) : void

Spawn meta-data synchronization.

This method makes sure only one meta-data synchronization happens at a time.

SynchronizedSubscribe ( GSF.TimeSeries.Transport.SynchronizedSubscriptionInfo info ) : bool

Subscribes (or re-subscribes) to a data publisher for a synchronized set of data points.

Unsubscribe ( ) : bool

Unsubscribes from a data publisher.

UnsynchronizedSubscribe ( GSF.TimeSeries.Transport.UnsynchronizedSubscriptionInfo info ) : bool

Subscribes (or re-subscribes) to a data publisher for an unsynchronized set of data points.

Protected Methods

Method Description
AttemptConnection ( ) : void

Attempts to connect to this DataSubscriber.

AttemptDisconnection ( ) : void

Attempts to disconnect from this DataSubscriber.

Dispose ( bool disposing ) : void

Releases the unmanaged resources used by the DataSubscriber object and optionally releases the managed resources.

DisposeLocalConcentrator ( ) : void

Disposes of any previously defined local concentrator.

GetLoggingPath ( string filePath ) : string

Gets file path for any defined logging path.

InterpretResponseMessage ( byte buffer, int startIndex, int length ) : string

Get message from string based response.

OnConnectionAuthenticated ( ) : void

Raises the ConnectionAuthenticated event.

OnConnectionEstablished ( ) : void

Raises the ConnectionEstablished event.

OnConnectionTerminated ( ) : void

Raises the ConnectionTerminated event.

OnDataStartTime ( Ticks startTime ) : void

Raises the DataStartTime event.

OnMetaDataReceived ( DataSet metadata ) : void

Raises the MetaDataReceived event.

OnNotificationReceived ( string message ) : void

Raises the NotificationReceived event.

OnProcessException ( MessageLevel level, Exception exception, string eventName = null, MessageFlags flags = MessageFlags.None ) : void

Raises AdapterBase.ProcessException event.

OnProcessingComplete ( string source ) : void

Raises the ProcessingComplete event.

OnReceivedServerResponse ( ServerResponse responseCode, ServerCommand commandCode ) : void

Raises the ReceivedServerResponse event.

OnReceivedUserCommandResponse ( ServerCommand command, ServerResponse response, byte buffer, int startIndex, int length ) : void

Raises the ReceivedUserCommandResponse event.

OnServerConfigurationChanged ( ) : void

Raises the ServerConfigurationChanged event.

SynchronizeMetadata ( ) : void

Handles meta-data synchronization to local system.

This function should only be initiated from call to SynchronizeMetadata(DataSet) to make sure only one meta-data synchronization happens at once. Users can override this method to customize process of meta-data synchronization.

Private Methods

Method Description
DataSubscriber_ConnectionAuthenticated ( object sender, EventArgs e ) : void
DataSubscriber_MetaDataReceived ( object sender, EventArgs e ) : void
DeserializeMetadata ( byte buffer ) : DataSet
DeserializeSignalIndexCache ( byte buffer ) : SignalIndexCache
DisconnectClient ( ) : void
FixExpectedMeasurementCounts ( ) : void
FromLocallySynchronizedInfo ( GSF.TimeSeries.Transport.SynchronizedSubscriptionInfo info ) : GSF.TimeSeries.Transport.UnsynchronizedSubscriptionInfo
GetAuthorizedSignalIDs ( ) : System.Guid[]
GetCharacterEncoding ( OperationalEncoding operationalEncoding ) : Encoding
GetDataGapRecoverySubscriptionStatus ( ) : string
GetFramesPerSecond ( DataTable measurementTable, System.Guid signalID ) : int
GetLocalCertificate ( ) : string
GetUnauthorizedSignalIDs ( ) : System.Guid[]
HandleDeviceStatisticsRegistration ( ) : void
HandleSocketException ( Exception ex ) : bool
InitSyncProgress ( long totalActions ) : void
IsUserCommand ( ServerCommand command ) : bool
LocallySynchronizedSubscribe ( bool compactFormat, int framesPerSecond, double lagTime, double leadTime, string filterExpression, string dataChannel = null, bool useLocalClockAsRealTime = false, bool ignoreBadTimestamps = false, bool allowSortsByArrival = true, long timeResolution = Ticks.PerMillisecond, bool allowPreemptivePublishing = true, DownsamplingMethod downsamplingMethod = DownsamplingMethod.LastReceived, string startTime = null, string stopTime = null, string constraintParameters = null, int processingInterval = -1, string waitHandleNames = null, int waitHandleTimeout ) : bool
OnExceededParsingExceptionThreshold ( ) : void

Raises the ExceededParsingExceptionThreshold event.

ParseTSSCMeasurements ( byte buffer, int responseLength, int &responseIndex, List measurements ) : void
ProcessServerResponse ( byte buffer, int length ) : void
RefreshMetadata ( ) : void
RegisterDeviceStatistics ( ) : void
RemoteCertificateExists ( ) : bool
RemotelySynchronizedSubscribe ( bool compactFormat, int framesPerSecond, double lagTime, double leadTime, string filterExpression, string dataChannel = null, bool useLocalClockAsRealTime = false, bool ignoreBadTimestamps = false, bool allowSortsByArrival = true, long timeResolution = Ticks.PerMillisecond, bool allowPreemptivePublishing = true, DownsamplingMethod downsamplingMethod = DownsamplingMethod.LastReceived, string startTime = null, string stopTime = null, string constraintParameters = null, int processingInterval = -1, string waitHandleNames = null, int waitHandleTimeout ) : bool
ResetLifetimeCounters ( ) : void
ResetMeasurementsPerSecondCounters ( ) : void
Restart ( ) : void
StartSubscription ( ) : void
SubscribeToOutputMeasurements ( bool metaDataRefreshCompleted ) : void
SubscribedDevicesTimer_Elapsed ( object sender, EventArgs elapsedEventArgs ) : void
SynchronizedMetadataChanged ( DataSet newSynchronizedMetadata ) : bool
TryFilterOutputMeasurements ( ) : void
UnregisterDeviceStatistics ( ) : void
UnsynchronizedSubscribe ( bool compactFormat, bool throttled, string filterExpression, string dataChannel = null, bool includeTime = true, double lagTime = 10.0D, double leadTime = 5.0D, bool useLocalClockAsRealTime = false, string startTime = null, string stopTime = null, string constraintParameters = null, int processingInterval = -1, string waitHandleNames = null, int waitHandleTimeout ) : bool
UpdateMeasurementsPerSecond ( System.DateTime now, int measurementCount ) : void
UpdateOutputMeasurements ( bool initialCall = false ) : bool
UpdateStatisticsHelpers ( ) : void
UpdateSyncProgress ( ) : void
m_commandChannel_ConnectionAttempt ( object sender, EventArgs e ) : void
m_commandChannel_ConnectionEstablished ( object sender, EventArgs e ) : void
m_commandChannel_ConnectionException ( object sender, EventArgs e ) : void
m_commandChannel_ConnectionTerminated ( object sender, EventArgs e ) : void
m_commandChannel_ReceiveData ( object sender, EventArgs e ) : void
m_commandChannel_ReceiveDataException ( object sender, EventArgs e ) : void
m_commandChannel_SendDataException ( object sender, EventArgs e ) : void
m_dataChannel_ConnectionAttempt ( object sender, EventArgs e ) : void
m_dataChannel_ConnectionException ( object sender, EventArgs e ) : void
m_dataChannel_ReceiveData ( object sender, EventArgs e ) : void
m_dataChannel_ReceiveDataException ( object sender, EventArgs e ) : void
m_dataGapRecoverer_ProcessException ( object sender, EventArgs e ) : void
m_dataGapRecoverer_RecoveredMeasurements ( object sender, EventArgs e ) : void
m_dataGapRecoverer_StatusMessage ( object sender, EventArgs e ) : void
m_dataStreamMonitor_Elapsed ( object sender, EventArgs e ) : void
m_localConcentrator_ProcessException ( object sender, EventArgs e ) : void
m_runTimeLog_ProcessException ( object sender, EventArgs e ) : void

Method Details

AttemptConnection() protected method

Attempts to connect to this DataSubscriber.
protected AttemptConnection ( ) : void
return void

AttemptDisconnection() protected method

Attempts to disconnect from this DataSubscriber.
protected AttemptDisconnection ( ) : void
return void

Authenticate() public method

Authenticates subscriber to a data publisher.
public Authenticate ( string sharedSecret, string authenticationID ) : bool
sharedSecret string Shared secret used to look up private crypto key and initialization vector.
authenticationID string Authentication ID that publisher will use to validate subscriber identity.
return bool

DataSubscriber() public method

Creates a new DataSubscriber.
public DataSubscriber ( ) : System
return System

Dispose() protected method

Releases the unmanaged resources used by the DataSubscriber object and optionally releases the managed resources.
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; false to release only unmanaged resources.
return void

DisposeLocalConcentrator() protected method

Disposes of any previously defined local concentrator.
protected DisposeLocalConcentrator ( ) : void
return void

GetLoggingPath() protected method

Gets file path for any defined logging path.
protected GetLoggingPath ( string filePath ) : string
filePath string Path to acquire within logging path.
return string

GetShortStatus() public method

Gets a short one-line status of this DataSubscriber.
public GetShortStatus ( int maxLength ) : string
maxLength int Maximum length of the status message.
return string

Initialize() public method

Initializes DataSubscriber.
public Initialize ( ) : void
return void

InterpretResponseMessage() protected method

Get message from string based response.
protected InterpretResponseMessage ( byte buffer, int startIndex, int length ) : string
buffer byte Response buffer.
startIndex int Start index of response message.
length int Length of response message.
return string

OnConnectionAuthenticated() protected method

Raises the ConnectionAuthenticated event.
protected OnConnectionAuthenticated ( ) : void
return void

OnConnectionEstablished() protected method

Raises the ConnectionEstablished event.
protected OnConnectionEstablished ( ) : void
return void

OnConnectionTerminated() protected method

Raises the ConnectionTerminated event.
protected OnConnectionTerminated ( ) : void
return void

OnDataStartTime() protected method

Raises the DataStartTime event.
protected OnDataStartTime ( Ticks startTime ) : void
startTime Ticks Start time, in , of first measurement transmitted.
return void

OnMetaDataReceived() protected method

Raises the MetaDataReceived event.
protected OnMetaDataReceived ( DataSet metadata ) : void
metadata System.Data.DataSet Meta-data instance to send to client subscription.
return void

OnNotificationReceived() protected method

Raises the NotificationReceived event.
protected OnNotificationReceived ( string message ) : void
message string Message for the notification.
return void

OnProcessException() protected method

Raises AdapterBase.ProcessException event.
protected OnProcessException ( MessageLevel level, Exception exception, string eventName = null, MessageFlags flags = MessageFlags.None ) : void
level MessageLevel The to assign to this message
exception System.Exception Processing .
eventName string A fixed string to classify this event; defaults to null.
flags MessageFlags to use, if any; defaults to .
return void

OnProcessingComplete() protected method

Raises the ProcessingComplete event.
protected OnProcessingComplete ( string source ) : void
source string Type name of adapter that sent the processing completed notification.
return void

OnReceivedServerResponse() protected method

Raises the ReceivedServerResponse event.
protected OnReceivedServerResponse ( ServerResponse responseCode, ServerCommand commandCode ) : void
responseCode ServerResponse Response received from the server.
commandCode ServerCommand Command that the server responded to.
return void

OnReceivedUserCommandResponse() protected method

Raises the ReceivedUserCommandResponse event.
protected OnReceivedUserCommandResponse ( ServerCommand command, ServerResponse response, byte buffer, int startIndex, int length ) : void
command ServerCommand The code for the user command.
response ServerResponse The code for the server's response.
buffer byte Buffer containing the message from the server.
startIndex int Index into the buffer used to skip the header.
length int The length of the message in the buffer, including the header.
return void

OnServerConfigurationChanged() protected method

Raises the ServerConfigurationChanged event.
protected OnServerConfigurationChanged ( ) : void
return void

SendServerCommand() public method

Sends a server command to the publisher connection.
public SendServerCommand ( ServerCommand commandCode, byte data = null ) : bool
commandCode ServerCommand to send.
data byte Optional command data to send.
return bool

SendServerCommand() public method

Sends a server command to the publisher connection with associated message data.
public SendServerCommand ( ServerCommand commandCode, string message ) : bool
commandCode ServerCommand to send.
message string String based command data to send to server.
return bool

Subscribe() public method

Subscribes (or re-subscribes) to a data publisher for a set of data points.
public Subscribe ( GSF.TimeSeries.Transport.SubscriptionInfo info ) : bool
info GSF.TimeSeries.Transport.SubscriptionInfo Configuration object that defines the subscription.
return bool

Subscribe() public method

Subscribes (or re-subscribes) to a data publisher for a set of data points.
public Subscribe ( bool remotelySynchronized, bool compactFormat, string connectionString ) : bool
remotelySynchronized bool Boolean value that determines if subscription should be remotely synchronized - note that data publisher may not allow remote synchronization.
compactFormat bool Boolean value that determines if the compact measurement format should be used. Set to false for full fidelity measurement serialization; otherwise set to true for bandwidth conservation.
connectionString string Connection string that defines required and optional parameters for the subscription.
return bool

SynchronizeMetadata() protected method

Handles meta-data synchronization to local system.
This function should only be initiated from call to SynchronizeMetadata(DataSet) to make sure only one meta-data synchronization happens at once. Users can override this method to customize process of meta-data synchronization.
protected SynchronizeMetadata ( ) : void
return void

SynchronizeMetadata() public method

Spawn meta-data synchronization.
This method makes sure only one meta-data synchronization happens at a time.
public SynchronizeMetadata ( DataSet metadata ) : void
metadata System.Data.DataSet to use for synchronization.
return void

SynchronizedSubscribe() public method

Subscribes (or re-subscribes) to a data publisher for a synchronized set of data points.
public SynchronizedSubscribe ( GSF.TimeSeries.Transport.SynchronizedSubscriptionInfo info ) : bool
info GSF.TimeSeries.Transport.SynchronizedSubscriptionInfo Configuration object that defines the subscription.
return bool

Unsubscribe() public method

Unsubscribes from a data publisher.
public Unsubscribe ( ) : bool
return bool

UnsynchronizedSubscribe() public method

Subscribes (or re-subscribes) to a data publisher for an unsynchronized set of data points.
public UnsynchronizedSubscribe ( GSF.TimeSeries.Transport.UnsynchronizedSubscriptionInfo info ) : bool
info GSF.TimeSeries.Transport.UnsynchronizedSubscriptionInfo Configuration object that defines the subscription.
return bool