示例#1
0
            public override bool    Equals(object _Other)
            {
                ParameterInt Other = _Other as ParameterInt;

                if (Other == null)
                {
                    throw new Exception("Other parameter is not of type FLOAT !");
                }

                return(Other.m_Value == m_Value);
            }
示例#2
0
        /// <summary>
        /// Creates a new parameter
        /// </summary>
        /// <param name="_Name"></param>
        /// <param name="_Type"></param>
        /// <returns></returns>
        public Parameter        CreateParameter(string _Name, PARAMETER_TYPE _Type)
        {
            Parameter Result = null;

            switch (_Type)
            {
            case PARAMETER_TYPE.BOOL:
                Result = new ParameterBool(this, _Name);
                break;

            case PARAMETER_TYPE.INT:
                Result = new ParameterInt(this, _Name);
                break;

            case PARAMETER_TYPE.FLOAT:
                Result = new ParameterFloat(this, _Name);
                break;

            case PARAMETER_TYPE.FLOAT2:
                Result = new ParameterFloat2(this, _Name);
                break;

            case PARAMETER_TYPE.FLOAT3:
                Result = new ParameterFloat3(this, _Name);
                break;

            case PARAMETER_TYPE.FLOAT4:
                Result = new ParameterFloat4(this, _Name);
                break;

            case PARAMETER_TYPE.MATRIX4:
                Result = new ParameterMatrix4(this, _Name);
                break;

            case PARAMETER_TYPE.TEXTURE2D:
                Result = new ParameterTexture2D(this, _Name);
                break;

            default:
                throw new Exception("Unsupported parameter type !");
            }

            // Add it...
            m_Parameters.Add(Result);
            m_Name2Parameter.Add(Result.Name, Result);

            return(Result);
        }
示例#3
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <remarks>Use CpProxy::[Un]Subscribe() to enable/disable querying of state variable and reporting of their changes.</remarks>
        /// <param name="aDevice">The device to use</param>
        public CpProxyUpnpOrgConnectionManager1(CpDevice aDevice)
            : base("schemas-upnp-org", "ConnectionManager", 1, aDevice)
        {
            OpenHome.Net.Core.Parameter param;
            List <String> allowedValues = new List <String>();

            iActionGetProtocolInfo = new OpenHome.Net.Core.Action("GetProtocolInfo");
            param = new ParameterString("Source", allowedValues);
            iActionGetProtocolInfo.AddOutputParameter(param);
            param = new ParameterString("Sink", allowedValues);
            iActionGetProtocolInfo.AddOutputParameter(param);

            iActionPrepareForConnection = new OpenHome.Net.Core.Action("PrepareForConnection");
            param = new ParameterString("RemoteProtocolInfo", allowedValues);
            iActionPrepareForConnection.AddInputParameter(param);
            param = new ParameterString("PeerConnectionManager", allowedValues);
            iActionPrepareForConnection.AddInputParameter(param);
            param = new ParameterInt("PeerConnectionID");
            iActionPrepareForConnection.AddInputParameter(param);
            allowedValues.Add("Input");
            allowedValues.Add("Output");
            param = new ParameterString("Direction", allowedValues);
            iActionPrepareForConnection.AddInputParameter(param);
            allowedValues.Clear();
            param = new ParameterInt("ConnectionID");
            iActionPrepareForConnection.AddOutputParameter(param);
            param = new ParameterInt("AVTransportID");
            iActionPrepareForConnection.AddOutputParameter(param);
            param = new ParameterInt("RcsID");
            iActionPrepareForConnection.AddOutputParameter(param);

            iActionConnectionComplete = new OpenHome.Net.Core.Action("ConnectionComplete");
            param = new ParameterInt("ConnectionID");
            iActionConnectionComplete.AddInputParameter(param);

            iActionGetCurrentConnectionIDs = new OpenHome.Net.Core.Action("GetCurrentConnectionIDs");
            param = new ParameterString("ConnectionIDs", allowedValues);
            iActionGetCurrentConnectionIDs.AddOutputParameter(param);

            iActionGetCurrentConnectionInfo = new OpenHome.Net.Core.Action("GetCurrentConnectionInfo");
            param = new ParameterInt("ConnectionID");
            iActionGetCurrentConnectionInfo.AddInputParameter(param);
            param = new ParameterInt("RcsID");
            iActionGetCurrentConnectionInfo.AddOutputParameter(param);
            param = new ParameterInt("AVTransportID");
            iActionGetCurrentConnectionInfo.AddOutputParameter(param);
            param = new ParameterString("ProtocolInfo", allowedValues);
            iActionGetCurrentConnectionInfo.AddOutputParameter(param);
            param = new ParameterString("PeerConnectionManager", allowedValues);
            iActionGetCurrentConnectionInfo.AddOutputParameter(param);
            param = new ParameterInt("PeerConnectionID");
            iActionGetCurrentConnectionInfo.AddOutputParameter(param);
            allowedValues.Add("Input");
            allowedValues.Add("Output");
            param = new ParameterString("Direction", allowedValues);
            iActionGetCurrentConnectionInfo.AddOutputParameter(param);
            allowedValues.Clear();
            allowedValues.Add("OK");
            allowedValues.Add("ContentFormatMismatch");
            allowedValues.Add("InsufficientBandwidth");
            allowedValues.Add("UnreliableChannel");
            allowedValues.Add("Unknown");
            param = new ParameterString("Status", allowedValues);
            iActionGetCurrentConnectionInfo.AddOutputParameter(param);
            allowedValues.Clear();

            iSourceProtocolInfo = new PropertyString("SourceProtocolInfo", SourceProtocolInfoPropertyChanged);
            AddProperty(iSourceProtocolInfo);
            iSinkProtocolInfo = new PropertyString("SinkProtocolInfo", SinkProtocolInfoPropertyChanged);
            AddProperty(iSinkProtocolInfo);
            iCurrentConnectionIDs = new PropertyString("CurrentConnectionIDs", CurrentConnectionIDsPropertyChanged);
            AddProperty(iCurrentConnectionIDs);

            iPropertyLock = new Mutex();
        }
示例#4
0
 /// <summary>
 /// Constructor for integer output argument for an action
 /// </summary>
 /// <remarks>Intended to be created without any value.  The value is later set after
 /// CpService.InvokeAction is called but before the invocation's callback is run)</remarks>
 /// <param name="aParameter">Defines the name plus any bounds to the value for the argument.
 /// Must have been previously added to the action using Action.AddOutputParameter</param>
 public ArgumentInt(ParameterInt aParameter)
 {
     iHandle = ActionArgumentCreateIntOutput(aParameter.Handle());
 }
示例#5
0
 /// <summary>
 /// Constructor for integer input argument for an action
 /// </summary>
 /// <remarks>Intended to be write only (its value is written on construction and not be later read)</remarks>
 /// <param name="aParameter">Defines the name plus any bounds to the value for the argument.
 /// Must have been previously added to the action using Action.AddInputParameter</param>
 /// <param name="aValue">Value for the argument</param>
 public ArgumentInt(ParameterInt aParameter, int aValue)
 {
     iHandle = ActionArgumentCreateIntInput(aParameter.Handle(), aValue);
 }
示例#6
0
        /// <summary>
        /// Creates a new parameter
        /// </summary>
        /// <param name="_Name"></param>
        /// <param name="_Type"></param>
        /// <returns></returns>
        public Parameter CreateParameter( string _Name, PARAMETER_TYPE _Type )
        {
            Parameter	Result = null;
            switch ( _Type )
            {
                case PARAMETER_TYPE.BOOL:
                    Result = new ParameterBool( this, _Name );
                    break;
                case PARAMETER_TYPE.INT:
                    Result = new ParameterInt( this, _Name );
                    break;
                case PARAMETER_TYPE.FLOAT:
                    Result = new ParameterFloat( this, _Name );
                    break;
                case PARAMETER_TYPE.FLOAT2:
                    Result = new ParameterFloat2( this, _Name );
                    break;
                case PARAMETER_TYPE.FLOAT3:
                    Result = new ParameterFloat3( this, _Name );
                    break;
                case PARAMETER_TYPE.FLOAT4:
                    Result = new ParameterFloat4( this, _Name );
                    break;
                case PARAMETER_TYPE.MATRIX4:
                    Result = new ParameterMatrix4( this, _Name );
                    break;
                case PARAMETER_TYPE.TEXTURE2D:
                    Result = new ParameterTexture2D( this, _Name );
                    break;

                default:
                    throw new Exception( "Unsupported parameter type !" );
            }

            // Add it...
            m_Parameters.Add( Result );
            m_Name2Parameter.Add( Result.Name, Result );

            return Result;
        }