Sammy1Am / MoppyClassic

Moppy has been replaced with Moppy 2.0!
569 stars 190 forks source link

Added in numerous events + related features #110

Closed solidsnake745 closed 8 years ago

solidsnake745 commented 9 years ago

For my own purposes I needed a way to send certain "events" to connected microcontrollers. This set of changes accomplishes that. Feel free to change up my comments or code. I know many are not fond of my one-liner approach to coding and I understand that completely. I also know I tend to get over descriptive with comments sometimes.

Events added to MoppyReceiver:

Mainly used for sending specific system byte sequences on MoppyPlayerOutput. This allows me to execute various functions in response to those events. For instance on connecting/disconnecting, I have my microcontroller setup to respond by turning the main power supply for my setup on/off respectively. I've also used sequenceStarting/Stopping for turning an LED on and off to indicate a sequence is being played. On another version of Moppy I'm working on, this is also used to interrupt a standby process when a sequence is to be played.

Event added to InputPanel:

Simple event, all it does for now is cause the currently selected input panel to save preferences before exiting. However it will allow executing of any shutdown tasks that may be needed in the future. I have plans, but I don't want to go into detail about that yet. Still think it could possibly be useful for others.

Other features/additions:

Sammy1Am commented 9 years ago

I've been super busy (new job, new.. Well a whole new state actually :P ), but these sound pretty handy. I'll take a closer look next time I'm in the code (no promises on when that'll be though).

On Saturday, August 29, 2015, solidsnake745 notifications@github.com wrote:

For my own purposes I needed a way to send certain "events" to connected microcontrollers. This set of changes accomplishes that. Feel free to change up my comments or code. I know many are not fond of my one-liner approach to coding and I understand that completely. I also know I tend to get over descriptive with comments sometimes.

Events added to MoppyReceiver:

  • connecting
  • disconnecting
  • sequenceStarting
  • sequenceStopping

Mainly used for sending specific system byte sequences on MoppyPlayerOutput. This allows me to execute various functions in response to those events. For instance on connecting/disconnecting, I have my microcontroller setup to respond by turning the main power supply for my setup on/off respectively. I've also used sequenceStarting/Stopping for turning an LED on and off to indicate a sequence is being played. On another version of Moppy I'm working on, this is also used to interrupt a standby process when a sequence is to be played.

Event added to InputPanel:

  • shuttingDown

Simple event, all it does for now is cause the currently selected input panel to save preferences before exiting. However it will allow executing of any shutdown tasks that may be needed in the future. I have plans, but I don't want to go into detail about that yet. Still think it could possibly be useful for others.

Other features/additions:

  • Added ability to enable/disable receivers (essentially channels) at the ReceiverMarshaller level
    • I mainly use this for automating my recording process, but I plan on using this for another input panel I'd like to build a little later on
  • Added shutdown hook to close ReceiverMarshaller on application close
    • With the addition of the disconnecting event, this ensure disconnecting is called as the application exists as well as severs the connection between Moppy and the devices

You can view, comment on, or merge this pull request online at:

https://github.com/SammyIAm/Moppy/pull/110 Commit Summary

  • Merge pull request #2 from SammyIAm/moppy-advanced
  • Adding in switch statement for event packets
  • Adding events for connecting, disconnecting, sequence starting, and sequence stopping to MoppyReceivers.
  • Merge origin/moppy-advanced into moppy-advanced

File Changes

Patch Links:

— Reply to this email directly or view it on GitHub https://github.com/SammyIAm/Moppy/pull/110.

solidsnake745 commented 8 years ago

So, I've been using this for a while now. Therefore I am reasonably OK with checking it in without a second opinion. Merging.

Sammy1Am commented 8 years ago

I've been gone far too long. Actually just pulled the floppies of out storage to give a demo at work; this new code seems to work great. :)