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

Periodic discovery #61

Closed
wants to merge 2 commits into from
Closed

Periodic discovery #61

wants to merge 2 commits into from

Conversation

azymohliad
Copy link
Owner

@azymohliad azymohliad commented Mar 2, 2024

A very basic periodic discovery is implemented. The current logic is the following:

  • Periodic discovery is used only when running in the background, otherwise (if Devices view is open) it scans continuously as before.
  • The intervals are hard-coded for now: 5 seconds scanning, 60 seconds pause.

TODO:

  • Review the logic: is it adequate to switch between periodic and continuous discovery based solely on the UI visibility? Are there cases where we want periodic discovery in the foreground, or continuous discovery in the background?
  • Review the default intervals. Should they be constant or ramp up over time? Should the first scan duration after startup or loosing the connection be longer than others?
  • Add interval settings (maybe without a UI, gsettings backend only).
  • Test thoroughly.
  • (maybe) Make a Flathub CI build and ask more people to test before releasing.

@azymohliad
Copy link
Owner Author

Waiting to get some answers and gather a bit more information before continuing:

@sorry-i-am-late
Copy link

sorry-i-am-late commented Sep 1, 2024

Any updates on this?

If it isnt ready yet I will just try to write a reconnect script that runs as a cron job but preferably it would be built in to the flatpak as that seems more efficient.

Edit: In case any of yall want my solution regardless of its janky nature have at it!
FYI, the killing and restarting of bluetooth was found to be needed for reliability reasons,

connection_pinetime.sh.txt

Edit 2: This script is used to ensure that the watch still receives notifications even if they come in while the watch is disconnected due to the phone being suspended.

notification-delay.sh.txt

@azymohliad
Copy link
Owner Author

Any updates on this?

Hi! In the process of implementing this I realized that it's not the right solution, a better option would be to implement secure pairing (#56) first, which is good to have anyway, and then it won't be necessary to start discovery before attempting to reconnect. But I haven't had time and energy to implement it yet. I should probably close this PR to not confuse people.

In case any of yall want my solution regardless of its janky nature have at it!

Thanks! It might be useful for other users meanwhile (relevant for #59).

@azymohliad azymohliad closed this Sep 2, 2024
@sorry-i-am-late
Copy link

sorry-i-am-late commented Sep 2, 2024

Thanks! It might be useful for other users meanwhile (relevant for #59).

I've also created a second script, which I put in the same comment as the other to capture and delay notifications until the first script ensures the watch is ready to receive them. This way, I won't miss any notifications, even if they're received during a suspended session when the watch is disconnected.

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

Successfully merging this pull request may close these issues.

2 participants