Loading system/gd/hci/cert/acl_manager_test.py +4 −19 Original line number Diff line number Diff line Loading @@ -56,16 +56,8 @@ class AclManagerTest(GdFacadeOnlyBaseTestClass): with PyHci(self.cert) as cert_hci, \ EventStream(self.dut.hci_acl_manager.FetchAclData(empty_proto.Empty())) as acl_data_stream: # CERT Enables scans and gets its address cert_hci.send_command_with_complete( hci_packets.WriteScanEnableBuilder( hci_packets.ScanEnable.INQUIRY_AND_PAGE_SCAN)) cert_hci.send_command_with_complete(hci_packets.ReadBdAddrBuilder()) read_bd_addr = ReadBdAddrCompleteCapture() assertThat(cert_hci.get_event_stream()).emits(read_bd_addr) cert_address = read_bd_addr.get().GetBdAddr() cert_hci.enable_inquiry_and_page_scan() cert_address = cert_hci.read_own_address() with EventStream( self.dut.hci_acl_manager.CreateConnection( Loading Loading @@ -180,15 +172,8 @@ class AclManagerTest(GdFacadeOnlyBaseTestClass): EventStream(self.dut.hci_acl_manager.FetchAclData(empty_proto.Empty())) as acl_data_stream: # CERT Enables scans and gets its address cert_hci.send_command_with_complete( hci_packets.WriteScanEnableBuilder( hci_packets.ScanEnable.INQUIRY_AND_PAGE_SCAN)) cert_hci.send_command_with_complete(hci_packets.ReadBdAddrBuilder()) read_bd_addr = ReadBdAddrCompleteCapture() assertThat(cert_hci.get_event_stream()).emits(read_bd_addr) cert_address = read_bd_addr.get().GetBdAddr() cert_hci.enable_inquiry_and_page_scan() cert_address = cert_hci.read_own_address() with EventStream( self.dut.hci_acl_manager.CreateConnection( Loading system/gd/hci/cert/py_hci.py +14 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ from google.protobuf import empty_pb2 as empty_proto from cert.event_stream import EventStream from captures import ReadBdAddrCompleteCapture from bluetooth_packets_python3 import hci_packets from cert.truth import assertThat class PyHci(object): Loading Loading @@ -51,3 +54,14 @@ class PyHci(object): def send_command_with_status(self, command): self.device.hci.send_command_with_status(command) def enable_inquiry_and_page_scan(self): self.send_command_with_complete( hci_packets.WriteScanEnableBuilder( hci_packets.ScanEnable.INQUIRY_AND_PAGE_SCAN)) def read_own_address(self): self.send_command_with_complete(hci_packets.ReadBdAddrBuilder()) read_bd_addr = ReadBdAddrCompleteCapture() assertThat(self.event_stream).emits(read_bd_addr) return read_bd_addr.get().GetBdAddr() Loading
system/gd/hci/cert/acl_manager_test.py +4 −19 Original line number Diff line number Diff line Loading @@ -56,16 +56,8 @@ class AclManagerTest(GdFacadeOnlyBaseTestClass): with PyHci(self.cert) as cert_hci, \ EventStream(self.dut.hci_acl_manager.FetchAclData(empty_proto.Empty())) as acl_data_stream: # CERT Enables scans and gets its address cert_hci.send_command_with_complete( hci_packets.WriteScanEnableBuilder( hci_packets.ScanEnable.INQUIRY_AND_PAGE_SCAN)) cert_hci.send_command_with_complete(hci_packets.ReadBdAddrBuilder()) read_bd_addr = ReadBdAddrCompleteCapture() assertThat(cert_hci.get_event_stream()).emits(read_bd_addr) cert_address = read_bd_addr.get().GetBdAddr() cert_hci.enable_inquiry_and_page_scan() cert_address = cert_hci.read_own_address() with EventStream( self.dut.hci_acl_manager.CreateConnection( Loading Loading @@ -180,15 +172,8 @@ class AclManagerTest(GdFacadeOnlyBaseTestClass): EventStream(self.dut.hci_acl_manager.FetchAclData(empty_proto.Empty())) as acl_data_stream: # CERT Enables scans and gets its address cert_hci.send_command_with_complete( hci_packets.WriteScanEnableBuilder( hci_packets.ScanEnable.INQUIRY_AND_PAGE_SCAN)) cert_hci.send_command_with_complete(hci_packets.ReadBdAddrBuilder()) read_bd_addr = ReadBdAddrCompleteCapture() assertThat(cert_hci.get_event_stream()).emits(read_bd_addr) cert_address = read_bd_addr.get().GetBdAddr() cert_hci.enable_inquiry_and_page_scan() cert_address = cert_hci.read_own_address() with EventStream( self.dut.hci_acl_manager.CreateConnection( Loading
system/gd/hci/cert/py_hci.py +14 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ from google.protobuf import empty_pb2 as empty_proto from cert.event_stream import EventStream from captures import ReadBdAddrCompleteCapture from bluetooth_packets_python3 import hci_packets from cert.truth import assertThat class PyHci(object): Loading Loading @@ -51,3 +54,14 @@ class PyHci(object): def send_command_with_status(self, command): self.device.hci.send_command_with_status(command) def enable_inquiry_and_page_scan(self): self.send_command_with_complete( hci_packets.WriteScanEnableBuilder( hci_packets.ScanEnable.INQUIRY_AND_PAGE_SCAN)) def read_own_address(self): self.send_command_with_complete(hci_packets.ReadBdAddrBuilder()) read_bd_addr = ReadBdAddrCompleteCapture() assertThat(self.event_stream).emits(read_bd_addr) return read_bd_addr.get().GetBdAddr()