eruption-project / eruption

Realtime RGB LED Driver for Linux
https://eruption-project.org/
GNU General Public License v3.0
258 stars 32 forks source link

Split dbus_interface into multiple files. #191

Closed Phen-Ro closed 1 year ago

Phen-Ro commented 1 year ago

This will help with modifying and maintaining the dbus interface in the future. One file per mod, then one file per path/interface, plus one file for extra convenience functionality.

The refactored code should be identical to the original but with the following two exceptions: dbus_tx is wrapped in an Arc rather than cloned, and higher-order functions are used for checking permissions.

Phen-Ro commented 1 year ago

The original motivation for this was to make some tweaks to eruptionctl to output all device statuses. That required diving into the dbus interface code, and from there I just had to refactor the 2500 line file.

The way the dbus_tree API requires explicit declaration of parameter names and then also requires you to explicitly pull out the arguments, this makes me think there should be a better way of establishing fn metadata to generate the dbus_tree objects. Maybe I'll learn more about macros to do this, or maybe I'll just think about doing it and then get distracted. You never know.

X3n0m0rph59 commented 1 year ago

Hi @Phen-Ro, thanks for this great work!