diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/Hrxxx0WirelessRemoteControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/Hrxxx0WirelessRemoteControllerJoinMap.cs new file mode 100644 index 00000000..f9037aa0 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/Hrxxx0WirelessRemoteControllerJoinMap.cs @@ -0,0 +1,238 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +namespace PepperDash.Essentials.Core.Bridges +{ + public class Hrxxx0WirelessRemoteControllerJoinMap : JoinMapBaseAdvanced + { + [JoinName("Power")] + public JoinDataComplete Power = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Power", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Menu")] + public JoinDataComplete Menu = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Menu", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Guide")] + public JoinDataComplete Guide = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "Guide", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Info")] + public JoinDataComplete Info = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 }, + new JoinMetadata() { Label = "Info", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("VolumeUp")] + public JoinDataComplete VolumeUp = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, + new JoinMetadata() { Label = "VolumeUp", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("VolumeDown")] + public JoinDataComplete VolumeDown = new JoinDataComplete(new JoinData() { JoinNumber = 6, JoinSpan = 1 }, + new JoinMetadata() { Label = "VolumeDown", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DialPadUp")] + public JoinDataComplete DialPadUp = new JoinDataComplete(new JoinData() { JoinNumber = 7, JoinSpan = 1 }, + new JoinMetadata() { Label = "DialPadUp", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DialPadDown")] + public JoinDataComplete DialPadDown = new JoinDataComplete(new JoinData() { JoinNumber = 8, JoinSpan = 1 }, + new JoinMetadata() { Label = "DialPadDown", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DialPadLeft")] + public JoinDataComplete DialPadLeft = new JoinDataComplete(new JoinData() { JoinNumber = 9, JoinSpan = 1 }, + new JoinMetadata() { Label = "DialPadLeft", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DialPadRight")] + public JoinDataComplete DialPadRight = new JoinDataComplete(new JoinData() { JoinNumber = 10, JoinSpan = 1 }, + new JoinMetadata() { Label = "DialPadRight", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DialPadSelect")] + public JoinDataComplete DialPadSelect = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 1 }, + new JoinMetadata() { Label = "DialPadSelect", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("ChannelUp")] + public JoinDataComplete ChannelUp = new JoinDataComplete(new JoinData() { JoinNumber = 12, JoinSpan = 1 }, + new JoinMetadata() { Label = "ChannelUp", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("ChannelDown")] + public JoinDataComplete ChannelDown = new JoinDataComplete(new JoinData() { JoinNumber = 13, JoinSpan = 1 }, + new JoinMetadata() { Label = "ChannelDown", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Mute")] + public JoinDataComplete Mute = new JoinDataComplete(new JoinData() { JoinNumber = 14, JoinSpan = 1 }, + new JoinMetadata() { Label = "Mute", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Exit")] + public JoinDataComplete Exit = new JoinDataComplete(new JoinData() { JoinNumber = 15, JoinSpan = 1 }, + new JoinMetadata() { Label = "Exit", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Last")] + public JoinDataComplete Last = new JoinDataComplete(new JoinData() { JoinNumber = 16, JoinSpan = 1 }, + new JoinMetadata() { Label = "Last", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Play")] + public JoinDataComplete Play = new JoinDataComplete(new JoinData() { JoinNumber = 17, JoinSpan = 1 }, + new JoinMetadata() { Label = "Play", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Pause")] + public JoinDataComplete Pause = new JoinDataComplete(new JoinData() { JoinNumber = 18, JoinSpan = 1 }, + new JoinMetadata() { Label = "Pause", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Rewind")] + public JoinDataComplete Rewind = new JoinDataComplete(new JoinData() { JoinNumber = 19, JoinSpan = 1 }, + new JoinMetadata() { Label = "Rewind", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("FastForward")] + public JoinDataComplete FastForward = new JoinDataComplete(new JoinData() { JoinNumber = 20, JoinSpan = 1 }, + new JoinMetadata() { Label = "FastForward", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("PreviousTrack")] + public JoinDataComplete PreviousTrack = new JoinDataComplete(new JoinData() { JoinNumber = 21, JoinSpan = 1 }, + new JoinMetadata() { Label = "PreviousTrack", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("NextTrack")] + public JoinDataComplete NextTrack = new JoinDataComplete(new JoinData() { JoinNumber = 22, JoinSpan = 1 }, + new JoinMetadata() { Label = "NextTrack", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Stop")] + public JoinDataComplete Stop = new JoinDataComplete(new JoinData() { JoinNumber = 23, JoinSpan = 1 }, + new JoinMetadata() { Label = "Stop", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Record")] + public JoinDataComplete Record = new JoinDataComplete(new JoinData() { JoinNumber = 24, JoinSpan = 1 }, + new JoinMetadata() { Label = "Record", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Dvr")] + public JoinDataComplete Dvr = new JoinDataComplete(new JoinData() { JoinNumber = 25, JoinSpan = 1 }, + new JoinMetadata() { Label = "Dvr", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Keypad1")] + public JoinDataComplete Keypad1 = new JoinDataComplete(new JoinData() { JoinNumber = 26, JoinSpan = 1 }, + new JoinMetadata() { Label = "Keypad1", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Keypad2Abc")] + public JoinDataComplete Keypad2 = new JoinDataComplete(new JoinData() { JoinNumber = 27, JoinSpan = 1 }, + new JoinMetadata() { Label = "Keypad2Abc", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Keypad3Def")] + public JoinDataComplete Keypad3Def = new JoinDataComplete(new JoinData() { JoinNumber = 28, JoinSpan = 1 }, + new JoinMetadata() { Label = "Keypad3Def", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Keypad4Ghi")] + public JoinDataComplete Keypad4Ghi = new JoinDataComplete(new JoinData() { JoinNumber = 29, JoinSpan = 1 }, + new JoinMetadata() { Label = "Keypad4Ghi", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Keypad5Jkl")] + public JoinDataComplete Keypad5Jkl = new JoinDataComplete(new JoinData() { JoinNumber = 30, JoinSpan = 1 }, + new JoinMetadata() { Label = "Keypad5Jkl", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Keypad6Mno")] + public JoinDataComplete Keypad6Mno = new JoinDataComplete(new JoinData() { JoinNumber = 31, JoinSpan = 1 }, + new JoinMetadata() { Label = "Keypad6Mno", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Keypad7Pqrs")] + public JoinDataComplete Keypad7Pqrs = new JoinDataComplete(new JoinData() { JoinNumber = 32, JoinSpan = 1 }, + new JoinMetadata() { Label = "Keypad7Pqrs", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Keypad8Tuv")] + public JoinDataComplete Keypad8Tuv = new JoinDataComplete(new JoinData() { JoinNumber = 33, JoinSpan = 1 }, + new JoinMetadata() { Label = "Keypad8Tuv", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Keypad9Wxyz")] + public JoinDataComplete Keypad9Wxyz = new JoinDataComplete(new JoinData() { JoinNumber = 34, JoinSpan = 1 }, + new JoinMetadata() { Label = "Keypad9Wxyz", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Keypad0")] + public JoinDataComplete Keypad0 = new JoinDataComplete(new JoinData() { JoinNumber = 35, JoinSpan = 1 }, + new JoinMetadata() { Label = "Keypad0", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Clear")] + public JoinDataComplete Clear = new JoinDataComplete(new JoinData() { JoinNumber = 36, JoinSpan = 1 }, + new JoinMetadata() { Label = "Clear", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Enter")] + public JoinDataComplete Enter = new JoinDataComplete(new JoinData() { JoinNumber = 37, JoinSpan = 1 }, + new JoinMetadata() { Label = "Enter", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Red")] + public JoinDataComplete Red = new JoinDataComplete(new JoinData() { JoinNumber = 38, JoinSpan = 1 }, + new JoinMetadata() { Label = "Red", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Green")] + public JoinDataComplete Green = new JoinDataComplete(new JoinData() { JoinNumber = 39, JoinSpan = 1 }, + new JoinMetadata() { Label = "Green", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Yellow")] + public JoinDataComplete Yellow = new JoinDataComplete(new JoinData() { JoinNumber = 40, JoinSpan = 1 }, + new JoinMetadata() { Label = "Yellow", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Blue")] + public JoinDataComplete Blue = new JoinDataComplete(new JoinData() { JoinNumber = 41, JoinSpan = 1 }, + new JoinMetadata() { Label = "Blue", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Custom1")] + public JoinDataComplete Custom1 = new JoinDataComplete(new JoinData() { JoinNumber = 42, JoinSpan = 1 }, + new JoinMetadata() { Label = "Custom1", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Custom2")] + public JoinDataComplete Custom2 = new JoinDataComplete(new JoinData() { JoinNumber = 43, JoinSpan = 1 }, + new JoinMetadata() { Label = "Custom2", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Custom3")] + public JoinDataComplete Custom3 = new JoinDataComplete(new JoinData() { JoinNumber = 44, JoinSpan = 1 }, + new JoinMetadata() { Label = "Custom3", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Custom4")] + public JoinDataComplete Custom4 = new JoinDataComplete(new JoinData() { JoinNumber = 45, JoinSpan = 1 }, + new JoinMetadata() { Label = "Custom4", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Custom5")] + public JoinDataComplete Custom5 = new JoinDataComplete(new JoinData() { JoinNumber = 46, JoinSpan = 1 }, + new JoinMetadata() { Label = "Custom5", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Custom6")] + public JoinDataComplete Custom6 = new JoinDataComplete(new JoinData() { JoinNumber = 47, JoinSpan = 1 }, + new JoinMetadata() { Label = "Custom6", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Custom7")] + public JoinDataComplete Custom7 = new JoinDataComplete(new JoinData() { JoinNumber = 48, JoinSpan = 1 }, + new JoinMetadata() { Label = "Custom7", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Custom8")] + public JoinDataComplete Custom8 = new JoinDataComplete(new JoinData() { JoinNumber = 49, JoinSpan = 1 }, + new JoinMetadata() { Label = "Custom8", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Custom9")] + public JoinDataComplete Custom9 = new JoinDataComplete(new JoinData() { JoinNumber = 50, JoinSpan = 1 }, + new JoinMetadata() { Label = "Custom9", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Fav")] + public JoinDataComplete Fav = new JoinDataComplete(new JoinData() { JoinNumber = 51, JoinSpan = 1 }, + new JoinMetadata() { Label = "Fav", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Home")] + public JoinDataComplete Home = new JoinDataComplete(new JoinData() { JoinNumber = 52, JoinSpan = 1 }, + new JoinMetadata() { Label = "Home", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("BatteryLow")] + public JoinDataComplete BatteryLow = new JoinDataComplete(new JoinData() { JoinNumber = 53, JoinSpan = 1 }, + new JoinMetadata() { Label = "BatteryLow", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("BatteryCritical")] + public JoinDataComplete BatteryCritical = new JoinDataComplete(new JoinData() { JoinNumber = 54, JoinSpan = 1 }, + new JoinMetadata() { Label = "BatteryCritical", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("BatteryVoltage")] + public JoinDataComplete BatteryVoltage = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "BatteryVoltage", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + public Hrxxx0WirelessRemoteControllerJoinMap(uint joinStart) + : base(joinStart, typeof(Hrxxx0WirelessRemoteControllerJoinMap)) + { + } + + + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CommFactory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CommFactory.cs index 94110fd7..eaf109ef 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CommFactory.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CommFactory.cs @@ -184,6 +184,26 @@ namespace PepperDash.Essentials.Core throw new FormatException(string.Format("ERROR:Unable to convert Cresnet ID: {0} to hex. Error:\n{1}", CresnetId)); } } + } + + public string InfinetId { get; set; } + + /// + /// Attepmts to provide uiont conversion of string InifinetId + /// + public uint InfinetIdInt + { + get + { + try + { + return Convert.ToUInt32(InfinetId, 16); + } + catch (Exception) + { + throw new FormatException(string.Format("ERROR:Unable to conver Infinet ID: {0} to hex. Error:\n{1}", InfinetId)); + } + } } } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/DELETE ComPortController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/DELETE ComPortController.cs deleted file mode 100644 index ece72b20..00000000 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/DELETE ComPortController.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; - -using Newtonsoft.Json; - -namespace PepperDash.Essentials.Core -{ - public class ComPortController : Device, IBasicCommunication - { - public event EventHandler BytesReceived; - public event EventHandler TextReceived; - - ComPort Port; - ComPort.ComPortSpec Spec; - - public ComPortController(string key, IComPorts ComDevice, uint comPortNum, ComPort.ComPortSpec spec) - : base(key) - { - Port = ComDevice.ComPorts[comPortNum]; - Spec = spec; - - Debug.Console(2, "Creating com port '{0}'", key); - Debug.Console(2, "Com port spec:\r{0}", JsonConvert.SerializeObject(spec)); - } - - /// - /// Creates a ComPort if the parameters are correct. Returns and logs errors if not - /// - public static ComPortController GetComPortController(string key, - IComPorts comDevice, uint comPortNum, ComPort.ComPortSpec spec) - { - Debug.Console(1, "Creating com port '{0}'", key); - if (comDevice == null) - throw new ArgumentNullException("comDevice"); - if (string.IsNullOrEmpty(key)) - throw new ArgumentNullException("key"); - if (comPortNum > comDevice.NumberOfComPorts) - { - Debug.Console(0, "[{0}] Com port {1} out of range on {2}", - key, comPortNum, comDevice.GetType().Name); - return null; - } - var port = new ComPortController(key, comDevice, comPortNum, spec); - return port; - } - - /// - /// Registers port and sends ComSpec - /// - /// false if either register or comspec fails - public override bool CustomActivate() - { - var result = Port.Register(); - if (result != eDeviceRegistrationUnRegistrationResponse.Success) - { - Debug.Console(0, this, "Cannot register Com port: {0}", result); - return false; - } - var specResult = Port.SetComPortSpec(Spec); - if (specResult != 0) - { - Debug.Console(0, this, "Cannot set comspec"); - return false; - } - Port.SerialDataReceived += new ComPortDataReceivedEvent(Port_SerialDataReceived); - return true; - } - - void Port_SerialDataReceived(ComPort ReceivingComPort, ComPortSerialDataEventArgs args) - { - if (BytesReceived != null) - { - var bytes = Encoding.GetEncoding(28591).GetBytes(args.SerialData); - BytesReceived(this, new GenericCommMethodReceiveBytesArgs(bytes)); - } - if(TextReceived != null) - TextReceived(this, new GenericCommMethodReceiveTextArgs(args.SerialData)); - } - - public override bool Deactivate() - { - return Port.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success; - } - - #region IBasicCommunication Members - - public void SendText(string text) - { - Port.Send(text); - } - - public void SendBytes(byte[] bytes) - { - - var text = Encoding.GetEncoding(28591).GetString(bytes, 0, bytes.Length); - Port.Send(text); - } - - #endregion - } -} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/IRPortHelper.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/IRPortHelper.cs index 015b03ea..28a7eb9f 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/IRPortHelper.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/IRPortHelper.cs @@ -78,70 +78,145 @@ namespace PepperDash.Essentials.Core portDevKey, portNum); return port; } - } + } + + public static IROutputPort GetIrOutputPort(DeviceConfig dc) + { + var irControllerKey = dc.Key + "-ir"; + if (dc.Properties == null) + { + Debug.Console(0, "[{0}] WARNING: Device config does not include properties. IR will not function.", dc.Key); + return null; + } + + var control = dc.Properties["control"]; + if (control == null) + { + Debug.Console(0, + "WARNING: Device config does not include control properties. IR will not function for {0}", dc.Key); + return null; + } + + var portDevKey = control.Value("controlPortDevKey"); + var portNum = control.Value("controlPortNumber"); + IIROutputPorts irDev = null; + + if (portDevKey == null) + { + Debug.Console(0, "WARNING: control properties is missing ir device for {0}", dc.Key); + return null; + } + + if (portNum == 0) + { + Debug.Console(0, "WARNING: control properties is missing ir port number for {0}", dc.Key); + return null; + } + + if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase) + || portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase)) + irDev = Global.ControlSystem; + else + irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts; + + if (irDev == null) + { + Debug.Console(0, "WARNING: device with IR ports '{0}' not found", portDevKey); + return null; + } + if (portNum >= irDev.NumberOfIROutputPorts) + { + Debug.Console(0, "WARNING: device '{0}' IR port {1} out of range", + portDevKey, portNum); + return null; + } + + + var port = irDev.IROutputPorts[portNum]; + + port.LoadIRDriver(Global.FilePathPrefix + "IR" + Global.DirectorySeparator + control["irFile"].Value()); + + return port; + + } + + public static IrOutputPortController GetIrOutputPortController(DeviceConfig config) + { + Debug.Console(1, "Attempting to create new Ir Port Controller"); + + if (config == null) + { + return null; + } + + var irDevice = new IrOutputPortController(config.Key, GetIrOutputPort, config); + + return irDevice; + } + + /* + /// + /// Returns a ready-to-go IrOutputPortController from a DeviceConfig object. + /// + public static IrOutputPortController GetIrOutputPortController(DeviceConfig devConf) + { + var irControllerKey = devConf.Key + "-ir"; + if (devConf.Properties == null) + { + Debug.Console(0, "[{0}] WARNING: Device config does not include properties. IR will not function.", devConf.Key); + return new IrOutputPortController(irControllerKey, null, ""); + } - /// - /// Returns a ready-to-go IrOutputPortController from a DeviceConfig object. - /// - public static IrOutputPortController GetIrOutputPortController(DeviceConfig devConf) - { - var irControllerKey = devConf.Key + "-ir"; - if (devConf.Properties == null) - { - Debug.Console(0, "[{0}] WARNING: Device config does not include properties. IR will not function.", devConf.Key); - return new IrOutputPortController(irControllerKey, null, ""); - } + var control = devConf.Properties["control"]; + if (control == null) + { + var c = new IrOutputPortController(irControllerKey, null, ""); + Debug.Console(0, c, "WARNING: Device config does not include control properties. IR will not function"); + return c; + } - var control = devConf.Properties["control"]; - if (control == null) - { - var c = new IrOutputPortController(irControllerKey, null, ""); - Debug.Console(0, c, "WARNING: Device config does not include control properties. IR will not function"); - return c; - } + var portDevKey = control.Value("controlPortDevKey"); + var portNum = control.Value("controlPortNumber"); + IIROutputPorts irDev = null; - var portDevKey = control.Value("controlPortDevKey"); - var portNum = control.Value("controlPortNumber"); - IIROutputPorts irDev = null; + if (portDevKey == null) + { + var c = new IrOutputPortController(irControllerKey, null, ""); + Debug.Console(0, c, "WARNING: control properties is missing ir device"); + return c; + } - if (portDevKey == null) - { - var c = new IrOutputPortController(irControllerKey, null, ""); - Debug.Console(0, c, "WARNING: control properties is missing ir device"); - return c; - } + if (portNum == 0) + { + var c = new IrOutputPortController(irControllerKey, null, ""); + Debug.Console(0, c, "WARNING: control properties is missing ir port number"); + return c; + } - if (portNum == 0) - { - var c = new IrOutputPortController(irControllerKey, null, ""); - Debug.Console(0, c, "WARNING: control properties is missing ir port number"); - return c; - } + if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase) + || portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase)) + irDev = Global.ControlSystem; + else + irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts; - if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase) - || portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase)) - irDev = Global.ControlSystem; - else - irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts; + if (irDev == null) + { + var c = new IrOutputPortController(irControllerKey, null, ""); + Debug.Console(0, c, "WARNING: device with IR ports '{0}' not found", portDevKey); + return c; + } - if (irDev == null) - { - var c = new IrOutputPortController(irControllerKey, null, ""); - Debug.Console(0, c, "WARNING: device with IR ports '{0}' not found", portDevKey); - return c; - } - - if (portNum <= irDev.NumberOfIROutputPorts) // success! - return new IrOutputPortController(irControllerKey, irDev.IROutputPorts[portNum], - IrDriverPathPrefix + control["irFile"].Value()); - else - { - var c = new IrOutputPortController(irControllerKey, null, ""); - Debug.Console(0, c, "WARNING: device '{0}' IR port {1} out of range", - portDevKey, portNum); - return c; - } - } + if (portNum <= irDev.NumberOfIROutputPorts) // success! + return new IrOutputPortController(irControllerKey, irDev.IROutputPorts[portNum], + IrDriverPathPrefix + control["irFile"].Value()); + else + { + var c = new IrOutputPortController(irControllerKey, null, ""); + Debug.Console(0, c, "WARNING: device '{0}' IR port {1} out of range", + portDevKey, portNum); + return c; + } + }*/ } /// diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs index 774c7490..801127c9 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs @@ -12,7 +12,8 @@ using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.Core.CrestronIO -{ +{ + [Description("Wrapper class for Digital Input")] public class GenericDigitalInputDevice : EssentialsBridgeableDevice, IDigitalInput { public DigitalInput InputPort { get; private set; } @@ -26,23 +27,78 @@ namespace PepperDash.Essentials.Core.CrestronIO return () => InputPort.State; } } - - public GenericDigitalInputDevice(string key, DigitalInput inputPort): - base(key) - { - InputStateFeedback = new BoolFeedback(InputStateFeedbackFunc); - - InputPort = inputPort; - - InputPort.StateChange += InputPort_StateChange; - - } - + + + public GenericDigitalInputDevice(string key, string name, Func postActivationFunc, + IOPortConfig config) + : base(key, name) + { + + AddPostActivationAction(() => + { + InputPort = postActivationFunc(config); + + InputPort.Register(); + + InputPort.StateChange += InputPort_StateChange; + + }); + } + + #region Events + void InputPort_StateChange(DigitalInput digitalInput, DigitalInputEventArgs args) { - InputStateFeedback.FireUpdate(); - } - + InputStateFeedback.FireUpdate(); + } + + #endregion + + #region PreActivate + + private static DigitalInput GetDigitalInput(IOPortConfig dc) + { + IDigitalInputPorts ioPortDevice; + + if (dc.PortDeviceKey.Equals("processor")) + { + if (!Global.ControlSystem.SupportsDigitalInput) + { + Debug.Console(0, "GetDigitalInput: Processor does not support Digital Inputs"); + return null; + } + ioPortDevice = Global.ControlSystem; + } + else + { + var ioPortDev = DeviceManager.GetDeviceForKey(dc.PortDeviceKey) as IDigitalInputPorts; + if (ioPortDev == null) + { + Debug.Console(0, "GetDigitalInput: Device {0} is not a valid device", dc.PortDeviceKey); + return null; + } + ioPortDevice = ioPortDev; + } + if (ioPortDevice == null) + { + Debug.Console(0, "GetDigitalInput: Device '0' is not a valid IRelayPorts Device", dc.PortDeviceKey); + return null; + } + + if (dc.PortNumber > ioPortDevice.NumberOfDigitalInputPorts) + { + Debug.Console(0, "GetDigitalInput: Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber); + } + + return ioPortDevice.DigitalInputPorts[dc.PortNumber]; + + + } + + #endregion + + #region Bridge Linking + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new IDigitalInputJoinMap(joinStart); @@ -65,98 +121,37 @@ namespace PepperDash.Essentials.Core.CrestronIO { Debug.Console(1, this, "Unable to link device '{0}'. Input is null", Key); Debug.Console(1, this, "Error: {0}", e); - } - } + } + } + + #endregion + + #region Factory + + public class GenericDigitalInputDeviceFactory : EssentialsDeviceFactory + { + public GenericDigitalInputDeviceFactory() + { + TypeNames = new List() { "digitalinput" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Generic Relay Device"); + + var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); + + if (props == null) return null; + + var portDevice = new GenericDigitalInputDevice(dc.Key, dc.Name, GetDigitalInput, props); + + return portDevice; + } + } + + #endregion + } - public class GenericDigitalInputDeviceFactory : EssentialsDeviceFactory - { - public GenericDigitalInputDeviceFactory() - { - TypeNames = new List() { "digitalinput" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new Digtal Input Device"); - - var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); - - IDigitalInputPorts portDevice; - - if (props.PortDeviceKey == "processor") - portDevice = Global.ControlSystem as IDigitalInputPorts; - else - portDevice = DeviceManager.GetDeviceForKey(props.PortDeviceKey) as IDigitalInputPorts; - - if (portDevice == null) - Debug.Console(0, "ERROR: Unable to add digital input device with key '{0}'. Port Device does not support digital inputs", dc.Key); - else - { - var cs = (portDevice as CrestronControlSystem); - if (cs == null) - { - Debug.Console(0, "ERROR: Port device for [{0}] is not control system", props.PortDeviceKey); - return null; - } - - if (cs.SupportsVersiport) - { - Debug.Console(1, "Attempting to add Digital Input device to Versiport port '{0}'", props.PortNumber); - - if (props.PortNumber > cs.NumberOfVersiPorts) - { - Debug.Console(0, "WARNING: Cannot add Vesiport {0} on {1}. Out of range", - props.PortNumber, props.PortDeviceKey); - return null; - } - - Versiport vp = cs.VersiPorts[props.PortNumber]; - - if (!vp.Registered) - { - var regSuccess = vp.Register(); - if (regSuccess == eDeviceRegistrationUnRegistrationResponse.Success) - { - Debug.Console(1, "Successfully Created Digital Input Device on Versiport"); - return new GenericVersiportDigitalInputDevice(dc.Key, vp, props); - } - else - { - Debug.Console(0, "WARNING: Attempt to register versiport {0} on device with key '{1}' failed: {2}", - props.PortNumber, props.PortDeviceKey, regSuccess); - return null; - } - } - } - else if (cs.SupportsDigitalInput) - { - Debug.Console(1, "Attempting to add Digital Input device to Digital Input port '{0}'", props.PortNumber); - - if (props.PortNumber > cs.NumberOfDigitalInputPorts) - { - Debug.Console(0, "WARNING: Cannot register DIO port {0} on {1}. Out of range", - props.PortNumber, props.PortDeviceKey); - return null; - } - - DigitalInput digitalInput = cs.DigitalInputPorts[props.PortNumber]; - - if (!digitalInput.Registered) - { - if (digitalInput.Register() == eDeviceRegistrationUnRegistrationResponse.Success) - { - Debug.Console(1, "Successfully Created Digital Input Device on Digital Input"); - return new GenericDigitalInputDevice(dc.Key, digitalInput); - } - else - Debug.Console(0, "WARNING: Attempt to register digital input {0} on device with key '{1}' failed.", - props.PortNumber, props.PortDeviceKey); - } - } - } - return null; - } - } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs index b79a8253..f3466683 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs @@ -14,46 +14,114 @@ namespace PepperDash.Essentials.Core.CrestronIO { /// /// Represents a generic device controlled by relays - /// + /// + [Description("Wrapper class for a Relay")] public class GenericRelayDevice : EssentialsBridgeableDevice, ISwitchedOutput { public Relay RelayOutput { get; private set; } - public BoolFeedback OutputIsOnFeedback { get; private set; } - - public GenericRelayDevice(string key, Relay relay): - base(key) - { - OutputIsOnFeedback = new BoolFeedback(new Func(() => RelayOutput.State)); - - RelayOutput = relay; - RelayOutput.Register(); - - RelayOutput.StateChange += new RelayEventHandler(RelayOutput_StateChange); - } - + public BoolFeedback OutputIsOnFeedback { get; private set; } + + //Maintained for compatibility with PepperDash.Essentials.Core.Devices.CrestronProcessor + public GenericRelayDevice(string key, Relay relay) : + base(key) + { + OutputIsOnFeedback = new BoolFeedback(new Func(() => RelayOutput.State)); + + RelayOutput = relay; + RelayOutput.Register(); + + RelayOutput.StateChange += new RelayEventHandler(RelayOutput_StateChange); + } + + public GenericRelayDevice(string key, string name, Func postActivationFunc, + IOPortConfig config) + : base(key, name) + { + + AddPostActivationAction(() => + { + RelayOutput = postActivationFunc(config); + + RelayOutput.Register(); + + RelayOutput.StateChange += RelayOutput_StateChange; + + }); + } + + #region PreActivate + + private static Relay GetRelay(IOPortConfig dc) + { + + IRelayPorts relayDevice; + + if(dc.PortDeviceKey.Equals("processor")) + { + if (!Global.ControlSystem.SupportsRelay) + { + Debug.Console(0, "GetRelayDevice: Processor does not support relays"); + return null; + } + relayDevice = Global.ControlSystem; + } + else + { + var relayDev = DeviceManager.GetDeviceForKey(dc.PortDeviceKey) as IRelayPorts; + if (relayDev == null) + { + Debug.Console(0, "GetRelayDevice: Device {0} is not a valid device", dc.PortDeviceKey); + return null; + } + relayDevice = relayDev; + } + if (relayDevice == null) + { + Debug.Console(0, "GetRelayDevice: Device '0' is not a valid IRelayPorts Device", dc.PortDeviceKey); + return null; + } + + if (dc.PortNumber > relayDevice.NumberOfRelayPorts) + { + Debug.Console(0, "GetRelayDevice: Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber); + } + + return relayDevice.RelayPorts[dc.PortNumber]; + } + + #endregion + + #region Events + void RelayOutput_StateChange(Relay relay, RelayEventArgs args) { - OutputIsOnFeedback.FireUpdate(); + OutputIsOnFeedback.FireUpdate(); } - public void OpenRelay() - { - RelayOutput.State = false; - } - - public void CloseRelay() - { - RelayOutput.State = true; - } - - public void ToggleRelayState() - { - if (RelayOutput.State == true) - OpenRelay(); - else - CloseRelay(); + #endregion + + #region Methods + + public void OpenRelay() + { + RelayOutput.State = false; + } + + public void CloseRelay() + { + RelayOutput.State = true; + } + + public void ToggleRelayState() + { + if (RelayOutput.State == true) + OpenRelay(); + else + CloseRelay(); } + + #endregion #region ISwitchedOutput Members @@ -67,8 +135,10 @@ namespace PepperDash.Essentials.Core.CrestronIO OpenRelay(); } - #endregion - + #endregion + + #region Bridge Linking + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new GenericRelayControllerJoinMap(joinStart); @@ -98,77 +168,90 @@ namespace PepperDash.Essentials.Core.CrestronIO // feedback for relay state - OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay.JoinNumber]); - } - } + OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay.JoinNumber]); + } + + #endregion + + #region Factory + + public class GenericRelayDeviceFactory : EssentialsDeviceFactory + { + public GenericRelayDeviceFactory() + { + TypeNames = new List() { "relayoutput" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Generic Relay Device"); + + var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); + + if (props == null) return null; + + var portDevice = new GenericRelayDevice(dc.Key, dc.Name, GetRelay, props); + + return portDevice; + + + /* + if (props.PortDeviceKey == "processor") + portDevice = Global.ControlSystem as IRelayPorts; + else + portDevice = DeviceManager.GetDeviceForKey(props.PortDeviceKey) as IRelayPorts; - public class GenericRelayDeviceFactory : EssentialsDeviceFactory - { - public GenericRelayDeviceFactory() - { - TypeNames = new List() { "relayoutput" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new Generic Relay Device"); - - var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); - var key = dc.Key; - - IRelayPorts portDevice; - - if (props.PortDeviceKey == "processor") - portDevice = Global.ControlSystem as IRelayPorts; - else - portDevice = DeviceManager.GetDeviceForKey(props.PortDeviceKey) as IRelayPorts; - - if (portDevice == null) - Debug.Console(0, "Unable to add relay device with key '{0}'. Port Device does not support relays", key); - else - { - var cs = (portDevice as CrestronControlSystem); - - if (cs != null) - { - // The relay is on a control system processor - if (!cs.SupportsRelay || props.PortNumber > cs.NumberOfRelayPorts) - { - Debug.Console(0, "Port Device: {0} does not support relays or does not have enough relays"); - return null; - } - } + if (portDevice == null) + Debug.Console(0, "Unable to add relay device with key '{0}'. Port Device does not support relays", key); else { - // The relay is on another device type + var cs = (portDevice as CrestronControlSystem); - if (props.PortNumber > portDevice.NumberOfRelayPorts) + if (cs != null) { - Debug.Console(0, "Port Device: {0} does not have enough relays"); - return null; + // The relay is on a control system processor + if (!cs.SupportsRelay || props.PortNumber > cs.NumberOfRelayPorts) + { + Debug.Console(0, "Port Device: {0} does not support relays or does not have enough relays"); + return null; + } } - } - - Relay relay = portDevice.RelayPorts[props.PortNumber]; - - if (!relay.Registered) - { - if (relay.Register() == eDeviceRegistrationUnRegistrationResponse.Success) - return new GenericRelayDevice(key, relay); else - Debug.Console(0, "Attempt to register relay {0} on device with key '{1}' failed.", props.PortNumber, props.PortDeviceKey); + { + // The relay is on another device type + + if (props.PortNumber > portDevice.NumberOfRelayPorts) + { + Debug.Console(0, "Port Device: {0} does not have enough relays"); + return null; + } + } + + Relay relay = portDevice.RelayPorts[props.PortNumber]; + + if (!relay.Registered) + { + if (relay.Register() == eDeviceRegistrationUnRegistrationResponse.Success) + return new GenericRelayDevice(key, relay); + else + Debug.Console(0, "Attempt to register relay {0} on device with key '{1}' failed.", props.PortNumber, props.PortDeviceKey); + } + else + { + return new GenericRelayDevice(key, relay); + } + + // Future: Check if portDevice is 3-series card or other non control system that supports versiports } - else - { - return new GenericRelayDevice(key, relay); - } - - // Future: Check if portDevice is 3-series card or other non control system that supports versiports - } - - return null; - - } + */ + + } + } + + #endregion + + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IDPad.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IDPad.cs index 2e0f3ae7..d222b47c 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IDPad.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IDPad.cs @@ -33,7 +33,7 @@ namespace PepperDash.Essentials.Core triList.SetBoolSigAction(141, dev.Right); triList.SetBoolSigAction(142, dev.Select); triList.SetBoolSigAction(130, dev.Menu); - triList.SetBoolSigAction(134, dev.Exit); + triList.SetBoolSigAction(134, dev.Exit); } public static void UnlinkButtons(this IDPad dev, BasicTriList triList) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IrOutputPortController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IrOutputPortController.cs index 67a74ed7..ecfca4f8 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IrOutputPortController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IrOutputPortController.cs @@ -3,7 +3,10 @@ using System.Collections.Generic; using System.Linq; using Crestron.SimplSharp; using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.DeviceSupport; +using Newtonsoft.Json.Linq; +using PepperDash.Essentials.Core.Config; + using PepperDash.Core; @@ -37,9 +40,21 @@ namespace PepperDash.Essentials.Core return; } LoadDriver(irDriverFilepath); - } - - /// + } + + public IrOutputPortController(string key, Func postActivationFunc, + DeviceConfig config) + : base(key) + { + AddPostActivationAction(() => + { + IrPort = postActivationFunc(config); + }); + } + + + + /// /// Loads the IR driver at path /// /// @@ -118,7 +133,6 @@ namespace PepperDash.Essentials.Core { Debug.Console(2, this, "Device {0}: IR Driver {1} does not contain command {2}", Key, IrPort.IRDriverFileNameByIRDriverId(IrPortUid), command); - } - + } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs index fd83f2a2..707a8fb8 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs @@ -13,8 +13,9 @@ using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Routing; namespace PepperDash.Essentials.Core -{ - public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IBridgeAdvanced +{ + [Description("Wrapper class for a Basic IR Display")] + public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IBridgeAdvanced { public IrOutputPortController IrPort { get; private set; } public ushort IrPulseTime { get; set; } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Gateways/CenRfgwController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Gateways/CenRfgwController.cs new file mode 100644 index 00000000..1fd7da6d --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Gateways/CenRfgwController.cs @@ -0,0 +1,139 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.Gateways; +using Newtonsoft.Json; + + +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; + + +namespace PepperDash.Essentials.Core +{ + [Description("Wrapper class for Crestron Infinet-EX Gateways")] + public class CenRfgwController : CrestronGenericBaseDevice + { + private GatewayBase _Gateway; + public GatewayBase GateWay { get { return _Gateway; } } + + /// + /// Constructor for the on-board gateway + /// + /// + /// + public CenRfgwController(string key, string name, GatewayBase gateway) : + base(key, name, gateway) + { + _Gateway = gateway; + } + + public static CenRfgwController GetNewExGatewayController(string key, string name, ushort ipId, ushort cresnetId, string gatewayType) + { + eExGatewayType type = (eExGatewayType)Enum.Parse(typeof(eExGatewayType), gatewayType, true); + try + { + var cs = Global.ControlSystem; + + GatewayBase gw = null; + switch (type) + { + case eExGatewayType.Ethernet: + gw = new CenRfgwEx(ipId, cs); + break; + case eExGatewayType.EthernetShared: + gw = new CenRfgwExEthernetSharable(ipId, cs); + break; + case eExGatewayType.Cresnet: + gw = new CenRfgwExCresnet(cresnetId, cs); + break; + } + return new CenRfgwController(key, name, gw); + } + catch (Exception) + { + Debug.Console(0, "ERROR: Cannot create EX Gateway, id {0}, type {1}", type == eExGatewayType.Cresnet ? cresnetId : ipId, gatewayType); + return null; + } + } + public static CenRfgwController GetNewErGatewayController(string key, string name, ushort ipId, ushort cresnetId, string gatewayType) + { + eExGatewayType type = (eExGatewayType)Enum.Parse(typeof(eExGatewayType), gatewayType, true); + try + { + var cs = Global.ControlSystem; + + GatewayBase gw = null; + switch (type) + { + case eExGatewayType.Ethernet: + gw = new CenErfgwPoe(ipId, cs); + break; + case eExGatewayType.EthernetShared: + gw = new CenErfgwPoeEthernetSharable(ipId, cs); + break; + case eExGatewayType.Cresnet: + gw = new CenErfgwPoeCresnet(cresnetId, cs); + break; + } + return new CenRfgwController(key, name, gw); + } + catch (Exception) + { + Debug.Console(0, "ERROR: Cannot create ER Gateway, id {0}, type {1}", type== eExGatewayType.Cresnet ? cresnetId : ipId, gatewayType); + return null; + } + } + + } + + + + public enum eExGatewayType + { + Ethernet, EthernetShared, Cresnet + } + + + #region Factory + public class CenRfgwControllerFactory : EssentialsDeviceFactory + { + public CenRfgwControllerFactory() + { + TypeNames = new List() { "cenrfgwex", "cenerfgwpoe" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + + Debug.Console(1, "Factory Attempting to create new CEN-GWEXER Device"); + + var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); + + var type = dc.Type.ToLower(); + var control = props.Control; + var ipid = control.IpIdInt; + var cresnetId = control.CresnetIdInt; + var gatewayType = props.GatewayType; + + switch (type) + { + case ("cenrfgwex"): + return CenRfgwController.GetNewExGatewayController(dc.Key, dc.Name, + (ushort)ipid, (ushort)cresnetId, gatewayType); + case ("cenerfgwpoe"): + return CenRfgwController.GetNewErGatewayController(dc.Key, dc.Name, + (ushort)ipid, (ushort)cresnetId, gatewayType); + default: + return null; + } + } + } + #endregion + + +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Gateways/EssentialsRfGatewayConfig.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Gateways/EssentialsRfGatewayConfig.cs new file mode 100644 index 00000000..e1ae8c11 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Gateways/EssentialsRfGatewayConfig.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using PepperDash.Core; +using PepperDash.Essentials.Core.Config; + + +namespace PepperDash.Essentials.Core +{ + public class EssentialsRfGatewayConfig + { + [JsonProperty("control")] + public EssentialsControlPropertiesConfig Control { get; set; } + + [JsonProperty("gatewayType")] + public string GatewayType { get; set; } + + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs index 2f3e1823..b540b3d6 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs @@ -17,8 +17,8 @@ namespace PepperDash.Essentials.Core { public static class Global { - public static CrestronControlSystem ControlSystem { get; set; } - + public static CrestronControlSystem ControlSystem { get; set; } + public static LicenseManager LicenseManager { get; set; } /// diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index 63b7f580..5b7fba6f 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -62,6 +62,10 @@ False ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Fusion.dll + + False + ..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Gateways.dll + False ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.GeneralIO.dll @@ -131,14 +135,21 @@ + + + + + + + @@ -177,6 +188,8 @@ + + @@ -189,11 +202,6 @@ - - - - - @@ -222,6 +230,9 @@ + + + @@ -277,7 +288,6 @@ - diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/ButtonExtensions.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/ButtonExtensions.cs new file mode 100644 index 00000000..43941260 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/ButtonExtensions.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using Crestron.SimplSharp; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; + +using PepperDash.Core; + +namespace PepperDash.Essentials.Core +{ + public static class ButtonExtensions + { + public static Button SetButtonAction(this Button button, Action a) + { + button.UserObject = a; + return button; + } + + public static Button SetButtonAction(this CrestronCollection + [Description("Wrapper Class for DM-RMC-100-S")] public class DmRmc100SController : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs index 9803b5b8..f33dd5be 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs @@ -11,7 +11,8 @@ namespace PepperDash.Essentials.DM /// /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// - /// + /// + [Description("Wrapper Class for DM-RMC-150-S")] public class DmRmc150SController : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs index 27187bcd..ed5bd378 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs @@ -12,8 +12,9 @@ namespace PepperDash.Essentials.DM /// /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// - /// - public class DmRmc200CController : DmRmcControllerBase, IRoutingInputsOutputs, + /// + [Description("Wrapper Class for DM-RMC-200-C")] + public class DmRmc200CController : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { private readonly DmRmc200C _rmc; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs index c909098f..6633af15 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs @@ -12,7 +12,8 @@ namespace PepperDash.Essentials.DM /// /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// - /// + /// + [Description("Wrapper Class for DM-RMC-200-S2")] public class DmRmc200S2Controller : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs index 8d53964b..4ccae3e9 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs @@ -12,8 +12,9 @@ namespace PepperDash.Essentials.DM /// /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// - /// - public class DmRmc200SController : DmRmcControllerBase, IRoutingInputsOutputs, + /// + [Description("Wrapper Class for DM-RMC-200-S")] + public class DmRmc200SController : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { private readonly DmRmc200S _rmc; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4KScalerCController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4KScalerCController.cs index 850f7458..052f0726 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4KScalerCController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4KScalerCController.cs @@ -12,8 +12,9 @@ namespace PepperDash.Essentials.DM /// /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// - /// - public class DmRmc4kScalerCController : DmRmcControllerBase, IRoutingInputsOutputs, IBasicVolumeWithFeedback, + /// + [Description("Wrapper Class for DM-RMC-4K-SCALER-C")] + public class DmRmc4kScalerCController : DmRmcControllerBase, IRoutingInputsOutputs, IBasicVolumeWithFeedback, IIROutputPorts, IComPorts, ICec, IRelayPorts { private readonly DmRmc4kScalerC _rmc; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4k100C1GController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4k100C1GController.cs index b2762c97..92af7ce1 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4k100C1GController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4k100C1GController.cs @@ -6,7 +6,9 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.DM -{ +{ + + [Description("Wrapper Class for DM-RMC-4K-100-C-1G")] public class DmRmc4k100C1GController : DmHdBaseTControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kScalerCDspController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kScalerCDspController.cs index e63ad5de..a7c83e35 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kScalerCDspController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kScalerCDspController.cs @@ -12,7 +12,8 @@ namespace PepperDash.Essentials.DM /// /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// - /// + /// + [Description("Wrapper Class for DM-RMC-4K-SCALER-C-DSP")] public class DmRmc4kScalerCDspController : DmRmcControllerBase, IRoutingInputsOutputs, IBasicVolumeWithFeedback, IIROutputPorts, IComPorts, ICec, IRelayPorts { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs index 946613a8..b5aeaa41 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs @@ -7,7 +7,8 @@ using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.DM -{ +{ + [Description("Wrapper Class for DM-RMC-4K-Z-100-C")] public class DmRmc4kZ100CController : DmRmcX100CController { private readonly DmRmc4kz100C _rmc; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs index 81fcf69b..70afc5eb 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs @@ -11,6 +11,7 @@ using PepperDash.Core; namespace PepperDash.Essentials.DM { + [Description("Wrapper Class for DM-RMC-4K-Z-SCALER-C")] public class DmRmc4kZScalerCController : DmRmcControllerBase, IRmcRouting, IIROutputPorts, IComPorts, ICec { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerCController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerCController.cs index 8b2c1e98..d1f2daa1 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerCController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerCController.cs @@ -12,8 +12,9 @@ namespace PepperDash.Essentials.DM /// /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// - /// - public class DmRmcScalerCController : DmRmcControllerBase, IRoutingInputsOutputs, + /// + [Description("Wrapper Class for DM-RMC-SCALER-C")] + public class DmRmcScalerCController : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { private readonly DmRmcScalerC _rmc; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerS2Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerS2Controller.cs index 1e014063..249a891b 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerS2Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerS2Controller.cs @@ -12,7 +12,8 @@ namespace PepperDash.Essentials.DM /// /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// - /// + /// + [Description("Wrapper Class for DM-RMC-SCALER-S2")] public class DmRmcScalerS2Controller : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerSController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerSController.cs index ba0f1ad7..bbf64796 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerSController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerSController.cs @@ -12,7 +12,8 @@ namespace PepperDash.Essentials.DM /// /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// - /// + /// + [Description("Wrapper Class for DM-RMC-SCALER-S")] public class DmRmcScalerSController : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs index 6fa713ad..920c056f 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs @@ -11,8 +11,9 @@ namespace PepperDash.Essentials.DM /// /// Builds a controller for basic DM-RMCs (both 4K and non-4K) with Com and IR ports and no control functions /// - /// - public class DmRmcX100CController : DmRmcControllerBase, IRoutingInputsOutputs, + /// + [Description("Wrapper Class for DM-RMC-4K-100-C & DM-RMC-100-C")] + public class DmRmcX100CController : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { private readonly DmRmc100C _rmc; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs index cbe3ebcc..4a83454b 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs @@ -16,7 +16,7 @@ namespace PepperDash.Essentials.DM /// /// Controller class for all DM-TX-201C/S/F transmitters /// - [Description("Wrapper class for DM-TX-200-C Endpoint")] + [Description("Wrapper class for DM-TX-200-C")] public class DmTx200Controller : DmTxControllerBase, ITxRouting, IHasFreeRun, IVgaBrightnessContrastControls { public DmTx200C2G Tx { get; private set; } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs index dcf5c068..c0336fc5 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs @@ -14,7 +14,7 @@ namespace PepperDash.Essentials.DM /// /// Controller class for all DM-TX-201C/S/F transmitters /// - [Description("Wrapper class for DM-TX-201-C Endpoint")] + [Description("Wrapper class for DM-TX-201-C")] public class DmTx201CController : DmTxControllerBase, ITxRouting, IHasFreeRun, IVgaBrightnessContrastControls { public DmTx201C Tx { get; private set; } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs index 27e78256..9780edb9 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs @@ -14,7 +14,7 @@ namespace PepperDash.Essentials.DM /// /// Controller class for all DM-TX-201S/F transmitters /// - [Description("Wrapper class for DM-TX-201-S/F Endpoint")] + [Description("Wrapper class for DM-TX-201-S/F")] public class DmTx201SController : DmTxControllerBase, ITxRouting, IHasFreeRun, IVgaBrightnessContrastControls { public DmTx201S Tx { get; private set; } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs index c47dc4ac..b74cb13e 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs @@ -17,8 +17,9 @@ using PepperDash.Essentials.DM.Config; namespace PepperDash.Essentials.DM { - using eVst = DmTx401C.eSourceSelection; - + using eVst = DmTx401C.eSourceSelection; + + [Description("Wrapper class for DM-TX-401-C")] public class DmTx401CController : DmTxControllerBase, ITxRouting, IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls { public DmTx401C Tx { get; private set; } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs index 12889528..28e55a4a 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs @@ -9,8 +9,9 @@ using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.DM { using eVst = eX02VideoSourceType; - using eAst = eX02AudioSourceType; - + using eAst = eX02AudioSourceType; + + [Description("Wrapper class for DM-TX-4K-100-C-1G")] public class DmTx4k100Controller : DmTxControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs index 59d05bf4..26ca429e 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs @@ -18,8 +18,9 @@ using PepperDash.Essentials.DM.Config; namespace PepperDash.Essentials.DM { using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType; - using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType; - + using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType; + + [Description("Wrapper class for DM-TX-4K-202-C")] public class DmTx4k202CController : DmTxControllerBase, ITxRouting, IHasFeedback, IIROutputPorts, IComPorts { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs index e2bc74de..9ddaabcc 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs @@ -18,8 +18,9 @@ using PepperDash.Essentials.DM.Config; namespace PepperDash.Essentials.DM { using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType; - using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType; - + using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType; + + [Description("Wrapper class for DM-TX-4K-302-C")] public class DmTx4k302CController : DmTxControllerBase, ITxRouting, IHasFeedback, IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs index dbe1c103..15084479 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs @@ -21,6 +21,7 @@ namespace PepperDash.Essentials.DM /// /// Controller class for all DM-TX-201C/S/F transmitters /// + [Description("Wrapper class for DM-TX-4K-Z-100-C")] public class DmTx4kz100Controller : DmTxControllerBase, IRoutingInputsOutputs, IHasFeedback, IIROutputPorts, IComPorts, ICec { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs index b6fa24ee..ccc0417f 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs @@ -20,6 +20,7 @@ namespace PepperDash.Essentials.DM using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType; using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType; + [Description("Wrapper class for DM-TX-4K-Z-302-C")] public class DmTx4kz302CController : DmTxControllerBase, ITxRouting, IHasFeedback, IIROutputPorts, IComPorts { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs index bcdf1fbe..ae1bcd6e 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs @@ -28,16 +28,16 @@ namespace PepperDash.Essentials.DM /// /// public static DmTxControllerBase GetDmTxController(string key, string name, string typeName, DmTxPropertiesConfig props) - { - // switch on type name... later... + { + // switch on type name... later... - typeName = typeName.ToLower(); - //uint ipid = Convert.ToUInt16(props.Id, 16); - var ipid = props.Control.IpIdInt; - var pKey = props.ParentDeviceKey.ToLower(); + typeName = typeName.ToLower(); + //uint ipid = Convert.ToUInt16(props.Id, 16); + var ipid = props.Control.IpIdInt; + var pKey = props.ParentDeviceKey.ToLower(); - if (pKey == "processor") - { + if (pKey == "processor") + { // Catch constructor failures, mainly dues to IPID try { diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Crestron/Gateways/CenRfgwController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Crestron/Gateways/CenRfgwController.cs deleted file mode 100644 index 04f6eb17..00000000 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Crestron/Gateways/CenRfgwController.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.Gateways; - -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Config; - - -namespace PepperDash.Essentials.Devices.Common -{ - public class CenRfgwController : CrestronGenericBaseDevice - { - public GatewayBase Gateway { get { return Hardware as GatewayBase; } } - - /// - /// Constructor for the on-board gateway - /// - /// - /// - public CenRfgwController(string key, string name, GatewayBase gateway) : - base(key, name, gateway) - { - } - - public static CenRfgwController GetNewExGatewayController(string key, string name, string id, string gatewayType) - { - uint uid; - eExGatewayType type; - try - { - uid = Convert.ToUInt32(id, 16); - type = (eExGatewayType)Enum.Parse(typeof(eExGatewayType), gatewayType, true); - var cs = Global.ControlSystem; - - GatewayBase gw = null; - switch (type) - { - case eExGatewayType.Ethernet: - gw = new CenRfgwEx(uid, cs); - break; - case eExGatewayType.EthernetShared: - gw = new CenRfgwExEthernetSharable(uid, cs); - break; - case eExGatewayType.Cresnet: - gw = new CenRfgwExCresnet(uid, cs); - break; - } - return new CenRfgwController(key, name, gw); - } - catch (Exception) - { - Debug.Console(0, "ERROR: Cannot create EX Gateway, id {0}, type {1}", id, gatewayType); - return null; - } - } - public static CenRfgwController GetNewErGatewayController(string key, string name, string id, string gatewayType) - { - uint uid; - eExGatewayType type; - try - { - uid = Convert.ToUInt32(id, 16); - type = (eExGatewayType)Enum.Parse(typeof(eExGatewayType), gatewayType, true); - var cs = Global.ControlSystem; - - GatewayBase gw = null; - switch (type) - { - case eExGatewayType.Ethernet: - gw = new CenErfgwPoe(uid, cs); - break; - case eExGatewayType.EthernetShared: - gw = new CenErfgwPoeEthernetSharable(uid, cs); - break; - case eExGatewayType.Cresnet: - gw = new CenErfgwPoeCresnet(uid, cs); - break; - } - return new CenRfgwController(key, name, gw); - } - catch (Exception) - { - Debug.Console(0, "ERROR: Cannot create EX Gateway, id {0}, type {1}", id, gatewayType); - return null; - } - } - - - /// - /// Gets the actual Crestron EX gateway for a given key. "processor" or the key of - /// a CenRfgwExController in DeviceManager - /// - /// - /// Either processor GW or Gateway property of CenRfgwExController - public static GatewayBase GetExGatewayBaseForKey(string key) - { - key = key.ToLower(); - if (key == "processor" && Global.ControlSystem.SupportsInternalRFGateway) - return Global.ControlSystem.ControllerRFGatewayDevice; - var gwCont = DeviceManager.GetDeviceForKey(key) as CenRfgwController; - if (gwCont != null) - return gwCont.Gateway; - - return null; - } - } - - public enum eExGatewayType - { - Ethernet, EthernetShared, Cresnet - } - - public class CenRfgwControllerFactory : EssentialsDeviceFactory - { - public CenRfgwControllerFactory() - { - TypeNames = new List() { "cenrfgwex", "cenerfgwpoe" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new CEN-GWEXER Device"); - return CenRfgwController.GetNewExGatewayController(dc.Key, dc.Name, - dc.Properties.Value("id"), dc.Properties.Value("gatewayType")); - } - } - -} \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj index 83065b05..ba12a129 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj @@ -132,7 +132,6 @@ - diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/CenOdtOccupancySensorBaseController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/CenOdtOccupancySensorBaseController.cs index eb3172d9..16c0a2f0 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/CenOdtOccupancySensorBaseController.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/CenOdtOccupancySensorBaseController.cs @@ -13,6 +13,7 @@ using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.Devices.Common.Occupancy { + [Description("Wrapper class for CEN-ODT-C-POE")] public class CenOdtOccupancySensorBaseController : CrestronGenericBridgeableBaseDevice, IOccupancyStatusProvider { public CenOdtCPoe OccSensor { get; private set; } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs index 907e8461..6dd61721 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs @@ -13,6 +13,7 @@ using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.Devices.Common.Occupancy { + [Description("Wrapper class for Single Technology GLS Occupancy Sensors")] public class GlsOccupancySensorBaseController : CrestronGenericBridgeableBaseDevice, IOccupancyStatusProvider { public GlsOccupancySensorBase OccSensor { get; private set; } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs index f7d9943a..26fec016 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs @@ -13,6 +13,7 @@ using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.Devices.Common.Occupancy { + [Description("Wrapper class for Dual Technology GLS Occupancy Sensors")] public class GlsOdtOccupancySensorController : GlsOccupancySensorBaseController { public new GlsOdtCCn OccSensor { get; private set; } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs index 8bf690a6..ec3f11e8 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs @@ -15,7 +15,8 @@ using PepperDash.Essentials.Core.Routing; namespace PepperDash.Essentials.Devices.Common { - public class IRSetTopBoxBase : EssentialsBridgeableDevice, ISetTopBoxControls, IRoutingOutputs, IUsageTracking, IPower + [Description("Wrapper class for an IR Set Top Box")] + public class IRSetTopBoxBase : EssentialsBridgeableDevice, ISetTopBoxControls, IRoutingOutputs, IUsageTracking, IPower { public IrOutputPortController IrPort { get; private set; } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs index 5d01ccc7..13e89040 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs @@ -14,9 +14,9 @@ using PepperDash.Essentials.Core.Routing; namespace PepperDash.Essentials.Devices.Common { + [Description("Wrapper class for an IR-Controlled AppleTV")] public class AppleTV : EssentialsBridgeableDevice, IDPad, ITransport, IUiDisplayInfo, IRoutingOutputs { - public IrOutputPortController IrPort { get; private set; } public const string StandardDriverName = "Apple AppleTV-v2.ir"; public uint DisplayUiType { get { return DisplayUiConstants.TypeAppleTv; } } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/Roku.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/Roku.cs index 49f96c31..de848406 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/Roku.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/Roku.cs @@ -12,7 +12,8 @@ using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Routing; namespace PepperDash.Essentials.Devices.Common -{ +{ + [Description("Wrapper class for an IR-Controlled Roku")] public class Roku2 : EssentialsDevice, IDPad, ITransport, IUiDisplayInfo, IRoutingOutputs { [Api]