From c755ecb16cb9780860a21872330ff79a68e06fdd Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 28 May 2024 11:26:25 -0500 Subject: [PATCH 1/6] fix: add correct casing to base touchpanel config --- .../CrestronTouchpanelPropertiesConfig.cs | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/PepperDash.Essentials.Core/Touchpanels/CrestronTouchpanelPropertiesConfig.cs b/src/PepperDash.Essentials.Core/Touchpanels/CrestronTouchpanelPropertiesConfig.cs index 73b66bce..5a42bcd1 100644 --- a/src/PepperDash.Essentials.Core/Touchpanels/CrestronTouchpanelPropertiesConfig.cs +++ b/src/PepperDash.Essentials.Core/Touchpanels/CrestronTouchpanelPropertiesConfig.cs @@ -1,20 +1,49 @@ -namespace PepperDash.Essentials.Core +using Newtonsoft.Json; + +namespace PepperDash.Essentials.Core { public class CrestronTouchpanelPropertiesConfig { + [JsonProperty("ipId")] public string IpId { get; set; } + + [JsonProperty("defaultRoomKey")] public string DefaultRoomKey { get; set; } + + [JsonProperty("roomListKey")] public string RoomListKey { get; set; } + + [JsonProperty("sgdFile")] public string SgdFile { get; set; } + + [JsonProperty("projectName")] public string ProjectName { get; set; } + + [JsonProperty("showVolumeGauge")] public bool ShowVolumeGauge { get; set; } + + [JsonProperty("usesSplashPage")] public bool UsesSplashPage { get; set; } + + [JsonProperty("showDate")] public bool ShowDate { get; set; } + + [JsonProperty("showTime")] public bool ShowTime { get; set; } + + [JsonProperty("setup")] public UiSetupPropertiesConfig Setup { get; set; } + + [JsonProperty("headerStyle")] public string HeaderStyle { get; set; } + + [JsonProperty("includeInFusionRoomHealth")] public bool IncludeInFusionRoomHealth { get; set; } + + [JsonProperty("screenSaverTimeoutMin")] public uint ScreenSaverTimeoutMin { get; set; } + + [JsonProperty("screenSaverMovePositionIntervalMs")] public uint ScreenSaverMovePositionIntervalMs { get; set; } @@ -22,6 +51,7 @@ /// The count of sources that will trigger the "additional" arrows to show on the SRL. /// Defaults to 5 /// + [JsonProperty("sourcesOverflowCount")] public int SourcesOverflowCount { get; set; } public CrestronTouchpanelPropertiesConfig() @@ -49,6 +79,7 @@ /// public class UiSetupPropertiesConfig { + [JsonProperty("isVisible")] public bool IsVisible { get; set; } } } \ No newline at end of file From edc916c9d3446e4f714ffd8e19154919d6d37959 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 28 May 2024 13:28:45 -0500 Subject: [PATCH 2/6] fix: add more json props --- .../Comm and IR/CommFactory.cs | 15 +++++--- .../CrestronTouchpanelPropertiesConfig.cs | 35 ++++++++++--------- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs b/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs index f54f4bfd..26b29d51 100644 --- a/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs +++ b/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs @@ -201,23 +201,26 @@ namespace PepperDash.Essentials.Core /// /// /// - public class EssentialsControlPropertiesConfig : - PepperDash.Core.ControlPropertiesConfig + public class EssentialsControlPropertiesConfig : + ControlPropertiesConfig { + [JsonProperty("comParams")] [JsonConverter(typeof(ComSpecJsonConverter))] - public ComPort.ComPortSpec ComParams { get; set; } + public ComPort.ComPortSpec ComParams { get; set; } - public string CresnetId { get; set; } + [JsonProperty("cresnetId")] + public string CresnetId { get; set; } /// /// Attempts to provide uint conversion of string CresnetId /// + [JsonIgnore] public uint CresnetIdInt { get { - try + try { return Convert.ToUInt32(CresnetId, 16); } @@ -228,11 +231,13 @@ namespace PepperDash.Essentials.Core } } + [JsonProperty("infinetId")] public string InfinetId { get; set; } /// /// Attepmts to provide uiont conversion of string InifinetId /// + [JsonIgnore] public uint InfinetIdInt { get diff --git a/src/PepperDash.Essentials.Core/Touchpanels/CrestronTouchpanelPropertiesConfig.cs b/src/PepperDash.Essentials.Core/Touchpanels/CrestronTouchpanelPropertiesConfig.cs index 5a42bcd1..9b6639db 100644 --- a/src/PepperDash.Essentials.Core/Touchpanels/CrestronTouchpanelPropertiesConfig.cs +++ b/src/PepperDash.Essentials.Core/Touchpanels/CrestronTouchpanelPropertiesConfig.cs @@ -4,46 +4,49 @@ namespace PepperDash.Essentials.Core { public class CrestronTouchpanelPropertiesConfig { - [JsonProperty("ipId")] + [JsonProperty("control")] + public EssentialsControlPropertiesConfig ControlProperties { get; set; } + + [JsonProperty("ipId", NullValueHandling = NullValueHandling.Ignore)] public string IpId { get; set; } - [JsonProperty("defaultRoomKey")] + [JsonProperty("defaultRoomKey", NullValueHandling = NullValueHandling.Ignore)] public string DefaultRoomKey { get; set; } - [JsonProperty("roomListKey")] + [JsonProperty("roomListKey", NullValueHandling = NullValueHandling.Ignore)] public string RoomListKey { get; set; } - [JsonProperty("sgdFile")] + [JsonProperty("sgdFile", NullValueHandling = NullValueHandling.Ignore)] public string SgdFile { get; set; } - [JsonProperty("projectName")] + [JsonProperty("projectName", NullValueHandling = NullValueHandling.Ignore)] public string ProjectName { get; set; } - [JsonProperty("showVolumeGauge")] + [JsonProperty("showVolumeGauge", NullValueHandling = NullValueHandling.Ignore)] public bool ShowVolumeGauge { get; set; } - [JsonProperty("usesSplashPage")] + [JsonProperty("usesSplashPage", NullValueHandling = NullValueHandling.Ignore)] public bool UsesSplashPage { get; set; } - [JsonProperty("showDate")] + [JsonProperty("showDate", NullValueHandling = NullValueHandling.Ignore)] public bool ShowDate { get; set; } - [JsonProperty("showTime")] + [JsonProperty("showTime", NullValueHandling = NullValueHandling.Ignore)] public bool ShowTime { get; set; } - [JsonProperty("setup")] + [JsonProperty("setup", NullValueHandling = NullValueHandling.Ignore)] public UiSetupPropertiesConfig Setup { get; set; } - [JsonProperty("headerStyle")] + [JsonProperty("headerStyle", NullValueHandling = NullValueHandling.Ignore)] public string HeaderStyle { get; set; } - [JsonProperty("includeInFusionRoomHealth")] + [JsonProperty("includeInFusionRoomHealth", NullValueHandling = NullValueHandling.Ignore)] public bool IncludeInFusionRoomHealth { get; set; } - [JsonProperty("screenSaverTimeoutMin")] + [JsonProperty("screenSaverTimeoutMin", NullValueHandling = NullValueHandling.Ignore)] public uint ScreenSaverTimeoutMin { get; set; } - [JsonProperty("screenSaverMovePositionIntervalMs")] + [JsonProperty("screenSaverMovePositionIntervalMs", NullValueHandling = NullValueHandling.Ignore)] public uint ScreenSaverMovePositionIntervalMs { get; set; } @@ -51,7 +54,7 @@ namespace PepperDash.Essentials.Core /// The count of sources that will trigger the "additional" arrows to show on the SRL. /// Defaults to 5 /// - [JsonProperty("sourcesOverflowCount")] + [JsonProperty("sourcesOverflowCount", NullValueHandling = NullValueHandling.Ignore)] public int SourcesOverflowCount { get; set; } public CrestronTouchpanelPropertiesConfig() @@ -79,7 +82,7 @@ namespace PepperDash.Essentials.Core /// public class UiSetupPropertiesConfig { - [JsonProperty("isVisible")] + [JsonProperty("isVisible", NullValueHandling = NullValueHandling.Ignore)] public bool IsVisible { get; set; } } } \ No newline at end of file From 00a7b25026390cf15551ffa6ed76518a0d32054c Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 28 May 2024 13:29:03 -0500 Subject: [PATCH 3/6] build: update PD Core --- .../PepperDash.Essentials.Core.csproj | 2 +- .../PepperDash.Essentials.Devices.Common.csproj | 2 +- src/PepperDash.Essentials/PepperDash.Essentials.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj index 1298873d..d8088003 100644 --- a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj +++ b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj @@ -28,7 +28,7 @@ - + diff --git a/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj b/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj index 7391ceed..8d342bb1 100644 --- a/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj +++ b/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj @@ -28,6 +28,6 @@ - + \ No newline at end of file diff --git a/src/PepperDash.Essentials/PepperDash.Essentials.csproj b/src/PepperDash.Essentials/PepperDash.Essentials.csproj index 33ade9bd..dc57fafa 100644 --- a/src/PepperDash.Essentials/PepperDash.Essentials.csproj +++ b/src/PepperDash.Essentials/PepperDash.Essentials.csproj @@ -47,7 +47,7 @@ - + From cc06c7bfd85861b02a8d44333695ee58804441c7 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 28 May 2024 14:43:31 -0500 Subject: [PATCH 4/6] fix: add nullable props where necessary --- .../Comm and IR/ComSpecJsonConverter.cs | 6 ++--- .../Comm and IR/CommFactory.cs | 12 ++++----- .../CrestronTouchpanelPropertiesConfig.cs | 25 +++++++++++-------- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/PepperDash.Essentials.Core/Comm and IR/ComSpecJsonConverter.cs b/src/PepperDash.Essentials.Core/Comm and IR/ComSpecJsonConverter.cs index 62296bd8..bfdccb65 100644 --- a/src/PepperDash.Essentials.Core/Comm and IR/ComSpecJsonConverter.cs +++ b/src/PepperDash.Essentials.Core/Comm and IR/ComSpecJsonConverter.cs @@ -23,12 +23,12 @@ namespace PepperDash.Essentials.Core { public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { - if (objectType == typeof(ComPort.ComPortSpec)) + if (objectType == typeof(ComPort.ComPortSpec?)) { var newSer = new JsonSerializer(); newSer.Converters.Add(new ComSpecPropsJsonConverter()); newSer.ObjectCreationHandling = ObjectCreationHandling.Replace; - return newSer.Deserialize(reader); + return newSer.Deserialize(reader); } return null; } @@ -38,7 +38,7 @@ namespace PepperDash.Essentials.Core /// public override bool CanConvert(Type objectType) { - return objectType == typeof(ComPort.ComPortSpec); + return objectType == typeof(ComPort.ComPortSpec?); } public override bool CanRead { get { return true; } } diff --git a/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs b/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs index 26b29d51..8fa4076a 100644 --- a/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs +++ b/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs @@ -51,7 +51,7 @@ namespace PepperDash.Essentials.Core switch (controlConfig.Method) { case eControlMethod.Com: - comm = new ComPortController(deviceConfig.Key + "-com", GetComPort, controlConfig.ComParams, controlConfig); + comm = new ComPortController(deviceConfig.Key + "-com", GetComPort, controlConfig.ComParams.Value, controlConfig); break; case eControlMethod.Cec: comm = new CecPortController(deviceConfig.Key + "-cec", GetCecPort, controlConfig); @@ -115,7 +115,7 @@ namespace PepperDash.Essentials.Core var comPar = config.ComParams; var dev = GetIComPortsDeviceFromManagedDevice(config.ControlPortDevKey); if (dev != null && config.ControlPortNumber <= dev.NumberOfComPorts) - return dev.ComPorts[config.ControlPortNumber]; + return dev.ComPorts[config.ControlPortNumber.Value]; Debug.LogMessage(LogEventLevel.Information, "GetComPort: Device '{0}' does not have com port {1}", config.ControlPortDevKey, config.ControlPortNumber); return null; } @@ -205,11 +205,11 @@ namespace PepperDash.Essentials.Core ControlPropertiesConfig { - [JsonProperty("comParams")] + [JsonProperty("comParams", NullValueHandling = NullValueHandling.Ignore)] [JsonConverter(typeof(ComSpecJsonConverter))] - public ComPort.ComPortSpec ComParams { get; set; } + public ComPort.ComPortSpec? ComParams { get; set; } - [JsonProperty("cresnetId")] + [JsonProperty("cresnetId", NullValueHandling = NullValueHandling.Ignore)] public string CresnetId { get; set; } /// @@ -231,7 +231,7 @@ namespace PepperDash.Essentials.Core } } - [JsonProperty("infinetId")] + [JsonProperty("infinetId", NullValueHandling = NullValueHandling.Ignore)] public string InfinetId { get; set; } /// diff --git a/src/PepperDash.Essentials.Core/Touchpanels/CrestronTouchpanelPropertiesConfig.cs b/src/PepperDash.Essentials.Core/Touchpanels/CrestronTouchpanelPropertiesConfig.cs index 9b6639db..aa4dac6d 100644 --- a/src/PepperDash.Essentials.Core/Touchpanels/CrestronTouchpanelPropertiesConfig.cs +++ b/src/PepperDash.Essentials.Core/Touchpanels/CrestronTouchpanelPropertiesConfig.cs @@ -23,16 +23,16 @@ namespace PepperDash.Essentials.Core public string ProjectName { get; set; } [JsonProperty("showVolumeGauge", NullValueHandling = NullValueHandling.Ignore)] - public bool ShowVolumeGauge { get; set; } + public bool? ShowVolumeGauge { get; set; } [JsonProperty("usesSplashPage", NullValueHandling = NullValueHandling.Ignore)] - public bool UsesSplashPage { get; set; } + public bool? UsesSplashPage { get; set; } [JsonProperty("showDate", NullValueHandling = NullValueHandling.Ignore)] - public bool ShowDate { get; set; } + public bool? ShowDate { get; set; } [JsonProperty("showTime", NullValueHandling = NullValueHandling.Ignore)] - public bool ShowTime { get; set; } + public bool? ShowTime { get; set; } [JsonProperty("setup", NullValueHandling = NullValueHandling.Ignore)] public UiSetupPropertiesConfig Setup { get; set; } @@ -41,13 +41,13 @@ namespace PepperDash.Essentials.Core public string HeaderStyle { get; set; } [JsonProperty("includeInFusionRoomHealth", NullValueHandling = NullValueHandling.Ignore)] - public bool IncludeInFusionRoomHealth { get; set; } + public bool? IncludeInFusionRoomHealth { get; set; } [JsonProperty("screenSaverTimeoutMin", NullValueHandling = NullValueHandling.Ignore)] - public uint ScreenSaverTimeoutMin { get; set; } + public uint? ScreenSaverTimeoutMin { get; set; } [JsonProperty("screenSaverMovePositionIntervalMs", NullValueHandling = NullValueHandling.Ignore)] - public uint ScreenSaverMovePositionIntervalMs { get; set; } + public uint? ScreenSaverMovePositionIntervalMs { get; set; } /// @@ -55,17 +55,20 @@ namespace PepperDash.Essentials.Core /// Defaults to 5 /// [JsonProperty("sourcesOverflowCount", NullValueHandling = NullValueHandling.Ignore)] - public int SourcesOverflowCount { get; set; } + public int? SourcesOverflowCount { get; set; } - public CrestronTouchpanelPropertiesConfig() + public CrestronTouchpanelPropertiesConfig() : this(false) { } + + public CrestronTouchpanelPropertiesConfig(bool setDefaultValues = false) { + if(!setDefaultValues) { return; } SourcesOverflowCount = 5; - HeaderStyle = CrestronTouchpanelPropertiesConfig.Habanero; + HeaderStyle = Habanero; // Default values ScreenSaverTimeoutMin = 5; ScreenSaverMovePositionIntervalMs = 15000; - } + } /// /// "habanero" From a3c1572a77259e52abb5089f65e49584b875a4c3 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 28 May 2024 14:43:39 -0500 Subject: [PATCH 5/6] build: update PD Core --- .../PepperDash.Essentials.Core.csproj | 2 +- .../PepperDash.Essentials.Devices.Common.csproj | 2 +- src/PepperDash.Essentials/PepperDash.Essentials.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj index d8088003..8ae0c0af 100644 --- a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj +++ b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj @@ -28,7 +28,7 @@ - + diff --git a/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj b/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj index 8d342bb1..a591961a 100644 --- a/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj +++ b/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj @@ -28,6 +28,6 @@ - + \ No newline at end of file diff --git a/src/PepperDash.Essentials/PepperDash.Essentials.csproj b/src/PepperDash.Essentials/PepperDash.Essentials.csproj index dc57fafa..9ed182b3 100644 --- a/src/PepperDash.Essentials/PepperDash.Essentials.csproj +++ b/src/PepperDash.Essentials/PepperDash.Essentials.csproj @@ -47,7 +47,7 @@ - + From 0bef5d4b77dd3d4d359bb3439908acf17c36d723 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 28 May 2024 14:57:35 -0500 Subject: [PATCH 6/6] build: update PD Core --- .../PepperDash.Essentials.Core.csproj | 2 +- .../PepperDash.Essentials.Devices.Common.csproj | 2 +- src/PepperDash.Essentials/PepperDash.Essentials.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj index 8ae0c0af..02d13f7d 100644 --- a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj +++ b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj @@ -28,7 +28,7 @@ - + diff --git a/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj b/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj index a591961a..b1abcdb0 100644 --- a/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj +++ b/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj @@ -28,6 +28,6 @@ - + \ No newline at end of file diff --git a/src/PepperDash.Essentials/PepperDash.Essentials.csproj b/src/PepperDash.Essentials/PepperDash.Essentials.csproj index 9ed182b3..0aada6d1 100644 --- a/src/PepperDash.Essentials/PepperDash.Essentials.csproj +++ b/src/PepperDash.Essentials/PepperDash.Essentials.csproj @@ -47,7 +47,7 @@ - +