示例#1
0
 def test_credit_exchange_receiving_incremental_credits(self):
     """
     Verify the IUT handles flow control correctly, by handling the LE Flow Control Credit sent by the peer.
     """
     self._setup_link_from_cert()
     (dut_channel, cert_channel) = self._open_channel_from_cert(initial_credit=0)
     for _ in range(4):
         dut_channel.send(b'hello')
     cert_channel.send_credits(1)
     assertThat(cert_channel).emits(L2capMatchers.FirstLeIFrame(b'hello', sdu_size=5))
     cert_channel.send_credits(1)
     assertThat(cert_channel).emits(L2capMatchers.FirstLeIFrame(b'hello', sdu_size=5))
     cert_channel.send_credits(2)
     assertThat(cert_channel).emits(
         L2capMatchers.FirstLeIFrame(b'hello', sdu_size=5), L2capMatchers.FirstLeIFrame(b'hello', sdu_size=5))
示例#2
0
 def test_no_segmentation_dut_is_central(self):
     """
     L2CAP/COS/CFC/BV-02-C
     """
     (dut_channel, cert_channel) = self._set_link_from_dut_and_open_channel()
     dut_channel.send(b'hello' * 40)
     assertThat(cert_channel).emits(L2capMatchers.FirstLeIFrame(b'hello' * 40, sdu_size=200))
示例#3
0
    def test_receiving_scid_over_bredr_and_le(self):
        """
        Test that the L2CAP entity can receive the same SCID in L2CAP connect requests on both the
        BR/EDR and LE links.
        """
        self._setup_acl_link_from_cert()
        # TODO: We should let LE use public address, same as classic link.
        # TODO: Update AclManager::impl::create_le_connection
        self._setup_le_link_from_cert()
        (dut_channel, cert_channel) = self._open_channel_from_cert(0x33, 0x70)
        (le_dut_channel,
         le_cert_channel) = self._open_le_coc_from_cert(0x35, 0x70)

        dut_channel.send(b'abc')
        assertThat(cert_channel).emits(L2capMatchers.Data(b'abc'))

        le_dut_channel.send(b'hello')
        assertThat(le_cert_channel).emits(
            L2capMatchers.FirstLeIFrame(b'hello', sdu_size=5))

        le_cert_channel.send_first_le_i_frame(4, SAMPLE_PACKET)
        assertThat(le_dut_channel).emits(
            L2capMatchers.PacketPayloadRawData(b'\x19\x26\x08\x17'))

        cert_channel.disconnect_and_verify()
        le_cert_channel.disconnect_and_verify()
示例#4
0
 def test_credit_based_connection_response_on_supported_le_psm(self):
     """
     Verify that an IUT receiving a valid LE Credit Based Connection Request from a peer will send an LE Credit Based Connection Response and establish the channel.
     """
     self._setup_link_from_cert()
     (dut_channel, cert_channel) = self._open_channel_from_cert()
     dut_channel.send(b'hello')
     assertThat(cert_channel).emits(L2capMatchers.FirstLeIFrame(b'hello', sdu_size=5))
示例#5
0
 def test_no_segmentation(self):
     """
     Verify that the IUT can send data segments which do not require segmentation.
     """
     self._setup_link_from_cert()
     (dut_channel, cert_channel) = self._open_channel_from_cert(mtu=1000, mps=202)
     dut_channel.send(b'hello' * 40)
     assertThat(cert_channel).emits(L2capMatchers.FirstLeIFrame(b'hello' * 40, sdu_size=200))
示例#6
0
 def test_segmentation(self):
     """
     Verify that the IUT can send data segments which are larger than the LE frame size.
     """
     self._setup_link_from_cert()
     (dut_channel, cert_channel) = self._open_channel_from_cert(mtu=1000, mps=102)
     dut_channel.send(b'hello' * 20 + b'world')
     # The first LeInformation packet contains 2 bytes of SDU size.
     # The packet is divided into first 100 bytes from 'hellohello....'
     # and remaining 5 bytes 'world'
     assertThat(cert_channel).emits(
         L2capMatchers.FirstLeIFrame(b'hello' * 20, sdu_size=105), L2capMatchers.Data(b'world')).inOrder()