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

Event System Implementation #1247

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mikepparks
Copy link
Contributor

(Re-implemented event system from previous PR #971 to be up to date with current codebase.)

The idea behind this event system is to implement system-wide notices when certain functions occur. This will allow for more reactive features and potentially improve cross-feature communication, while cutting back on or eliminating duplicate functionality.

Examples of usage:

  • On WebConfig restart, an event is triggered and the Display feature will change to a "Restarting" screen.
  • With rotary encoders, the direction of travel, as well as the encoder ID is sent in an event that could be used for adjusting turbo rate, or switching profiles.

To add events, the following is needed:

  • A new event enum value added to GPEventType in proto/enums.proto
  • An event header in headers/events
  • Event handlers can be registered with EventManager::getInstance().registerEventHandler(GP_EVENT_ID, GPEVENT_CALLBACK(this->handleEvent(event);));
  • Events can be fired with EventManager::getInstance().triggerEvent(new GPEventClass(...props...));

Re-implemented event system from previous PR OpenStickCommunity#971 to be up to date with current codebase.
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.

1 participant