Exemplo n.º 1
0
 /// <summary>
 /// Raises the <see cref="ReceivedCommandFrame"/> event.
 /// </summary>
 /// <param name="frame"><see cref="ICommandFrame"/> to send to <see cref="ReceivedCommandFrame"/> event.</param>
 protected virtual void OnReceivedCommandFrame(ICommandFrame frame)
 {
     if ((object)ReceivedCommandFrame != null)
     {
         ReceivedCommandFrame(this, new EventArgs <ICommandFrame>(frame));
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Casts the parsed <see cref="IChannelFrame"/> to its specific implementation (i.e., <see cref="IDataFrame"/>, <see cref="IConfigurationFrame"/>, <see cref="ICommandFrame"/> or <see cref="IHeaderFrame"/>).
        /// </summary>
        /// <param name="frame"><see cref="IChannelFrame"/> that was parsed by <see cref="FrameImageParserBase{TTypeIdentifier,TOutputType}"/> that implements protocol specific common frame header interface.</param>
        protected virtual void OnReceivedChannelFrame(IChannelFrame frame)
        {
            // Process frame types in order or likely occurrence
            if ((object)frame != null)
            {
                IDataFrame dataFrame = frame as IDataFrame;

                if ((object)dataFrame != null)
                {
                    // Frame was a data frame
                    OnReceivedDataFrame(dataFrame);
                }
                else
                {
                    IConfigurationFrame configFrame = frame as IConfigurationFrame;

                    if ((object)configFrame != null)
                    {
                        // Frame was a configuration frame
                        OnReceivedConfigurationFrame(configFrame);
                    }
                    else
                    {
                        IHeaderFrame headerFrame = frame as IHeaderFrame;

                        if ((object)headerFrame != null)
                        {
                            // Frame was a header frame
                            OnReceivedHeaderFrame(headerFrame);
                        }
                        else
                        {
                            ICommandFrame commandFrame = frame as ICommandFrame;

                            if ((object)commandFrame != null)
                            {
                                // Frame was a command frame
                                OnReceivedCommandFrame(commandFrame);
                            }
                            else
                            {
                                // Frame type was undetermined
                                OnReceivedUndeterminedFrame(frame);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Raises the <see cref="ReceivedCommandFrame"/> event.
 /// </summary>
 /// <param name="frame"><see cref="ICommandFrame"/> to send to <see cref="ReceivedCommandFrame"/> event.</param>
 protected virtual void OnReceivedCommandFrame(ICommandFrame frame)
 {
     ReceivedCommandFrame?.Invoke(this, new EventArgs <ICommandFrame>(frame));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Creates a new <see cref="CommandCell"/> from specified parameters.
 /// </summary>
 /// <param name="parent">A reference to the parent <see cref="ICommandFrame"/> for this <see cref="CommandCell"/>.</param>
 /// <param name="extendedDataByte">Extended data <see cref="Byte"/> that represents this <see cref="CommandCell"/>.</param>
 public CommandCell(ICommandFrame parent, byte extendedDataByte)
     : base(parent, 0)
 {
     m_extendedDataByte = extendedDataByte;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Creates a new <see cref="CommandCell"/> from specified parameters.
 /// </summary>
 /// <param name="parent">A reference to the parent <see cref="ICommandFrame"/> for this <see cref="CommandCell"/>.</param>
 /// <param name="extendedDataByte">Extended data <see cref="byte"/> that represents this <see cref="CommandCell"/>.</param>
 public CommandCell(ICommandFrame parent, byte extendedDataByte)
     : base(parent, 0)
 {
     m_extendedDataByte = extendedDataByte;
 }