Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to scan for *only* Coded PHY #52

Open
mafaneh opened this issue Sep 14, 2021 · 3 comments
Open

Not able to scan for *only* Coded PHY #52

mafaneh opened this issue Sep 14, 2021 · 3 comments

Comments

@mafaneh
Copy link

mafaneh commented Sep 14, 2021

I am currently using a OnePlus Nord N10 5G and I can confirm it works well for scanning, advertising (primary & secondary), and connecting all using Coded PHY (using the nRF Connect Android app).

The issue I am running into is I'm not able to scan only Coded PHY advertisements (primary + secondary). According to the Android API documentation, you can set the PHY used for scanning to be: 1M + Coded PHY, 1M only, or Coded only. However, I am still receiving non-Coded PHY advertisements even when I set the Phy to Coded PHY using the .setPhy(BluetoothDevice.PHY_LE_CODED) during the setting of the Scan Settings.

Here's the code I modified in the app (in ScannerViewModel.java):

	public void startScan() {
		if (scannerStateLiveData.isScanning()) {
			return;
		}

		// Scanning settings
		final ScanSettings settings = new ScanSettings.Builder()
				.setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY)
				.setLegacy(false)
				.setPhy(BluetoothDevice.PHY_LE_CODED)
				.setReportDelay(500)
				.setUseHardwareBatchingIfSupported(false)
				.build();

		final BluetoothLeScannerCompat scanner = BluetoothLeScannerCompat.getScanner();
		scanner.startScan(null, settings, scanCallback);
		scannerStateLiveData.scanningStarted();
	}

Is this an issue with the API? or am I doing something wrong?

@philips77
Copy link
Member

philips77 commented Sep 14, 2021

How about you set report delay to 0?
Edit: You're using scanner compat with disabled hardware batching, so delays are emulated by the library... This will not help.

So I guess there's nothing that can be done. It's how the phone behaves... Did you try other phones?

@mafaneh
Copy link
Author

mafaneh commented Sep 14, 2021

I have not tried other phones. I only have a Pixel 4a and I believe that does not support scanning for extended advertisements. In your testing, have you tried scanning for Coded PHY only?

@philips77
Copy link
Member

We rather checked if devices advertising with primary phy coded are discovered at all, but we used "all supported" mode for phy no in the scanner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants