Ejemplo n.º 1
0
        public ReturnCode SetDefaultParticipantQos(DomainParticipantQos qos)
        {
            ReturnCode result;

            using (OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler marshaler =
                       new OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler())
            {
                result = marshaler.CopyIn(qos);
                if (result == ReturnCode.Ok)
                {
                    // Invoke the corresponding gapi function.
                    result = OpenSplice.Gapi.DomainParticipantFactory.set_default_participant_qos(
                        GapiPeer,
                        marshaler.GapiPtr);
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This operation sets the default DomainParticipantQos of the DomainParticipantFactory.
        /// </summary>
        /// <remarks>
        /// This operation sets the default DomainParticipantQos of the DomainParticipantFactory
        /// (that is the struct with the QosPolicy settings) which is used for newly created
        /// IDomainParticipant objects, in case no QoS was provided in the CreateParticipant operation.
        ///
        /// The DomainParticipantQos is always self consistent, because its policies do not
        /// depend on each other. <br>
        /// This means this operation never returns the ReturnCode InconsistentPolicy.
        ///
        /// The values set by this operation are returned by GetDefaultParticipantQos().
        /// </remarks>
        /// @param qos The DomainParticipantQos which contains the new default
        ///            DomainParticipantQos for the newly created DomainParticipants
        /// @return DDS.ReturnCode Ok - The new default DomainParticipantQos is set
        /// @return DDS.ReturnCode Error - An internal error has occured
        /// @return DDS.ReturnCode OutOfResources - The DDS ran out of resources to complete this operation
        public ReturnCode SetDefaultParticipantQos(DomainParticipantQos qos)
        {
            ReturnCode result;

            lock (singleton_lock)
            {
                ReportStack.Start();
                result = QosManager.checkQos(qos);
                if (result == DDS.ReturnCode.Ok)
                {
                    using (OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler marshaler =
                               new OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler())
                    {
                        result = marshaler.CopyIn(qos);
                        if (result == ReturnCode.Ok)
                        {
                            marshaler.CopyOut(ref defaultParticipantQos);
                            // Listener scheduling qospolicy is not part of User Layer, so obtain it separately from participant.
                            if (qos.ListenerScheduling.SchedulingClass == null)
                            {
                                return(ReturnCode.BadParameter);
                            }
                            this.defaultParticipantQos.ListenerScheduling.SchedulingClass.Kind = qos.ListenerScheduling.SchedulingClass.Kind;
                            if (qos.ListenerScheduling.SchedulingPriorityKind == null)
                            {
                                return(ReturnCode.BadParameter);
                            }
                            this.defaultParticipantQos.ListenerScheduling.SchedulingPriorityKind.Kind = qos.ListenerScheduling.SchedulingPriorityKind.Kind;
                            this.defaultParticipantQos.ListenerScheduling.SchedulingPriority          = qos.ListenerScheduling.SchedulingPriority;
                        }
                    }
                }
                ReportStack.Flush(null, result != ReturnCode.Ok);
            }
            return(result);
        }
        public ReturnCode SetDefaultParticipantQos(DomainParticipantQos qos)
        {
            ReturnCode result;

            using (OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler marshaler = 
                    new OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler())
            {
                result = marshaler.CopyIn(qos);
                if (result == ReturnCode.Ok)
                {
                    // Invoke the corresponding gapi function.
                    result = OpenSplice.Gapi.DomainParticipantFactory.set_default_participant_qos(
                            GapiPeer,
                            marshaler.GapiPtr);
                }
            }
            return result;
        }
        public IDomainParticipant CreateParticipant(
            DomainId domainId,
            DomainParticipantQos qos,
            IDomainParticipantListener listener,
            StatusKind mask)
        {
            IDomainParticipant participant = null;
            string className = null;

            using (OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler marshaler = 
                    new OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler())
            {
                if (marshaler.CopyIn(qos) == ReturnCode.Ok)
                {
                    if (listener != null)
                    {
                        OpenSplice.Gapi.gapi_domainParticipantListener gapiListener;
                        DomainParticipantListenerHelper listenerHelper = new DomainParticipantListenerHelper();
                        listenerHelper.Listener = listener;
                        listenerHelper.CreateListener(out gapiListener);
                        using (DomainParticipantListenerMarshaler listenerMarshaler = 
                                new DomainParticipantListenerMarshaler(ref gapiListener))
                        {
                            // Invoke the corresponding gapi function.
                            IntPtr gapiParticipant = OpenSplice.Gapi.DomainParticipantFactory.create_participant(
                                    GapiPeer,
                                    domainId,
                                    marshaler.GapiPtr,
                                    listenerMarshaler.GapiPtr,
                                    mask,
                                    IntPtr.Zero,
                                    IntPtr.Zero,
                                    IntPtr.Zero,
                                    className);
                            if (gapiParticipant != IntPtr.Zero)
                            {
                                participant = new OpenSplice.DomainParticipant(gapiParticipant, listenerHelper);
                            }
                        }
                    }
                    else
                    {
                        // Invoke the corresponding gapi function.
                        IntPtr gapiParticipant = OpenSplice.Gapi.DomainParticipantFactory.create_participant(
                            GapiPeer,
                            domainId,
                            marshaler.GapiPtr,
                            IntPtr.Zero,
                            mask,
                            IntPtr.Zero,
                            IntPtr.Zero,
                            IntPtr.Zero,
                            className);
                        if (gapiParticipant != IntPtr.Zero)
                        {
                            participant = new OpenSplice.DomainParticipant(gapiParticipant);
                        }
                    }
                }
            }

            if (participant != null)
            {
                DomainParticipantFactoryQos dpfQos = null;
                ReturnCode result = GetQos(ref dpfQos);
                if (result == ReturnCode.Ok)
                {
                    if (dpfQos.EntityFactory.AutoenableCreatedEntities)
                    {
                        participant.Enable();
                    }
                }
            }       
                
            return participant;
        }
Ejemplo n.º 5
0
        public ReturnCode SetQos(DomainParticipantQos qos)
        {
            ReturnCode result;

            using (OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler marshaler =
                    new OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler())
            {
                result = marshaler.CopyIn(qos);
                if (result == ReturnCode.Ok)
                {
                    result = Gapi.DomainParticipant.set_qos(
                            GapiPeer,
                            marshaler.GapiPtr);
                }
            }
            return result;
        }
Ejemplo n.º 6
0
        public IDomainParticipant CreateParticipant(
            string domainId,
            DomainParticipantQos qos,
            IDomainParticipantListener listener,
            StatusKind mask)
        {
            IDomainParticipant participant = null;

            using (OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler marshaler =
                       new OpenSplice.CustomMarshalers.DomainParticipantQosMarshaler())
            {
                if (marshaler.CopyIn(qos) == ReturnCode.Ok)
                {
                    if (listener != null)
                    {
                        OpenSplice.Gapi.gapi_domainParticipantListener gapiListener;
                        DomainParticipantListenerHelper listenerHelper = new DomainParticipantListenerHelper();
                        listenerHelper.Listener = listener;
                        listenerHelper.CreateListener(out gapiListener);
                        using (DomainParticipantListenerMarshaler listenerMarshaler =
                                   new DomainParticipantListenerMarshaler(ref gapiListener))
                        {
                            // Invoke the corresponding gapi function.
                            IntPtr gapiParticipant = OpenSplice.Gapi.DomainParticipantFactory.create_participant(
                                GapiPeer,
                                domainId,
                                marshaler.GapiPtr,
                                listenerMarshaler.GapiPtr,
                                mask,
                                IntPtr.Zero,
                                IntPtr.Zero,
                                IntPtr.Zero);
                            if (gapiParticipant != IntPtr.Zero)
                            {
                                participant = new OpenSplice.DomainParticipant(gapiParticipant, listenerHelper);
                            }
                        }
                    }
                    else
                    {
                        // Invoke the corresponding gapi function.
                        IntPtr gapiParticipant = OpenSplice.Gapi.DomainParticipantFactory.create_participant(
                            GapiPeer,
                            domainId,
                            marshaler.GapiPtr,
                            IntPtr.Zero,
                            mask,
                            IntPtr.Zero,
                            IntPtr.Zero,
                            IntPtr.Zero);
                        if (gapiParticipant != IntPtr.Zero)
                        {
                            participant = new OpenSplice.DomainParticipant(gapiParticipant);
                        }
                    }
                }
            }

            if (participant != null)
            {
                DomainParticipantFactoryQos dpfQos = null;
                ReturnCode result = GetQos(ref dpfQos);
                if (result == ReturnCode.Ok)
                {
                    if (dpfQos.EntityFactory.AutoenableCreatedEntities)
                    {
                        participant.Enable();
                    }
                }
            }

            return(participant);
        }