StreamDeckSharp/OpenMacroBoard.SDK/IMacroBoard.cs
2026-08-03 22:34:16 +02:00

141 lines
4.5 KiB
C#

using System;
namespace OpenMacroBoard.SDK {
/// <summary>
/// An interface that allows you to interact with (LCD) macro boards
/// </summary>
public interface IMacroBoard : IDisposable {
// <summary>
// Is raised when a key is pressed
// </summary>
//event EventHandler<KeyEventArgs> KeyStateChanged;
/// <summary>
/// Is raised when the MarcoBoard is being disconnected or connected
/// </summary>
event EventHandler<ConnectionEventArgs> ConnectionStateChanged;
/// <summary>
/// Is raised when a key is pressed
/// </summary>
event EventHandler<KeyPressEvent> ButtonPressed;
/// <summary>
/// Is raised when a key is released
/// </summary>
event EventHandler<KeyPressEvent> ButtonReleased;
/// <summary>
/// Is raised when the Touchbar is tapped
/// </summary>
event EventHandler<TouchTipEvent> TouchbarTouched;
/// <summary>
/// Is raised when the Touchbar is pressed (long tap)
/// </summary>
event EventHandler<TouchTipEvent> TouchbarPressed;
/// <summary>
/// Is raised when the finger is fliped over the Touchbar
/// </summary>
event EventHandler<TouchFlipEvent> TouchFlipEvent;
/// <summary>
/// Is raised when a Rotary Encoder is pressed
/// </summary>
event EventHandler<KnobPressEvent> EncoderPressed;
/// <summary>
/// Is raised when a Rotary Encoder is released
/// </summary>
event EventHandler<KnobPressEvent> EncoderReleased;
/// <summary>
/// Is raised when a Rotary Encoder is turned
/// </summary>
event EventHandler<KnobTurnEvent> EncoderTurn;
/// <summary>
/// Informations about the keys and their position
/// </summary>
IKeyLayout Keys {
get;
}
/// <summary>
/// Gets a value indicating whether the MarcoBoard is connected.
/// </summary>
Boolean IsConnected {
get;
}
/// <summary>
/// Sets the brightness for this <see cref="IMacroBoard"/>
/// </summary>
/// <param name="percent">Brightness in percent (0 - 100)</param>
/// <remarks>
/// <para>
/// The brightness on the device is controlled with PWM (https://en.wikipedia.org/wiki/Pulse-width_modulation).
/// This results in a non-linear correlation between set percentage and perceived brightness.
/// </para>
/// <para>
/// In a nutshell: changing from 10 - 30 results in a bigger change than 80 - 100 (barely visible change)
/// This effect should be compensated outside this library
/// </para>
/// </remarks>
void SetBrightness(Byte percent);
/// <summary>
/// Uploads an image for a specific button.
/// </summary>
/// <param name="keyId">Specifies which key the image will be applied on</param>
/// <param name="bitmapData">Bitmap. The key will be painted black if this value is null.</param>
void SetButtonImage(Int32 keyId, KeyBitmap bitmapData);
/// <summary>
/// Uploads an image for the complete LCD.
/// </summary>
/// <param name="bitmapData">Bitmap. The key will be painted black if this value is null.</param>
void SetFullScreenImage(KeyBitmap bitmapData);
/// <summary>
/// Uploads a full image for the touchscreen window strip.
/// </summary>
/// <param name="bitmapData">Bitmap. The key will be painted black if this value is null.</param>
void SetWindowImage(KeyBitmap bitmapData);
/// <summary>
/// Uploads an image into a rectangular region of the touchscreen window.
/// </summary>
/// <param name="x_pos">X-coordinate</param>
/// <param name="y_pos">Y-coordinate</param>
/// <param name="width">Image width</param>
/// <param name="heigt">Image height</param>
/// <param name="bitmapData">Bitmap. The key will be painted black if this value is null.</param>
void SetPartialWindowImage(Int32 x_pos, Int32 y_pos, KeyBitmap bitmapData);
/// <summary>
/// Shows the standby logo (full-screen)
/// </summary>
void ShowLogo();
/// <summary>
/// Gets the firmware version.
/// </summary>
/// <returns>
/// Returns the firmware version
/// or <see cref="String.Empty"/> if the device doesn't have a firmware.
/// </returns>
String GetFirmwareVersion();
/// <summary>
/// Gets the serial number.
/// </summary>
/// <returns>
/// Returns the serial number
/// or <see cref="String.Empty"/> if the device doesn't have a serial number.
/// </returns>
String GetSerialNumber();
}
}