def _is_matching_le_flow_control_credit(packet, cid): frame = L2capMatchers.le_control_frame_with_code( packet, LeCommandCode.LE_FLOW_CONTROL_CREDIT) if frame is None: return False request = l2cap_packets.LeFlowControlCreditView(frame) return request.GetCid() == cid
def _on_credit(self, l2cap_le_control_view): credit_view = l2cap_packets.LeFlowControlCreditView( l2cap_le_control_view) cid = credit_view.GetCid() if cid not in self._cid_to_cert_channels: return self._cid_to_cert_channels[ cid]._credits_left += credit_view.GetCredits()