Exemple #1
0
        // __ Impl ____________________________________________________________


        private void Parse()
        {
            try
            {
                using (FileStream s = new FileStream(mLogFileName, FileMode.Open))
                {
                    using (BinaryReader reader = new BinaryReader(s))
                    {
                        while (true)
                        {
                            SyncStream(reader);
                            var packet = MavLinkPacket.Deserialize(reader, 0);

                            if (packet.IsValid)
                            {
                                HandlePacketReceived(this, packet);
                            }
                        }
                    }
                }
            }
            catch (EndOfStreamException)
            {
            }

            HandleReceptionEnded(this);
        }
Exemple #2
0
        private void PacketProcessingWorker(object state)
        {
            using (var reader = MavLinkPacket.GetBinaryReader(mProcessStream))
            {
                while (true)
                {
                    SyncStream(reader);
                    var packet = MavLinkPacket.Deserialize(reader, 0);

                    if (packet.IsValid)
                    {
                        NotifyPacketReceived(packet);
                    }
                    else
                    {
                        Debug.WriteLine("PACKET IS INVALID! => " + packet.MessageId);
                        NotifyPacketDiscarded(packet);
                    }
                }
            }
        }