示例#1
0
 def test_request_refused_due_to_source_cid_already_allocated_responder(self):
     """
     Verify that an IUT receiving an LE Credit Based Connection Request for a second channel will refuse the connection with result "0x000A - Connection refused – Source CID already allocated" if it receives a Source CID which is already in use.
     """
     self._setup_link_from_cert()
     (dut_channel, cert_channel) = self._open_channel_from_cert(psm=0x33, scid=0x0101)
     self.dut_l2cap.register_coc(self.cert_address, psm=0x35)
     self.cert_l2cap.get_control_channel().send(
         l2cap_packets.LeCreditBasedConnectionRequestBuilder(2, 0x35, 0x0101, 1000, 1000, 1000))
     assertThat(self.cert_l2cap.get_control_channel()).emits(L2capMatchers.CreditBasedConnectionResponseUsedCid())
示例#2
0
    def open_channel_with_expected_result(
            self,
            psm=0x33,
            result=LeCreditBasedConnectionResponseResult.SUCCESS):
        self.control_channel.send(
            l2cap_packets.LeCreditBasedConnectionRequestBuilder(
                1, psm, 0x40, 1000, 100, 6))

        response = L2capMatchers.CreditBasedConnectionResponse(result)
        assertThat(self.control_channel).emits(response)
示例#3
0
 def test_credit_based_connection_request_unsupported_le_psm(self):
     """
     Verify that an IUT receiving an LE Credit Based Connection Request on an unsupported LE_PSM will respond with an LE Credit Based Connection Response refusing the connection.
     """
     self._setup_link_from_cert()
     self.cert_l2cap.get_control_channel().send(
         l2cap_packets.LeCreditBasedConnectionRequestBuilder(1, 0x34, 0x0101, 2000, 1000, 1000))
     assertThat(self.cert_l2cap.get_control_channel()).emits(
         L2capMatchers.CreditBasedConnectionResponse(
             result=LeCreditBasedConnectionResponseResult.LE_PSM_NOT_SUPPORTED))
示例#4
0
    def open_channel(self,
                     signal_id,
                     psm,
                     scid,
                     mtu=1000,
                     mps=100,
                     initial_credit=6):
        self.control_channel.send(
            l2cap_packets.LeCreditBasedConnectionRequestBuilder(
                signal_id, psm, scid, mtu, mps, initial_credit))

        response = L2capCaptures.CreditBasedConnectionResponse()
        assertThat(self.control_channel).emits(response)
        channel = CertLeL2capChannel(self._device, scid,
                                     response.get().GetDestinationCid(),
                                     self._get_acl_stream(), self._le_acl,
                                     self.control_channel,
                                     response.get().GetInitialCredits())
        self._cid_to_cert_channels[scid] = channel
        return channel