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

Invalid arguments in method call for SetDiscoveryFilter with RSSI #23

Open
Delapouite opened this issue Sep 29, 2020 · 5 comments
Open

Comments

@Delapouite
Copy link

Hello

I experience a DBusError: Invalid arguments in method call when I try to specify the RSSI threshold in the SetDiscoveryFilter of an adapter:

await adapter.SetDiscoveryFilter({ RSSI: 5 });

The getDiscoveryFilters returns the following array, showing RSSI as a valid filter :
[ 'UUIDs', 'RSSI', 'Pathloss', 'Transport', 'DuplicateData', 'Discoverable', 'Pattern' ]

Is there anything that should be done to pass numbers properly? For example, specifying a boolean filter works as intented:

await adapter.SetDiscoveryFilter({ DuplicateData: true });

Thanks for your help!

@Niels-Be
Copy link
Owner

So I investigated this and it seams that there is an issue in the dbus library when encoding numbers as variants.
The library always encodes numbers with the smallest possible datatype in this case as BYTE, but bluez expects an INT16 and therefore fails with invalid argument.
This is a major issue also affecting other methods. We probably need to switch to another dbus library since node-dbus no longer seams to be maintained.

@Vishal8523
Copy link

Vishal8523 commented Dec 8, 2020

Any updates on this one ?

I am trying to set the "adapter.SetDiscoveryFilter({ DuplicateData: true })" yet I am not able to see the devices in the scan.

What should be done ?

@WaeCo : What should be done ?
@Delapouite: Any fix that you have done ?

@Niels-Be
Copy link
Owner

For anyone interested in this to work. I rewrote the library to use dbus-next which should fix this issue.
You can find the new code in dbus-next branch.

You can now pass along the datatype as Dbus.Variant:

adapter.SetDiscoveryFilter({
        RSSI: new Dbus.Variant("n", -100), // need to use variant to set correct data type
        DuplicateData: true,
});

See: tests/discovery-filter.js for details.

@Haochen7
Copy link

Hi @WaeCo, thank you for your work. By the way, is there a plan to migrate the current master to use the dbus-next version of the repo.

Thanks again for your help.

@Niels-Be
Copy link
Owner

Still waiting on dbusjs/node-dbus-next#67 to be merged.

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

4 participants