C# Class GSF.PhasorProtocols.MultiProtocolFrameParser

Protocol independent frame parser.
This class takes all protocol frame parsing implementations and reduces them to a single simple-to-use class exposing all data through abstract interfaces (e.g., IConfigurationFrame, IDataFrame, etc.) - this way new protocol implementations can be added without adversely affecting consuming code. Additionally, this class implements a variety of transport options (e.g., TCP, UDP, Serial, etc.) and hides the complexities of this connectivity and internally pushes all data received from the selected transport protocol to the selected phasor parsing protocol.
Inheritance: IFrameParser
Mostrar archivo Open project: GridProtectionAlliance/gsf Class Usage Examples

Public Methods

Method Description
Dispose ( ) : void

Releases all the resources used by the MultiProtocolFrameParser object.

MultiProtocolFrameParser ( ) : System

Creates a new MultiProtocolFrameParser using the default settings.

ResetTotalBytesReceived ( ) : void

Resets the value for the TotalBytesReceived statistic.

SendDeviceCommand ( DeviceCommand command ) : WaitHandle

Sends the specified DeviceCommand to the remote device.

Command will only be sent if DeviceSupportsCommands is true and MultiProtocolFrameParser.

Start ( ) : void

Starts the MultiProtocolFrameParser.

Stop ( ) : void

Stops the MultiProtocolFrameParser.

TryInitializeFrameParser ( ) : bool

Attempts to initialize the protocol specific frame parser.

Starting the multi-protocol frame parser will automatically initialize the frame parsers so calling this method then will be unnecessary, however, if you are using this class just to edit custom connection parameters then initializing the will be necessary.

Write ( byte buffer, int offset, int count ) : void

Writes data directly to the frame parsing engine buffer.

This method is public to allow consumer to "manually send extra data" to the parsing engine to be parsed, if desired.

Private Methods

Method Description
ClientConnectedHandler ( ) : void
DeriveCommandSupport ( ) : bool

Derives a flag based on settings that determines if the current connection supports device commands.

Dispose ( bool disposing ) : void

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

IFrameParser ( SourceChannel source, byte buffer, int offset, int count ) : void
InitializeCommandChannel ( string connectionString ) : void

Initialize command channel.

InitializeDataChannel ( string>.Dictionary settings ) : void

Initialize data channel.

InitializeFrameParser ( string>.Dictionary settings ) : void

Initialize frame parser.

InitializeUdpDataChannel ( string>.Dictionary settings ) : void
MaintainCapturedFrameReplayTiming ( IFrame sourceFrame ) : void
OnConnectionException ( Exception ex, int connectionAttempts ) : void

Raises the ConnectionException event.

OnExceededParsingExceptionThreshold ( ) : void

Raises the ExceededParsingExceptionThreshold event.

OnParsingException ( Exception ex ) : void

Raises the ParsingException event.

OnParsingException ( Exception innerException, string message ) : void

Raises the ParsingException event.

Parse ( SourceChannel source, byte buffer, int offset, int count ) : void

Writes a sequence of bytes onto the IBinaryImageParser stream for parsing.

ReadNextFileBuffer ( ) : void
StartDataParsingSequence ( ) : 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_commandChannel_UnhandledUserException ( object sender, EventArgs e ) : void
m_dataChannel_ConnectionAttempt ( object sender, EventArgs e ) : void
m_dataChannel_ConnectionEstablished ( object sender, EventArgs e ) : void
m_dataChannel_ConnectionException ( object sender, EventArgs e ) : void
m_dataChannel_ConnectionTerminated ( object sender, EventArgs e ) : void
m_dataChannel_ReceiveData ( object sender, EventArgs e ) : void
m_dataChannel_ReceiveDataException ( object sender, EventArgs e ) : void
m_dataChannel_ReceiveDataFrom ( object sender, EventArgs e ) : void
m_dataChannel_SendDataException ( object sender, EventArgs e ) : void
m_dataChannel_UnhandledUserException ( object sender, EventArgs e ) : void
m_frameParser_BufferParsed ( object sender, EventArgs e ) : void
m_frameParser_ConfigurationChanged ( object sender, EventArgs e ) : void
m_frameParser_ParsingException ( object sender, EventArgs e ) : void
m_frameParser_ReceivedCommandFrame ( object sender, EventArgs e ) : void
m_frameParser_ReceivedConfigurationFrame ( object sender, EventArgs e ) : void
m_frameParser_ReceivedDataFrame ( object sender, EventArgs e ) : void
m_frameParser_ReceivedFrameBufferImage ( object sender, EventArgs e ) : void
m_frameParser_ReceivedFrameImage ( object sender, int>.EventArgs e ) : void
m_frameParser_ReceivedHeaderFrame ( object sender, EventArgs e ) : void
m_frameParser_ReceivedUndeterminedFrame ( object sender, EventArgs e ) : void
m_rateCalcTimer_Elapsed ( object sender, EventArgs e ) : void
m_serverBasedDataChannel_ClientConnected ( object sender, EventArgs e ) : void
m_serverBasedDataChannel_ClientConnectingException ( object sender, EventArgs e ) : void
m_serverBasedDataChannel_ClientDisconnected ( object sender, EventArgs e ) : void
m_serverBasedDataChannel_ReceiveClientData ( object sender, int>.EventArgs e ) : void
m_serverBasedDataChannel_ReceiveClientDataException ( object sender, Exception>.EventArgs e ) : void
m_serverBasedDataChannel_SendClientDataException ( object sender, Exception>.EventArgs e ) : void
m_serverBasedDataChannel_ServerStarted ( object sender, EventArgs e ) : void
m_serverBasedDataChannel_ServerStopped ( object sender, EventArgs e ) : void
m_serverBasedDataChannel_UnhandledUserException ( object sender, EventArgs e ) : void

Method Details

Dispose() public method

Releases all the resources used by the MultiProtocolFrameParser object.
public Dispose ( ) : void
return void

MultiProtocolFrameParser() public method

Creates a new MultiProtocolFrameParser using the default settings.
public MultiProtocolFrameParser ( ) : System
return System

ResetTotalBytesReceived() public method

Resets the value for the TotalBytesReceived statistic.
public ResetTotalBytesReceived ( ) : void
return void

SendDeviceCommand() public method

Sends the specified DeviceCommand to the remote device.
Command will only be sent if DeviceSupportsCommands is true and MultiProtocolFrameParser.
public SendDeviceCommand ( DeviceCommand command ) : WaitHandle
command DeviceCommand to send to the remote device.
return System.Threading.WaitHandle

Start() public method

Starts the MultiProtocolFrameParser.
public Start ( ) : void
return void

Stop() public method

Stops the MultiProtocolFrameParser.
public Stop ( ) : void
return void

TryInitializeFrameParser() public method

Attempts to initialize the protocol specific frame parser.
Starting the multi-protocol frame parser will automatically initialize the frame parsers so calling this method then will be unnecessary, however, if you are using this class just to edit custom connection parameters then initializing the will be necessary.
public TryInitializeFrameParser ( ) : bool
return bool

Write() public method

Writes data directly to the frame parsing engine buffer.
This method is public to allow consumer to "manually send extra data" to the parsing engine to be parsed, if desired.
public Write ( byte buffer, int offset, int count ) : void
buffer byte Buffer containing data to be parsed.
offset int Offset into buffer where data begins.
count int Length of data in buffer to be parsed.
return void