Beispiel #1
0
        public virtual void OnTxDataSnifferComplete(ComTransmissionEventArgs e)
        {
            EventHandler <ComTransmissionEventArgs> handler = txDataSnifferComplete;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Beispiel #2
0
        private void SendCommand(byte[] commandBytes)
        {
            _comPort.Write(commandBytes, 0, commandBytes.Length);
            Queue <byte> sentBytes = new Queue <byte>();

            foreach (var c in commandBytes)
            {
                sentBytes.Enqueue(c);
            }
            ComTransmissionEventArgs args = new ComTransmissionEventArgs();

            args.TransmittedData = sentBytes;
            OnTxDataSnifferComplete(args);
        }
Beispiel #3
0
        //Methods
        void ComPortDataReceived(object s, SerialDataReceivedEventArgs e)
        {
            var data = new byte[_comPort.BytesToRead];

            _comPort.Read(data, 0, data.Length);
            Queue <byte> receivedProtocoll = new Queue <byte>();

            foreach (var b in data.ToList())
            {
                _receivedData.Enqueue(b);
                receivedProtocoll.Enqueue(b);
            }
            //data.ToList().ForEach(b => _receivedData.Enqueue(b));
            ComTransmissionEventArgs sniffedArgs = new ComTransmissionEventArgs();

            sniffedArgs.TransmittedData = receivedProtocoll;
            OnRecDataSnifferComplete(sniffedArgs);
            ProcessData();
        }