def test_connect_dynamic_channel_and_send_data(self): self._setup_link_from_cert() (dut_channel, cert_channel) = self._open_channel(scid=0x41, psm=0x33) dut_channel.send(b'abc') assertThat(cert_channel).emits(L2capMatchers.Data(b'abc'))
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()
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()
def test_fixed_channel_send(self): self.dut_l2cap.enable_fixed_channel(4) self._setup_link_from_cert() (dut_channel, cert_channel) = self._open_fixed_channel(4) dut_channel.send(b'hello' * 40) assertThat(cert_channel).emits(L2capMatchers.Data(b'hello' * 40))