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

iOS supports requestLEScan without service filter, but the plugin prevents it #582

Closed
Maximvdw opened this issue Oct 18, 2023 · 2 comments
Closed
Labels
bug Something isn't working cannot reproduce

Comments

@Maximvdw
Copy link

Maximvdw commented Oct 18, 2023

iOS supports the scanning of BLE devices without specifying a service list. This requires
the service list to be nil:
https://developer.apple.com/documentation/corebluetooth/cbcentralmanager/1518986-scanforperipherals#discussion

However, on this line:
https://github.com/capacitor-community/bluetooth-le/blob/main/ios/Plugin/Plugin.swift#L509
an empty array is used when no services are provided in the call, preventing any possibility to get nil.

Since an empty array would not do anything, I propose to return nil in the aforementioned getServiceUUIDs method. If developers still want the scanning of an empty array for some reason, they can just pass it along.

EDIT: After reading up on it, there does not seem to be a valid reason to 'scan' for an empty list, as this would not start a scan

@Maximvdw Maximvdw added the bug Something isn't working label Oct 18, 2023
@pwespi
Copy link
Member

pwespi commented Oct 19, 2023

EDIT: After reading up on it, there does not seem to be a valid reason to 'scan' for an empty list, as this would not start a scan

Where did you read this? In my tests, whether services is nil or an empty array doesn't matter and I obtain the same scan results.

Copy link

It looks like this issue didn't get the information it needed, so I'll close it for now. If I made a mistake, sorry! I am just a bot.

Have a great day!
Capacitor Community Bot 💙

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cannot reproduce
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants