feat: Add property to IcdEnvironment to determine if SSL communication is enabled

This commit is contained in:
Austin Noska
2020-08-10 17:24:32 -04:00
committed by Chris Cameron
parent 0ece381939
commit 1a0ea4119e
3 changed files with 43 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added Collection extensions for setting and adding ranges of items
- Added a method for getting the total number of seconds in a date
- Added extensions to raise events with common event args using the data directly
- Added property to IcdEnvironment to determine whether SSL communication is enabled
### Changed
- Repeater changed to use configured callbacks instead of a dumb event

View File

@@ -128,6 +128,39 @@ namespace ICD.Common.Utils
}
}
/// <summary>
/// Gets the SSL state of the processor.
/// </summary>
[PublicAPI]
public static bool SslEnabled
{
get
{
const CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET param =
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_SSL_OFF_STATUS;
const EthernetAdapterType type = EthernetAdapterType.EthernetLANAdapter;
try
{
short id = CrestronEthernetHelper.GetAdapterdIdForSpecifiedAdapterType(type);
if (id >= InitialParametersClass.NumberOfEthernetInterfaces)
return false;
string status = CrestronEthernetHelper.GetEthernetParameter(param, id);
if (!string.IsNullOrEmpty(status) && !status.Equals(INVALID_VALUE))
// GET_SSL_OFF_STATUS return OFF for SSL is Enabled and ON for SSL is disabled
return status == "OFF";
return false;
}
catch (ArgumentException)
{
return false;
}
}
}
/// <summary>
/// Gets the hostname of the processor.
/// </summary>

View File

@@ -73,6 +73,15 @@ namespace ICD.Common.Utils
}
}
/// <summary>
/// Exists for parity with SimplSharp processors which have the ability to enable/disable SSL communication.
/// </summary>
[PublicAPI]
public static bool SslEnabled
{
get { return true; }
}
/// <summary>
/// Gets the hostname of the processor.
/// </summary>