Ejemplo n.º 1
0
        /// <summary>
        /// 添加一条接收到的流
        /// </summary>
        /// <param name="remoteDeviceID">远程设备编号</param>
        /// <param name="stream">数据流</param>
        /// <param name="frame">数据流对应的协议帧对象。</param>
        /// <param name="parser">数据流对应的解析器</param>
        public void AddIncomingStream(string remoteDeviceID, byte[] stream, object frame = null, IStreamFrameParser <byte> parser = null)
        {
            if (!_IncomingStreamVisable)
            {
                return;
            }

            var data = new Tuple <bool, DataCached>(true, new IncomingData(remoteDeviceID, stream, frame, parser));

            _productCache.AddProduct(data);
        }
Ejemplo n.º 2
0
        private void OnCommStreamCreated(object sender, CommLogCreatedEventArgs args)
        {
            try
            {
                // 检查缓存池中元素的个数,超过阈值则记录。
                if (_logCache.Count > 500)
                {
                    LogUtility.Warning(string.Format("通信流日志缓存池的个数已达到 {0} 条!", _logCache.Count));
                }

                _logCache.AddProduct(args);
            }
            catch (Exception ex)
            {
                LogUtility.Error(ex);
            }
        }