Exemplo n.º 1
0
        public ReturnCode CopyFromTopicQos(ref DataWriterQos dataWriterQos, TopicQos topicQos)
        {
            ReturnCode result = ReturnCode.Ok;

            if (dataWriterQos == null)
            {
                result = GetDefaultDataWriterQos(ref dataWriterQos);
            }

            if (result == ReturnCode.Ok)
            {
                using (OpenSplice.CustomMarshalers.TopicQosMarshaler marshaler =
                        new OpenSplice.CustomMarshalers.TopicQosMarshaler())
                {
                    result = marshaler.CopyIn(topicQos);
                    if (result == ReturnCode.Ok)
                    {
                        using (OpenSplice.CustomMarshalers.DataWriterQosMarshaler dataWriterMarshaler =
                                new OpenSplice.CustomMarshalers.DataWriterQosMarshaler())
                        {
                            result = dataWriterMarshaler.CopyIn(dataWriterQos);
                            if (result == ReturnCode.Ok)
                            {
                                result = Gapi.Publisher.copy_from_topic_qos(
                                        GapiPeer,
                                        dataWriterMarshaler.GapiPtr,
                                        marshaler.GapiPtr);

                                if (result == ReturnCode.Ok)
                                {
                                    dataWriterMarshaler.CopyOut(ref dataWriterQos);
                                }
                            }
                        }
                    }
                }
            }

            return result;
        }
Exemplo n.º 2
0
        public ReturnCode GetDefaultTopicQos(ref TopicQos qos)
        {
            ReturnCode result;

            using (OpenSplice.CustomMarshalers.TopicQosMarshaler marshaler =
                    new OpenSplice.CustomMarshalers.TopicQosMarshaler())
            {
                result = Gapi.DomainParticipant.get_default_topic_qos(
                        GapiPeer,
                        marshaler.GapiPtr);

                if (result == ReturnCode.Ok)
                {
                    marshaler.CopyOut(ref qos);
                }
            }

            return result;
        }
Exemplo n.º 3
0
        public ReturnCode SetQos(TopicQos qos)
        {
            ReturnCode result;

            using (OpenSplice.CustomMarshalers.TopicQosMarshaler marshaler = 
                    new OpenSplice.CustomMarshalers.TopicQosMarshaler())
            {
                result = marshaler.CopyIn(qos);
                if (result == DDS.ReturnCode.Ok)
                {
                    result = Gapi.Topic.set_qos(GapiPeer, marshaler.GapiPtr);
                }
            }

            return result;
        }
Exemplo n.º 4
0
        public ITopic CreateTopic(
                string topicName,
                string typeName,
                TopicQos qos,
                ITopicListener listener,
                StatusKind mask)
        {
            ITopic topic = null;

            using (OpenSplice.CustomMarshalers.TopicQosMarshaler marshaler =
                    new OpenSplice.CustomMarshalers.TopicQosMarshaler())
            {
                if (marshaler.CopyIn(qos) == ReturnCode.Ok)
                {
                    if (listener != null)
                    {
                        OpenSplice.Gapi.gapi_topicListener gapiListener;
                        TopicListenerHelper listenerHelper = new TopicListenerHelper();
                        listenerHelper.Listener = listener;
                        listenerHelper.CreateListener(out gapiListener);
                        using (TopicListenerMarshaler listenerMarshaler =
                                new TopicListenerMarshaler(ref gapiListener))
                        {
                            IntPtr gapiPtr = Gapi.DomainParticipant.create_topic(
                                    GapiPeer,
                                    topicName,
                                    typeName,
                                    marshaler.GapiPtr,
                                    listenerMarshaler.GapiPtr,
                                    mask);
                            if (gapiPtr != IntPtr.Zero)
                            {
                                topic = new Topic(gapiPtr, listenerHelper);
                            }
                        }
                    }
                    else
                    {
                        // Invoke the corresponding gapi function.
                        IntPtr gapiPtr = Gapi.DomainParticipant.create_topic(
                                GapiPeer,
                                topicName,
                                typeName,
                                marshaler.GapiPtr,
                                IntPtr.Zero,
                                mask);

                        if (gapiPtr != IntPtr.Zero)
                        {
                            topic = new Topic(gapiPtr);
                        }
                    }
                }
            }

            if (topic != null)
            {
                DomainParticipantQos dpQos = null;
                ReturnCode result = GetQos(ref dpQos);
                if (result == ReturnCode.Ok)
                {
                    if (dpQos.EntityFactory.AutoenableCreatedEntities)
                    {
                        topic.Enable();
                    }
                }
            }

            return topic;
        }
Exemplo n.º 5
0
        public ReturnCode GetQos(ref TopicQos qos)
        {
            ReturnCode result;
            
            using (OpenSplice.CustomMarshalers.TopicQosMarshaler marshaler = 
                    new OpenSplice.CustomMarshalers.TopicQosMarshaler())
            {
                result = Gapi.Topic.get_qos(GapiPeer, marshaler.GapiPtr);
                if (result == ReturnCode.Ok)
                {
                    marshaler.CopyOut(ref qos);
                }
            }

            return result;
        }