def on_recv(self, cf):
        """Function that must be called every time a CAN frame is received, to
        advance the state machine."""

        data = bytes(cf.data)

        if len(data) < 2:
            return

        ae = 0
        if self.extended_rx_addr is not None:
            ae = 1
            if len(data) < 3:
                return
            if six.indexbytes(data, 0) != self.extended_rx_addr:
                return

        n_pci = six.indexbytes(data, ae) & 0xf0

        if n_pci == N_PCI_FC:
            with self.tx_mutex:
                self._recv_fc(data[ae:])
        elif n_pci == N_PCI_SF:
            with self.rx_mutex:
                self._recv_sf(data[ae:])
        elif n_pci == N_PCI_FF:
            with self.rx_mutex:
                self._recv_ff(data[ae:])
        elif n_pci == N_PCI_CF:
            with self.rx_mutex:
                self._recv_cf(data[ae:])
def on_recv ( self , cf ) : data = bytes ( cf . data ) if len ( data ) < 2 : return ae = 0 if self . extended_rx_addr is not None : ae = 1 if len ( data ) < 3 : return if six . indexbytes ( data , 0 ) != self . extended_rx_addr : return n_pci = six . indexbytes ( data , ae ) & 0xf0 if n_pci == N_PCI_FC : with self . tx_mutex : self . _recv_fc ( data [ ae : ] ) elif n_pci == N_PCI_SF : with self . rx_mutex : self . _recv_sf ( data [ ae : ] ) elif n_pci == N_PCI_FF : with self . rx_mutex : self . _recv_ff ( data [ ae : ] ) elif n_pci == N_PCI_CF : with self . rx_mutex : self . _recv_cf ( data [ ae : ] )
Function that must be called every time a CAN frame is received, to
        advance the state machine.