Пример #1
0
        private void ReadCallback(HidDeviceData data)
        {
            LogTo.Debug("Got a ReadCallback of length {0}", data.Data.Length);

            if(open)
                _device.Read(ReadCallback);
            else
            {
                LogTo.Trace("Ignored incoming data, device is closed");
                return;
            }

            if (DataReceived == null)
                return;

            var bytes = data.Data;
            var preparsed = _preparser.InterpretPacket(bytes);
            var dataString = _parser.CurrentParser.InterpretPacket(preparsed, bytes);
            var args = new DataReceivedEventArgs(dataString);
            DataReceived(this, args);
        }
Пример #2
0
 private void DataDeviceOnDataReceived(object sender, DataReceivedEventArgs dataReceivedEventArgs)
 {
     AddLine(dataReceivedEventArgs.Data);
     if (_logger != null)
         if (_logger.LoggingState == LoggingState.Enabled)
             _logger.Write(dataReceivedEventArgs.Data);
 }