fix: updated CEN-IO classes inheriting from EssentialsDevice to CrestronGenericBaseDevice to resolve activation issues

This commit is contained in:
jdevito
2022-08-31 14:43:58 -05:00
parent 40cb1b0fcf
commit fb689c4484
3 changed files with 76 additions and 69 deletions

View File

@@ -16,7 +16,7 @@ namespace PepperDash.Essentials.Core
/// Wrapper class for CEN-IO-DIGIN-104 digital input module /// Wrapper class for CEN-IO-DIGIN-104 digital input module
/// </summary> /// </summary>
[Description("Wrapper class for the CEN-IO-DIGIN-104 diginal input module")] [Description("Wrapper class for the CEN-IO-DIGIN-104 diginal input module")]
public class CenIoDigIn104Controller : EssentialsDevice, IDigitalInputPorts public class CenIoDigIn104Controller : CrestronGenericBaseDevice, IDigitalInputPorts
{ {
public CenIoDi104 Di104 { get; private set; } public CenIoDi104 Di104 { get; private set; }
@@ -52,10 +52,17 @@ namespace PepperDash.Essentials.Core
{ {
Debug.Console(1, "Factory Attempting to create new CEN-DIGIN-104 Device"); Debug.Console(1, "Factory Attempting to create new CEN-DIGIN-104 Device");
var control = CommFactory.GetControlPropertiesConfig(dc); var control = CommFactory.GetControlPropertiesConfig(dc);
var ipid = control.IpIdInt; if (control == null)
{
return new CenIoDigIn104Controller(dc.Key, dc.Name, new Crestron.SimplSharpPro.GeneralIO.CenIoDi104(ipid, Global.ControlSystem)); Debug.Console(1, "Factory failed to create a new CEN-DIGIN-104 Device, control properties not found");
return null;
}
var ipid = control.IpIdInt;
if (ipid != 0) return new CenIoDigIn104Controller(dc.Key, dc.Name, new CenIoDi104(ipid, Global.ControlSystem));
Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device using IP-ID-{0}", ipid);
return null;
} }
} }

View File

@@ -1,93 +1,93 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.GeneralIO; using Crestron.SimplSharpPro.GeneralIO;
using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Config;
using PepperDash.Core; using PepperDash.Core;
namespace PepperDash.Essentials.Core namespace PepperDash.Essentials.Core
{ {
/// <summary> /// <summary>
/// Wrapper class for CEN-IO-IR-104 module /// Wrapper class for CEN-IO-IR-104 module
/// </summary> /// </summary>
[Description("Wrapper class for the CEN-IO-IR-104 module")] [Description("Wrapper class for the CEN-IO-IR-104 module")]
public class CenIoIr104Controller : EssentialsDevice, IIROutputPorts public class CenIoIr104Controller : CrestronGenericBaseDevice, IIROutputPorts
{ {
private readonly CenIoIr104 _ir104; private readonly CenIoIr104 _ir104;
/// <summary> /// <summary>
/// Constructor /// Constructor
/// </summary> /// </summary>
/// <param name="key"></param> /// <param name="key"></param>
/// <param name="name"></param> /// <param name="name"></param>
/// <param name="ir104"></param> /// <param name="ir104"></param>
public CenIoIr104Controller(string key, string name, CenIoIr104 ir104) public CenIoIr104Controller(string key, string name, CenIoIr104 ir104)
: base(key, name) : base(key, name, ir104)
{ {
_ir104 = ir104; _ir104 = ir104;
} }
#region IDigitalInputPorts Members #region IDigitalInputPorts Members
/// <summary> /// <summary>
/// IR port collection /// IR port collection
/// </summary> /// </summary>
public CrestronCollection<IROutputPort> IROutputPorts public CrestronCollection<IROutputPort> IROutputPorts
{ {
get { return _ir104.IROutputPorts; } get { return _ir104.IROutputPorts; }
} }
/// <summary> /// <summary>
/// Number of relay ports property /// Number of relay ports property
/// </summary> /// </summary>
public int NumberOfIROutputPorts public int NumberOfIROutputPorts
{ {
get { return _ir104.NumberOfIROutputPorts; } get { return _ir104.NumberOfIROutputPorts; }
} }
#endregion #endregion
} }
/// <summary> /// <summary>
/// CEN-IO-IR-104 controller fatory /// CEN-IO-IR-104 controller fatory
/// </summary> /// </summary>
public class CenIoIr104ControllerFactory : EssentialsDeviceFactory<CenIoIr104Controller> public class CenIoIr104ControllerFactory : EssentialsDeviceFactory<CenIoIr104Controller>
{ {
/// <summary> /// <summary>
/// Constructor /// Constructor
/// </summary> /// </summary>
public CenIoIr104ControllerFactory() public CenIoIr104ControllerFactory()
{ {
TypeNames = new List<string>() { "cenioir104" }; TypeNames = new List<string>() { "cenioir104" };
} }
/// <summary> /// <summary>
/// Build device CEN-IO-IR-104 /// Build device CEN-IO-IR-104
/// </summary> /// </summary>
/// <param name="dc"></param> /// <param name="dc"></param>
/// <returns></returns> /// <returns></returns>
public override EssentialsDevice BuildDevice(DeviceConfig dc) public override EssentialsDevice BuildDevice(DeviceConfig dc)
{ {
Debug.Console(1, "Factory Attempting to create new CEN-IO-IR-104 Device"); Debug.Console(1, "Factory Attempting to create new CEN-IO-IR-104 Device");
var control = CommFactory.GetControlPropertiesConfig(dc); var control = CommFactory.GetControlPropertiesConfig(dc);
if (control == null) if (control == null)
{ {
Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device"); Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device, control properties not found");
return null; return null;
} }
var ipid = control.IpIdInt; var ipid = control.IpIdInt;
if(ipid != 0) return new CenIoIr104Controller(dc.Key, dc.Name, new CenIoIr104(ipid, Global.ControlSystem)); if(ipid != 0) return new CenIoIr104Controller(dc.Key, dc.Name, new CenIoIr104(ipid, Global.ControlSystem));
Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device using IP-ID-{0}", ipid); Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device using IP-ID-{0}", ipid);
return null; return null;
} }
} }
} }

View File

@@ -10,7 +10,7 @@ namespace PepperDash.Essentials.Core
/// Wrapper class for CEN-IO-RY-104 relay module /// Wrapper class for CEN-IO-RY-104 relay module
/// </summary> /// </summary>
[Description("Wrapper class for the CEN-IO-RY-104 relay module")] [Description("Wrapper class for the CEN-IO-RY-104 relay module")]
public class CenIoRy104Controller : EssentialsDevice, IRelayPorts public class CenIoRy104Controller : CrestronGenericBaseDevice, IRelayPorts
{ {
private readonly CenIoRy104 _ry104; private readonly CenIoRy104 _ry104;
@@ -21,7 +21,7 @@ namespace PepperDash.Essentials.Core
/// <param name="name"></param> /// <param name="name"></param>
/// <param name="ry104"></param> /// <param name="ry104"></param>
public CenIoRy104Controller(string key, string name, CenIoRy104 ry104) public CenIoRy104Controller(string key, string name, CenIoRy104 ry104)
: base(key, name) : base(key, name, ry104)
{ {
_ry104 = ry104; _ry104 = ry104;
} }
@@ -62,8 +62,8 @@ namespace PepperDash.Essentials.Core
var controlPropertiesConfig = CommFactory.GetControlPropertiesConfig(dc); var controlPropertiesConfig = CommFactory.GetControlPropertiesConfig(dc);
if (controlPropertiesConfig == null) if (controlPropertiesConfig == null)
{ {
Debug.Console(1, "Factory failed to create a new CEN-IO-RY-104 Device"); Debug.Console(1, "Factory failed to create a new CEN-IO-RY-104 Device, control properties not found");
return null; return null;
} }