theironrobin / siglo

GTK app to sync InfiniTime watch with PinePhone
Mozilla Public License 2.0
153 stars 23 forks source link

Siglo D-Bus daemon #105

Open kq98 opened 2 years ago

kq98 commented 2 years ago

Siglo daemon The daemon is driven by a d-bus service and is as such init system agnostic. It currently implements:

  • connections, disconnections, scans, pulling the firmware version, setting the time, pushing notifications and music player data to the watch(my old PR)
  • The daemon exposes a dbus interface under the common name com.github.alexr4535.siglo.Daemon that the GUI process or another application can use to interact with the daemon.
  • The dbus interface could easily be expanded and expose kinetic data, which is what some people wanted.
  • Pairing is unfortunately not possible right now with the current gatt library. I'm currently looking into bleak which is the only library that I could find that does implement pairing(recommendations welcome).

Notably the daemon currently does not handle Firmware updates, although that would certainly be possible. I didn't want to make this PR even larger, so for now the flashing is still handled by the gui application.

Problems Warning messages clutter stderr, they are only present when access to the entire session bus is granted and they seem to be associated with file manipulations. But I don't know anything further.

Testing and Feedback To make the testing a little bit easier, I pushed the daemon on my testing branch as well, with a slightly modified manifest so that you can install everything like this:

git clone --branch=testing https://github.com/kq98/siglo.git
cd siglo
flatpak-builder --force-clean --install --user build-dir com.github.alexr4535.siglo.json

You can use notify-send to simulate an incoming sms for testing like this:

notify-send Joe 'This is an example message' --hint=STRING:'desktop-entry':'sm.puri.Chatty'

All MPRIS compliant music players should work. The daemon interface has a Quit() method you can call using d-feet, should the daemon get stuck. Or just kill it using htop. You can also run the daemon manually to capture it's output with flatpak run com.github.alexr4535.siglo --daemon

Be aware that if you already installed Siglo on that device in the past, the sandbox permissions might not be up to date. Check with Flatseal that Siglo has access to the entire session bus and permission to run in the background.

I hope, that even when this doesn't make it into the project, which I understand considering the size of this PR, that I could at least inspire some further development on Siglo.