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

OOP based event handler implementation (nexus511-mod) #831

Merged
merged 2 commits into from
Jun 28, 2017

Conversation

nexus511
Copy link
Contributor

@nexus511 nexus511 commented Jun 26, 2017

As I wanted to build some LED-based status information I have been in the need for some more flexible plugin mechanism.

The already implemented callback-mechanism is nice, if you do not plan to extend the functionality by only one hook. So I decided to implement an OOP based approach using an observer pattern which allows to attach multiple listeners to events produced by the printercore.

As I think that this would be also useful for other people using custom external hardware, it would be nice to see this as a general feature of printrun.

A sample implementation of an empty plugin can be found within the plugins folder. It is theoretically possible to attach multiple plugins as a list while each one should of course be carefully implemented to not interfere with the overall performance of the printing-process.

I have been using the patch-set for several month on my own printer on a raspberry-pi. If you see any problems with the patches, please let me know.

Nexus added 2 commits June 26, 2017 11:29
… the

actual actions triggered by pronterface on the device interface. This set of
patches allows to add multiple event-listeners to the printcore to attach
external status-interfaces like LEDs, LCD-monitors or anything else.

It actually extends the existing callback-mechanism by a more flexible
and object-based observer model.

This patch also contains an example plugin to show, how the feature can be used
in general.
@kliment kliment merged commit e536f43 into kliment:master Jun 28, 2017
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