/// <summary> /// Method ensures that the protocolInfo for a PrepareForConnection request /// matches up correctly with a supported protocol on the device. /// The check is a trivial check and nothing more. /// <see cref="MediaServerDevice.SinkCm_PrepareForConnection"/> /// will do additional checks to ensure that the entire request is correct. /// </summary> /// <param name="protInfo">protocolInfo string proposed in the request</param> /// <param name="dir">direction of the stream, relative to the server</param> private void ValidateConnectionRequest(ProtocolInfoString protInfo, DvConnectionManager.Enum_A_ARG_TYPE_Direction dir) { bool incompatibleProtocol = true; // Grab the correct protocolInfo set, depending on whether // the stream is supposed to be a source or a sink. ArrayList al; if (dir == DvConnectionManager.Enum_A_ARG_TYPE_Direction.INPUT) { al = this.m_SinkProtocolInfoSet; } else if (dir == DvConnectionManager.Enum_A_ARG_TYPE_Direction.OUTPUT) { al = this.m_SourceProtocolInfoSet; } else { throw new Error_InvalidDirection(""); } // Compare the requested protocol info string against the // list of available ones. // foreach (ProtocolInfoString prot in al) { if (protInfo.Matches(prot)) { incompatibleProtocol = false; break; } } if (incompatibleProtocol) { throw new Error_IncompatibleProtocolInfo("("+protInfo.ToString()+")"); } }