Skip to content

Fixing the missing devices when discovering for the first time. Fixes #151#157

Open
ncdm-stldr wants to merge 1 commit into
edufolly:masterfrom
ncdm-stldr:master
Open

Fixing the missing devices when discovering for the first time. Fixes #151#157
ncdm-stldr wants to merge 1 commit into
edufolly:masterfrom
ncdm-stldr:master

Conversation

@ncdm-stldr
Copy link
Copy Markdown

The first time one call startDiscovery(), some results are lost and not sent through the stream returned by startDiscovery.
After investigation, it appeared to me this happens because the plugin calls _methodChannel.invokeMethod('startDiscovery'); before listening to the EventChannel _discoveryChannel.
Therefore I switched the two code blocks. I also added something to prevent the following situation:

  • We listen to the _discoveryChannel EventChannel.
  • An past discovery finishes now which triggers the onDone method of the subsciption we just created
  • We start a discovery.
  • We return a closed empty stream which will never receive the result of the new discovery

@ncdm-stldr
Copy link
Copy Markdown
Author

Note that to reproduce the issue, one can simply run the example application of the plugin, then explore the scanned devices: the first time we click on the button, we do not see all the devices. We can however see some devices in the logs which are not displayed because startDiscovery doesn't return them.

@ncdm-stldr
Copy link
Copy Markdown
Author

ncdm-stldr commented Oct 5, 2022

@DanielLimaFN
Hi,
Thank you the review.
Is this repository still maintained?
It seems that there are a lots of people that would be interested to contribute to the project. For example there are at least 5 forks (including yours) that support android 12.
Is there already another repository that replaced the one from edufolly?

@edufolly edufolly added the good first issue Good for newcomers label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

good first issue Good for newcomers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants