From 56a48175c6eccfcf8034b7b49a9613b0b4d7d8ce Mon Sep 17 00:00:00 2001 From: Drew Tingen Date: Wed, 30 Nov 2022 11:59:43 -0500 Subject: [PATCH] feat(IcdEnvironment):Updated environment to sperate Crestron platform for environment for SW on VC4 --- CHANGELOG.md | 2 ++ ICD.Common.Utils/IcdEnvironment.SimplSharp.cs | 16 ++++++++------ ICD.Common.Utils/IcdEnvironment.Standard.cs | 12 +--------- ICD.Common.Utils/IcdEnvironment.cs | 22 ++++++++++++++++--- 4 files changed, 31 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bcd9dfd..fc609aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed + - IcdEnvironment - Added CrestronDevicePlatform, removed from CrestronRuntimeEnvironment, to support SimplWindows on VC-4 ## [16.0.5] 2022-07-11 ### Changed diff --git a/ICD.Common.Utils/IcdEnvironment.SimplSharp.cs b/ICD.Common.Utils/IcdEnvironment.SimplSharp.cs index 23c13e6..3329337 100644 --- a/ICD.Common.Utils/IcdEnvironment.SimplSharp.cs +++ b/ICD.Common.Utils/IcdEnvironment.SimplSharp.cs @@ -194,14 +194,16 @@ namespace ICD.Common.Utils { // Cache the runtime environment s_Framework = eFramework.Crestron; - - if (CrestronEnvironment.RuntimeEnvironment == eRuntimeEnvironment.SIMPL) - s_CrestronRuntimeEnvironment = eCrestronRuntimeEnvironment.Simpl; - else if (CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance) - s_CrestronRuntimeEnvironment = eCrestronRuntimeEnvironment.Appliance; - else - s_CrestronRuntimeEnvironment = eCrestronRuntimeEnvironment.Server; + s_CrestronRuntimeEnvironment = CrestronEnvironment.RuntimeEnvironment == eRuntimeEnvironment.SIMPL + ? eCrestronRuntimeEnvironment.SimplPlus + : eCrestronRuntimeEnvironment.SimplSharpPro; + + s_CrestronDevicePlatform = CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance + ? eCrestronDevicePlatform.Appliance + : eCrestronDevicePlatform.Server; + + // todo: Make this check more robust s_CrestronSeries = Type.GetType("Mono.Runtime") != null ? eCrestronSeries.FourSeries : eCrestronSeries.ThreeSeries; CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironmentOnProgramStatusEventHandler; diff --git a/ICD.Common.Utils/IcdEnvironment.Standard.cs b/ICD.Common.Utils/IcdEnvironment.Standard.cs index 9bdab23..7dcba1a 100644 --- a/ICD.Common.Utils/IcdEnvironment.Standard.cs +++ b/ICD.Common.Utils/IcdEnvironment.Standard.cs @@ -107,20 +107,10 @@ namespace ICD.Common.Utils static IcdEnvironment() { -#if NETFRAMEWORK - s_Framework = eFramework.Framework; - s_CrestronSeries = eCrestronSeries.FourSeries; - if (CrestronEnvironment.RuntimeEnvironment == eRuntimeEnvironment.SIMPL) - s_CrestronRuntimeEnvironment = eCrestronRuntimeEnvironment.Simpl; - else if (CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance) - s_CrestronRuntimeEnvironment = eCrestronRuntimeEnvironment.Appliance; - else - s_CrestronRuntimeEnvironment = eCrestronRuntimeEnvironment.Server; -#else s_Framework = eFramework.Standard; s_CrestronSeries = eCrestronSeries.Na; s_CrestronRuntimeEnvironment = eCrestronRuntimeEnvironment.Na; -#endif + s_CrestronDevicePlatform = eCrestronDevicePlatform.Na; } /// diff --git a/ICD.Common.Utils/IcdEnvironment.cs b/ICD.Common.Utils/IcdEnvironment.cs index ce551aa..006516b 100644 --- a/ICD.Common.Utils/IcdEnvironment.cs +++ b/ICD.Common.Utils/IcdEnvironment.cs @@ -32,9 +32,15 @@ namespace ICD.Common.Utils public enum eCrestronRuntimeEnvironment { Na, //Non-Crestron - Simpl, // Running in Simpl, Non-Pro - Appliance, // S#Pro running on a Crestron hardware appliance - Server // S#Pro running on a server (VC-4) + SimplPlus, // Running in Simpl+, Non-Pro + SimplSharpPro // Running in Simpl#Pro + } + + public enum eCrestronDevicePlatform + { + Na, // Non-Crestron + Appliance, // Running on Crestron hardware appliance + Server // Running on VC-4 Server } /// @@ -120,14 +126,24 @@ namespace ICD.Common.Utils private static readonly eFramework s_Framework; private static readonly eCrestronSeries s_CrestronSeries; private static readonly eCrestronRuntimeEnvironment s_CrestronRuntimeEnvironment; + private static readonly eCrestronDevicePlatform s_CrestronDevicePlatform; private static readonly SafeCriticalSection s_ProgramInitializationSection = new SafeCriticalSection(); private static bool s_ProgramInitializationComplete; public static eFramework Framework {get { return s_Framework; }} public static eCrestronSeries CrestronSeries {get { return s_CrestronSeries; }} + + /// + /// Crestron environment being run in, SimplPlus or SimplSharpPro + /// public static eCrestronRuntimeEnvironment CrestronRuntimeEnvironment {get { return s_CrestronRuntimeEnvironment; }} + /// + /// Crestron platform being run on, Appliance (crestron hardware) or Server (VC-4) + /// + public static eCrestronDevicePlatform CrestronDevicePlatform { get { return s_CrestronDevicePlatform; } } + /// /// Returns true if the program has been flagged as completely initialized. ///