Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33d7c917 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge changes Ib5197ec5,I9a155234 am: 110276b2

Change-Id: Ie2edb7d7f6d2db2b8f8aabd023ba29718560e8a1
parents 3970b225 110276b2
Loading
Loading
Loading
Loading
+75 −0
Original line number Diff line number Diff line
@@ -590,6 +590,44 @@ class L2capTest(GdFacadeOnlyBaseTestClass):

        assertThat(self.cert_acl).emits(is_correct_information_response)

    def test_extended_feature_info_response_streaming(self):
        """
        L2CAP/EXF/BV-02-C
        """
        asserts.skip("Streaming not supported")
        self._setup_link_from_cert()

        signal_id = 3
        information_request = l2cap_packets.InformationRequestBuilder(
            signal_id,
            l2cap_packets.InformationRequestInfoType.EXTENDED_FEATURES_SUPPORTED
        )
        information_request_l2cap = l2cap_packets.BasicFrameBuilder(
            1, information_request)
        self.cert_send_b_frame(information_request_l2cap)

        def is_correct_information_response(l2cap_packet):
            packet_bytes = l2cap_packet.payload
            l2cap_view = l2cap_packets.BasicFrameView(
                bt_packets.PacketViewLittleEndian(list(packet_bytes)))
            if l2cap_view.GetChannelId() != 1:
                return False
            l2cap_control_view = l2cap_packets.ControlView(
                l2cap_view.GetPayload())
            if l2cap_control_view.GetCode(
            ) != l2cap_packets.CommandCode.INFORMATION_RESPONSE:
                return False
            information_response_view = l2cap_packets.InformationResponseView(
                l2cap_control_view)
            if information_response_view.GetInfoType(
            ) != l2cap_packets.InformationRequestInfoType.EXTENDED_FEATURES_SUPPORTED:
                return False
            extended_features_view = l2cap_packets.InformationResponseExtendedFeaturesView(
                information_response_view)
            return extended_features_view.GetStreamingMode()

        assertThat(self.cert_acl).emits(is_correct_information_response)

    def test_extended_feature_info_response_fcs(self):
        """
        L2CAP/EXF/BV-03-C [Extended Features Information Response for FCS Option]
@@ -628,6 +666,43 @@ class L2capTest(GdFacadeOnlyBaseTestClass):

        assertThat(self.cert_acl).emits(is_correct_information_response)

    def test_extended_feature_info_response_fixed_channels(self):
        """
        L2CAP/EXF/BV-05-C
        """
        self._setup_link_from_cert()

        signal_id = 3
        information_request = l2cap_packets.InformationRequestBuilder(
            signal_id,
            l2cap_packets.InformationRequestInfoType.EXTENDED_FEATURES_SUPPORTED
        )
        information_request_l2cap = l2cap_packets.BasicFrameBuilder(
            1, information_request)
        self.cert_send_b_frame(information_request_l2cap)

        def is_correct_information_response(l2cap_packet):
            packet_bytes = l2cap_packet.payload
            l2cap_view = l2cap_packets.BasicFrameView(
                bt_packets.PacketViewLittleEndian(list(packet_bytes)))
            if l2cap_view.GetChannelId() != 1:
                return False
            l2cap_control_view = l2cap_packets.ControlView(
                l2cap_view.GetPayload())
            if l2cap_control_view.GetCode(
            ) != l2cap_packets.CommandCode.INFORMATION_RESPONSE:
                return False
            information_response_view = l2cap_packets.InformationResponseView(
                l2cap_control_view)
            if information_response_view.GetInfoType(
            ) != l2cap_packets.InformationRequestInfoType.EXTENDED_FEATURES_SUPPORTED:
                return False
            extended_features_view = l2cap_packets.InformationResponseExtendedFeaturesView(
                information_response_view)
            return extended_features_view.GetFixedChannels()

        assertThat(self.cert_acl).emits(is_correct_information_response)

    def test_config_channel_not_use_FCS(self):
        """
        L2CAP/FOC/BV-01-C [IUT Initiated Configuration of the FCS Option]
+2 −1
Original line number Diff line number Diff line
@@ -512,7 +512,8 @@ void ClassicSignallingManager::OnInformationRequest(SignalId signal_id, Informat
    case InformationRequestInfoType::EXTENDED_FEATURES_SUPPORTED: {
      // TODO: implement this response
      auto response = InformationResponseExtendedFeaturesBuilder::Create(
          signal_id.Value(), InformationRequestResult::SUCCESS, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0);
          signal_id.Value(), InformationRequestResult::SUCCESS, 0, 0, 0, 1 /* ERTM */, 0 /* Streaming mode */,
          1 /* FCS */, 0, 1 /* Fixed Channels */, 0, 0);
      enqueue_buffer_->Enqueue(std::move(response), handler_);
      break;
    }