OpenMacroBoard / StreamDeckSharp

A simple .NET wrapper for Stream Deck
MIT License
351 stars 47 forks source link

New Device Connected Event #25

Closed owaits closed 3 years ago

owaits commented 3 years ago

I can find events on the device for connected and disconnected and I am able to enumerate all connected devices. However this relies on the stream deck being connected at the point when you first start the software or would require the use of a poll.

Would you consider implementing the HidSharp DeviceList Changed event and filtering this by the Stream Deck vendor ID so there is an easy way to know when a previously unseen Stream Deck is connected.

wischi-chr commented 3 years ago

Because StreamDeck.EnumerateDevices doesn't have an internal state the library doesn't know which devices are "previously unseen". I could add an event that reports every device, the users would have to keep track of "previously unseen" devices themselfs.

wischi-chr commented 3 years ago

I just released a new version of the package (v2.1.0), which has a new static method StreamDeck.CreateDeviceListener().

This method creates an IStreamDeckListener, which tracks stream deck devices and reports connection changes (connect and disconnect) and also provides an event called NewDeviceConnected where only new "previously unseen" devices are reported.

Let me know what you think and please consider giving this project a ⭐ if you like it.

owaits commented 3 years ago

Amazing, thank you for doing this so quickly! I have updated my code to use the new CreateDeviceListener() and it is working how I would have expected. Thank you so much for this and all your efforts with this project!