示例#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);
                            MavLinkPacket packet = MavLinkPacket.Deserialize(reader, 0);

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

            HandleReceptionEnded(this);
        }
示例#2
0
        // __ Impl ____________________________________________________________
        private void PacketProcessingWorker(object state)
        {
            using (BinaryReader reader = MavLinkPacket.GetBinaryReader(mProcessStream))
            {
                while (true)
                {
                    SyncStream(reader);
                    MavLinkPacket packet = MavLinkPacket.Deserialize(reader, 0);

                    if (packet.IsValid)
                    {
                        NotifyPacketReceived(packet);
                    }
                    else
                    {
                        NotifyPacketDiscarded(packet);
                    }
                }
            }
        }