Exemple #1
0
        /// <summary>
        ///     Polls the data connection for any new data.
        ///     This is specifically for the Polling Mechanism
        /// </summary>
        public void Poll(StreamlineCore core, int pollCount)
        {
            // Check if we can read directly
            if (Converter == null && MediaConnection.CanReadDirect)
            {
                // Read a data packet directly from the connection
                core.PassDataToNextConnectable(this, MediaConnection.ReadDirect(pollCount));
            }
            else
            {
                // Only grab new points if we went through the decoded data
                if (!_leftoverDecodedData.MinCountOnAllChannels(pollCount))
                {
                    // Grab all available bytes, and pass it to the decoder
                    var data = MediaConnection.ReadToEnd(pollCount);
                    if (_leftoverInputData != null)
                    {
                        _leftoverInputData = _leftoverInputData.Concat(data);
                    }
                    else
                    {
                        _leftoverInputData = data;
                    }
                    _leftoverDecodedData.Add(Converter.DecodeData(ref _leftoverInputData));
                }

                // Pass the data on to the next step
                core.PassDataToNextConnectable(this, _leftoverDecodedData.PopSubPacket(pollCount));
            }
        }
Exemple #2
0
 /// <summary>
 /// Add Network Data to packet
 /// </summary>
 /// <param name="data">Data to add</param>
 public void SendDataAddToPacket(INetworkData data)
 {
     _packet.Add(data);
 }