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

Investigate ScanFilter.setManufacturerData() not working #636

Open
dariuszseweryn opened this issue Oct 28, 2019 · 2 comments
Open

Investigate ScanFilter.setManufacturerData() not working #636

dariuszseweryn opened this issue Oct 28, 2019 · 2 comments

Comments

@dariuszseweryn
Copy link
Owner

Summary

It seems that setting
ScanFitler.Builder().setManufacturerData(/* int manufacturerId */ 0x0123, /* byte[] manufacturerData */ null) will not pass any advertisements with the specified manufacturerId.
More fitting solution would be to pass all advertisements with this id no matter the data.

Library version

1.10.3 (not a library issue)

Preconditions

Have a peripheral advertising data with manufacturerId = 0x0123

Steps to reproduce actual result


1. Set ScanFitler.Builder().setManufacturerData(/* int manufacturerId */ 0x0123, /* byte[] manufacturerData */ null)

2. Scan peripheral that advertises manufacturerId = 0x0123

3. Observe results

Actual result

No ScanResult is emitted

Expected result

A ScanResult with the given manufacturerId is emitted

Minimum code snippet reproducing the issue

        val scanSettings = ScanSettings.Builder()
            .setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY)
            .setCallbackType(ScanSettings.CALLBACK_TYPE_ALL_MATCHES)
            .build()

        val manuId = 0xBEEF
        val scanFilter = ScanFilter.Builder()
            .setManufacturerData(manuId, null)
            .build()

        return rxBleClient.scanBleDevices(scanSettings, scanFilter)

Logs from the application running with settings:

RxBleClient.updateLogOptions(new LogOptions.Builder()
        .setLogLevel(LogConstants.DEBUG)
        .setMacAddressLogSetting(LogConstants.MAC_ADDRESS_FULL)
        .setUuidsLogSetting(LogConstants.UUIDS_FULL)
        .setShouldLogAttributeValues(true)
        .build()
);
// no logs as Android OS does not match anything
@omeryounus
Copy link

Also setDeviceName(name) and setDeviceMacAddress(macaddress) is not working.

@dariuszseweryn
Copy link
Owner Author

I have seen setDeviceName(name) not working because of name being advertised with more than one trailing 0. As for the MAC address I have not seen this before.

Now testing with Samsung SM-G920F / API 24. When using .setManufacturerData(manuId, null) the filter does not seem to work at all.

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

No branches or pull requests

2 participants