from bluetooth_packets_python3.l2cap_packets import SegmentationAndReassembly
from bluetooth_packets_python3.l2cap_packets import SupervisoryFunction
from bluetooth_packets_python3.l2cap_packets import Poll
+from bluetooth_packets_python3.l2cap_packets import InformationRequestInfoType
from cert.event_stream import FilteringEventStream
from cert.event_stream import IEventStream
from cert.matchers import L2capMatchers
self._dcid, s, p, f, req_seq)
self._acl.send(frame.Serialize())
+ def send_information_request(self, type):
+ assertThat(self._scid).isEqualTo(1)
+ signal_id = 3
+ information_request = l2cap_packets.InformationRequestBuilder(
+ signal_id, type)
+ self.send(information_request)
+
+ def send_extended_features_request(self):
+ self.send_information_request(
+ InformationRequestInfoType.EXTENDED_FEATURES_SUPPORTED)
+
class CertL2cap(Closable):
L2CAP/COS/IEX/BV-01-C [Query for 1.2 Features]
"""
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)
+ control_channel = self.cert_l2cap.get_control_channel()
- assertThat(self.cert_l2cap.get_control_channel()).emits(
+ control_channel.send_extended_features_request()
+
+ assertThat(control_channel).emits(
L2capMatchers.InformationResponseExtendedFeatures())
def test_extended_feature_info_response_ertm(self):
Retransmission Mode]
"""
self._setup_link_from_cert()
+ control_channel = self.cert_l2cap.get_control_channel()
- 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)
+ control_channel.send_extended_features_request()
- assertThat(self.cert_l2cap.get_control_channel()).emits(
+ assertThat(control_channel).emits(
L2capMatchers.InformationResponseExtendedFeatures(
supports_ertm=True))
"""
asserts.skip("Streaming not supported")
self._setup_link_from_cert()
+ control_channel = self.cert_l2cap.get_control_channel()
- 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)
+ control_channel.send_extended_features_request()
- assertThat(self.cert_l2cap.get_control_channel()).emits(
+ assertThat(control_channel).emits(
L2capMatchers.InformationResponseExtendedFeatures(
supports_streaming=True))
Note: This is not mandated by L2CAP Spec
"""
self._setup_link_from_cert()
+ control_channel = self.cert_l2cap.get_control_channel()
- 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)
+ control_channel.send_extended_features_request()
- assertThat(self.cert_l2cap.get_control_channel()).emits(
+ assertThat(control_channel).emits(
L2capMatchers.InformationResponseExtendedFeatures(
supports_fcs=True))
L2CAP/EXF/BV-05-C
"""
self._setup_link_from_cert()
+ control_channel = self.cert_l2cap.get_control_channel()
- 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)
+ control_channel.send_extended_features_request()
- assertThat(self.cert_l2cap.get_control_channel()).emits(
+ assertThat(control_channel).emits(
L2capMatchers.InformationResponseExtendedFeatures(
supports_fixed_channels=True))