Exemple #1
0
        public static PDW Desserialize(byte[] data)
        {
            PDW result = new PDW();

            using (MemoryStream m = new MemoryStream(data)) {
                using (BinaryReader reader = new BinaryReader(m)) {
                    result.counter              = reader.ReadInt32();
                    result.receiverID           = reader.ReadInt32();
                    result.toa                  = reader.ReadInt64();
                    result.startFrequencyMHz    = reader.ReadSingle();
                    result.stopFrequencyMHz     = reader.ReadSingle();
                    result.pulseWidth           = reader.ReadDouble();
                    result.snr                  = reader.ReadSingle();
                    result.phase                = reader.ReadSingle();
                    result.phaseReferenceTime   = reader.ReadSingle();
                    result.errorFlags           = reader.ReadInt32();
                    result.modulationFlags      = reader.ReadInt32();
                    result.modulationParameters = reader.ReadSingle();
                    result.angleOfArrival       = reader.ReadSingle();
                    result.riseTime             = reader.ReadSingle();
                    result.fallTime             = reader.ReadSingle();
                    result.pri                  = reader.ReadDouble();
                }
            }
            return(result);
        }
Exemple #2
0
        private static async Task ReaderAsync(int port)
        {
            Console.WriteLine("Starting...");
            using (var client = new UdpClient(port))
            {
                do
                {
                    UdpReceiveResult r = await client.ReceiveAsync();

                    PDW p = Desserialize(r.Buffer);
                    Console.WriteLine("freq = " + p.startFrequencyMHz);
                }while (true);
            }
        }