コード例 #1
0
        /// <summary>
        /// Add the incoming data.
        /// </summary>
        /// <param name="data">Data to add.</param>
        /// <param name="isBinaryData">Flag if Binary data should be decoded.</param>
        /// <param name="isDvlData">Flag if DVL data should be decoded.</param>
        /// <param name="isPd0Data">Flag if PD0 data should be decoded.</param>
        /// <param name="isPd6_13Data">Flag if PD6/PD13 data should be decoded.</param>
        /// <param name="isPd4_5Data">Flag if PD4/PD5 data should be decoded.</param>
        public void AddIncomingData(byte[] data, bool isBinaryData = true, bool isDvlData = true, bool isPd0Data = true, bool isPd6_13Data = true, bool isPd4_5Data = true)
        {
            // Binary data
            if (isBinaryData)
            {
                try
                {
                    _binaryCodec.AddIncomingData(data);
                }
                catch (Exception e)
                {
                    log.Error("Error decoding Binary data.", e);
                }
            }
            else
            {
                // Clear buffer, format not needed
                _binaryCodec.ClearIncomingData();
            }

            // DVL data
            if (isDvlData)
            {
                try
                {
                    _dvlCodec.AddIncomingData(data);
                }
                catch (Exception e)
                {
                    log.Error("Error decoding the DVL data.", e);
                }
            }
            else
            {
                // Clear buffer, format not needed
                _dvlCodec.ClearIncomingData();
            }

            // PD0 data
            if (isPd0Data)
            {
                try
                {
                    _pd0Codec.AddIncomingData(data);
                }
                catch (Exception e)
                {
                    log.Error("Error decoding the PD0 data.", e);
                }
            }
            else
            {
                // Clear buffer, format not needed
                _pd0Codec.ClearIncomingData();
            }

            // PD6 / PD13 data
            if (isPd6_13Data)
            {
                try
                {
                    _pd6_13Codec.AddIncomingData(data);
                }
                catch (Exception e)
                {
                    log.Error("Error decoding PD6/13 data.", e);
                }
            }
            else
            {
                // Clear buffer, format not needed
                _pd6_13Codec.ClearIncomingData();
            }

            // PD4 / PD5 data
            if (isPd4_5Data)
            {
                try
                {
                    _pd4_5Codec.AddIncomingData(data);
                }
                catch (Exception e)
                {
                    log.Error("Error decoding PD4/5 data.", e);
                }
            }
            else
            {
                // Clear buffer, format not needed
                _pd4_5Codec.ClearIncomingData();
            }
        }