/// <summary> /// ControlSystem Constructor. Starting point for the SIMPL#Pro program. /// Use the constructor to: /// * Initialize the maximum number of threads (max = 400) /// * Register devices /// * Register event handlers /// * Add Console Commands /// /// Please be aware that the constructor needs to exit quickly; if it doesn't /// exit in time, the SIMPL#Pro program will exit. /// /// You cannot send / receive data in the constructor /// </summary> public ControlSystem() : base() { try { Thread.MaxNumberOfUserThreads = 20; xp = new XpanelForSmartGraphics(0xaa, this); xp.SigChange += new SigEventHandler(xp_SigChange); xp.OnlineStatusChange += new OnlineStatusChangeEventHandler(xp_OnlineStatusChange); xp.Register(); matrix = new DmMd8x8(0x20, this); matrix.DMInputChange += new DMInputEventHandler(matrix_DMInputChange); matrix.DMOutputChange += new DMOutputEventHandler(matrix_DMOutputChange); matrix.OnlineStatusChange += new OnlineStatusChangeEventHandler(matrix_OnlineStatusChange); matrix.Register(); //Subscribe to the controller events (System, Program, and Ethernet) CrestronEnvironment.SystemEventHandler += new SystemEventHandler(ControlSystem_ControllerSystemEventHandler); CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(ControlSystem_ControllerProgramEventHandler); CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(ControlSystem_ControllerEthernetEventHandler); } catch (Exception e) { ErrorLog.Error("Error in the constructor: {0}", e.Message); } }
public static Device CreateChassis(JToken devToken) { Device dev = null; try { var devType = devToken.Value <string>("type"); var devKey = devToken.Value <string>("key"); var devName = devToken.Value <string>("name"); // Catch all 200 series TX var devprops = devToken["properties"]; var ipId = Convert.ToUInt32(devprops.Value <string>("ipId"), 16); var parent = devprops.Value <string>("parent"); if (parent == null) { parent = "controlSystem"; } if (devType.Equals("dmmd8x8", StringComparison.OrdinalIgnoreCase)) { var dm = new DmMd8x8(ipId, Global.ControlSystem); //dev = new DmChassisController(devKey, devName, dm); } else if (devType.Equals("dmmd16x16", StringComparison.OrdinalIgnoreCase)) { var dm = new DmMd16x16(ipId, Global.ControlSystem); //dev = new DmChassisController(devKey, devName, dm); } } catch (Exception e) { FactoryHelper.HandleDeviceCreationError(devToken, e); } return(dev); }
public DmMd8x8 DMFrame(uint paramIpId, CrestronControlSystem paramControlSystem) { _frame = new DmMd8x8(paramIpId, paramControlSystem); ErrorLog.Notice("TDS: this is inside the frame"); input1 = new DmcC(1, _frame); input2 = new DmcDvi(2, _frame); input3 = new DmcHd(3, _frame); input4 = new DmcS(4, _frame); input5 = new DmcC(5, _frame); input6 = new Dmc4kHd(6, _frame); input7 = new DmcVga(7, _frame); input8 = new DmcStr(8, _frame); output1_2 = new Dmc4kCoHdSingle(1, _frame); output3_4 = new Dmc4kHdoSingle(2, _frame); output5_6 = new DmcStroSingle(3, _frame); output7_8 = new DmcCoHdSingle(4, _frame); _frame.VideoEnter.BoolValue = true; return(_frame); }
/* This has been moved to a separate class * //card list * private DmcC input1; * private DmcDvi input2; * private DmcHd input3; * private DmcS input4; * private DmcC input5; * private Dmc4kHd input6; * private DmcVga input7; * private DmcStr input8; * * private Dmc4kCoHdSingle output1_2; * private Dmc4kHdoSingle output3_4; * private DmcStroSingle output5_6; * private DmcCoHdSingle output7_8; */ /// <summary> /// ControlSystem Constructor. Starting point for the SIMPL#Pro program. /// Use the constructor to: /// * Initialize the maximum number of threads (max = 400) /// * Register devices /// * Register event handlers /// * Add Console Commands /// /// Please be aware that the constructor needs to exit quickly; if it doesn't /// exit in time, the SIMPL#Pro program will exit. /// /// You cannot send / receive data in the constructor /// </summary> public TSW750_w_DMMD8x8() : base() { try { Thread.MaxNumberOfUserThreads = 20; //Subscribe to the controller events (System, Program, and Ethernet) CrestronEnvironment.SystemEventHandler += new SystemEventHandler(ControlSystem_ControllerSystemEventHandler); CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(ControlSystem_ControllerProgramEventHandler); CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(ControlSystem_ControllerEthernetEventHandler); ErrorLog.Notice("*** : Constructor"); ErrorLog.Notice("*** : Current Time is {0}", DateTime.Now); myServer = new HttpCwsServer("api"); myServer.Routes.Add(new HttpCwsRoute("roomname") { Name = "ROOMNAME" }); myServer.HttpRequestHandler = new Server_Handler(this); myServer.Register(); //TSW Panel myPanel = new Tsw750(0x20, this); myPanel.Description = "Touchpanel"; myPanel.OnlineStatusChange += new OnlineStatusChangeEventHandler(Device_OnlineStatusChange); if (myPanel.Register() != eDeviceRegistrationUnRegistrationResponse.Success) { ErrorLog.Error("TDS: Error in Registering myPanel: {0}", myPanel.RegistrationFailureReason); } else { myPanel.SigChange += MyPanel_SigChange; } //DM Frame myFrame = DMFrameMaker.DMFrame(0x19, this); /* * myFrame = new DmMd8x8(0x19, this); * input1 = new DmcC(1, myFrame); * input2 = new DmcDvi(2, myFrame); * input3 = new DmcHd(3, myFrame); * input4 = new DmcS(4, myFrame); * input5 = new DmcC(5, myFrame); * input6 = new Dmc4kHd(6, myFrame); * input7 = new DmcVga(7, myFrame); * input8 = new DmcStr(8, myFrame); * output1_2 = new Dmc4kCoHdSingle(1, myFrame); * output3_4 = new Dmc4kHdoSingle(2, myFrame); * output5_6 = new DmcStroSingle(3, myFrame); * output7_8 = new DmcCoHdSingle(4, myFrame); * * myFrame.VideoEnter.BoolValue = true; */ myFrame.Description = "DigitalMedia Switcher"; myFrame.OnlineStatusChange += new OnlineStatusChangeEventHandler(Device_OnlineStatusChange); if (myFrame.Register() != eDeviceRegistrationUnRegistrationResponse.Success) { ErrorLog.Error("TDS: Error in Registering myFrame: {0}", myFrame.RegistrationFailureReason); } else { myFrame.DMOutputChange += MyFrame_DMOutputChange; } } catch (Exception e) { ErrorLog.Error("TDS: Error in the constructor: {0}", e.Message); } }
/// <summary> /// Factory method to create a new chassis controller from config data. Limited to 8x8 right now /// </summary> public static DmChassisController GetDmChassisController(string key, string name, string type, DMChassisPropertiesConfig properties) { try { type = type.ToLower(); uint ipid = properties.Control.IpIdInt; DmMDMnxn chassis = null; switch (type) { case "dmmd8x8": chassis = new DmMd8x8(ipid, Global.ControlSystem); break; case "dmmd8x8rps": chassis = new DmMd8x8rps(ipid, Global.ControlSystem); break; case "dmmd8x8cpu3": chassis = new DmMd8x8Cpu3(ipid, Global.ControlSystem); break; case "dmmd8x8cpu3rps": chassis = new DmMd8x8Cpu3rps(ipid, Global.ControlSystem); break; case "dmmd16x16": chassis = new DmMd16x16(ipid, Global.ControlSystem); break; case "dmmd16x16rps": chassis = new DmMd16x16rps(ipid, Global.ControlSystem); break; case "dmmd16x16cpu3": chassis = new DmMd16x16Cpu3(ipid, Global.ControlSystem); break; case "dmmd16x16cpu3rps": chassis = new DmMd16x16Cpu3rps(ipid, Global.ControlSystem); break; case "dmmd32x32": chassis = new DmMd32x32(ipid, Global.ControlSystem); break; case "dmmd32x32rps": chassis = new DmMd32x32rps(ipid, Global.ControlSystem); break; case "dmmd32x32cpu3": chassis = new DmMd32x32Cpu3(ipid, Global.ControlSystem); break; case "dmmd32x32cpu3rps": chassis = new DmMd32x32Cpu3rps(ipid, Global.ControlSystem); break; } if (chassis == null) { return(null); } var controller = new DmChassisController(key, name, chassis); // add the cards and port names foreach (var kvp in properties.InputSlots) { controller.AddInputCard(kvp.Value, kvp.Key); } foreach (var kvp in properties.OutputSlots) { controller.AddOutputCard(kvp.Value, kvp.Key); } foreach (var kvp in properties.VolumeControls) { // get the card // check it for an audio-compatible type // make a something-something that will make it work // retire to mountain village var outNum = kvp.Key; var card = controller.Chassis.Outputs[outNum].Card; Audio.Output audio = null; if (card is DmcHdo) { audio = (card as DmcHdo).Audio; } else if (card is Dmc4kHdo) { audio = (card as Dmc4kHdo).Audio; } if (audio == null) { continue; } // wire up the audio to something here... controller.AddVolumeControl(outNum, audio); } controller.InputNames = properties.InputNames; controller.OutputNames = properties.OutputNames; if (!string.IsNullOrEmpty(properties.NoRouteText)) { controller.NoRouteText = properties.NoRouteText; Debug.Console(1, controller, "Setting No Route Text value to: {0}", controller.NoRouteText); } else { Debug.Console(1, controller, "NoRouteText not specified. Defaulting to blank string.", controller.NoRouteText); } controller.PropertiesConfig = properties; return(controller); } catch (Exception e) { Debug.Console(0, "Error creating DM chassis:\r{0}", e); } return(null); }