def test_inquiry_from_dut(self): inquiry_msg = neighbor_facade.InquiryMsg( inquiry_mode=neighbor_facade.DiscoverabilityMode.GENERAL, result_mode=neighbor_facade.ResultMode.STANDARD, length_1_28s=3, max_results=0) session = self.dut_neighbor.set_inquiry_mode(inquiry_msg) self.cert_hci.send_command(hci_packets.WriteScanEnableBuilder(hci_packets.ScanEnable.INQUIRY_AND_PAGE_SCAN)) assertThat(session).emits(NeighborMatchers.InquiryResult(self.cert_address), timeout=timedelta(seconds=10))
def test_inquiry_rssi_from_dut(self): inquiry_msg = neighbor_facade.InquiryMsg( inquiry_mode=neighbor_facade.DiscoverabilityMode.GENERAL, result_mode=neighbor_facade.ResultMode.RSSI, length_1_28s=3, max_results=0) with EventStream(self.dut.neighbor.SetInquiryMode( inquiry_msg)) as inquiry_event_stream: self.enqueue_hci_command( hci_packets.WriteScanEnableBuilder( hci_packets.ScanEnable.INQUIRY_AND_PAGE_SCAN), True) inquiry_event_stream.assert_event_occurs( lambda msg: b'\x22\x0f' in msg.packet # Expecting an HCI Event (code 0x22, length 0x0f) )
def test_inquiry_from_dut(self): inquiry_msg = neighbor_facade.InquiryMsg( inquiry_mode=neighbor_facade.DiscoverabilityMode.GENERAL, result_mode=neighbor_facade.ResultMode.STANDARD, length_1_28s=3, max_results=0) with EventCallbackStream( self.device_under_test.neighbor.SetInquiryMode( inquiry_msg)) as inquiry_event_stream: hci_event_asserts = EventAsserts(inquiry_event_stream) self.enqueue_hci_command( hci_packets.WriteScanEnableBuilder( hci_packets.ScanEnable.INQUIRY_AND_PAGE_SCAN), True) hci_event_asserts.assert_event_occurs( lambda msg: b'\x02\x0f' in msg.packet # Expecting an HCI Event (code 0x02, length 0x0f) )
def test_inquiry_extended_from_dut(self): self._set_name() gap_name = hci_packets.GapData() gap_name.data_type = hci_packets.GapDataType.COMPLETE_LOCAL_NAME gap_name.data = list(bytes(self.cert_name)) gap_data = list([gap_name]) self.cert_hci.send_command( hci_packets.WriteExtendedInquiryResponseBuilder(hci_packets.FecRequired.NOT_REQUIRED, gap_data)) inquiry_msg = neighbor_facade.InquiryMsg( inquiry_mode=neighbor_facade.DiscoverabilityMode.GENERAL, result_mode=neighbor_facade.ResultMode.EXTENDED, length_1_28s=8, max_results=0) session = self.dut_neighbor.set_inquiry_mode(inquiry_msg) self.cert_hci.send_command(hci_packets.WriteScanEnableBuilder(hci_packets.ScanEnable.INQUIRY_AND_PAGE_SCAN)) assertThat(session).emits( NeighborMatchers.ExtendedInquiryResult(self.cert_address), timeout=timedelta(seconds=10))
def test_inquiry_extended_from_dut(self): name_string = b'Im_A_Cert' gap_name = hci_packets.GapData() gap_name.data_type = hci_packets.GapDataType.COMPLETE_LOCAL_NAME gap_name.data = list(bytes(name_string)) gap_data = list([gap_name]) self.enqueue_hci_command( hci_packets.WriteExtendedInquiryResponseBuilder( hci_packets.FecRequired.NOT_REQUIRED, gap_data), True) inquiry_msg = neighbor_facade.InquiryMsg( inquiry_mode=neighbor_facade.DiscoverabilityMode.GENERAL, result_mode=neighbor_facade.ResultMode.EXTENDED, length_1_28s=3, max_results=0) with EventStream(self.dut.neighbor.SetInquiryMode( inquiry_msg)) as inquiry_event_stream: self.enqueue_hci_command( hci_packets.WriteScanEnableBuilder( hci_packets.ScanEnable.INQUIRY_AND_PAGE_SCAN), True) inquiry_event_stream.assert_event_occurs( lambda msg: name_string in msg.packet)