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

Introduce DBus-powered x1plusd to manage settings #223

Merged
merged 11 commits into from Apr 29, 2024
Merged

Conversation

jwise
Copy link
Member

@jwise jwise commented Apr 28, 2024

Continuing in the path of #196, we introduce a handful of infrastructure in this PR, and only a few tiny users :-) The core idea of this is that we introduce @riptidewave93 's x1plusd (and the associated settings service), but instead of binding it to DDS, we bind it to DBus using jeepney (which @jphannifan found after I spent a night unsuccessfully wrestling with the library dependencies for dasbus -- thanks!). The x1plusd registers a DBus bus name x1plus.x1plusd that has an object /x1plus/settings, which, in turn, exposes the following methods:

  • x1plus.settings.GetSettings(json: string) returns a JSON dictionary of all the current known X1Plus settings, loaded from the SD card's printer-specific X1Plus settings JSON.
  • x1plus.settings.PutSettings(json: string) updates the X1Plus settings with keys from the passed JSON dictionary.

When a setting changes, it emits a signal:

  • x1plus.settings.SettingsChanged(json: string), with a dictionary that has set in it only the keys that have changed.

We also introduce a QML API, X1Plus.Settings.get / X1Plus.Settings.put. X1Plus.Settings.get works like a QML binding, and if used in a QML binding context, will dynamically retrigger the binding if the setting changes either internally to bbl_screen or externally, as part of another system user's DBus operation.

Finally, we wire the lock screen's locktype and passcode variables to X1Plus.Settings, to store them in the settings.json, and we migrate these settings on boot if they exist. To show the live QML binding behavior, we introduce a x1plus-test-settings.py that commands the X1Plus daemon to change some settings. Test it by loading the lock screen configuration dialog, and then ssh'ing in and running something like:

$ /opt/x1plus-test-settings.py passcode=1337

or:

$ /opt/x1plus-test-settings.py locktype=1

You should see the settings change in real time on the display.

riptidewave93 and others added 9 commits April 28, 2024 02:42
This adds our python service which will later house multiple DDS interfaces. To start, we have a settings engine other things, such as our OTA engine, can use.
* Remove get settings
* remove usage of set as a var
* added a catch-all for an invalid command
* Renamed things to x1plusd
* Better file handling logic
* Exception handling on main loop
@jwise jwise merged commit facd79e into main Apr 29, 2024
1 check passed
@jwise jwise deleted the jwise/settingsd branch April 29, 2024 07:37
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.

None yet

2 participants