def test_multiple_channels_with_interleaved_data_streams(self): """ Verify that an IUT can create multiple channels and receives data streams on the channels when the streams are interleaved. """ self._setup_link_from_cert() (dut_channel_x, cert_channel_x) = self._open_channel_from_cert(signal_id=1, scid=0x0103, psm=0x33) (dut_channel_y, cert_channel_y) = self._open_channel_from_cert(signal_id=2, scid=0x0105, psm=0x35) (dut_channel_z, cert_channel_z) = self._open_channel_from_cert(signal_id=3, scid=0x0107, psm=0x37) cert_channel_y.send_first_le_i_frame(4, SAMPLE_PACKET) cert_channel_z.send_first_le_i_frame(4, SAMPLE_PACKET) cert_channel_y.send_first_le_i_frame(4, SAMPLE_PACKET) cert_channel_z.send_first_le_i_frame(4, SAMPLE_PACKET) cert_channel_y.send_first_le_i_frame(4, SAMPLE_PACKET) # TODO: We should assert two events in order, but it got stuck assertThat(dut_channel_y).emits( L2capMatchers.PacketPayloadRawData(b'\x19\x26\x08\x17'), at_least_times=3) assertThat(dut_channel_z).emits( L2capMatchers.PacketPayloadRawData(b'\x19\x26\x08\x17'), L2capMatchers.PacketPayloadRawData(b'\x19\x26\x08\x17')).inOrder() cert_channel_z.send_first_le_i_frame(4, SAMPLE_PACKET) assertThat(dut_channel_z).emits( L2capMatchers.PacketPayloadRawData(b'\x19\x26\x08\x17'))
def test_fixed_channel_receive(self): self.dut_l2cap.enable_fixed_channel(4) self._setup_link_from_cert() (dut_channel, cert_channel) = self._open_fixed_channel(4) cert_channel.send(SAMPLE_PACKET) assertThat(dut_channel).emits( L2capMatchers.PacketPayloadRawData(b'\x19\x26\x08\x17'))
def test_data_receiving_dut_is_central(self): """ L2CAP/COS/CFC/BV-04-C """ (dut_channel, cert_channel) = self._set_link_from_dut_and_open_channel() cert_channel.send_first_le_i_frame(4, SAMPLE_PACKET) assertThat(dut_channel).emits(L2capMatchers.PacketPayloadRawData(b'\x19\x26\x08\x17'))
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_le_credit_based_connection_request_on_supported_le_psm(self): """ Verify that an IUT sending an LE Credit Based Connection Request to a peer will establish the channel upon receiving the LE Credit Based Connection Response. """ self._setup_link_from_cert() (dut_channel, cert_channel) = self._open_channel_from_dut() cert_channel.send_first_le_i_frame(4, SAMPLE_PACKET) assertThat(dut_channel).emits(L2capMatchers.PacketPayloadRawData(b'\x19\x26\x08\x17'))
def test_data_receiving(self): """ Verify that the IUT can receive unsegmented data correctly. """ self._setup_link_from_cert() (dut_channel, cert_channel) = self._open_channel_from_cert() cert_channel.send_first_le_i_frame(4, SAMPLE_PACKET) assertThat(dut_channel).emits(L2capMatchers.PacketPayloadRawData(b'\x19\x26\x08\x17'))
def test_reassembling(self): """ Verify that the IUT can correctly reassemble data received from the Lower Tester which is greater than the IUT LE-frame size. """ self._setup_link_from_cert() (dut_channel, cert_channel) = self._open_channel_from_cert() sdu_size_for_two_sample_packet = 8 cert_channel.send_first_le_i_frame(sdu_size_for_two_sample_packet, SAMPLE_PACKET) cert_channel.send(SAMPLE_PACKET) assertThat(dut_channel).emits(L2capMatchers.PacketPayloadRawData(b'\x19\x26\x08\x17' * 2))