-
-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from BarRaider/stream-deck-plus-sdk
Stream Deck+ SDK support
- Loading branch information
Showing
27 changed files
with
1,710 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
using BarRaider.SdTools.Payloads; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace BarRaider.SdTools | ||
{ | ||
/// <summary> | ||
/// Main abstract class your plugin should derive from for dials (not keys) | ||
/// For keys use the KeyBase or KeyAndEncoderBase | ||
/// Holds implementation for all the basic functions | ||
/// If you're missing an event, you can register to it from the Connection.StreamDeckConnection object | ||
/// </summary> | ||
public abstract class EncoderBase : IEncoderPlugin | ||
{ | ||
/// <summary> | ||
/// Called when the dial is rotated | ||
/// </summary> | ||
public abstract void DialRotate(DialRotatePayload payload); | ||
|
||
/// <summary> | ||
/// Called when the Dial is pressed or released | ||
/// </summary> | ||
public abstract void DialPress(DialPressPayload payload); | ||
|
||
/// <summary> | ||
/// Called when the touchpad (above the dials) is pressed | ||
/// </summary> | ||
public abstract void TouchPress(TouchpadPressPayload payload); | ||
|
||
/// <summary> | ||
/// Called when the PropertyInspector has new settings | ||
/// </summary> | ||
/// <param name="payload"></param> | ||
public abstract void ReceivedSettings(ReceivedSettingsPayload payload); | ||
|
||
/// <summary> | ||
/// Called when GetGlobalSettings is called. | ||
/// </summary> | ||
/// <param name="payload"></param> | ||
public abstract void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload); | ||
|
||
/// <summary> | ||
/// Called every second | ||
/// Logic for displaying title/image can go here | ||
/// </summary> | ||
public abstract void OnTick(); | ||
|
||
/// <summary> | ||
/// Abstract method Called when the plugin is disposed | ||
/// </summary> | ||
public abstract void Dispose(); | ||
|
||
/// <summary> | ||
/// Main iDisposable Dispose function | ||
/// </summary> | ||
public void Destroy() | ||
{ | ||
Dispose(); | ||
if (Connection != null) | ||
{ | ||
Connection.Dispose(); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Connection object which handles your communication with the Stream Deck app | ||
/// </summary> | ||
protected ISDConnection Connection { get; private set; } | ||
|
||
/// <summary> | ||
/// Constructor for PluginBase. Receives the communication and plugin settings | ||
/// Note that the settings object is not used by the base and should be consumed by the deriving class. | ||
/// Usually, a private class inside the deriving class is created which stores the settings | ||
/// Example for settings usage: | ||
/// * if (payload.Settings == null || payload.Settings.Count == 0) | ||
/// * { | ||
/// * // Create default settings | ||
/// * } | ||
/// * else | ||
/// * { | ||
/// this.settings = payload.Settings.ToObject(); | ||
/// * } | ||
/// | ||
/// </summary> | ||
/// <param name="connection">Communication module with Stream Deck</param> | ||
/// <param name="payload">Plugin settings - NOTE: Not used in base class, should be consumed by deriving class</param> | ||
#pragma warning disable IDE0060 // Remove unused parameter | ||
public EncoderBase(ISDConnection connection, InitialPayload payload) | ||
#pragma warning restore IDE0060 // Remove unused parameter | ||
{ | ||
Connection = connection; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace BarRaider.SdTools | ||
{ | ||
public interface ICommonPluginFunctions : IDisposable | ||
{ | ||
/// <summary> | ||
/// Called when the PropertyInspector has new settings | ||
/// </summary> | ||
/// <param name="payload"></param> | ||
void ReceivedSettings(ReceivedSettingsPayload payload); | ||
|
||
/// <summary> | ||
/// Called when GetGlobalSettings is called. | ||
/// </summary> | ||
/// <param name="payload"></param> | ||
void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload); | ||
|
||
/// <summary> | ||
/// Called every second | ||
/// Logic for displaying title/image can go here | ||
/// </summary> | ||
void OnTick(); | ||
|
||
/// <summary> | ||
/// Internal function used by StreamDeckTools to prevent memory leaks | ||
/// </summary> | ||
void Destroy(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using BarRaider.SdTools.Payloads; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace BarRaider.SdTools | ||
{ | ||
/// <summary> | ||
/// Interface used to capture dial/encoder events | ||
/// </summary> | ||
public interface IEncoderPlugin : ICommonPluginFunctions | ||
{ | ||
/// <summary> | ||
/// Called when the dial is rotated | ||
/// </summary> | ||
void DialRotate(DialRotatePayload payload); | ||
|
||
/// <summary> | ||
/// Called when the Dial is pressed or released | ||
/// </summary> | ||
void DialPress(DialPressPayload payload); | ||
|
||
/// <summary> | ||
/// Called when the touchpad (above the dials) is pressed | ||
/// </summary> | ||
void TouchPress(TouchpadPressPayload payload); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace BarRaider.SdTools | ||
{ | ||
/// <summary> | ||
/// Interface used to capture key events | ||
/// </summary> | ||
public interface IKeypadPlugin : ICommonPluginFunctions | ||
{ | ||
void KeyPressed(KeyPayload payload); | ||
|
||
/// <summary> | ||
/// Called when a Stream Deck key is released | ||
/// </summary> | ||
void KeyReleased(KeyPayload payload); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using BarRaider.SdTools.Payloads; | ||
using Newtonsoft.Json.Linq; | ||
|
||
namespace BarRaider.SdTools | ||
{ | ||
|
||
/// <summary> | ||
/// Main abstract class your plugin should derive from for keys (not dials) | ||
/// For dials use the EncoderBase or KeyAndEncoderBase | ||
/// Holds implementation for all the basic functions | ||
/// If you're missing an event, you can register to it from the Connection.StreamDeckConnection object | ||
/// </summary> | ||
public abstract class KeyAndEncoderBase : IKeypadPlugin, IEncoderPlugin | ||
{ | ||
/// <summary> | ||
/// Called when the dial is rotated | ||
/// </summary> | ||
public abstract void DialRotate(DialRotatePayload payload); | ||
|
||
/// <summary> | ||
/// Called when the Dial is pressed or released | ||
/// </summary> | ||
public abstract void DialPress(DialPressPayload payload); | ||
|
||
/// <summary> | ||
/// Called when the touchpad (above the dials) is pressed | ||
/// </summary> | ||
public abstract void TouchPress(TouchpadPressPayload payload); | ||
|
||
/// <summary> | ||
/// Called when a Stream Deck key is pressed | ||
/// </summary> | ||
public abstract void KeyPressed(KeyPayload payload); | ||
|
||
/// <summary> | ||
/// Called when a Stream Deck key is released | ||
/// </summary> | ||
public abstract void KeyReleased(KeyPayload payload); | ||
|
||
/// <summary> | ||
/// Called when the PropertyInspector has new settings | ||
/// </summary> | ||
/// <param name="payload"></param> | ||
public abstract void ReceivedSettings(ReceivedSettingsPayload payload); | ||
|
||
/// <summary> | ||
/// Called when GetGlobalSettings is called. | ||
/// </summary> | ||
/// <param name="payload"></param> | ||
public abstract void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload); | ||
|
||
/// <summary> | ||
/// Called every second | ||
/// Logic for displaying title/image can go here | ||
/// </summary> | ||
public abstract void OnTick(); | ||
|
||
/// <summary> | ||
/// Abstract method Called when the plugin is disposed | ||
/// </summary> | ||
public abstract void Dispose(); | ||
|
||
/// <summary> | ||
/// Main iDisposable Dispose function | ||
/// </summary> | ||
public void Destroy() | ||
{ | ||
Dispose(); | ||
if (Connection != null) | ||
{ | ||
Connection.Dispose(); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Connection object which handles your communication with the Stream Deck app | ||
/// </summary> | ||
protected ISDConnection Connection { get; private set; } | ||
|
||
/// <summary> | ||
/// Constructor for PluginBase. Receives the communication and plugin settings | ||
/// Note that the settings object is not used by the base and should be consumed by the deriving class. | ||
/// Usually, a private class inside the deriving class is created which stores the settings | ||
/// Example for settings usage: | ||
/// * if (payload.Settings == null || payload.Settings.Count == 0) | ||
/// * { | ||
/// * // Create default settings | ||
/// * } | ||
/// * else | ||
/// * { | ||
/// this.settings = payload.Settings.ToObject(); | ||
/// * } | ||
/// | ||
/// </summary> | ||
/// <param name="connection">Communication module with Stream Deck</param> | ||
/// <param name="payload">Plugin settings - NOTE: Not used in base class, should be consumed by deriving class</param> | ||
#pragma warning disable IDE0060 // Remove unused parameter | ||
public KeyAndEncoderBase(ISDConnection connection, InitialPayload payload) | ||
#pragma warning restore IDE0060 // Remove unused parameter | ||
{ | ||
Connection = connection; | ||
} | ||
} | ||
} |
Oops, something went wrong.