Merge pull request #1169 from PepperDash/hotfix/latest-dbs

Hotfix/latest dbs
This commit is contained in:
Andrew Welker
2024-02-02 08:33:23 -06:00
committed by GitHub
3 changed files with 87 additions and 1 deletions

View File

@@ -0,0 +1,85 @@
using System.Collections.Generic;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.GeneralIO;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core.CrestronIO
{
/// <summary>
/// Wrapper class for CEN-IO-COM-Xxx expander module
/// </summary>
[Description("Wrapper class for the CEN-IO-COM-102 & CEN-IO-COM-202 expander module")]
public class CenIoComController : CrestronGenericBaseDevice, IComPorts
{
private readonly CenIoCom _cenIoCom;
public CenIoComController(string key, string name, CenIoCom cenIo)
:base(key, name, cenIo)
{
_cenIoCom = cenIo;
}
#region Implementation of IComPorts
public CrestronCollection<ComPort> ComPorts
{
get { return _cenIoCom.ComPorts; }
}
public int NumberOfComPorts
{
get { return _cenIoCom.NumberOfComPorts; }
}
#endregion
}
public class CenIoCom102ControllerFactory : EssentialsDeviceFactory<CenIoComController>
{
private const string CenIoCom102Type = "ceniocom102";
private const string CenIoCom202Type = "ceniocom202";
public CenIoCom102ControllerFactory()
{
TypeNames = new List<string> { CenIoCom102Type, CenIoCom202Type };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new CEN-IO-COM-Xxx Device");
var control = CommFactory.GetControlPropertiesConfig(dc);
if (control == null)
{
Debug.Console(1, "Factory failed to create a new CEN-IO-COM-Xxx Device, control properties not found");
return null;
}
var ipid = control.IpIdInt;
if (ipid < 2)
{
Debug.Console(1, "Factory failed to create a new CEN-IO-COM-Xxx Device, invalid IP-ID found");
return null;
}
switch (dc.Type)
{
case CenIoCom102Type:
{
return new CenIoComController(dc.Key, dc.Name, new CenIoCom102(ipid, Global.ControlSystem));
}
case CenIoCom202Type:
{
return new CenIoComController(dc.Key, dc.Name, new CenIoCom202(ipid, Global.ControlSystem));
}
default:
{
Debug.Console(1, "Factory failed to create a new CEN-IO-COM-Xxx Device, invalid type '{0}'", dc.Type);
return null;
}
}
}
}
}

View File

@@ -185,6 +185,7 @@
</Compile>
<Compile Include="Crestron IO\Cards\CenCi33Controller.cs" />
<Compile Include="Crestron IO\Cards\InternalCardCageController.cs" />
<Compile Include="Crestron IO\CenIoCom\CenIoComController.cs" />
<Compile Include="Crestron IO\DinCenCn\DinCenCnController.cs" />
<Compile Include="Crestron IO\DinCenCn\IHasCresnetBranches.cs" />
<Compile Include="Crestron IO\DinIo8\DinIo8Controller.cs" />

View File

@@ -1,3 +1,3 @@
<packages>
<package id="PepperDashCore" version="1.3.1" targetFramework="net35" allowedVersions="[1.0,2.0)"/>
<package id="PepperDashCore" version="1.3.2" targetFramework="net35" allowedVersions="[1.0,2.0)"/>
</packages>