Skip to content

Commit 2832324

Browse files
committed
Fix test_scan implementation
Discover dut's random address before connecting to it
1 parent 8de9f8d commit 2832324

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

avatar/cases/le_host_test.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,29 @@ def test_scan(
105105
scan_response_data = DataTypes() if scannable == 'scannable' else None
106106
target = self.dut.address if directed == 'directed' else None
107107

108+
# Advertise with Android and Scan with Bumble to retrieve the address
109+
android_advertise = self.dut.host.Advertise(
110+
legacy=True,
111+
connectable=True,
112+
own_address_type=RANDOM,
113+
data=DataTypes(manufacturer_specific_data=b'pause cafe'),
114+
)
115+
bumble_scan = self.ref.host.Scan(legacy=False, passive=False, timeout=self.scan_timeout)
116+
result_scan = next((x for x in bumble_scan if b'pause cafe' in x.data.manufacturer_specific_data)) # pytype: disable=name-error
117+
android_advertise.cancel()
118+
bumble_scan.cancel()
119+
logging.error(f'result_scan: {result_scan}')
120+
logging.error(f'random address: {result_scan.random.hex()}')
121+
target = result_scan.random
122+
123+
# Perform the test as usual
108124
advertise = self.ref.host.Advertise(
109125
legacy=True,
110126
connectable=is_connectable,
111127
data=data, # type: ignore[arg-type]
112128
scan_response_data=scan_response_data, # type: ignore[arg-type]
113-
public=target,
129+
# public=target,
130+
random=target,
114131
own_address_type=PUBLIC,
115132
)
116133

0 commit comments

Comments
 (0)