Example #1
0
        public void ReceiveRequest(object sender, PacketReceiveArgs e)
        {
            Invoke(new MethodInvoker(() =>
            {
                label9.ForeColor = Color.White;
                //MessageBox.Show(e.response.ToString());

                label8.ForeColor   = Color.Green;
                Length.Text        = e.length.ToString();
                Time.Text          = DateTime.Now.ToString();
                Mea.Text           = e.pack._measurement.ToString();
                Temp.Text          = e.pack._temperature.ToString();
                SignalContent.Text = BitConverter.ToString(e.tst);
                SNCode.Text        = e.sn.sn.ToString();
                state.Text         = (Convert.ToString(e.pack._error[0], 2).PadLeft(8, '0') + Convert.ToString(e.pack._error[1], 2).PadLeft(8, '0'));
            }));
        }
Example #2
0
        private void ProcessIncomingPackets(object source, PacketReceiveArgs args)
        {
            ByteBuffer   buff         = new ByteBuffer(args.Packet);
            PacketHolder packetHolder = PacketHolder.GetRootAsPacketHolder(buff);

            switch (packetHolder.PacketType)
            {
            case Packets.Spawn:
                ProcessSpawn(packetHolder, args.RemoteId);
                break;

            case Packets.MovementAndRotation:
            case Packets.Movement:
            case Packets.Rotation:
                ProcessPlayerMovement(packetHolder, args.RemoteId);
                break;
            }
        }