예제 #1
0
        public override EssentialsDevice BuildDevice(DeviceConfig dc)
        {
            var type = dc.Type.ToLower();

            Debug.Console(1, "Factory Attempting to create new AirMedia Device");

            var   props    = JsonConvert.DeserializeObject <AirMediaPropertiesConfig>(dc.Properties.ToString());
            AmX00 amDevice = null;

            if (type == "am200")
            {
                amDevice = new Crestron.SimplSharpPro.DM.AirMedia.Am200(props.Control.IpIdInt, Global.ControlSystem);
            }
            else if (type == "am300")
            {
                amDevice = new Crestron.SimplSharpPro.DM.AirMedia.Am300(props.Control.IpIdInt, Global.ControlSystem);
            }

            return(new AirMediaController(dc.Key, dc.Name, amDevice, dc, props));
        }
예제 #2
0
        public static IKeyed GetDevice(DeviceConfig dc)
        {
            var key        = dc.Key;
            var name       = dc.Name;
            var type       = dc.Type;
            var properties = dc.Properties;

            var typeName = dc.Type.ToLower();

            if (typeName.StartsWith("am"))
            {
                if (typeName == "am200" || typeName == "am300")
                {
                    var   props    = JsonConvert.DeserializeObject <AirMediaPropertiesConfig>(properties.ToString());
                    AmX00 amDevice = null;
                    if (typeName == "am200")
                    {
                        amDevice = new Crestron.SimplSharpPro.DM.AirMedia.Am200(props.Control.IpIdInt, Global.ControlSystem);
                    }
                    else if (typeName == "am300")
                    {
                        amDevice = new Crestron.SimplSharpPro.DM.AirMedia.Am300(props.Control.IpIdInt, Global.ControlSystem);
                    }

                    return(new AirMediaController(key, name, amDevice, dc, props));
                }
            }
            else if (typeName.StartsWith("dmmd8x") || typeName.StartsWith("dmmd16x") || typeName.StartsWith("dmmd32x"))
            {
                var props = JsonConvert.DeserializeObject
                            <PepperDash.Essentials.DM.Config.DMChassisPropertiesConfig>(properties.ToString());
                return(PepperDash.Essentials.DM.DmChassisController.
                       GetDmChassisController(key, name, type, props));
            }
            else if (typeName.StartsWith("dmmd128x") || typeName.StartsWith("dmmd64x"))
            {
                var props = JsonConvert.DeserializeObject
                            <PepperDash.Essentials.DM.Config.DMChassisPropertiesConfig>(properties.ToString());
                return(PepperDash.Essentials.DM.DmBladeChassisController.
                       GetDmChassisController(key, name, type, props));
            }
            // Hand off to DmTxHelper class
            else if (typeName.StartsWith("dmtx"))
            {
                var props = JsonConvert.DeserializeObject
                            <PepperDash.Essentials.DM.Config.DmTxPropertiesConfig>(properties.ToString());
                return(PepperDash.Essentials.DM.DmTxHelper.GetDmTxController(key, name, type, props));
            }

            // Hand off to DmRmcHelper class
            else if (typeName.StartsWith("dmrmc"))
            {
                var props = JsonConvert.DeserializeObject
                            <PepperDash.Essentials.DM.Config.DmRmcPropertiesConfig>(properties.ToString());
                return(PepperDash.Essentials.DM.DmRmcHelper.GetDmRmcController(key, name, type, props));
            }

            else if (typeName.Equals("hdmd4x14ke"))
            {
                var props = JsonConvert.DeserializeObject
                            <PepperDash.Essentials.DM.Config.HdMdNxM4kEPropertiesConfig>(properties.ToString());
                return(PepperDash.Essentials.DM.Chassis.HdMdNxM4kEController.GetController(key, name, type, props));
            }

            else if (typeName.Equals("hdmd400ce") || typeName.Equals("hdmd300ce") || typeName.Equals("hdmd200ce") || typeName.Equals("hdmd200c1ge"))
            {
                var props = JsonConvert.DeserializeObject
                            <PepperDash.Essentials.DM.HdMdxxxCEPropertiesConfig>(properties.ToString());

                if (typeName.Equals("hdmd400ce"))
                {
                    return(new PepperDash.Essentials.DM.HdMdxxxCEController(key, name,
                                                                            new HdMd400CE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem)));
                }
                else if (typeName.Equals("hdmd300ce"))
                {
                    return(new PepperDash.Essentials.DM.HdMdxxxCEController(key, name,
                                                                            new HdMd300CE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem)));
                }
                else if (typeName.Equals("hdmd200ce"))
                {
                    return(new PepperDash.Essentials.DM.HdMdxxxCEController(key, name,
                                                                            new HdMd200CE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem)));
                }
                else if (typeName.Equals("hdmd200c1ge"))
                {
                    return(new PepperDash.Essentials.DM.HdMdxxxCEController(key, name,
                                                                            new HdMd200C1GE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem)));
                }
            }

            return(null);
        }