parameters: (self, data, first_msg_start, num_drops)
docstring: write streamed data to a file
docstring_summary: write streamed data to a file
docstring_tokens: write streamed data to a file
function: def process_streamed_ulog_data(self, data, first_msg_start, num_drops):
          ''' write streamed data to a file '''
          if not self.got_ulog_header: # the first 16 bytes need special treatment
              if len(data) < 16: # that's never the case anyway
                  raise Exception('first received message too short')
              self.file.write(bytearray(data[0:16]))
              data = data[16:]
              self.got_ulog_header = True
  
          if self.got_header_section and num_drops > 0:
              if num_drops > 25: num_drops = 25
              # write a dropout message. We don't really know the actual duration,
              # so just use the number of drops * 10 ms
              self.file.write(bytearray([ 2, 0, 79, num_drops*10, 0 ]))
  
          if num_drops > 0:
              self.write_ulog_messages(self.ulog_message)
              self.ulog_message = []
              if first_msg_start == 255:
                  return # no useful information in this message: drop it
              data = data[first_msg_start:]
              first_msg_start = 0
  
          if first_msg_start == 255 and len(self.ulog_message) > 0:
              self.ulog_message.extend(data)
              return
  
          if len(self.ulog_message) > 0:
              self.file.write(bytearray(self.ulog_message + data[:first_msg_start]))
              self.ulog_message = []
  
          data = self.write_ulog_messages(data[first_msg_start:])
          self.ulog_message = data
function_tokens: def process_streamed_ulog_data ( self , data , first_msg_start , num_drops ) : if not self . got_ulog_header : # the first 16 bytes need special treatment if len ( data ) < 16 : # that's never the case anyway raise Exception ( 'first received message too short' ) self . file . write ( bytearray ( data [ 0 : 16 ] ) ) data = data [ 16 : ] self . got_ulog_header = True if self . got_header_section and num_drops > 0 : if num_drops > 25 : num_drops = 25 # write a dropout message. We don't really know the actual duration, # so just use the number of drops * 10 ms self . file . write ( bytearray ( [ 2 , 0 , 79 , num_drops * 10 , 0 ] ) ) if num_drops > 0 : self . write_ulog_messages ( self . ulog_message ) self . ulog_message = [ ] if first_msg_start == 255 : return # no useful information in this message: drop it data = data [ first_msg_start : ] first_msg_start = 0 if first_msg_start == 255 and len ( self . ulog_message ) > 0 : self . ulog_message . extend ( data ) return if len ( self . ulog_message ) > 0 : self . file . write ( bytearray ( self . ulog_message + data [ : first_msg_start ] ) ) self . ulog_message = [ ] data = self . write_ulog_messages ( data [ first_msg_start : ] ) self . ulog_message = data