(self, new_byte)
return None
Re-build packets read in from bytes over serial one byte at a time.

        new_byte -- the next bytes to add to the packet.

        Returns a list of the bytes in the packet once a full packet is read.
        Returns None otherwise.
Re-build packets read in from bytes over serial one byte at a time.
Re - build packets read in from bytes over serial one byte at a time .
def parse_byte(self, new_byte):
        """
        Re-build packets read in from bytes over serial one byte at a time.

        new_byte -- the next bytes to add to the packet.

        Returns a list of the bytes in the packet once a full packet is read.
        Returns None otherwise.
        """
        if new_byte is None or len(new_byte) == 0:
            return None

        # Convert from str or bytes to an integer for comparison
        new_byte = ord(new_byte)

        if (len(self.buffer) == 0 and
                new_byte in [self._ble_event, self._ble_response,
                             self._wifi_event, self._wifi_response]):
            self.buffer.append(new_byte)
        elif len(self.buffer) == 1:
            self.buffer.append(new_byte)
            self.expected_length = (
                4 + (self.buffer[0] & 0x07) + self.buffer[1])
        elif len(self.buffer) > 1:
            self.buffer.append(new_byte)

        if (self.expected_length > 0 and
                len(self.buffer) == self.expected_length):
            packet = self.buffer
            self.buffer = []
            return packet

        return None
def parse_byte ( self , new_byte ) : if new_byte is None or len ( new_byte ) == 0 : return None # Convert from str or bytes to an integer for comparison new_byte = ord ( new_byte ) if ( len ( self . buffer ) == 0 and new_byte in [ self . _ble_event , self . _ble_response , self . _wifi_event , self . _wifi_response ] ) : self . buffer . append ( new_byte ) elif len ( self . buffer ) == 1 : self . buffer . append ( new_byte ) self . expected_length = ( 4 + ( self . buffer [ 0 ] & 0x07 ) + self . buffer [ 1 ] ) elif len ( self . buffer ) > 1 : self . buffer . append ( new_byte ) if ( self . expected_length > 0 and len ( self . buffer ) == self . expected_length ) : packet = self . buffer self . buffer = [ ] return packet return None