/// <summary> /// /// </summary> /// <param name="dc"></param> /// <returns></returns> public static CrestronBasicShadesController GetCsmQmt50Dccn(DeviceConfig dc) { var control = CommFactory.GetControlPropertiesConfig(dc); var shade = new CsmQmt50Dccn(control.CresnetIdInt, Global.ControlSystem); return(new CrestronBasicShadesController(dc.Key, dc.Name, shade)); }
/// <summary> /// Factory for P model controller /// </summary> /// <param name="dc"></param> /// <returns></returns> public static KeypadController GetC2nCbdEController(DeviceConfig dc) { var control = CommFactory.GetControlPropertiesConfig(dc); var kp = new cresKps.C2nCbdE(control.CresnetIdInt, Global.ControlSystem); return(FinishFactory(kp, dc)); }
/// <summary> /// Builds and returns an instance of EssentialsPluginDeviceTemplate /// </summary> /// <param name="dc">device configuration</param> /// <returns>plugin device or null</returns> /// <remarks> /// The example provided below takes the device key, name, properties config and the comms device created. /// Modify the EssetnialsPlugingDeviceTemplate constructor as needed to meet the requirements of the plugin device. /// </remarks> /// <seealso cref="PepperDash.Core.eControlMethod"/> public override EssentialsDevice BuildDevice(PepperDash.Essentials.Core.Config.DeviceConfig dc) { Debug.Console(1, "[{0}] Factory Attempting to create new device from type: {1}", dc.Key, dc.Type); // get the plugin device properties configuration object & check for null var propertiesConfig = dc.Properties.ToObject <EssentialsPluginConfigObjectTemplate>(); if (propertiesConfig == null) { Debug.Console(0, "[{0}] Factory: failed to read properties config for {1}", dc.Key, dc.Name); return(null); } // attempt build the plugin device comms device & check for null // TODO { ] As of PepperDash Core 1.0.41, HTTP and HTTPS are not valid eControlMethods and will throw an exception. var comms = CommFactory.CreateCommForDevice(dc); if (comms == null) { Debug.Console(1, "[{0}] Factory Notice: No control object present for device {1}", dc.Key, dc.Name); return(null); } else { return(new EssentialsPluginTemplateDevice(dc.Key, dc.Name, propertiesConfig, comms)); } }
public override EssentialsDevice BuildDevice(DeviceConfig dc) { Debug.Console(1, "Factory Attempting to create new Din8sw8Controller Device"); var comm = CommFactory.GetControlPropertiesConfig(dc); return(new Din8sw8Controller(dc.Key, comm.CresnetIdInt)); }
public override EssentialsDevice BuildDevice(DeviceConfig dc) { var typeName = dc.Type.ToLower(); var comm = CommFactory.GetControlPropertiesConfig(dc); var props = JsonConvert.DeserializeObject <CrestronTouchpanelPropertiesConfig>(dc.Properties.ToString()); Debug.Console(1, "Factory Attempting to create new DgeController Device"); DmDge200C dgeDevice = null; if (typeName == "dmdge200c") { dgeDevice = new DmDge200C(comm.IpIdInt, Global.ControlSystem); } if (dgeDevice == null) { Debug.Console(1, "Unable to create DGE device"); return(null); } var dgeController = new DmDge200CController(dc.Key, dc.Name, dgeDevice, dc, props); return(dgeController); }
/// <summary> /// Builds and returns an instance of EssentialsPluginTemplateCrestronDevice /// </summary> /// <param name="dc">device configuration</param> /// <returns>plugin device or null</returns> /// <remarks> /// The example provided below takes the device key, name, properties config and the comms device created. /// Modify the EssetnialsPlugingDeviceTemplate constructor as needed to meet the requirements of the plugin device. /// </remarks> /// <seealso cref="PepperDash.Core.eControlMethod"/> public override EssentialsDevice BuildDevice(PepperDash.Essentials.Core.Config.DeviceConfig dc) { Debug.Console(1, "[{0}] Factory Attempting to create new device from type: {1}", dc.Key, dc.Type); // get the plugin device properties configuration object & check for null var propertiesConfig = dc.Properties.ToObject <EssentialsPluginConfigObjectTemplate>(); if (propertiesConfig == null) { Debug.Console(0, "[{0}] Factory: failed to read properties config for {1}", dc.Key, dc.Name); return(null); } var controlConfig = CommFactory.GetControlPropertiesConfig(dc); if (controlConfig == null) { var myTouchpanel = new Tsw760(controlConfig.IpIdInt, Global.ControlSystem); return(new EssentialsPluginTemplateCrestronDevice(dc.Key, dc.Name, propertiesConfig, myTouchpanel)); } else { Debug.Console(0, "[{0}] Factory: Unable to get control properties from device config for {1}", dc.Key, dc.Name); return(null); } }
public override EssentialsDevice BuildDevice(DeviceConfig dc) { Debug.Console(1, "Factory Attempting to create new Biamp Tesira Device"); var comm = CommFactory.CreateCommForDevice(dc); return(new TesiraDsp(dc.Key, dc.Name, comm, dc)); }
public override EssentialsDevice BuildDevice(DeviceConfig dc) { Debug.Console(1, "Factory Attempting to create new LutronQuantumArea Device"); var comm = CommFactory.CreateCommForDevice(dc); var props = Newtonsoft.Json.JsonConvert.DeserializeObject <Environment.Lutron.LutronQuantumPropertiesConfig>(dc.Properties.ToString()); return(new LutronQuantumArea(dc.Key, dc.Name, comm, props)); }
public override EssentialsDevice BuildDevice(DeviceConfig dc) { Debug.Console(1, "Factory Attempting to create new C2N-RTHS Device"); var control = CommFactory.GetControlPropertiesConfig(dc); var cresnetId = control.CresnetIdInt; return(new C2nRthsController(dc.Key, dc.Name, new C2nRths(cresnetId, Global.ControlSystem))); }
public static etc BuildDevice(DeviceConfig dc) { Debug.Console(2, "Build Device - Lutron"); var comm = CommFactory.CreateCommForDevice(dc); var newMe = new etc(dc.Key, dc.Name, comm, dc); return(newMe); }
public override EssentialsDevice BuildDevice(DeviceConfig dc) { Debug.Console(1, "Factory Attempting to create new BiampTesira Device"); var comm = CommFactory.CreateCommForDevice(dc); var props = Newtonsoft.Json.JsonConvert.DeserializeObject <BiampTesiraFortePropertiesConfig>( dc.Properties.ToString()); return(new BiampTesiraForteDsp(dc.Key, dc.Name, comm, props)); }
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(); try { if (typeName == "necmpsx") { var comm = CommFactory.CreateCommForDevice(dc); if (comm != null) { return(new NecPSXMDisplay(dc.Key, dc.Name, comm)); } } if (typeName == "panasonicthef") { var comm = CommFactory.CreateCommForDevice(dc); if (comm != null) { return(new PanasonicThefDisplay(dc.Key, dc.Name, comm)); } } else if (typeName == "samsungmdc") { var comm = CommFactory.CreateCommForDevice(dc); if (comm != null) { return(new SamsungMDC(dc.Key, dc.Name, comm, dc.Properties["id"].Value <string>())); } } if (typeName == "avocorvtf") { var comm = CommFactory.CreateCommForDevice(dc); if (comm != null) { return(new AvocorDisplay(dc.Key, dc.Name, comm, null)); } } } catch (Exception e) { Debug.Console(0, "Displays factory: Exception creating device type {0}, key {1}: \nCONFIG JSON: {2} \nERROR: {3}\n\n", dc.Type, dc.Key, JsonConvert.SerializeObject(dc), e); return(null); } return(null); }
public override EssentialsDevice BuildDevice(DeviceConfig dc) { Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); var comm = CommFactory.CreateCommForDevice(dc); if (comm != null) { return(new PanasonicThDisplay(dc.Key, dc.Name, comm)); } else { return(null); } }
public override EssentialsDevice BuildDevice(DeviceConfig dc) { Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); var comm = CommFactory.CreateCommForDevice(dc); if (comm != null) { return(new SamsungMDC(dc.Key, dc.Name, comm, dc.Properties["id"].Value <string>())); } else { return(null); } }
/// <summary> /// Builds and returns an instance of CCDisplayDevice /// </summary> /// <param name="dc">device configuration</param> /// <returns>plugin device or null</returns> /// <remarks> /// The example provided below takes the device key, name, properties config and the comms device created. /// Modify the EssetnialsPlugingDeviceTemplate constructor as needed to meet the requirements of the plugin device. /// </remarks> /// <seealso cref="PepperDash.Core.eControlMethod"/> public override EssentialsDevice BuildDevice(DeviceConfig dc) { Debug.Console(1, "[{0}] Factory Attempting to create new device from type: {1}", dc.Key, dc.Type); // get the plugin device properties configuration object & check for null var propertiesConfig = dc.Properties.ToObject <ClearOneDSPConfig>(); if (propertiesConfig == null) { Debug.Console(0, "[{0}] Factory: failed to read properties config for {1}", dc.Key, dc.Name); return(null); } var comm = CommFactory.CreateCommForDevice(dc); return(new ClearOneDSPDevice(dc.Key, dc.Name, propertiesConfig, comm)); }
/// <summary> /// Builds an instance of the device and returns it /// </summary> /// <param name="dc">Device Configuration</param> /// <returns>Instance of Device</returns> public static PanasonicDisplay BuildDevice(DeviceConfig dc) { var comm = CommFactory.CreateCommForDevice(dc); // No use in creating the display if we can't communicate with it if (comm != null) { // Deserialize the Properties object so we can access any custom properties var config = JsonConvert.DeserializeObject <PanasonicDisplayConfigObject>(dc.Properties.ToString()); var newDisplay = new PanasonicDisplay(dc.Key, dc.Name, comm, dc); return(newDisplay); } else { Debug.Console(0, Debug.ErrorLogLevel.Warning, "Unable to create Communication device for device with key '{0}'", dc.Key); return(null); } }
public EssentialCommsPort(EssentialsControlPropertiesConfig config, string keyPrefix) { Comm = CommFactory.CreateCommForConfig(config, keyPrefix); // var PortGather = new CommunicationGather(Comm, config.EndOfLineChar); Comm.TextReceived += new EventHandler <GenericCommMethodReceiveTextArgs>(Communication_TextReceived); var socket = Comm as ISocketStatus; StatusFeedback = new IntFeedback(() => { return((int)socket.ClientStatus); }); ConnectedFeedback = new BoolFeedback(() => { return(Comm.IsConnected); }); if (socket != null) { socket.ConnectionChange += new EventHandler <GenericSocketStatusChageEventArgs>(socket_ConnectionChange); } else { } }
public override EssentialsDevice BuildDevice(DeviceConfig dc) { Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device"); var typeName = dc.Type.ToLower(); var key = dc.Key; var name = dc.Name; var comm = CommFactory.GetControlPropertiesConfig(dc); var occSensor = new CenOdtCPoe(comm.IpIdInt, Global.ControlSystem); if (occSensor == null) { Debug.Console(0, "ERROR: Unable to create Occupancy Sensor Device. Key: '{0}'", key); return(null); } return(new CenOdtOccupancySensorBaseController(key, name, occSensor)); }
/// <summary> /// Builds and returns an instance of CameraVisca /// </summary> /// <param name="dc">device configuration</param> /// <returns>plugin device or null</returns> /// <seealso cref="PepperDash.Core.eControlMethod"/> public override EssentialsDevice BuildDevice(DeviceConfig dc) { Debug.Console(1, "[{0}] Factory Attempting to create new CameraVisca device from type: {1}", dc.Key, dc.Type); IList <string> deserializeErrorMessages = new List <string>(); // get the plugin device properties configuration object & check for null var cameraViscaConfig = JsonConvert.DeserializeObject <CameraViscaConfig>( dc.Properties.ToString(), new JsonSerializerSettings() { Error = delegate(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs args) { deserializeErrorMessages.Add(args.ErrorContext.Error.Message); args.ErrorContext.Handled = true; } }); if (deserializeErrorMessages.Count > 0) { Debug.Console(0, "[{0}] Factory: failed to parse config: {1}", dc.Key, String.Join("\r\n", deserializeErrorMessages.ToArray())); return(null); } if (cameraViscaConfig == null) { Debug.Console(0, "[{0}] Factory: failed to read properties config for {1}", dc.Key, dc.Name); return(null); } // attempt build the plugin device comms device & check for null var comm = CommFactory.CreateCommForDevice(dc); if (comm == null) { Debug.Console(1, "[{0}] Factory Notice: No control object present for device {1}", dc.Key, dc.Name); return(null); } return(new CameraVisca(dc.Key, dc.Name, cameraViscaConfig, comm)); }
public override EssentialsDevice BuildDevice(DeviceConfig dc) { Debug.Console(1, "Factory Attempting to create new MobileControlSIMPLRoomBridge Device"); var comm = CommFactory.GetControlPropertiesConfig(dc); var bridge = new PepperDash.Essentials.Room.MobileControl.MobileControlSIMPLRoomBridge(dc.Key, dc.Name, comm.IpIdInt); bridge.AddPreActivationAction(() => { var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as MobileControlSystemController; if (parent == null) { Debug.Console(0, bridge, "ERROR: Cannot connect bridge. System controller not present"); } Debug.Console(0, bridge, "Linking to parent controller"); bridge.AddParent(parent); parent.AddBridge(bridge); }); return(bridge); }
private void CreateSubControls(bool isTcpClient) { // 配置页面与工厂 if (isTcpClient) { _settingPage = new ClientConfigControl(); _commFactory = new ClientCommFactory(_settingPage as IClientConfigProvider); } else { _settingPage = new ServerConfigControl(); _commFactory = new ServerCommFactory(_settingPage as IServerConfigProvider); } _settingPage.LocalNodeIdChanged += this.OnLocalNodeIdChanged; this.AddTabPage("配置", _settingPage.View); // 创建状态控件并设置相关参数 _commMonitorControl.CreateGraphics(); _commMonitorControl.Dock = DockStyle.Fill; this.AddTabPage("状态", _commMonitorControl); //this.tabControlMain.ImageList = _commMonitorControl.ImageList; //this.tabControlMain.TabPages.AddRange(_commMonitorControl.TabPages); // 创建数据发送控件 this.AddTabPage("数据发送", _dataSendingControl); // 创建日志控件 this.AddTabPage("日志", new LogControlMultiPages() { Dock = DockStyle.Fill }); // 快照 this.AddTabPage("快照", _snapshotControl); }
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 == "amplifier") { return(new Amplifier(dc.Key, dc.Name)); } else if (dc.Group.ToLower() == "touchpanel") // typeName.StartsWith("tsw")) { return(UiDeviceFactory.GetUiDevice(dc)); } else if (typeName == "mockdisplay") { return(new MockDisplay(key, name)); } else if (typeName == "generic") { return(new Device(key, name)); } //// MOVE into something else??? //else if (typeName == "basicirdisplay") //{ // var ir = IRPortHelper.GetIrPort(properties); // if (ir != null) // return new BasicIrDisplay(key, name, ir.Port, ir.FileName); //} else if (typeName == "commmock") { var comm = CommFactory.CreateCommForDevice(dc); var props = JsonConvert.DeserializeObject <ConsoleCommMockDevicePropertiesConfig>( properties.ToString()); return(new ConsoleCommMockDevice(key, name, props, comm)); } else if (typeName == "appserver") { var props = JsonConvert.DeserializeObject <MobileControlConfig>(properties.ToString()); return(new MobileControlSystemController(key, name, props)); } else if (typeName == "mobilecontrolbridge-ddvc01") { var comm = CommFactory.GetControlPropertiesConfig(dc); var bridge = new PepperDash.Essentials.Room.MobileControl.MobileControlDdvc01RoomBridge(key, name, comm.IpIdInt); bridge.AddPreActivationAction(() => { var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as MobileControlSystemController; if (parent == null) { Debug.Console(0, bridge, "ERROR: Cannot connect bridge. System controller not present"); } Debug.Console(0, bridge, "Linking to parent controller"); bridge.AddParent(parent); parent.AddBridge(bridge); }); return(bridge); } else if (typeName == "roomonwhenoccupancydetectedfeature") { return(new RoomOnToDefaultSourceWhenOccupied(dc)); } return(null); }
public static IKeyed GetUiDevice(DeviceConfig config) { var comm = CommFactory.GetControlPropertiesConfig(config); var typeName = config.Type.ToLower(); EssentialsTouchpanelController panelController = null; var props = JsonConvert.DeserializeObject <CrestronTouchpanelPropertiesConfig>(config.Properties.ToString()); if (typeName.Contains("dge")) { Dge100 dgeDevice = null; if (typeName == "dge100") { dgeDevice = new Dge100(comm.IpIdInt, Global.ControlSystem); } else if (typeName == "dmdge200c") { dgeDevice = new DmDge200C(comm.IpIdInt, Global.ControlSystem); } if (dgeDevice == null) { Debug.Console(1, "Unable to create DGE device"); return(null); } var dgeController = new DgeController(config.Key + "-comPorts", config.Name, dgeDevice, config, props); DeviceManager.AddDevice(dgeController); panelController = new EssentialsTouchpanelController(config.Key, config.Name, dgeController.DigitalGraphicsEngine, props.ProjectName, props.SgdFile); } else { panelController = new EssentialsTouchpanelController(config.Key, config.Name, config.Type, props, comm.IpIdInt); } panelController.AddPostActivationAction(() => { var mainDriver = new EssentialsPanelMainInterfaceDriver(panelController.Panel, props); // Then the sub drivers // spin up different room drivers depending on room type var room = DeviceManager.GetDeviceForKey(props.DefaultRoomKey); if (room is EssentialsHuddleSpaceRoom) { // Header Driver Debug.Console(0, panelController, "Adding header driver"); mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props); // AV Driver Debug.Console(0, panelController, "Adding huddle space AV driver"); var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props); avDriver.DefaultRoomKey = props.DefaultRoomKey; mainDriver.AvDriver = avDriver; avDriver.CurrentRoom = room as EssentialsHuddleSpaceRoom; // Environment Driver if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0) { Debug.Console(0, panelController, "Adding environment driver"); mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props); mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment); } mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom); panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted. if (panelController.Panel is TswFt5ButtonSystem) { var tsw = panelController.Panel as TswFt5ButtonSystem; // Wire up hard keys tsw.Power.UserObject = new Action <bool>(b => { if (!b) { avDriver.PowerButtonPressed(); } }); //tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); }); if (mainDriver.EnvironmentDriver != null) { tsw.Lights.UserObject = new Action <bool>(b => { if (!b) { //mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin); mainDriver.EnvironmentDriver.Toggle(); } }); } tsw.Up.UserObject = new Action <bool>(avDriver.VolumeUpPress); tsw.Down.UserObject = new Action <bool>(avDriver.VolumeDownPress); } } //else if (room is EssentialsPresentationRoom) //{ // Debug.Console(0, panelController, "Adding presentation room driver"); // var avDriver = new EssentialsPresentationPanelAvFunctionsDriver(mainDriver, props); // avDriver.CurrentRoom = room as EssentialsPresentationRoom; // avDriver.DefaultRoomKey = props.DefaultRoomKey; // mainDriver.AvDriver = avDriver ; // mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props); // panelController.LoadAndShowDriver(mainDriver); // if (panelController.Panel is TswFt5ButtonSystem) // { // var tsw = panelController.Panel as TswFt5ButtonSystem; // // Wire up hard keys // tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.PowerButtonPressed(); }); // //tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); }); // tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress); // tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress); // } //} else if (room is EssentialsHuddleVtc1Room) { Debug.Console(0, panelController, "Adding huddle space VTC AV driver"); // Header Driver mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props); // AV Driver var avDriver = new EssentialsHuddleVtc1PanelAvFunctionsDriver(mainDriver, props); var codecDriver = new PepperDash.Essentials.UIDrivers.VC.EssentialsVideoCodecUiDriver(panelController.Panel, avDriver, (room as EssentialsHuddleVtc1Room).VideoCodec, mainDriver.HeaderDriver); avDriver.SetVideoCodecDriver(codecDriver); avDriver.DefaultRoomKey = props.DefaultRoomKey; mainDriver.AvDriver = avDriver; avDriver.CurrentRoom = room as EssentialsHuddleVtc1Room; // Environment Driver if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0) { Debug.Console(0, panelController, "Adding environment driver"); mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props); mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment); } mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom); panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted. if (panelController.Panel is TswFt5ButtonSystem) { var tsw = panelController.Panel as TswFt5ButtonSystem; // Wire up hard keys tsw.Power.UserObject = new Action <bool>(b => { if (!b) { avDriver.EndMeetingPress(); } }); //tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); }); if (mainDriver.EnvironmentDriver != null) { tsw.Lights.UserObject = new Action <bool>(b => { if (!b) { //mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin); mainDriver.EnvironmentDriver.Toggle(); } }); } tsw.Up.UserObject = new Action <bool>(avDriver.VolumeUpPress); tsw.Down.UserObject = new Action <bool>(avDriver.VolumeDownPress); } } else { Debug.Console(0, panelController, "ERROR: Cannot load AvFunctionsDriver for room '{0}'", props.DefaultRoomKey); } }); return(panelController); }
public static IKeyed GetDevice(DeviceConfig dc) { var key = dc.Key; var name = dc.Name; var type = dc.Type; var properties = dc.Properties; var propAnon = new {}; JsonConvert.DeserializeAnonymousType(dc.Properties.ToString(), propAnon); var typeName = dc.Type.ToLower(); var groupName = dc.Group.ToLower(); if (typeName == "appletv") { var irCont = IRPortHelper.GetIrOutputPortController(dc); return(new AppleTV(key, name, irCont)); } else if (typeName == "analogwaylivecore") { var comm = CommFactory.CreateCommForDevice(dc); var props = JsonConvert.DeserializeObject <AnalogWayLiveCorePropertiesConfig>( properties.ToString()); return(new AnalogWayLiveCore(key, name, comm, props)); } else if (typeName == "basicirdisplay") { var ir = IRPortHelper.GetIrPort(properties); if (ir != null) { var display = new BasicIrDisplay(key, name, ir.Port, ir.FileName); display.IrPulseTime = 200; // Set default pulse time for IR commands. return(display); } } else if (typeName == "biamptesira") { var comm = CommFactory.CreateCommForDevice(dc); var props = JsonConvert.DeserializeObject <BiampTesiraFortePropertiesConfig>( properties.ToString()); return(new BiampTesiraForteDsp(key, name, comm, props)); } else if (typeName == "cameravisca") { var comm = CommFactory.CreateCommForDevice(dc); var props = JsonConvert.DeserializeObject <Cameras.CameraPropertiesConfig>( properties.ToString()); return(new Cameras.CameraVisca(key, name, comm, props)); } else if (typeName == "cenrfgwex") { return(CenRfgwController.GetNewExGatewayController(key, name, properties.Value <string>("id"), properties.Value <string>("gatewayType"))); } else if (typeName == "cenerfgwpoe") { return(CenRfgwController.GetNewErGatewayController(key, name, properties.Value <string>("id"), properties.Value <string>("gatewayType"))); } else if (groupName == "discplayer") // (typeName == "irbluray") { if (properties["control"]["method"].Value <string>() == "ir") { var irCont = IRPortHelper.GetIrOutputPortController(dc); return(new IRBlurayBase(key, name, irCont)); } else if (properties["control"]["method"].Value <string>() == "com") { Debug.Console(0, "[{0}] COM Device type not implemented YET!", key); } } else if (typeName == "digitallogger") { // var comm = CommFactory.CreateCommForDevice(dc); var props = JsonConvert.DeserializeObject <DigitalLoggerPropertiesConfig>( properties.ToString()); return(new DigitalLogger(key, name, props)); } else if (typeName == "genericaudiooutwithvolume") { var zone = dc.Properties.Value <uint>("zone"); return(new GenericAudioOutWithVolume(key, name, dc.Properties.Value <string>("volumeDeviceKey"), zone)); } else if (groupName == "genericsource") { return(new GenericSource(key, name)); } else if (typeName == "inroompc") { return(new Core.Devices.InRoomPc(key, name)); } else if (typeName == "laptop") { return(new Core.Devices.Laptop(key, name)); } else if (typeName == "mockvc") { return(new VideoCodec.MockVC(dc)); } else if (typeName == "mockac") { var props = JsonConvert.DeserializeObject <AudioCodec.MockAcPropertiesConfig>(properties.ToString()); return(new AudioCodec.MockAC(key, name, props)); } else if (typeName.StartsWith("ciscospark")) { var comm = CommFactory.CreateCommForDevice(dc); return(new VideoCodec.Cisco.CiscoSparkCodec(dc, comm)); } else if (typeName == "zoomroom") { var comm = CommFactory.CreateCommForDevice(dc); return(new VideoCodec.ZoomRoom.ZoomRoom(dc, comm)); } else if (typeName == "digitalinput") { var props = JsonConvert.DeserializeObject <IOPortConfig>(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", 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(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(key, digitalInput)); } else { Debug.Console(0, "WARNING: Attempt to register digital input {0} on device with key '{1}' failed.", props.PortNumber, props.PortDeviceKey); } } } } } else if (typeName == "relayoutput") { var props = JsonConvert.DeserializeObject <IOPortConfig>(properties.ToString()); 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); } } else { // 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 if (typeName == "microphoneprivacycontroller") { var props = JsonConvert.DeserializeObject <Core.Privacy.MicrophonePrivacyControllerConfig>(properties.ToString()); return(new Core.Privacy.MicrophonePrivacyController(key, props)); } else if (typeName == "roku") { var irCont = IRPortHelper.GetIrOutputPortController(dc); return(new Roku2(key, name, irCont)); } else if (groupName == "settopbox") //(typeName == "irstbbase") { var irCont = IRPortHelper.GetIrOutputPortController(dc); var config = dc.Properties.ToObject <SetTopBoxPropertiesConfig>(); var stb = new IRSetTopBoxBase(key, name, irCont, config); //stb.HasDvr = properties.Value<bool>("hasDvr"); var listName = properties.Value <string>("presetsList"); if (listName != null) { stb.LoadPresets(listName); } return(stb); } else if (typeName == "tvonecorio") { var comm = CommFactory.CreateCommForDevice(dc); var props = JsonConvert.DeserializeObject <TVOneCorioPropertiesConfig>( properties.ToString()); return(new TVOneCorio(key, name, comm, props)); } else if (typeName == "glsoirccn") { var comm = CommFactory.GetControlPropertiesConfig(dc); GlsOccupancySensorBase occSensor = null; occSensor = new GlsOirCCn(comm.CresnetIdInt, Global.ControlSystem); if (occSensor != null) { return(new GlsOccupancySensorBaseController(key, name, occSensor)); } else { Debug.Console(0, "ERROR: Unable to create Occupancy Sensor Device. Key: '{0}'", key); } } else if (typeName == "glsodtccn") { var comm = CommFactory.GetControlPropertiesConfig(dc); var occSensor = new GlsOdtCCn(comm.CresnetIdInt, Global.ControlSystem); if (occSensor != null) { return(new GlsOdtOccupancySensorController(key, name, occSensor)); } else { Debug.Console(0, "ERROR: Unable to create Occupancy Sensor Device. Key: '{0}'", key); } } else if (groupName == "lighting") { if (typeName == "lutronqs") { var comm = CommFactory.CreateCommForDevice(dc); var props = JsonConvert.DeserializeObject <Environment.Lutron.LutronQuantumPropertiesConfig>(properties.ToString()); return(new Environment.Lutron.LutronQuantumArea(key, name, comm, props)); } else if (typeName == "din8sw8") { var comm = CommFactory.GetControlPropertiesConfig(dc); return(new Environment.Lighting.Din8sw8Controller(key, comm.CresnetIdInt)); } } else if (groupName == "environment") { if (typeName == "shadecontroller") { var props = JsonConvert.DeserializeObject <Core.Shades.ShadeControllerConfigProperties>(properties.ToString()); return(new Core.Shades.ShadeController(key, name, props)); } else if (typeName == "relaycontrolledshade") { var props = JsonConvert.DeserializeObject <Environment.Somfy.RelayControlledShadeConfigProperties>(properties.ToString()); return(new Environment.Somfy.RelayControlledShade(key, name, props)); } } return(null); }
/// <summary> /// Ugly form /// </summary> /// <param name="dc"></param> /// <returns></returns> public static CrestronBasicShadesController GetCsmQmtdc1631Cn(DeviceConfig dc) { return(new CrestronBasicShadesController(dc.Key, dc.Name, new CsmQmtdc1631Cn(CommFactory.GetControlPropertiesConfig(dc).CresnetIdInt, Global.ControlSystem))); }
public override EssentialsDevice BuildDevice(DeviceConfig dc) { var comm = CommFactory.GetControlPropertiesConfig(dc); var props = Newtonsoft.Json.JsonConvert.DeserializeObject <CrestronTouchpanelPropertiesConfig>(dc.Properties.ToString()); Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); var panelController = new EssentialsTouchpanelController(dc.Key, dc.Name, dc.Type, props, comm.IpIdInt); panelController.AddPostActivationAction(() => { var mainDriver = new EssentialsPanelMainInterfaceDriver(panelController.Panel, props); // Then the sub drivers // spin up different room drivers depending on room type var room = DeviceManager.GetDeviceForKey(props.DefaultRoomKey); if (room is EssentialsHuddleSpaceRoom) { // Header Driver Debug.Console(0, panelController, "Adding header driver"); mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props); // AV Driver Debug.Console(0, panelController, "Adding huddle space AV driver"); var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props); avDriver.DefaultRoomKey = props.DefaultRoomKey; mainDriver.AvDriver = avDriver; avDriver.CurrentRoom = room as EssentialsHuddleSpaceRoom; // Environment Driver if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0) { Debug.Console(0, panelController, "Adding environment driver"); mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props); mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment); } mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom); panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted. if (panelController.Panel is TswFt5ButtonSystem) { var tsw = panelController.Panel as TswFt5ButtonSystem; // Wire up hard keys tsw.Power.UserObject = new Action <bool>(b => { if (!b) { avDriver.PowerButtonPressed(); } }); //tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); }); if (mainDriver.EnvironmentDriver != null) { tsw.Lights.UserObject = new Action <bool>(b => { if (!b) { //mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin); mainDriver.EnvironmentDriver.Toggle(); } }); } tsw.Up.UserObject = new Action <bool>(avDriver.VolumeUpPress); tsw.Down.UserObject = new Action <bool>(avDriver.VolumeDownPress); } } else if (room is EssentialsHuddleVtc1Room) { Debug.Console(0, panelController, "Adding huddle space VTC AV driver"); // Header Driver mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props); // AV Driver var avDriver = new EssentialsHuddleVtc1PanelAvFunctionsDriver(mainDriver, props); var codecDriver = new PepperDash.Essentials.UIDrivers.VC.EssentialsVideoCodecUiDriver(panelController.Panel, avDriver, (room as EssentialsHuddleVtc1Room).VideoCodec, mainDriver.HeaderDriver); avDriver.SetVideoCodecDriver(codecDriver); avDriver.DefaultRoomKey = props.DefaultRoomKey; mainDriver.AvDriver = avDriver; avDriver.CurrentRoom = room as EssentialsHuddleVtc1Room; // Environment Driver if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0) { Debug.Console(0, panelController, "Adding environment driver"); mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props); mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment); } mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom); panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted. if (panelController.Panel is TswFt5ButtonSystem) { var tsw = panelController.Panel as TswFt5ButtonSystem; // Wire up hard keys tsw.Power.UserObject = new Action <bool>(b => { if (!b) { avDriver.EndMeetingPress(); } }); //tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); }); if (mainDriver.EnvironmentDriver != null) { tsw.Lights.UserObject = new Action <bool>(b => { if (!b) { //mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin); mainDriver.EnvironmentDriver.Toggle(); } }); } tsw.Up.UserObject = new Action <bool>(avDriver.VolumeUpPress); tsw.Down.UserObject = new Action <bool>(avDriver.VolumeDownPress); } } else { Debug.Console(0, panelController, "ERROR: Cannot load AvFunctionsDriver for room '{0}'", props.DefaultRoomKey); } }); return(panelController); }