internal ReturnCode init(DomainParticipant participant, string name, PublisherQos qos) { ReturnCode result; ReportStack.Start(); MyDomainId = participant.MyDomainId; using (OpenSplice.CustomMarshalers.PublisherQosMarshaler marshaler = new OpenSplice.CustomMarshalers.PublisherQosMarshaler()) { result = marshaler.CopyIn(qos); if (result == ReturnCode.Ok) { IntPtr uPublisher = User.Publisher.New(participant.rlReq_UserPeer, name, marshaler.UserPtr, 0); if (uPublisher != IntPtr.Zero) { result = base.init(uPublisher); } else { result = DDS.ReturnCode.Error; ReportStack.Report(result, "Could not create Publisher."); } } } if (result == ReturnCode.Ok) { this.participant = participant; } ReportStack.Flush(this, result != ReturnCode.Ok); return(result); }
public ReturnCode SetQos(PublisherQos qos) { ReturnCode result = DDS.ReturnCode.AlreadyDeleted; ReportStack.Start(); if (this.rlReq_isAlive) { result = QosManager.checkQos(qos); if (result == DDS.ReturnCode.Ok) { using (OpenSplice.CustomMarshalers.PublisherQosMarshaler marshaler = new OpenSplice.CustomMarshalers.PublisherQosMarshaler()) { result = marshaler.CopyIn(qos); if (result == ReturnCode.Ok) { result = uResultToReturnCode( User.Publisher.SetQos(rlReq_UserPeer, marshaler.UserPtr)); if (result != ReturnCode.Ok) { ReportStack.Report(result, "Could not apply PublisherQos."); } } else { ReportStack.Report(result, "Could not copy PublisherQos."); } } } } ReportStack.Flush(this, result != ReturnCode.Ok); return(result); }
public ReturnCode SetDefaultPublisherQos(PublisherQos qos) { ReturnCode result; using (OpenSplice.CustomMarshalers.PublisherQosMarshaler marshaler = new OpenSplice.CustomMarshalers.PublisherQosMarshaler()) { result = marshaler.CopyIn(qos); if (result == ReturnCode.Ok) { result = Gapi.DomainParticipant.set_default_publisher_qos( GapiPeer, marshaler.GapiPtr); } } return(result); }
public ReturnCode SetQos(PublisherQos qos) { ReturnCode result; using (OpenSplice.CustomMarshalers.PublisherQosMarshaler marshaler = new OpenSplice.CustomMarshalers.PublisherQosMarshaler()) { result = marshaler.CopyIn(qos); if (result == ReturnCode.Ok) { // Invoke the corresponding gapi function. result = Gapi.Publisher.set_qos( GapiPeer, marshaler.GapiPtr); } } return(result); }
/// <summary> /// This operation creates a Publisher with the desired QosPolicy settings and if applicable, /// attaches the optionally specified PublisherListener to it. /// </summary> /// <remarks> /// This operation creates a Publisher with the desired QosPolicy settings and if /// applicable, attaches the optionally specified PublisherListener to it. When the /// PublisherListener is not applicable, the NULL pointer must be supplied instead. /// To delete the Publisher the operation DeletePublisher or /// DeleteContainedEntities must be used. /// In case the specified QosPolicy settings are not consistent, no Publisher is /// created and the NULL pointer is returned. /// </remarks> /// <param name="qos">A collection of QosPolicy settings for the new Publisher. /// In case these settings are not self consistent, no Publisher is created.</param> /// <param name="listener">The PublisherListener instance which will be attached to the new Publisher. /// It is permitted to use null as the value of the listener: this behaves as a PublisherListener /// whose operations perform no action.</param> /// <param name="mask">A bit-mask in which each bit enables the invocation of the PublisherListener /// for a certain status.</param> /// <returns>The newly created Publisher. In case of an error, a null Publisher is returned.</returns> public IPublisher CreatePublisher(PublisherQos qos, IPublisherListener listener, StatusKind mask) { IPublisher publisher = null; using (OpenSplice.CustomMarshalers.PublisherQosMarshaler marshaler = new OpenSplice.CustomMarshalers.PublisherQosMarshaler()) { // Note: we use the same gapi lister as the DataWriter since the // publisher doesn't add anything unique if (marshaler.CopyIn(qos) == ReturnCode.Ok) { if (listener != null) { Gapi.gapi_publisherDataWriterListener gapiListener; PublisherDataWriterListenerHelper listenerHelper = new PublisherDataWriterListenerHelper(); listenerHelper.Listener = listener; listenerHelper.CreateListener(out gapiListener); using (PublisherDataWriterListenerMarshaler listenerMarshaler = new PublisherDataWriterListenerMarshaler(ref gapiListener)) { IntPtr gapiPtr = Gapi.DomainParticipant.create_publisher( GapiPeer, marshaler.GapiPtr, listenerMarshaler.GapiPtr, mask); if (gapiPtr != IntPtr.Zero) { publisher = new Publisher(gapiPtr, listenerHelper); } } } else { // Invoke the corresponding gapi function. IntPtr gapiPtr = Gapi.DomainParticipant.create_publisher( GapiPeer, marshaler.GapiPtr, IntPtr.Zero, mask); if (gapiPtr != IntPtr.Zero) { publisher = new Publisher(gapiPtr); } } } } if (publisher != null) { DomainParticipantQos dpQos = null; ReturnCode result = GetQos(ref dpQos); if (result == ReturnCode.Ok) { if (dpQos.EntityFactory.AutoenableCreatedEntities) { publisher.Enable(); } } } return(publisher); }