public DDS.ReturnCode GetDiscoveredParticipantData(
     ref ParticipantBuiltinTopicData participant_data, InstanceHandle particpant_handle)
 {
     throw new System.NotImplementedException();
     //return realParticipant.get_discovered_participant_data(
     //      participant_data, participant_handle);
 }
Пример #2
0
        public void TestLookupInstance()
        {
            ParticipantBuiltinTopicData data = default;
            SampleInfo info = new SampleInfo();

            DomainParticipantQos qos = new DomainParticipantQos();

            qos.UserData.Value = new byte[] { 0x42 };
            DomainParticipant otherParticipant = AssemblyInitializer.Factory.CreateParticipant(AssemblyInitializer.RTPS_DOMAIN, qos);

            Assert.IsNotNull(otherParticipant);
            otherParticipant.BindRtpsUdpTransportConfig();

            Thread.Sleep(500);

            ReturnCode ret = _dr.ReadNextSample(ref data, info);

            Assert.AreEqual(ReturnCode.Ok, ret);
            Assert.AreEqual(1, data.UserData.Value.Count());
            Assert.AreEqual(0x42, data.UserData.Value.First());

            // Lookup for an existing instance
            var handle = _dr.LookupInstance(data);

            Assert.AreNotEqual(InstanceHandle.HandleNil, handle);

            ret = otherParticipant.DeleteContainedEntities();
            Assert.AreEqual(ReturnCode.Ok, ret);

            ret = AssemblyInitializer.Factory.DeleteParticipant(otherParticipant);
            Assert.AreEqual(ReturnCode.Ok, ret);
        }
Пример #3
0
        public void TestTakeNextSample()
        {
            ParticipantBuiltinTopicData data = default;
            SampleInfo infos = new SampleInfo();
            ReturnCode ret   = _dr.TakeNextSample(ref data, infos);

            Assert.AreEqual(ReturnCode.NoData, ret);

            DomainParticipantQos qos = new DomainParticipantQos();

            qos.UserData.Value = new byte[] { 0x42 };
            DomainParticipant otherParticipant = AssemblyInitializer.Factory.CreateParticipant(AssemblyInitializer.RTPS_DOMAIN, qos);

            Assert.IsNotNull(otherParticipant);
            otherParticipant.BindRtpsUdpTransportConfig();

            Thread.Sleep(500);

            ret = _dr.TakeNextSample(ref data, infos);
            Assert.AreEqual(ReturnCode.Ok, ret);
            Assert.AreEqual(1, data.UserData.Value.Count());
            Assert.AreEqual(0x42, data.UserData.Value.First());

            ret = otherParticipant.DeleteContainedEntities();
            Assert.AreEqual(ReturnCode.Ok, ret);

            ret = AssemblyInitializer.Factory.DeleteParticipant(otherParticipant);
            Assert.AreEqual(ReturnCode.Ok, ret);
        }
Пример #4
0
        public ReturnCode GetDiscoveredParticipantData(ref ParticipantBuiltinTopicData data, InstanceHandle handle)
        {
            ReturnCode result;
            GCHandle   dataHandle = GCHandle.Alloc(data, GCHandleType.Normal);

            result = (ReturnCode)Gapi.DomainParticipant.get_discovered_participant_data(
                GapiPeer,
                GCHandle.ToIntPtr(dataHandle),
                handle,
                ParticipantDataMarshaler.CopyOutDelegate);

            data = dataHandle.Target as ParticipantBuiltinTopicData;
            dataHandle.Free();

            return(result);
        }
Пример #5
0
        public void TestGetKeyValue()
        {
            // Call GetKeyValue with HandleNil
            ParticipantBuiltinTopicData data = default;
            SampleInfo info = new SampleInfo();
            ReturnCode ret  = _dr.GetKeyValue(ref data, InstanceHandle.HandleNil);

            Assert.AreEqual(ReturnCode.BadParameter, ret);

            DomainParticipantQos qos = new DomainParticipantQos();

            qos.UserData.Value = new byte[] { 0x42 };
            DomainParticipant otherParticipant = AssemblyInitializer.Factory.CreateParticipant(AssemblyInitializer.RTPS_DOMAIN, qos);

            Assert.IsNotNull(otherParticipant);
            otherParticipant.BindRtpsUdpTransportConfig();

            Assert.IsTrue(_participant.WaitForParticipants(1, 20_000));
            Assert.IsTrue(otherParticipant.WaitForParticipants(1, 20_000));

            // Get the for an existing instance
            ret = _dr.ReadNextSample(ref data, info);
            Assert.AreEqual(ReturnCode.Ok, ret);
            Assert.AreEqual(1, data.UserData.Value.Count);
            Assert.AreEqual(0x42, data.UserData.Value.First());

            ParticipantBuiltinTopicData aux = default;

            ret = _dr.GetKeyValue(ref aux, info.InstanceHandle);
            Assert.AreEqual(ReturnCode.Ok, ret);
            for (int i = 0; i < 3; i++)
            {
                Assert.AreEqual(data.Key.Value[i], aux.Key.Value[i]);
            }

            ret = otherParticipant.DeleteContainedEntities();
            Assert.AreEqual(ReturnCode.Ok, ret);

            ret = AssemblyInitializer.Factory.DeleteParticipant(otherParticipant);
            Assert.AreEqual(ReturnCode.Ok, ret);
        }
Пример #6
0
 public int GetDiscoveredParticipantData(
     out ParticipantBuiltinTopicData[] participant_data,
     long participant_handle)
 {
     throw new System.NotImplementedException();
     //return realParticipant.get_discovered_participant_data(
       //      participant_data, participant_handle);
 }
Пример #7
0
        public ReturnCode GetDiscoveredParticipantData(ref ParticipantBuiltinTopicData data, InstanceHandle handle)
        {
            ReturnCode result;
            GCHandle dataHandle = GCHandle.Alloc(data, GCHandleType.Normal);

            result = (ReturnCode)  Gapi.DomainParticipant.get_discovered_participant_data(
                    GapiPeer,
                    GCHandle.ToIntPtr(dataHandle),
                    handle,
                    ParticipantDataMarshaler.CopyOutDelegate);

            data = dataHandle.Target as ParticipantBuiltinTopicData;
            dataHandle.Free();

            return result;
        }
 public override ParticipantBuiltinTopicData CopyFrom(ParticipantBuiltinTopicData other)
 {
     throw new System.NotImplementedException();
 }
Пример #9
0
 public DDS.ReturnCode GetDiscoveredParticipantData(
         ref ParticipantBuiltinTopicData participant_data, InstanceHandle particpant_handle)
 {
     throw new System.NotImplementedException();
     //return realParticipant.get_discovered_participant_data(
       //      participant_data, participant_handle);
 }