public ReturnCode SetQos(DataWriterQos qos) { ReturnCode result = DDS.ReturnCode.AlreadyDeleted; ReportStack.Start(); if (this.rlReq_isAlive) { result = QosManager.checkQos(qos); if (result == DDS.ReturnCode.Ok) { using (OpenSplice.CustomMarshalers.DataWriterQosMarshaler marshaler = new OpenSplice.CustomMarshalers.DataWriterQosMarshaler()) { result = marshaler.CopyIn(qos); if (result == ReturnCode.Ok) { result = uResultToReturnCode( User.Writer.SetQos(rlReq_UserPeer, marshaler.UserPtr)); } else { ReportStack.Report(result, "Could not apply DataWriterQos."); } } } } ReportStack.Flush(this, result != ReturnCode.Ok); return(result); }
public ReturnCode SetDefaultDataWriterQos(DataWriterQos qos) { ReturnCode result = DDS.ReturnCode.AlreadyDeleted; ReportStack.Start(); lock (this) { if (this.rlReq_isAlive) { result = QosManager.checkQos(qos); if (result == DDS.ReturnCode.Ok) { using (OpenSplice.CustomMarshalers.DataWriterQosMarshaler marshaler = new OpenSplice.CustomMarshalers.DataWriterQosMarshaler()) { result = marshaler.CopyIn(qos); if (result == ReturnCode.Ok) { marshaler.CopyOut(ref defaultDataWriterQos); } } } } } ReportStack.Flush(this, result != ReturnCode.Ok); return(result); }
internal Publisher() { DDS.ReturnCode result; using (OpenSplice.CustomMarshalers.DataWriterQosMarshaler marshaler = new OpenSplice.CustomMarshalers.DataWriterQosMarshaler()) { result = marshaler.CopyIn(QosManager.defaultDataWriterQos); if (result == ReturnCode.Ok) { marshaler.CopyOut(ref defaultDataWriterQos); } } }
public ReturnCode SetQos(DataWriterQos qos) { ReturnCode result; using (OpenSplice.CustomMarshalers.DataWriterQosMarshaler marshaler = new OpenSplice.CustomMarshalers.DataWriterQosMarshaler()) { result = marshaler.CopyIn(qos); if (result == ReturnCode.Ok) { result = Gapi.DataWriter.set_qos(GapiPeer, marshaler.GapiPtr); } } return(result); }
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); }
internal ReturnCode init(Publisher publisher, DataWriterQos dwQos, Topic aTopic, string dwName) { ReturnCode result = DDS.ReturnCode.Ok; MyDomainId = publisher.MyDomainId; using (OpenSplice.CustomMarshalers.DataWriterQosMarshaler marshaler = new OpenSplice.CustomMarshalers.DataWriterQosMarshaler()) { result = marshaler.CopyIn(dwQos); if (result == ReturnCode.Ok) { IntPtr uWriter = User.Writer.New(publisher.rlReq_UserPeer, dwName, aTopic.rlReq_UserPeer, marshaler.UserPtr); if (uWriter != IntPtr.Zero) { result = base.init(uWriter); } else { ReportStack.Report(result, "Could not create DataWriter."); result = DDS.ReturnCode.OutOfResources; } } else { ReportStack.Report(result, "Could not copy DataWriterQos."); } } if (result == ReturnCode.Ok) { this.publisher = publisher; this.topic = aTopic; (aTopic as ITopicDescriptionImpl).wlReq_IncrNrUsers(); } return(result); }
public IDataWriter CreateDataWriter( ITopic topic, DataWriterQos qos, IDataWriterListener listener, StatusKind mask) { DataWriter dataWriter = null; Topic topicObj = topic as Topic; using (OpenSplice.CustomMarshalers.DataWriterQosMarshaler marshaler = new OpenSplice.CustomMarshalers.DataWriterQosMarshaler()) { if (marshaler.CopyIn(qos) == ReturnCode.Ok) { if (listener != null) { // Note: we use the same gapi lister as the DataWriter since the // publisher doesn't add anything unique OpenSplice.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.Publisher.create_datawriter( GapiPeer, topicObj.GapiPeer, marshaler.GapiPtr, listenerMarshaler.GapiPtr, mask); if (gapiPtr != IntPtr.Zero) { TypeSupport typeSupport = topic.Participant.GetTypeSupport(topic.TypeName) as OpenSplice.TypeSupport; dataWriter = typeSupport.CreateDataWriter(gapiPtr); dataWriter.SetListener(listenerHelper); } } } else { // Invoke the corresponding gapi function. IntPtr gapiPtr = Gapi.Publisher.create_datawriter( GapiPeer, topicObj.GapiPeer, marshaler.GapiPtr, IntPtr.Zero, mask); if (gapiPtr != IntPtr.Zero) { TypeSupport typeSupport = topic.Participant.GetTypeSupport(topic.TypeName) as OpenSplice.TypeSupport; dataWriter = typeSupport.CreateDataWriter(gapiPtr); } } } } if (dataWriter != null) { PublisherQos pubQos = null; ReturnCode result = GetQos(ref pubQos); if (result == ReturnCode.Ok) { if (pubQos.EntityFactory.AutoenableCreatedEntities) { dataWriter.Enable(); } } } return(dataWriter); }