public DomainParticipantTransportSource(IDomainParticipant participant, string senderTopic, string receiverTopic) { _participant = participant; var bdt = new ByteDataTypeSupport(); var result = bdt.RegisterType(participant, bdt.TypeName); if (result != ReturnCode.Ok) { throw new Exception("Unable to register type: " + result); } _publisher = _participant.CreatePublisher(); _subscriber = _participant.CreateSubscriber(); var senderTopicQos = new TopicQos(); participant.GetDefaultTopicQos(ref senderTopicQos); var receiverTopicQos = new TopicQos(); participant.GetDefaultTopicQos(ref receiverTopicQos); _senderTopic = participant.CreateTopic(senderTopic, bdt.TypeName, senderTopicQos); _receiverTopic = participant.CreateTopic(receiverTopic, bdt.TypeName, receiverTopicQos); _dataWriter = (ByteDataWriter)_publisher.CreateDataWriter(_senderTopic); _dataToSendHandle = _dataWriter.RegisterInstance(_dataToSend); var dataReaderQos = new DataReaderQos(); _subscriber.GetDefaultDataReaderQos(ref dataReaderQos); _dataReader = (ByteDataReader)_subscriber.CreateDataReader(_receiverTopic, dataReaderQos, this, StatusKind.Any); }
public DomainParticipantTransportSource(IDomainParticipant participant, string senderTopic, string receiverTopic) { _participant = participant; var bdt = new ByteDataTypeSupport(); var result = bdt.RegisterType(participant, bdt.TypeName); if (result != ReturnCode.Ok) throw new Exception("Unable to register type: " + result); _publisher = _participant.CreatePublisher(); _subscriber = _participant.CreateSubscriber(); var senderTopicQos = new TopicQos(); participant.GetDefaultTopicQos(ref senderTopicQos); var receiverTopicQos = new TopicQos(); participant.GetDefaultTopicQos(ref receiverTopicQos); _senderTopic = participant.CreateTopic(senderTopic, bdt.TypeName, senderTopicQos); _receiverTopic = participant.CreateTopic(receiverTopic, bdt.TypeName, receiverTopicQos); _dataWriter = (ByteDataWriter)_publisher.CreateDataWriter(_senderTopic); _dataToSendHandle = _dataWriter.RegisterInstance(_dataToSend); var dataReaderQos = new DataReaderQos(); _subscriber.GetDefaultDataReaderQos(ref dataReaderQos); _dataReader = (ByteDataReader)_subscriber.CreateDataReader(_receiverTopic, dataReaderQos, this, StatusKind.Any); }