public void SerialPort1_DataReceived(object sender, DataReceivedArgs e) //FIFO
 {
     foreach (byte b in e.Data)
     {
         DecodeMessage(b);
     }
 }
예제 #2
0
 private void SerialPort1_DataReceived(object sender, DataReceivedArgs e)
 {
     for (int i = 0; i < e.Data.Length; i++)
     {
         DecodeMessage(e.Data[i]);
     }
 }
예제 #3
0
        async void holder_OnDataReceived(object sender, DataReceivedArgs e)
        {
            var data = (ProcessedMsg)e.Data;

            this.StoredList.Add(data);
            await this.DetectSave();
        }
예제 #4
0
 public void DecodeMsgReceived(object sender, DataReceivedArgs e)
 {
     foreach (var b in e.Data)
     {
         DecodeMessage(b);
     }
 }
예제 #5
0
        public void OnHerkulexSendToSerial(byte[] data)
        {
            DataReceivedArgs arg = new DataReceivedArgs();

            arg.Data = data;
            OnHerkulexSendToSerialEvent?.Invoke(this, arg);
        }
예제 #6
0
 public void SerialPort_DataReceived(object sender, DataReceivedArgs e)
 {
     for (int i = 0; i < e.Data.Length; i++)
     {
         byteListReceived.Enqueue(e.Data[i]);
     }
 }
예제 #7
0
 private void SocketOnDataReceived(DataReceivedArgs args)
 {
     lock (_handleLock) {
         _receiveBuffer.AddBytes(args.Data);
         _lastActive = DateTime.UtcNow;
         Handle();
     }
 }
 private void SerialPort1_DataReceived(object sender, DataReceivedArgs e)
 {
     robot.receivedText += Encoding.UTF8.GetString(e.Data, 0, e.Data.Length);
     for (int i = 0; i < e.Data.Length; i++)
     {
         robot.byteListReceived.Enqueue(e.Data[i]);
     }
 }
예제 #9
0
 private void SerialPort1_DataReceived(object sender, DataReceivedArgs e)
 {
     //receivedtext += Encoding.UTF8.GetString(e.Data, 0, e.Data.Length);
     for (int i = 0; i < e.Data.Length; i++)
     {
         DecodeMessage(e.Data[i]);
     }
 }
 private void SerialPort1_DataReceived(object sender, DataReceivedArgs e)
 {
     //robot.receivedMessage += Encoding.UTF8.GetString(e.Data, 0, e.Data.Length);
     foreach (byte b in e.Data)
     {
         DecodeMessage(b);
     }
 }
예제 #11
0
 private void SerialPort_DataReceived(object sender, DataReceivedArgs e)
 {
     for (int i = 0; i < e.Data.Length; i++)
     {
         //robot.byteListReceived.Enqueue(e.Data[i]);
         decodeMsg(e.Data[i]);
     }
 }
예제 #12
0
 private void OnClient_MainDataReceived(object sender, DataReceivedArgs e)
 {
     Device.BeginInvokeOnMainThread(async() =>
     {
         // This gets called but it never fires the MainDataReceived event because _stream.DataAvailable (in Client.Receiver) is never true!
         // Except once just to show that this code works.
         await DisplayAlert("Success", $"Received this '{e.Data}' from the server!", ":-)");
     });
 }
예제 #13
0
        private void OnDataReceived(object sender, DataReceivedArgs e)
        {
            EventHandler <DataReceivedArgs> handler = MainDataReceived;

            if (handler != null)
            {
                MainDataReceived(this, e);                   // re-raise event
            }
        }
예제 #14
0
        private void TcpAdapter_OnDataReceivedEvent(object sender, DataReceivedArgs e)
        {
            //On deserialize le message JSON en provenance de la Referee Box
            string s             = Encoding.ASCII.GetString(e.Data);
            var    refBoxCommand = JsonConvert.DeserializeObject <RefBoxMessage>(s);

            var msg = ZeroFormatterSerializer.Serialize <ZeroFormatterMsg>(refBoxCommand);

            OnMulticastSendRefBoxCommand(msg);
        }
        public void SerialPort1_DataReceived(object sender, DataReceivedArgs e)
        {
            int i;

            robot.receivedText += Encoding.UTF8.GetString(e.Data, 0, e.Data.Length);
            for (i = 0; i < e.Data.Length; i++)
            {
                DecodeMessage(e.Data[i]);
                //robot.byteListReceived.Enqueue(e.Data[i]);
            }
        }
예제 #16
0
 private void mBulkInOut_DataReceived(object sender, DataReceivedArgs e)
 {
     if (InvokeRequired)
     {
         Invoke(new DataRecvDelegate(OnDataReceived), new object[] { sender, e });
     }
     else
     {
         OnDataReceived(sender, e);
     }
 }
예제 #17
0
 public void SerialPort1_DataReceived(object sender, DataReceivedArgs e)
 {
     for (int i = 0; i < e.Data.Length; i++)
     {
         robot.byteListReceived.Enqueue(e.Data[i]);
     }
     //foreach(var c in e.Data)
     //{
     //    robot.byteListReceived.Enqueue(c);
     //}
 }
예제 #18
0
 private void SerialPort_OnDataReceived(object sender, DataReceivedArgs e)
 {
     byte[] dataReceived = new byte[e.Data.Length];
     foreach (byte b in e.Data)
     {
         dataReceived[b] = e.Data[b];
     }
     OnDataReceivedEvent?.Invoke(this, new DataReceivedArgs {
         Data = dataReceived
     });
 }
예제 #19
0
        private void OnDataReceived_Loop(object sender, DataReceivedArgs e)
        {
            UsbEndpointBase epSendender = (UsbEndpointBase)sender;
            String          sTemp       = "";

            for (int i = 0; i < e.Count; i++)
            {
                sTemp += e.Buffer[i].ToString("X2");
            }

            Debug.Print(" Len:" + e.Count.ToString() + " Data:" + sTemp);
        }
예제 #20
0
파일: Client.cs 프로젝트: umby24/ZBase
        /// <summary>
        /// This is called whenever data is received from the client
        /// </summary>
        /// <param name="args"></param>
        private void SocketOnDataReceived(DataReceivedArgs args)
        {
            if (!_canReceive)
            {
                return;
            }

            lock (_fk) {
                Interlocked.Add(ref Server.ReceivedIncrement, args.Data.Length);
                _receiveBuffer.AddBytes(args.Data); // -- Add the bytes into our receive buffer..
                _lastActive = DateTime.UtcNow;
            }
        }
    private void OnDataReceived(object sender, DataReceivedArgs args)
    {
        switch (args.Type)
        {
        case DataType.SceneState:
            SceneState.FromByteArray(args.Buffer, ref this.sceneState);
            this.OnSceneData();
            break;

        case DataType.InputState:
            InputState.FromByteArray(args.Buffer, ref this.inputState);
            this.OnInputData();
            break;
        }
    }
예제 #22
0
 private void Reader_ReceiveData(object sender, DataReceivedArgs e)
 {
     txtType.Text    = e.DL.Record.DocumentType;
     txtNumber.Text  = e.DL.Record.LicenseNumber;
     txtIDState.Text = e.DL.Record.JurisdictionCode;
     txtFname.Text   = e.DL.Record.FirstName;
     txtMname.Text   = e.DL.Record.MiddleName;
     txtLname.Text   = e.DL.Record.LastName;
     txtSuffix.Text  = e.DL.Record.NameSuffix;
     txtAdd1.Text    = e.DL.Record.Address1;
     txtAdd2.Text    = e.DL.Record.Address2;
     txtCity.Text    = e.DL.Record.City;
     txtState.Text   = e.DL.Record.JurisdictionCode;
     txtZip.Text     = e.DL.Record.PostalCode;
 }
예제 #23
0
        private void MySockOnDataReceived(DataReceivedArgs args)
        {
            lock (_receiveBuffer) {
                if (_receiveBuffer.Length == 0)
                {
                    _receiveBuffer = args.Data;
                    return;
                }

                var tempBuff = new byte[_receiveBuffer.Length + args.Data.Length];
                Buffer.BlockCopy(_receiveBuffer, 0, tempBuff, 0, _receiveBuffer.Length);
                Buffer.BlockCopy(args.Data, 0, tempBuff, _receiveBuffer.Length, args.Data.Length);
                _receiveBuffer = tempBuff;
            }
        }
예제 #24
0
파일: FTNN.cs 프로젝트: dominwong4/FTNN
 private void OnDataReceived(DataReceivedArgs args, int index)
 {
     lock (_receiveBuffer[index])
     {
         if (_receiveBuffer.Length == 0)
         {
             _receiveBuffer[index] = args.Data;
             return;
         }
         var tempBuff = new byte[_receiveBuffer[index].Length + args.Data.Length];
         Buffer.BlockCopy(_receiveBuffer[index], 0, tempBuff, 0, _receiveBuffer[index].Length);
         Buffer.BlockCopy(args.Data, 0, tempBuff, _receiveBuffer[index].Length, args.Data.Length);
         _receiveBuffer[index] = tempBuff;
     }
     //Debug.info("Read [" + index + "] : " );
 }
예제 #25
0
        private async void UDPDataReceived(object sender, DataReceivedArgs e)
        {
            string data = Encoding.UTF8.GetString(e.data);

            System.Diagnostics.Trace.TraceInformation(data);
            QSO qso = qsoFactory.create(data);

            if (qso == null)
            {
                return;
            }
            //System.Diagnostics.Trace.TraceInformation(qso.toJSON());
            dgvQSOInsert(qso);
            ProtoBufSerialization.Write <QSO>(qsoFilePath, qso, true);
            await http.postQso(qso);
        }
예제 #26
0
        private void OnDataReceived(object sender, DataReceivedArgs e)
        {
            switch (miTestType)
            {
            case 1:
                OnDataReceived_Benchmark(sender, e);
                break;

            case 3:
                OnDataReceived_Benchmark(sender, e);
                break;

            default:
                break;
            }
        }
예제 #27
0
        private void MySockOnDataReceived(DataReceivedArgs args)
        {
            System.Diagnostics.Debug.WriteLine("MySockOnDataReceived");
            lock (_receiveBuffer) {
                if (_receiveBuffer.Length == 0)
                {
                    _receiveBuffer = args.Data;
                    return;
                }

                var tempBuff = new byte[_receiveBuffer.Length + args.Data.Length];
                Buffer.BlockCopy(_receiveBuffer, 0, tempBuff, 0, _receiveBuffer.Length);
                Buffer.BlockCopy(args.Data, 0, tempBuff, _receiveBuffer.Length, args.Data.Length);
                _receiveBuffer = tempBuff;
            }
        }
예제 #28
0
        private void SocketOnDataReceived(DataReceivedArgs args)
        {
            WriteToBox("Data Received");
            var readBuffer = args.Data;
            int bytesRead  = readBuffer.Length;

            // There  might be more data, so store the data received so far.
            StringBuilder sb = new StringBuilder();

            sb.Append(Encoding.ASCII.GetString(
                          readBuffer, 0, bytesRead));

            String content = sb.ToString();

            Console.WriteLine("Read {0} bytes from socket. \n Data : {1}",
                              content.Length, content);
        }
예제 #29
0
 async void Holder_OnDataReceived(object sender, DataReceivedArgs e)
 {
     if (e.Data != null)
     {
         var msg = (BaseMessage)e.Data;
         if (msg != null)
         {
             var client = this.Clients.FirstOrDefault(c => c.Value.AcceptMessageType.Equals(msg.GetType()));
             if (client != null)
             {
                 try {
                     await client.Value.Send(msg);
                 } catch (Exception ex) {
                     this.Processed(this, new ProcessedArgs(msg.MsgType, msg.ID, ex));
                     Console.WriteLine(ex.Message);
                 }
             }
         }
     }
 }
예제 #30
0
        private void MySockOnDataReceived(DataReceivedArgs args) {
            lock (_receiveBuffer) {
                if (_receiveBuffer.Length == 0) {
                    _receiveBuffer = args.Data;
                    return;
                }

                var tempBuff = new byte[_receiveBuffer.Length + args.Data.Length];
                Buffer.BlockCopy(_receiveBuffer, 0, tempBuff, 0, _receiveBuffer.Length);
                Buffer.BlockCopy(args.Data, 0, tempBuff, _receiveBuffer.Length, args.Data.Length);
                _receiveBuffer = tempBuff;
            }
            //string asAscii = Encoding.ASCII.GetString(args.Data);
            //WriteToBox("Got Data: " + asAscii.Replace("\r\n", ""));

            //if (asAscii.Contains("451")) {
            //    _mySock.Send(Encoding.ASCII.GetBytes("NICK u24something\r\n"));
            //    _mySock.Send(Encoding.ASCII.GetBytes("USER u24something u24something bla :u24something\r\n"));
            //    _mySock.Send(Encoding.ASCII.GetBytes("MODE u24something +B-x\r\n"));
            //}
        }