feat(IcdEnvironment):Updated environment to sperate Crestron platform for environment for SW on VC4

This commit is contained in:
Drew Tingen
2022-11-30 11:59:43 -05:00
parent 0acd0ae5d4
commit 56a48175c6
4 changed files with 31 additions and 21 deletions

View File

@@ -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). and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [Unreleased] ## [Unreleased]
### Changed
- IcdEnvironment - Added CrestronDevicePlatform, removed from CrestronRuntimeEnvironment, to support SimplWindows on VC-4
## [16.0.5] 2022-07-11 ## [16.0.5] 2022-07-11
### Changed ### Changed

View File

@@ -195,13 +195,15 @@ namespace ICD.Common.Utils
// Cache the runtime environment // Cache the runtime environment
s_Framework = eFramework.Crestron; s_Framework = eFramework.Crestron;
if (CrestronEnvironment.RuntimeEnvironment == eRuntimeEnvironment.SIMPL) s_CrestronRuntimeEnvironment = CrestronEnvironment.RuntimeEnvironment == eRuntimeEnvironment.SIMPL
s_CrestronRuntimeEnvironment = eCrestronRuntimeEnvironment.Simpl; ? eCrestronRuntimeEnvironment.SimplPlus
else if (CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance) : eCrestronRuntimeEnvironment.SimplSharpPro;
s_CrestronRuntimeEnvironment = eCrestronRuntimeEnvironment.Appliance;
else
s_CrestronRuntimeEnvironment = eCrestronRuntimeEnvironment.Server;
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; s_CrestronSeries = Type.GetType("Mono.Runtime") != null ? eCrestronSeries.FourSeries : eCrestronSeries.ThreeSeries;
CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironmentOnProgramStatusEventHandler; CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironmentOnProgramStatusEventHandler;

View File

@@ -107,20 +107,10 @@ namespace ICD.Common.Utils
static IcdEnvironment() 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_Framework = eFramework.Standard;
s_CrestronSeries = eCrestronSeries.Na; s_CrestronSeries = eCrestronSeries.Na;
s_CrestronRuntimeEnvironment = eCrestronRuntimeEnvironment.Na; s_CrestronRuntimeEnvironment = eCrestronRuntimeEnvironment.Na;
#endif s_CrestronDevicePlatform = eCrestronDevicePlatform.Na;
} }
/// <summary> /// <summary>

View File

@@ -32,9 +32,15 @@ namespace ICD.Common.Utils
public enum eCrestronRuntimeEnvironment public enum eCrestronRuntimeEnvironment
{ {
Na, //Non-Crestron Na, //Non-Crestron
Simpl, // Running in Simpl, Non-Pro SimplPlus, // Running in Simpl+, Non-Pro
Appliance, // S#Pro running on a Crestron hardware appliance SimplSharpPro // Running in Simpl#Pro
Server // S#Pro running on a server (VC-4) }
public enum eCrestronDevicePlatform
{
Na, // Non-Crestron
Appliance, // Running on Crestron hardware appliance
Server // Running on VC-4 Server
} }
/// <summary> /// <summary>
@@ -120,14 +126,24 @@ namespace ICD.Common.Utils
private static readonly eFramework s_Framework; private static readonly eFramework s_Framework;
private static readonly eCrestronSeries s_CrestronSeries; private static readonly eCrestronSeries s_CrestronSeries;
private static readonly eCrestronRuntimeEnvironment s_CrestronRuntimeEnvironment; private static readonly eCrestronRuntimeEnvironment s_CrestronRuntimeEnvironment;
private static readonly eCrestronDevicePlatform s_CrestronDevicePlatform;
private static readonly SafeCriticalSection s_ProgramInitializationSection = new SafeCriticalSection(); private static readonly SafeCriticalSection s_ProgramInitializationSection = new SafeCriticalSection();
private static bool s_ProgramInitializationComplete; private static bool s_ProgramInitializationComplete;
public static eFramework Framework {get { return s_Framework; }} public static eFramework Framework {get { return s_Framework; }}
public static eCrestronSeries CrestronSeries {get { return s_CrestronSeries; }} public static eCrestronSeries CrestronSeries {get { return s_CrestronSeries; }}
/// <summary>
/// Crestron environment being run in, SimplPlus or SimplSharpPro
/// </summary>
public static eCrestronRuntimeEnvironment CrestronRuntimeEnvironment {get { return s_CrestronRuntimeEnvironment; }} public static eCrestronRuntimeEnvironment CrestronRuntimeEnvironment {get { return s_CrestronRuntimeEnvironment; }}
/// <summary>
/// Crestron platform being run on, Appliance (crestron hardware) or Server (VC-4)
/// </summary>
public static eCrestronDevicePlatform CrestronDevicePlatform { get { return s_CrestronDevicePlatform; } }
/// <summary> /// <summary>
/// Returns true if the program has been flagged as completely initialized. /// Returns true if the program has been flagged as completely initialized.
/// </summary> /// </summary>