handle mavlink packets

def mavlink_packet(self, m):
        '''handle mavlink packets'''
        if m.get_type() == 'REMOTE_LOG_DATA_BLOCK':
            if not self.packet_is_for_me(m):
                self.dropped += 1
                return

            if self.sender is None and m.seqno == 0:
                if self.log_settings.verbose:
                    print("DFLogger: Received data packet - starting new log")
                self.start_new_log()
                self.sender = (m.get_srcSystem(), m.get_srcComponent())

            if self.sender is None:
                # No connection right now, and this packet did not start one
                return

            if self.stopped:
                # send a stop packet @1Hz until the other end gets the idea:
                self.tell_sender_to_stop(m)
                return

            if self.sender is not None:
                size = len(m.data)
                data = ''.join(str(chr(x)) for x in m.data[:size])
                ofs = size*(m.seqno)
                self.logfile.seek(ofs)
                self.logfile.write(data)

                if m.seqno in self.missing_blocks:
                    if self.log_settings.verbose:
                        print("DFLogger: Got missing block: %d" % (m.seqno,))
                    del self.missing_blocks[m.seqno]
                    self.missing_found += 1
                    self.blocks_to_ack_and_nack.append(
                        [self.master, m.seqno, 1, time.time(), None]
                    )
                    self.acking_blocks[m.seqno] = 1
                    # print("DFLogger: missing: %s" %
                    # (str(self.missing_blocks),))
                else:
                    self.do_ack_block(m.seqno)
                    if self.last_seqno < m.seqno:
                        self.last_seqno = m.seqno
                self.download += size