chore: move all files to file-scoped namespace

This commit is contained in:
Andrew Welker 2025-07-04 16:02:32 -05:00 committed by Neil Dorin
parent aaa5b0532b
commit 3ece4f0b7b
522 changed files with 39628 additions and 45678 deletions

View file

@ -1,149 +1,90 @@
using Newtonsoft.Json;
namespace PepperDash.Essentials.Core
namespace PepperDash.Essentials.Core;
public class CrestronTouchpanelPropertiesConfig
{
/// <summary>
/// Represents a CrestronTouchpanelPropertiesConfig
/// </summary>
public class CrestronTouchpanelPropertiesConfig
{
/// <summary>
/// Gets or sets the ControlProperties
/// </summary>
[JsonProperty("control")]
public EssentialsControlPropertiesConfig ControlProperties { get; set; }
[JsonProperty("control")]
public EssentialsControlPropertiesConfig ControlProperties { get; set; }
/// <summary>
/// Gets or sets the IpId
/// </summary>
[JsonProperty("ipId", NullValueHandling = NullValueHandling.Ignore)]
public string IpId { get; set; }
[JsonProperty("ipId", NullValueHandling = NullValueHandling.Ignore)]
public string IpId { get; set; }
/// <summary>
/// Gets or sets the DefaultRoomKey
/// </summary>
[JsonProperty("defaultRoomKey", NullValueHandling = NullValueHandling.Ignore)]
public string DefaultRoomKey { get; set; }
/// <summary>
/// Gets or sets the RoomListKey
/// </summary>
[JsonProperty("roomListKey", NullValueHandling = NullValueHandling.Ignore)]
public string RoomListKey { get; set; }
[JsonProperty("defaultRoomKey", NullValueHandling = NullValueHandling.Ignore)]
public string DefaultRoomKey { get; set; }
[JsonProperty("roomListKey", NullValueHandling = NullValueHandling.Ignore)]
public string RoomListKey { get; set; }
/// <summary>
/// Gets or sets the SgdFile
/// </summary>
[JsonProperty("sgdFile", NullValueHandling = NullValueHandling.Ignore)]
public string SgdFile { get; set; }
[JsonProperty("sgdFile", NullValueHandling = NullValueHandling.Ignore)]
public string SgdFile { get; set; }
/// <summary>
/// Gets or sets the ProjectName
/// </summary>
[JsonProperty("projectName", NullValueHandling = NullValueHandling.Ignore)]
public string ProjectName { get; set; }
[JsonProperty("projectName", NullValueHandling = NullValueHandling.Ignore)]
public string ProjectName { get; set; }
/// <summary>
/// Gets or sets the ShowVolumeGauge
/// </summary>
[JsonProperty("showVolumeGauge", NullValueHandling = NullValueHandling.Ignore)]
public bool? ShowVolumeGauge { get; set; }
[JsonProperty("showVolumeGauge", NullValueHandling = NullValueHandling.Ignore)]
public bool? ShowVolumeGauge { get; set; }
/// <summary>
/// Gets or sets the UsesSplashPage
/// </summary>
[JsonProperty("usesSplashPage", NullValueHandling = NullValueHandling.Ignore)]
public bool? UsesSplashPage { get; set; }
[JsonProperty("usesSplashPage", NullValueHandling = NullValueHandling.Ignore)]
public bool? UsesSplashPage { get; set; }
/// <summary>
/// Gets or sets the ShowDate
/// </summary>
[JsonProperty("showDate", NullValueHandling = NullValueHandling.Ignore)]
public bool? ShowDate { get; set; }
[JsonProperty("showDate", NullValueHandling = NullValueHandling.Ignore)]
public bool? ShowDate { get; set; }
/// <summary>
/// Gets or sets the ShowTime
/// </summary>
[JsonProperty("showTime", NullValueHandling = NullValueHandling.Ignore)]
public bool? ShowTime { get; set; }
[JsonProperty("showTime", NullValueHandling = NullValueHandling.Ignore)]
public bool? ShowTime { get; set; }
/// <summary>
/// Gets or sets the Setup
/// </summary>
[JsonProperty("setup", NullValueHandling = NullValueHandling.Ignore)]
public UiSetupPropertiesConfig Setup { get; set; }
[JsonProperty("setup", NullValueHandling = NullValueHandling.Ignore)]
public UiSetupPropertiesConfig Setup { get; set; }
/// <summary>
/// Gets or sets the HeaderStyle
/// </summary>
[JsonProperty("headerStyle", NullValueHandling = NullValueHandling.Ignore)]
public string HeaderStyle { get; set; }
[JsonProperty("headerStyle", NullValueHandling = NullValueHandling.Ignore)]
public string HeaderStyle { get; set; }
/// <summary>
/// Gets or sets the IncludeInFusionRoomHealth
/// </summary>
[JsonProperty("includeInFusionRoomHealth", NullValueHandling = NullValueHandling.Ignore)]
public bool? IncludeInFusionRoomHealth { get; set; }
[JsonProperty("includeInFusionRoomHealth", NullValueHandling = NullValueHandling.Ignore)]
public bool? IncludeInFusionRoomHealth { get; set; }
/// <summary>
/// Gets or sets the ScreenSaverTimeoutMin
/// </summary>
[JsonProperty("screenSaverTimeoutMin", NullValueHandling = NullValueHandling.Ignore)]
public uint? ScreenSaverTimeoutMin { get; set; }
[JsonProperty("screenSaverTimeoutMin", NullValueHandling = NullValueHandling.Ignore)]
public uint? ScreenSaverTimeoutMin { get; set; }
/// <summary>
/// Gets or sets the ScreenSaverMovePositionIntervalMs
/// </summary>
[JsonProperty("screenSaverMovePositionIntervalMs", NullValueHandling = NullValueHandling.Ignore)]
public uint? ScreenSaverMovePositionIntervalMs { get; set; }
[JsonProperty("screenSaverMovePositionIntervalMs", NullValueHandling = NullValueHandling.Ignore)]
public uint? ScreenSaverMovePositionIntervalMs { get; set; }
/// <summary>
/// The count of sources that will trigger the "additional" arrows to show on the SRL.
/// Defaults to 5
/// </summary>
[JsonProperty("sourcesOverflowCount", NullValueHandling = NullValueHandling.Ignore)]
public int? SourcesOverflowCount { get; set; }
/// <summary>
/// Constructor
/// </summary>
public CrestronTouchpanelPropertiesConfig() : this(false) { }
/// <summary>
/// Constructor
/// </summary>
/// <param name="setDefaultValues">set values to default if true</param>
public CrestronTouchpanelPropertiesConfig(bool setDefaultValues = false)
{
if(!setDefaultValues) { return; }
SourcesOverflowCount = 5;
HeaderStyle = Habanero;
// Default values
ScreenSaverTimeoutMin = 5;
ScreenSaverMovePositionIntervalMs = 15000;
}
/// <summary>
/// "habanero"
/// </summary>
public const string Habanero = "habanero";
/// <summary>
/// "verbose"
/// </summary>
public const string Verbose = "verbose";
}
/// <summary>
/// Represents a UiSetupPropertiesConfig
/// The count of sources that will trigger the "additional" arrows to show on the SRL.
/// Defaults to 5
/// </summary>
public class UiSetupPropertiesConfig
[JsonProperty("sourcesOverflowCount", NullValueHandling = NullValueHandling.Ignore)]
public int? SourcesOverflowCount { get; set; }
public CrestronTouchpanelPropertiesConfig() : this(false) { }
public CrestronTouchpanelPropertiesConfig(bool setDefaultValues = false)
{
/// <summary>
/// Gets or sets the IsVisible
/// </summary>
[JsonProperty("isVisible", NullValueHandling = NullValueHandling.Ignore)]
public bool IsVisible { get; set; }
}
if(!setDefaultValues) { return; }
SourcesOverflowCount = 5;
HeaderStyle = Habanero;
// Default values
ScreenSaverTimeoutMin = 5;
ScreenSaverMovePositionIntervalMs = 15000;
}
/// <summary>
/// "habanero"
/// </summary>
public const string Habanero = "habanero";
/// <summary>
/// "verbose"
/// </summary>
public const string Verbose = "verbose";
}
/// <summary>
///
/// </summary>
public class UiSetupPropertiesConfig
{
[JsonProperty("isVisible", NullValueHandling = NullValueHandling.Ignore)]
public bool IsVisible { get; set; }
}

View file

@ -1,20 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DeviceSupport;
namespace PepperDash.Essentials.Core
namespace PepperDash.Essentials.Core;
/// <summary>
/// Defines the contract for IHasBasicTriListWithSmartObject
/// </summary>
public interface IHasBasicTriListWithSmartObject
{
/// <summary>
/// Defines the contract for IHasBasicTriListWithSmartObject
/// Gets the Panel
/// </summary>
public interface IHasBasicTriListWithSmartObject
{
/// <summary>
/// Gets the Panel
/// </summary>
BasicTriListWithSmartObject Panel { get; }
}
}
BasicTriListWithSmartObject Panel { get; }
}

View file

@ -1,247 +1,209 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
namespace PepperDash.Essentials.Core.Touchpanels.Keyboards
namespace PepperDash.Essentials.Core.Touchpanels.Keyboards;
public class HabaneroKeyboardController
{
/// <summary>
/// Represents a HabaneroKeyboardController
/// Single-key press events, rather than using a built-up text string on the OutputFeedback
/// </summary>
public class HabaneroKeyboardController
{
/// <summary>
/// Single-key press events, rather than using a built-up text string on the OutputFeedback
/// </summary>
public event EventHandler<KeyboardControllerPressEventArgs> KeyPress;
public event EventHandler<KeyboardControllerPressEventArgs> KeyPress;
/// <summary>
/// Gets or sets the TriList
/// </summary>
public BasicTriList TriList { get; private set; }
public BasicTriList TriList { get; private set; }
/// <summary>
/// Gets or sets the OutputFeedback
/// </summary>
public StringFeedback OutputFeedback { get; private set; }
public StringFeedback OutputFeedback { get; private set; }
/// <summary>
/// Gets or sets the IsVisible
/// </summary>
public bool IsVisible { get; private set; }
public bool IsVisible { get; private set; }
/// <summary>
/// Gets or sets the DotComButtonString
/// </summary>
public string DotComButtonString { get; set; }
public string DotComButtonString { get; set; }
/// <summary>
/// Gets or sets the GoButtonText
/// </summary>
public string GoButtonText { get; set; }
public string GoButtonText { get; set; }
/// <summary>
/// Gets or sets the SecondaryButtonText
/// </summary>
public string SecondaryButtonText { get; set; }
public string SecondaryButtonText { get; set; }
/// <summary>
/// Gets or sets the GoButtonVisible
/// </summary>
public bool GoButtonVisible { get; set; }
public bool GoButtonVisible { get; set; }
/// <summary>
/// Gets or sets the SecondaryButtonVisible
/// </summary>
public bool SecondaryButtonVisible { get; set; }
public bool SecondaryButtonVisible { get; set; }
int ShiftMode = 0;
StringBuilder Output;
int ShiftMode = 0;
StringBuilder Output;
/// <summary>
/// Gets or sets the HideAction
/// </summary>
public Action HideAction { get; set; }
public Action HideAction { get; set; }
CTimer BackspaceTimer;
/// <summary>
///
/// </summary>
/// <param name="trilist"></param>
public HabaneroKeyboardController(BasicTriList trilist)
{
TriList = trilist;
Output = new StringBuilder();
OutputFeedback = new StringFeedback(() => Output.ToString());
DotComButtonString = ".com";
}
/// <summary>
///
/// </summary>
/// <param name="trilist"></param>
public HabaneroKeyboardController(BasicTriList trilist)
{
TriList = trilist;
Output = new StringBuilder();
OutputFeedback = new StringFeedback(() => Output.ToString());
DotComButtonString = ".com";
}
/// <summary>
/// Show method
/// </summary>
public void Show()
{
if (IsVisible)
return;
/// <summary>
/// Shows the keyboard and attaches sig handlers in the range of 2901-2969
/// </summary>
public void Show()
{
if (IsVisible)
return;
TriList.SetSigTrueAction(ClosePressJoin, Hide);
TriList.SetSigTrueAction(GoButtonPressJoin, () => OnKeyPress(KeyboardSpecialKey.GoButton));
TriList.SetSigTrueAction(SecondaryButtonPressJoin, () => OnKeyPress(KeyboardSpecialKey.SecondaryButton));
TriList.SetSigTrueAction(2921, () => Press(A(ShiftMode)));
TriList.SetSigTrueAction(2922, () => Press(B(ShiftMode)));
TriList.SetSigTrueAction(2923, () => Press(C(ShiftMode)));
TriList.SetSigTrueAction(2924, () => Press(D(ShiftMode)));
TriList.SetSigTrueAction(2925, () => Press(E(ShiftMode)));
TriList.SetSigTrueAction(2926, () => Press(F(ShiftMode)));
TriList.SetSigTrueAction(2927, () => Press(G(ShiftMode)));
TriList.SetSigTrueAction(2928, () => Press(H(ShiftMode)));
TriList.SetSigTrueAction(2929, () => Press(I(ShiftMode)));
TriList.SetSigTrueAction(2930, () => Press(J(ShiftMode)));
TriList.SetSigTrueAction(2931, () => Press(K(ShiftMode)));
TriList.SetSigTrueAction(2932, () => Press(L(ShiftMode)));
TriList.SetSigTrueAction(2933, () => Press(M(ShiftMode)));
TriList.SetSigTrueAction(2934, () => Press(N(ShiftMode)));
TriList.SetSigTrueAction(2935, () => Press(O(ShiftMode)));
TriList.SetSigTrueAction(2936, () => Press(P(ShiftMode)));
TriList.SetSigTrueAction(2937, () => Press(Q(ShiftMode)));
TriList.SetSigTrueAction(2938, () => Press(R(ShiftMode)));
TriList.SetSigTrueAction(2939, () => Press(S(ShiftMode)));
TriList.SetSigTrueAction(2940, () => Press(T(ShiftMode)));
TriList.SetSigTrueAction(2941, () => Press(U(ShiftMode)));
TriList.SetSigTrueAction(2942, () => Press(V(ShiftMode)));
TriList.SetSigTrueAction(2943, () => Press(W(ShiftMode)));
TriList.SetSigTrueAction(2944, () => Press(X(ShiftMode)));
TriList.SetSigTrueAction(2945, () => Press(Y(ShiftMode)));
TriList.SetSigTrueAction(2946, () => Press(Z(ShiftMode)));
TriList.SetSigTrueAction(2947, () => Press('.'));
TriList.SetSigTrueAction(2948, () => Press('@'));
TriList.SetSigTrueAction(2949, () => Press(' '));
TriList.SetSigTrueAction(ClosePressJoin, Hide);
TriList.SetSigTrueAction(GoButtonPressJoin, () => OnKeyPress(KeyboardSpecialKey.GoButton));
TriList.SetSigTrueAction(SecondaryButtonPressJoin, () => OnKeyPress(KeyboardSpecialKey.SecondaryButton));
TriList.SetSigTrueAction(2921, () => Press(A(ShiftMode)));
TriList.SetSigTrueAction(2922, () => Press(B(ShiftMode)));
TriList.SetSigTrueAction(2923, () => Press(C(ShiftMode)));
TriList.SetSigTrueAction(2924, () => Press(D(ShiftMode)));
TriList.SetSigTrueAction(2925, () => Press(E(ShiftMode)));
TriList.SetSigTrueAction(2926, () => Press(F(ShiftMode)));
TriList.SetSigTrueAction(2927, () => Press(G(ShiftMode)));
TriList.SetSigTrueAction(2928, () => Press(H(ShiftMode)));
TriList.SetSigTrueAction(2929, () => Press(I(ShiftMode)));
TriList.SetSigTrueAction(2930, () => Press(J(ShiftMode)));
TriList.SetSigTrueAction(2931, () => Press(K(ShiftMode)));
TriList.SetSigTrueAction(2932, () => Press(L(ShiftMode)));
TriList.SetSigTrueAction(2933, () => Press(M(ShiftMode)));
TriList.SetSigTrueAction(2934, () => Press(N(ShiftMode)));
TriList.SetSigTrueAction(2935, () => Press(O(ShiftMode)));
TriList.SetSigTrueAction(2936, () => Press(P(ShiftMode)));
TriList.SetSigTrueAction(2937, () => Press(Q(ShiftMode)));
TriList.SetSigTrueAction(2938, () => Press(R(ShiftMode)));
TriList.SetSigTrueAction(2939, () => Press(S(ShiftMode)));
TriList.SetSigTrueAction(2940, () => Press(T(ShiftMode)));
TriList.SetSigTrueAction(2941, () => Press(U(ShiftMode)));
TriList.SetSigTrueAction(2942, () => Press(V(ShiftMode)));
TriList.SetSigTrueAction(2943, () => Press(W(ShiftMode)));
TriList.SetSigTrueAction(2944, () => Press(X(ShiftMode)));
TriList.SetSigTrueAction(2945, () => Press(Y(ShiftMode)));
TriList.SetSigTrueAction(2946, () => Press(Z(ShiftMode)));
TriList.SetSigTrueAction(2947, () => Press('.'));
TriList.SetSigTrueAction(2948, () => Press('@'));
TriList.SetSigTrueAction(2949, () => Press(' '));
TriList.SetSigHeldAction(2950, 500, StartBackspaceRepeat, StopBackspaceRepeat, Backspace);
//TriList.SetSigTrueAction(2950, Backspace);
TriList.SetSigTrueAction(2951, Shift);
TriList.SetSigTrueAction(2952, NumShift);
TriList.SetSigTrueAction(2953, Clear);
TriList.SetSigTrueAction(2954, () => Press(DotComButtonString));
TriList.SetSigTrueAction(2951, Shift);
TriList.SetSigTrueAction(2952, NumShift);
TriList.SetSigTrueAction(2953, Clear);
TriList.SetSigTrueAction(2954, () => Press(DotComButtonString));
TriList.SetBool(GoButtonVisibleJoin, GoButtonVisible);
TriList.SetString(GoButtonTextJoin, GoButtonText);
TriList.SetBool(SecondaryButtonVisibleJoin, SecondaryButtonVisible);
TriList.SetString(SecondaryButtonTextJoin, SecondaryButtonText);
TriList.SetBool(GoButtonVisibleJoin, GoButtonVisible);
TriList.SetString(GoButtonTextJoin, GoButtonText);
TriList.SetBool(SecondaryButtonVisibleJoin, SecondaryButtonVisible);
TriList.SetString(SecondaryButtonTextJoin, SecondaryButtonText);
TriList.SetBool(KeyboardVisible, true);
TriList.SetBool(KeyboardVisible, true);
ShowKeys();
IsVisible = true;
}
/// <summary>
/// Hides the keyboard and disconnects ALL sig handlers from 2901 - 2969
/// </summary>
public void Hide()
{
if (!IsVisible)
return;
for (uint i = 2901; i < 2970; i++)
TriList.ClearBoolSigAction(i);
// run attached actions
if(HideAction != null)
HideAction();
TriList.SetBool(KeyboardVisible, false);
IsVisible = false;
}
/// <summary>
///
/// </summary>
/// <param name="c"></param>
public void Press(char c)
{
OnKeyPress(c.ToString());
Output.Append(c);
OutputFeedback.FireUpdate();
ResetShift();
}
/// <summary>
///
/// </summary>
/// <param name="s"></param>
public void Press(string s)
{
OnKeyPress(s);
Output.Append(s);
OutputFeedback.FireUpdate();
ResetShift();
}
/// <summary>
///
/// </summary>
public void EnableGoButton()
{
TriList.SetBool(GoButtonEnableJoin, true);
}
/// <summary>
///
/// </summary>
public void DisableGoButton()
{
TriList.SetBool(GoButtonEnableJoin, false);
}
void ResetShift()
{
if (ShiftMode == 1)
{
ShiftMode = 0;
ShowKeys();
IsVisible = true;
}
/// <summary>
/// Hide method
/// </summary>
public void Hide()
else if (ShiftMode == 3)
{
if (!IsVisible)
return;
for (uint i = 2901; i < 2970; i++)
TriList.ClearBoolSigAction(i);
// run attached actions
if(HideAction != null)
HideAction();
TriList.SetBool(KeyboardVisible, false);
IsVisible = false;
ShiftMode = 2;
ShowKeys();
}
}
/// <summary>
///
/// </summary>
/// <param name="c"></param>
/// <summary>
/// Press method
/// </summary>
public void Press(char c)
{
OnKeyPress(c.ToString());
Output.Append(c);
OutputFeedback.FireUpdate();
ResetShift();
}
/// <summary>
///
/// </summary>
/// <param name="s"></param>
/// <summary>
/// Press method
/// </summary>
public void Press(string s)
{
OnKeyPress(s);
Output.Append(s);
OutputFeedback.FireUpdate();
ResetShift();
}
/// <summary>
/// EnableGoButton method
/// </summary>
public void EnableGoButton()
{
TriList.SetBool(GoButtonEnableJoin, true);
}
/// <summary>
///
/// </summary>
public void DisableGoButton()
{
TriList.SetBool(GoButtonEnableJoin, false);
}
void ResetShift()
{
if (ShiftMode == 1)
{
ShiftMode = 0;
ShowKeys();
}
else if (ShiftMode == 3)
{
ShiftMode = 2;
ShowKeys();
}
}
char A(int i) { return new char[] { 'a', 'A', '?', '?' }[i]; }
char B(int i) { return new char[] { 'b', 'B', ':', ':' }[i]; }
char C(int i) { return new char[] { 'c', 'C', '>', '>' }[i]; }
char D(int i) { return new char[] { 'd', 'D', '_', '_' }[i]; }
char E(int i) { return new char[] { 'e', 'E', '3', '#' }[i]; }
char F(int i) { return new char[] { 'f', 'F', '=', '=' }[i]; }
char G(int i) { return new char[] { 'g', 'G', '+', '+' }[i]; }
char H(int i) { return new char[] { 'h', 'H', '[', '[' }[i]; }
char I(int i) { return new char[] { 'i', 'I', '8', '*' }[i]; }
char J(int i) { return new char[] { 'j', 'J', ']', ']' }[i]; }
char K(int i) { return new char[] { 'k', 'K', '/', '/' }[i]; }
char L(int i) { return new char[] { 'l', 'L', '\\', '\\' }[i]; }
char M(int i) { return new char[] { 'm', 'M', '"', '"' }[i]; }
char N(int i) { return new char[] { 'n', 'N', '\'', '\'' }[i]; }
char O(int i) { return new char[] { 'o', 'O', '9', '(' }[i]; }
char P(int i) { return new char[] { 'p', 'P', '0', ')' }[i]; }
char Q(int i) { return new char[] { 'q', 'Q', '1', '!' }[i]; }
char R(int i) { return new char[] { 'r', 'R', '4', '$' }[i]; }
char S(int i) { return new char[] { 's', 'S', '-', '-' }[i]; }
char T(int i) { return new char[] { 't', 'T', '5', '%' }[i]; }
char U(int i) { return new char[] { 'u', 'U', '7', '&' }[i]; }
char V(int i) { return new char[] { 'v', 'V', ';', ';' }[i]; }
char W(int i) { return new char[] { 'w', 'W', '2', '@' }[i]; }
char X(int i) { return new char[] { 'x', 'X', '<', '<' }[i]; }
char Y(int i) { return new char[] { 'y', 'Y', '6', '^' }[i]; }
char Z(int i) { return new char[] { 'z', 'Z', ',', ',' }[i]; }
char A(int i) { return new char[] { 'a', 'A', '?', '?' }[i]; }
char B(int i) { return new char[] { 'b', 'B', ':', ':' }[i]; }
char C(int i) { return new char[] { 'c', 'C', '>', '>' }[i]; }
char D(int i) { return new char[] { 'd', 'D', '_', '_' }[i]; }
char E(int i) { return new char[] { 'e', 'E', '3', '#' }[i]; }
char F(int i) { return new char[] { 'f', 'F', '=', '=' }[i]; }
char G(int i) { return new char[] { 'g', 'G', '+', '+' }[i]; }
char H(int i) { return new char[] { 'h', 'H', '[', '[' }[i]; }
char I(int i) { return new char[] { 'i', 'I', '8', '*' }[i]; }
char J(int i) { return new char[] { 'j', 'J', ']', ']' }[i]; }
char K(int i) { return new char[] { 'k', 'K', '/', '/' }[i]; }
char L(int i) { return new char[] { 'l', 'L', '\\', '\\' }[i]; }
char M(int i) { return new char[] { 'm', 'M', '"', '"' }[i]; }
char N(int i) { return new char[] { 'n', 'N', '\'', '\'' }[i]; }
char O(int i) { return new char[] { 'o', 'O', '9', '(' }[i]; }
char P(int i) { return new char[] { 'p', 'P', '0', ')' }[i]; }
char Q(int i) { return new char[] { 'q', 'Q', '1', '!' }[i]; }
char R(int i) { return new char[] { 'r', 'R', '4', '$' }[i]; }
char S(int i) { return new char[] { 's', 'S', '-', '-' }[i]; }
char T(int i) { return new char[] { 't', 'T', '5', '%' }[i]; }
char U(int i) { return new char[] { 'u', 'U', '7', '&' }[i]; }
char V(int i) { return new char[] { 'v', 'V', ';', ';' }[i]; }
char W(int i) { return new char[] { 'w', 'W', '2', '@' }[i]; }
char X(int i) { return new char[] { 'x', 'X', '<', '<' }[i]; }
char Y(int i) { return new char[] { 'y', 'Y', '6', '^' }[i]; }
char Z(int i) { return new char[] { 'z', 'Z', ',', ',' }[i]; }
/// <summary>
/// Does what it says
@ -266,248 +228,206 @@ namespace PepperDash.Essentials.Core.Touchpanels.Keyboards
}
}
void Backspace()
void Backspace()
{
OnKeyPress(KeyboardSpecialKey.Backspace);
if (Output.Length > 0)
{
OnKeyPress(KeyboardSpecialKey.Backspace);
if (Output.Length > 0)
{
Output.Remove(Output.Length - 1, 1);
OutputFeedback.FireUpdate();
}
}
void Clear()
{
OnKeyPress(KeyboardSpecialKey.Clear);
Output.Remove(0, Output.Length);
Output.Remove(Output.Length - 1, 1);
OutputFeedback.FireUpdate();
}
}
/* When in mode 0 (lowercase):
* shift button: up arrow 0
* numShift button: 123/#$@#$ 0
*
* - shift --> mode 1
* - double-tap shift --> caps lock
* - numShift --> mode 2
*
* mode 1 (uppercase)
* shift button: down arrow 1
* numShift button: 123/##$# 0
*
* - shift --> mode 0
* - numShift --> mode 2
*
* - Tapping any key will go back to mode 0
*
* mode 2 (numbers-sym)
* Shift button: #$#$#$ 2
* numShift: ABC 1
*
* - shift --> mode 3
* - double-tap shift --> caps lock
* - numShift --> mode 0
*
* mode 3 (sym)
* Shift button: 123 3
* numShift: ABC 1
*
* - shift --> mode 2
* - numShift --> mode 0
*
* - Tapping any key will go back to mode 2
*/
void Shift()
{
if (ShiftMode == 0)
ShiftMode = 1;
else if (ShiftMode == 1)
ShiftMode = 0;
else if (ShiftMode == 2)
ShiftMode = 3;
else
ShiftMode = 2;
void Clear()
{
OnKeyPress(KeyboardSpecialKey.Clear);
ShowKeys();
}
Output.Remove(0, Output.Length);
OutputFeedback.FireUpdate();
}
void NumShift()
{
if (ShiftMode == 0 || ShiftMode == 1)
ShiftMode = 2;
else if (ShiftMode == 2 || ShiftMode == 3)
ShiftMode = 0;
ShowKeys();
}
/* When in mode 0 (lowercase):
* shift button: up arrow 0
* numShift button: 123/#$@#$ 0
*
* - shift --> mode 1
* - double-tap shift --> caps lock
* - numShift --> mode 2
*
* mode 1 (uppercase)
* shift button: down arrow 1
* numShift button: 123/##$# 0
*
* - shift --> mode 0
* - numShift --> mode 2
*
* - Tapping any key will go back to mode 0
*
* mode 2 (numbers-sym)
* Shift button: #$#$#$ 2
* numShift: ABC 1
*
* - shift --> mode 3
* - double-tap shift --> caps lock
* - numShift --> mode 0
*
* mode 3 (sym)
* Shift button: 123 3
* numShift: ABC 1
*
* - shift --> mode 2
* - numShift --> mode 0
*
* - Tapping any key will go back to mode 2
*/
void Shift()
{
if (ShiftMode == 0)
ShiftMode = 1;
else if (ShiftMode == 1)
ShiftMode = 0;
else if (ShiftMode == 2)
ShiftMode = 3;
else
ShiftMode = 2;
void ShowKeys()
{
TriList.SetString(2921, A(ShiftMode).ToString());
TriList.SetString(2922, B(ShiftMode).ToString());
TriList.SetString(2923, C(ShiftMode).ToString());
TriList.SetString(2924, D(ShiftMode).ToString());
TriList.SetString(2925, E(ShiftMode).ToString());
TriList.SetString(2926, F(ShiftMode).ToString());
TriList.SetString(2927, G(ShiftMode).ToString());
TriList.SetString(2928, H(ShiftMode).ToString());
TriList.SetString(2929, I(ShiftMode).ToString());
TriList.SetString(2930, J(ShiftMode).ToString());
TriList.SetString(2931, K(ShiftMode).ToString());
TriList.SetString(2932, L(ShiftMode).ToString());
TriList.SetString(2933, M(ShiftMode).ToString());
TriList.SetString(2934, N(ShiftMode).ToString());
TriList.SetString(2935, O(ShiftMode).ToString());
TriList.SetString(2936, P(ShiftMode).ToString());
TriList.SetString(2937, Q(ShiftMode).ToString());
TriList.SetString(2938, R(ShiftMode).ToString());
TriList.SetString(2939, S(ShiftMode).ToString());
TriList.SetString(2940, T(ShiftMode).ToString());
TriList.SetString(2941, U(ShiftMode).ToString());
TriList.SetString(2942, V(ShiftMode).ToString());
TriList.SetString(2943, W(ShiftMode).ToString());
TriList.SetString(2944, X(ShiftMode).ToString());
TriList.SetString(2945, Y(ShiftMode).ToString());
TriList.SetString(2946, Z(ShiftMode).ToString());
TriList.SetString(2954, DotComButtonString);
ShowKeys();
}
TriList.SetUshort(2951, (ushort)ShiftMode); // 0 = up, 1 = down, 2 = #, 3 = 123
TriList.SetUshort(2952, (ushort)(ShiftMode < 2 ? 0 : 1)); // 0 = #, 1 = abc
}
void NumShift()
{
if (ShiftMode == 0 || ShiftMode == 1)
ShiftMode = 2;
else if (ShiftMode == 2 || ShiftMode == 3)
ShiftMode = 0;
ShowKeys();
}
/// <summary>
/// Event fire helper for text
/// </summary>
/// <param name="text"></param>
void OnKeyPress(string text)
{
var handler = KeyPress;
if (handler != null)
KeyPress(this, new KeyboardControllerPressEventArgs(text));
}
/// <summary>
/// event helper for special keys
/// </summary>
/// <param name="key"></param>
void OnKeyPress(KeyboardSpecialKey key)
{
var handler = KeyPress;
if (handler != null)
KeyPress(this, new KeyboardControllerPressEventArgs(key));
}
/// <summary>
/// 2901
/// </summary>
public const uint KeyboardVisible = 2901;
/// <summary>
/// 2902
/// </summary>
public const uint ClosePressJoin = 2902;
/// <summary>
/// 2903
/// </summary>
public const uint GoButtonPressJoin = 2903;
/// <summary>
/// 2903
/// </summary>
public const uint GoButtonTextJoin = 2903;
/// <summary>
/// 2904
/// </summary>
public const uint SecondaryButtonPressJoin = 2904;
/// <summary>
/// 2904
/// </summary>
public const uint SecondaryButtonTextJoin = 2904;
/// <summary>
/// 2905
/// </summary>
public const uint GoButtonVisibleJoin = 2905;
/// <summary>
/// 2906
/// </summary>
public const uint SecondaryButtonVisibleJoin = 2906;
/// <summary>
/// 2907
/// </summary>
public const uint GoButtonEnableJoin = 2907;
/// <summary>
/// 2910
/// </summary>
public const uint ClearPressJoin = 2910;
/// <summary>
/// 2911
/// </summary>
public const uint ClearVisibleJoin = 2911;
void ShowKeys()
{
TriList.SetString(2921, A(ShiftMode).ToString());
TriList.SetString(2922, B(ShiftMode).ToString());
TriList.SetString(2923, C(ShiftMode).ToString());
TriList.SetString(2924, D(ShiftMode).ToString());
TriList.SetString(2925, E(ShiftMode).ToString());
TriList.SetString(2926, F(ShiftMode).ToString());
TriList.SetString(2927, G(ShiftMode).ToString());
TriList.SetString(2928, H(ShiftMode).ToString());
TriList.SetString(2929, I(ShiftMode).ToString());
TriList.SetString(2930, J(ShiftMode).ToString());
TriList.SetString(2931, K(ShiftMode).ToString());
TriList.SetString(2932, L(ShiftMode).ToString());
TriList.SetString(2933, M(ShiftMode).ToString());
TriList.SetString(2934, N(ShiftMode).ToString());
TriList.SetString(2935, O(ShiftMode).ToString());
TriList.SetString(2936, P(ShiftMode).ToString());
TriList.SetString(2937, Q(ShiftMode).ToString());
TriList.SetString(2938, R(ShiftMode).ToString());
TriList.SetString(2939, S(ShiftMode).ToString());
TriList.SetString(2940, T(ShiftMode).ToString());
TriList.SetString(2941, U(ShiftMode).ToString());
TriList.SetString(2942, V(ShiftMode).ToString());
TriList.SetString(2943, W(ShiftMode).ToString());
TriList.SetString(2944, X(ShiftMode).ToString());
TriList.SetString(2945, Y(ShiftMode).ToString());
TriList.SetString(2946, Z(ShiftMode).ToString());
TriList.SetString(2954, DotComButtonString);
TriList.SetUshort(2951, (ushort)ShiftMode); // 0 = up, 1 = down, 2 = #, 3 = 123
TriList.SetUshort(2952, (ushort)(ShiftMode < 2 ? 0 : 1)); // 0 = #, 1 = abc
}
/// <summary>
/// Event args for keyboard key presses
/// Event fire helper for text
/// </summary>
public class KeyboardControllerPressEventArgs : EventArgs
/// <param name="text"></param>
void OnKeyPress(string text)
{
/// <summary>
/// Gets or sets the Text
/// </summary>
public string Text { get; private set; }
/// <summary>
/// Gets or sets the SpecialKey
/// </summary>
public KeyboardSpecialKey SpecialKey { get; private set; }
/// <summary>
/// Constructor
/// </summary>
/// <param name="text"></param>
public KeyboardControllerPressEventArgs(string text)
{
Text = text;
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="key">special keyboard key</param>
public KeyboardControllerPressEventArgs(KeyboardSpecialKey key)
{
SpecialKey = key;
}
var handler = KeyPress;
if (handler != null)
KeyPress(this, new KeyboardControllerPressEventArgs(text));
}
/// <summary>
/// Enumeration of KeyboardSpecialKey values
/// event helper for special keys
/// </summary>
public enum KeyboardSpecialKey
/// <param name="key"></param>
void OnKeyPress(KeyboardSpecialKey key)
{
/// <summary>
/// None
/// </summary>
None = 0,
/// <summary>
/// Backspace
/// </summary>
Backspace,
/// <summary>
/// Clear
/// </summary>
Clear,
/// <summary>
/// GoButton
/// </summary>
GoButton,
/// <summary>
/// SecondaryButton
/// </summary>
SecondaryButton
var handler = KeyPress;
if (handler != null)
KeyPress(this, new KeyboardControllerPressEventArgs(key));
}
/// <summary>
/// 2901
/// </summary>
public const uint KeyboardVisible = 2901;
/// <summary>
/// 2902
/// </summary>
public const uint ClosePressJoin = 2902;
/// <summary>
/// 2903
/// </summary>
public const uint GoButtonPressJoin = 2903;
/// <summary>
/// 2903
/// </summary>
public const uint GoButtonTextJoin = 2903;
/// <summary>
/// 2904
/// </summary>
public const uint SecondaryButtonPressJoin = 2904;
/// <summary>
/// 2904
/// </summary>
public const uint SecondaryButtonTextJoin = 2904;
/// <summary>
/// 2905
/// </summary>
public const uint GoButtonVisibleJoin = 2905;
/// <summary>
/// 2906
/// </summary>
public const uint SecondaryButtonVisibleJoin = 2906;
/// <summary>
/// 2907
/// </summary>
public const uint GoButtonEnableJoin = 2907;
/// <summary>
/// 2910
/// </summary>
public const uint ClearPressJoin = 2910;
/// <summary>
/// 2911
/// </summary>
public const uint ClearVisibleJoin = 2911;
}
/// <summary>
///
/// </summary>
public class KeyboardControllerPressEventArgs : EventArgs
{
public string Text { get; private set; }
public KeyboardSpecialKey SpecialKey { get; private set; }
public KeyboardControllerPressEventArgs(string text)
{
Text = text;
}
public KeyboardControllerPressEventArgs(KeyboardSpecialKey key)
{
SpecialKey = key;
}
}
public enum KeyboardSpecialKey
{
None = 0, Backspace, Clear, GoButton, SecondaryButton
}

View file

@ -1,14 +1,10 @@
using System;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using Serilog.Events;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Represents a ModalDialog
/// </summary>
namespace PepperDash.Essentials.Core;
public class ModalDialog
{
/// <summary>
@ -19,10 +15,10 @@ namespace PepperDash.Essentials.Core
/// Bool press 3992
/// </summary>
public const uint Button2Join = 3992;
/// <summary>
/// 3993
/// </summary>
public const uint CancelButtonJoin = 3993;
/// <summary>
/// 3993
/// </summary>
public const uint CancelButtonJoin = 3993;
/// <summary>
///For visibility of single button. Bool feedback 3994
/// </summary>
@ -35,19 +31,19 @@ namespace PepperDash.Essentials.Core
/// Shows the timer guage if in use. Bool feedback 3996
/// </summary>
public const uint TimerVisibleJoin = 3996;
/// <summary>
/// Visibility join to show "X" button 3997
/// </summary>
public const uint CancelVisibleJoin = 3997;
/// <summary>
/// Visibility join to show "X" button 3997
/// </summary>
public const uint CancelVisibleJoin = 3997;
/// <summary>
/// Shows the modal subpage. Boolean feeback join 3999
/// </summary>
public const uint ModalVisibleJoin = 3999;
///// <summary>
///// The seconds value of the countdown timer. Ushort join 3991
///// </summary>
//public const uint TimerSecondsJoin = 3991;
/// <summary>
/// The seconds value of the countdown timer. Ushort join 3991
/// </summary>
//public const uint TimerSecondsJoin = 3991;
/// <summary>
/// The full ushort value of the countdown timer for a gauge. Ushort join 3992
/// </summary>
@ -82,10 +78,10 @@ namespace PepperDash.Essentials.Core
get { return TriList.BooleanInput[ModalVisibleJoin].BoolValue; }
}
/// <summary>
///
/// </summary>
public bool CanCancel { get; private set; }
/// <summary>
///
/// </summary>
public bool CanCancel { get; private set; }
BasicTriList TriList;
@ -103,10 +99,10 @@ namespace PepperDash.Essentials.Core
TriList = triList;
// Attach actions to buttons
triList.SetSigFalseAction(Button1Join, () => OnModalComplete(1));
triList.SetSigFalseAction(Button1Join, () => OnModalComplete(1));
triList.SetSigFalseAction(Button2Join, () => OnModalComplete(2));
triList.SetSigFalseAction(CancelButtonJoin, () => { if (CanCancel) CancelDialog(); });
CanCancel = true;
triList.SetSigFalseAction(CancelButtonJoin, () => { if (CanCancel) CancelDialog(); });
CanCancel = true;
}
/// <summary>
@ -156,15 +152,15 @@ namespace PepperDash.Essentials.Core
TriList.StringInput[Button2TextJoin].StringValue = button2Text;
}
// Show/hide guage
TriList.BooleanInput[TimerVisibleJoin].BoolValue = showGauge;
CanCancel = showCancel;
TriList.BooleanInput[CancelVisibleJoin].BoolValue = showCancel;
TriList.BooleanInput[TimerVisibleJoin].BoolValue = showGauge;
CanCancel = showCancel;
TriList.BooleanInput[CancelVisibleJoin].BoolValue = showCancel;
//Reveal and activate
TriList.BooleanInput[ModalVisibleJoin].BoolValue = true;
WakePanel();
WakePanel();
return true;
}
@ -172,49 +168,47 @@ namespace PepperDash.Essentials.Core
return false;
}
/// <summary>
/// WakePanel method
/// </summary>
public void WakePanel()
{
try
{
var panel = TriList as TswFt5Button;
/// <summary>
/// Wakes the panel by turning on the backlight if off
/// </summary>
public void WakePanel()
{
try
{
var panel = TriList as TswFt5Button;
if (panel != null && panel.ExtenderSystemReservedSigs.BacklightOffFeedback.BoolValue)
panel.ExtenderSystemReservedSigs.BacklightOn();
}
catch
{
Debug.LogMessage(LogEventLevel.Debug, "Error Waking Panel. Maybe testing with Xpanel?");
}
}
if (panel != null && panel.ExtenderSystemReservedSigs.BacklightOffFeedback.BoolValue)
panel.ExtenderSystemReservedSigs.BacklightOn();
}
catch
{
Debug.LogMessage(LogEventLevel.Debug, "Error Waking Panel. Maybe testing with Xpanel?");
}
}
/// <summary>
/// CancelDialog method
/// </summary>
/// <summary>
/// Hide dialog from elsewhere, fires CompleteAction
/// </summary>
public void CancelDialog()
{
OnModalComplete(0);
OnModalComplete(0);
}
/// <summary>
/// Hides dialog. Fires no action
/// </summary>
public void HideDialog()
{
TriList.BooleanInput[ModalVisibleJoin].BoolValue = false;
}
/// <summary>
/// Hides dialog. Fires no action
/// </summary>
public void HideDialog()
{
TriList.BooleanInput[ModalVisibleJoin].BoolValue = false;
}
// When the modal is cleared or times out, clean up the various bits
void OnModalComplete(uint buttonNum)
{
TriList.BooleanInput[ModalVisibleJoin].BoolValue = false;
var action = ModalCompleteAction;
if (action != null)
action(buttonNum);
var action = ModalCompleteAction;
if (action != null)
action(buttonNum);
}
}
}
}

View file

@ -7,8 +7,8 @@ using PepperDash.Core;
using PepperDash.Core.Logging;
using Serilog.Events;
namespace PepperDash.Essentials.Core.Touchpanels
{
namespace PepperDash.Essentials.Core.Touchpanels;
/// <summary>
/// A wrapper class for the touchpanel portion of an MPC3 class process to allow for configurable
/// behavior of the keybad buttons
@ -85,9 +85,9 @@ namespace PepperDash.Essentials.Core.Touchpanels
return;
}
TryParseInt(key, out int buttonNumber);
TryParseInt(key, out int buttonNumber);
var buttonEventTypes = config.EventTypes;
var buttonEventTypes = config.EventTypes;
BoolOutputSig enabledFb = null;
BoolOutputSig disabledFb = null;
@ -174,10 +174,10 @@ namespace PepperDash.Essentials.Core.Touchpanels
return;
}
TryParseInt(key, out int buttonNumber);
TryParseInt(key, out int buttonNumber);
// Link up the button feedbacks to the specified device feedback
var buttonFeedback = config.Feedback;
// Link up the button feedbacks to the specified device feedback
var buttonFeedback = config.Feedback;
if (buttonFeedback == null || string.IsNullOrEmpty(buttonFeedback.DeviceKey))
{
Debug.LogMessage(LogEventLevel.Debug, this, "Button '{0}' feedback not configured, skipping.",
@ -189,14 +189,14 @@ namespace PepperDash.Essentials.Core.Touchpanels
try
{
if (!(DeviceManager.GetDeviceForKey(buttonFeedback.DeviceKey) is Device device))
{
Debug.LogMessage(LogEventLevel.Debug, this, "Button '{0}' feedback deviceKey '{1}' not found.",
key, buttonFeedback.DeviceKey);
return;
}
if (!(DeviceManager.GetDeviceForKey(buttonFeedback.DeviceKey) is Device device))
{
Debug.LogMessage(LogEventLevel.Debug, this, "Button '{0}' feedback deviceKey '{1}' not found.",
key, buttonFeedback.DeviceKey);
return;
}
deviceFeedback = device.GetFeedbackProperty(buttonFeedback.FeedbackName);
deviceFeedback = device.GetFeedbackProperty(buttonFeedback.FeedbackName);
if (deviceFeedback == null)
{
Debug.LogMessage(LogEventLevel.Debug, this, "Button '{0}' feedbackName property '{1}' not found.",
@ -236,36 +236,36 @@ namespace PepperDash.Essentials.Core.Touchpanels
var boolFeedback = deviceFeedback as BoolFeedback;
switch (key)
{
case ("power"):
switch (key)
{
case ("power"):
{
boolFeedback?.LinkCrestronFeedback(_touchpanel.FeedbackPower);
break;
}
case ("volumeup"):
case ("volumedown"):
case ("volumefeedback"):
{
if (deviceFeedback is IntFeedback intFeedback)
{
boolFeedback?.LinkCrestronFeedback(_touchpanel.FeedbackPower);
break;
var volumeFeedback = intFeedback;
volumeFeedback.LinkInputSig(_touchpanel.VolumeBargraph);
}
case ("volumeup"):
case ("volumedown"):
case ("volumefeedback"):
{
if (deviceFeedback is IntFeedback intFeedback)
{
var volumeFeedback = intFeedback;
volumeFeedback.LinkInputSig(_touchpanel.VolumeBargraph);
}
break;
}
case ("mute"):
{
boolFeedback?.LinkCrestronFeedback(_touchpanel.FeedbackMute);
break;
}
default:
{
boolFeedback?.LinkCrestronFeedback(_touchpanel.Feedbacks[(uint)buttonNumber]);
break;
}
}
break;
}
case ("mute"):
{
boolFeedback?.LinkCrestronFeedback(_touchpanel.FeedbackMute);
break;
}
default:
{
boolFeedback?.LinkCrestronFeedback(_touchpanel.Feedbacks[(uint)buttonNumber]);
break;
}
}
}
/// <summary>
/// Try parse int helper method
@ -393,5 +393,4 @@ namespace PepperDash.Essentials.Core.Touchpanels
/// </summary>
[JsonProperty("feedbackName")]
public string FeedbackName { get; set; }
}
}
}

View file

@ -1,16 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
namespace PepperDash.Essentials.Core;
/// <summary>
/// Extensions used for more-clear attachment of Actions to user objects on sigs
/// </summary>
@ -18,7 +13,7 @@ namespace PepperDash.Essentials.Core
{
/// <summary>
/// Attaches Action to Sig's user object and returns the same Sig. This provides no protection
/// from null sigs
/// from null sigs
/// </summary>
/// <param name="sig">The BoolOutputSig to attach the Action to</param>
/// <param name="a">An action to run when sig is pressed and when released</param>
@ -74,14 +69,14 @@ namespace PepperDash.Essentials.Core
return sig.SetBoolSigAction(b => { if (!b) a(); });
}
/// <summary>
/// Sets an action to a held sig
/// </summary>
/// <returns>The sig</returns>
public static BoolOutputSig SetSigHeldAction(this BasicTriList tl, uint sigNum, uint heldMs, Action heldAction)
{
return SetSigHeldAction(tl, sigNum, heldMs, heldAction, null);
}
/// <summary>
/// Sets an action to a held sig
/// </summary>
/// <returns>The sig</returns>
public static BoolOutputSig SetSigHeldAction(this BasicTriList tl, uint sigNum, uint heldMs, Action heldAction)
{
return SetSigHeldAction(tl, sigNum, heldMs, heldAction, null);
}
/// <summary>
/// Sets an action to a held sig as well as a released-without-hold action
@ -124,17 +119,14 @@ namespace PepperDash.Essentials.Core
}
/// <summary>
/// Sets an action to a held sig as well as a released-without-hold action
/// </summary>
/// <returns>The sig</returns>
/// <summary>
/// SetSigHeldAction method
/// </summary>
public static BoolOutputSig SetSigHeldAction(this BasicTriList tl, uint sigNum, uint heldMs, Action heldAction, Action releaseAction)
{
/// <summary>
/// Sets an action to a held sig as well as a released-without-hold action
/// </summary>
/// <returns>The sig</returns>
public static BoolOutputSig SetSigHeldAction(this BasicTriList tl, uint sigNum, uint heldMs, Action heldAction, Action releaseAction)
{
return tl.BooleanOutput[sigNum].SetSigHeldAction(heldMs, heldAction, null, releaseAction);
}
}
/// <summary>
/// Sets an action to a held sig, an action for the release of hold, as well as a released-without-hold action
@ -232,35 +224,35 @@ namespace PepperDash.Essentials.Core
return ClearSigAction(tl.StringOutput[sigNum]) as StringOutputSig;
}
/// <summary>
/// ClearAllSigActions method
/// </summary>
public static void ClearAllSigActions(this BasicTriList t1)
/// <summary>
/// Clears all actions on all sigs
/// </summary>
public static void ClearAllSigActions(this BasicTriList t1)
{
foreach (var sig in t1.BooleanOutput)
{
foreach (var sig in t1.BooleanOutput)
{
ClearSigAction(sig);
}
foreach (var sig in t1.UShortOutput)
{
ClearSigAction(sig);
}
foreach (var sig in t1.StringOutput)
{
ClearSigAction(sig);
}
ClearSigAction(sig);
}
/// <summary>
/// SetBool method
/// </summary>
public static void SetBool(this BasicTriList tl, uint sigNum, bool value)
foreach (var sig in t1.UShortOutput)
{
tl.BooleanInput[sigNum].BoolValue = value;
ClearSigAction(sig);
}
foreach (var sig in t1.StringOutput)
{
ClearSigAction(sig);
}
}
/// <summary>
/// Helper method to set the value of a bool Sig on TriList
/// </summary>
public static void SetBool(this BasicTriList tl, uint sigNum, bool value)
{
tl.BooleanInput[sigNum].BoolValue = value;
}
/// <summary>
/// Sends an true-false pulse to the sig
/// </summary>
@ -282,21 +274,21 @@ namespace PepperDash.Essentials.Core
tl.BooleanInput[sigNum].Pulse(ms);
}
/// <summary>
/// Helper method to set the value of a ushort Sig on TriList
/// </summary>
public static void SetUshort(this BasicTriList tl, uint sigNum, ushort value)
{
tl.UShortInput[sigNum].UShortValue = value;
}
/// <summary>
/// Helper method to set the value of a ushort Sig on TriList
/// </summary>
public static void SetUshort(this BasicTriList tl, uint sigNum, ushort value)
{
tl.UShortInput[sigNum].UShortValue = value;
}
/// <summary>
/// Helper method to set the value of a string Sig on TriList
/// </summary>
public static void SetString(this BasicTriList tl, uint sigNum, string value)
{
tl.StringInput[sigNum].StringValue = value;
}
/// <summary>
/// Helper method to set the value of a string Sig on TriList
/// </summary>
public static void SetString(this BasicTriList tl, uint sigNum, string value)
{
tl.StringInput[sigNum].StringValue = value;
}
/// <summary>
/// Helper method to set the value of a string Sig on TriList with encoding
@ -343,5 +335,4 @@ namespace PepperDash.Essentials.Core
{
return tl.StringOutput[sigNum].StringValue;
}
}
}