/// <summary> /// /// </summary> /// <param name="key"></param> /// <param name="name"></param> /// <param name="chassis"></param> public DmBladeChassisController(string key, string name, BladeSwitch chassis) : base(key, name, chassis) { Chassis = chassis; InputPorts = new RoutingPortCollection <RoutingInputPort>(); OutputPorts = new RoutingPortCollection <RoutingOutputPort>(); VolumeControls = new Dictionary <uint, DmCardAudioOutputController>(); TxDictionary = new Dictionary <uint, string>(); RxDictionary = new Dictionary <uint, string>(); IsOnline.OutputChange += new EventHandler <FeedbackEventArgs>(IsOnline_OutputChange); Chassis.DMInputChange += new DMInputEventHandler(Chassis_DMInputChange); Chassis.DMOutputChange += new DMOutputEventHandler(Chassis_DMOutputChange); VideoOutputFeedbacks = new Dictionary <uint, IntFeedback>(); UsbOutputRoutedToFeebacks = new Dictionary <uint, IntFeedback>(); UsbInputRoutedToFeebacks = new Dictionary <uint, IntFeedback>(); VideoInputSyncFeedbacks = new Dictionary <uint, BoolFeedback>(); InputNameFeedbacks = new Dictionary <uint, StringFeedback>(); OutputNameFeedbacks = new Dictionary <uint, StringFeedback>(); OutputVideoRouteNameFeedbacks = new Dictionary <uint, StringFeedback>(); OutputAudioRouteNameFeedbacks = new Dictionary <uint, StringFeedback>(); InputEndpointOnlineFeedbacks = new Dictionary <uint, BoolFeedback>(); OutputEndpointOnlineFeedbacks = new Dictionary <uint, BoolFeedback>(); InputCardHdcpCapabilityFeedbacks = new Dictionary <uint, IntFeedback>(); InputCardHdcpCapabilityTypes = new Dictionary <uint, eHdcpCapabilityType>(); for (uint x = 1; x <= Chassis.NumberOfOutputs; x++) { var tempX = x; if (Chassis.Outputs[tempX] != null) { VideoOutputFeedbacks[tempX] = new IntFeedback(() => { if (Chassis.Outputs[tempX].VideoOutFeedback != null) { return((ushort)Chassis.Outputs[tempX].VideoOutFeedback.Number); } else { return(0); }; }); OutputNameFeedbacks[tempX] = new StringFeedback(() => { if (Chassis.Outputs[tempX].NameFeedback != null) { return(Chassis.Outputs[tempX].NameFeedback.StringValue); } else { return(""); } }); OutputVideoRouteNameFeedbacks[tempX] = new StringFeedback(() => { if (Chassis.Outputs[tempX].VideoOutFeedback != null) { return(Chassis.Outputs[tempX].VideoOutFeedback.NameFeedback.StringValue); } else { return(""); } }); OutputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => { //if (Chassis.Outputs[tempX].Endpoint != null) // return Chassis.Outputs[tempX].Endpoint.IsOnline; //else return(Chassis.Outputs[tempX].EndpointOnlineFeedback); }); } if (Chassis.Inputs[tempX] != null) { UsbInputRoutedToFeebacks[tempX] = new IntFeedback(() => { if (Chassis.Inputs[tempX].USBRoutedToFeedback != null) { return((ushort)Chassis.Inputs[tempX].USBRoutedToFeedback.Number); } else { return(0); }; }); VideoInputSyncFeedbacks[tempX] = new BoolFeedback(() => { if (Chassis.Inputs[tempX].VideoDetectedFeedback != null) { return(Chassis.Inputs[tempX].VideoDetectedFeedback.BoolValue); } else { return(false); } }); InputNameFeedbacks[tempX] = new StringFeedback(() => { if (Chassis.Inputs[tempX].NameFeedback != null) { return(Chassis.Inputs[tempX].NameFeedback.StringValue); } else { return(""); } }); InputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => { return(Chassis.Inputs[tempX].EndpointOnlineFeedback); }); InputCardHdcpCapabilityFeedbacks[tempX] = new IntFeedback(() => { var inputCard = Chassis.Inputs[tempX]; if (inputCard.Card is DmHdmi4kInputBladeCard) { InputCardHdcpCapabilityTypes[tempX] = eHdcpCapabilityType.Hdcp2_2Support; if ((inputCard.Card as DmHdmi4kInputBladeCard).Hdmi4kInput.HdcpSupportOnFeedback.BoolValue) { return(1); } else { return(0); } } if (inputCard.Card is DmC4kInputBladeCard) { InputCardHdcpCapabilityTypes[tempX] = eHdcpCapabilityType.Hdcp2_2Support; if ((inputCard.Card as DmC4kInputBladeCard).DmInput.HdcpCapabilityFeedback.Equals(eHdcpCapabilityType.HdcpSupportOff)) { return(0); } else { return(1); } } else { return(0); } }); } } }
/// <summary> /// Factory method to create a new chassis controller from config data. Limited to 8x8 right now /// </summary> public static DmBladeChassisController GetDmChassisController(string key, string name, string type, DMChassisPropertiesConfig properties) { try { type = type.ToLower(); uint ipid = properties.Control.IpIdInt; BladeSwitch chassis = null; if (type == "dmmd64x64") { chassis = new DmMd64x64(ipid, Global.ControlSystem); } else if (type == "dmmd128x128") { chassis = new DmMd128x128(ipid, Global.ControlSystem); } if (chassis == null) { return(null); } var controller = new DmBladeChassisController(key, name, chassis); // add the cards and port names foreach (var kvp in properties.InputSlots) { controller.AddInputBlade(kvp.Value, kvp.Key); } foreach (var kvp in properties.OutputSlots) { controller.AddOutputBlade(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 DmHdmi4kOutputBladeCard) { audio = (card as DmHdmi4kOutputBladeCard).Hdmi4kOutput.Audio; } if (audio == null) { continue; } // wire up the audio to something here... controller.AddVolumeControl(outNum, audio); } controller.InputNames = properties.InputNames; controller.OutputNames = properties.OutputNames; controller.PropertiesConfig = properties; return(controller); } catch (System.Exception e) { Debug.Console(0, "Error creating DM chassis:\r{0}", e); } return(null); }