Exemplo n.º 1
0
        public ReturnCode GetOfferedIncompatibleQosStatus(
            ref OfferedIncompatibleQosStatus status)
        {
            ReturnCode result;

            using (OfferedIncompatibleQosStatusMarshaler marshaler =
                       new OfferedIncompatibleQosStatusMarshaler())
            {
                if (status == null)
                {
                    status = new OfferedIncompatibleQosStatus();
                }
                if (status.Policies == null)
                {
                    status.Policies = new QosPolicyCount[28];
                }
                marshaler.CopyIn(status);

                result = Gapi.DataWriter.get_offered_incompatible_qos_status(
                    GapiPeer, marshaler.GapiPtr);

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

            return(result);
        }
        internal static V_RESULT CopyOut(ref v_incompatibleQosInfo from, OfferedIncompatibleQosStatus to)
        {
            to.TotalCount       = from.totalCount;
            to.TotalCountChange = from.totalChanged;
            to.LastPolicyId     = (QosPolicyId)from.lastPolicyId;
            if (from.totalCount > 0)
            {
                int arrSize = 0;
                for (int i = 0; i < Constants.V_POLICY_ID_COUNT; i++)
                {
                    int v = from.policyCount[i];

                    if (v != 0)
                    {
                        arrSize++;
                    }
                }

                int n = 0;
                to.Policies = new QosPolicyCount[arrSize];
                for (int i = 0; i < Constants.V_POLICY_ID_COUNT; i++)
                {
                    int v = from.policyCount[i];

                    if (v != 0)
                    {
                        to.Policies[n]          = new QosPolicyCount();
                        to.Policies[n].PolicyId = (QosPolicyId)i;
                        to.Policies[n].Count    = v;
                        n++;
                    }
                }
            }
            return(V_RESULT.OK);
        }
Exemplo n.º 3
0
        public ReturnCode GetOfferedIncompatibleQosStatus(
            ref OfferedIncompatibleQosStatus status)
        {
            ReturnCode result;

            ReportStack.Start();
            if (this.rlReq_isAlive)
            {
                if (status == null)
                {
                    status = new OfferedIncompatibleQosStatus();
                }
                GCHandle statusGCHandle = GCHandle.Alloc(status, GCHandleType.Normal);
                result = uResultToReturnCode(
                    User.Writer.GetIncompatibleQosStatus(
                        rlReq_UserPeer, 1, OfferedIncompatibleQosStatusMarshaler.CopyOut, GCHandle.ToIntPtr(statusGCHandle)));
                status = statusGCHandle.Target as OfferedIncompatibleQosStatus;
                statusGCHandle.Free();
            }
            else
            {
                result = DDS.ReturnCode.AlreadyDeleted;
            }
            ReportStack.Flush(this, result != ReturnCode.Ok);
            return(result);
        }
Exemplo n.º 4
0
        internal static V_RESULT CopyOut(IntPtr fromPtr, IntPtr toPtr)
        {
            v_incompatibleQosInfo from = (v_incompatibleQosInfo)Marshal.PtrToStructure(fromPtr, type);

            GCHandle toGCHandle             = GCHandle.FromIntPtr(toPtr);
            OfferedIncompatibleQosStatus to = toGCHandle.Target as OfferedIncompatibleQosStatus;

            V_RESULT result = CopyOut(ref from, to);

            toGCHandle.Target = to;
            return(result);
        }
Exemplo n.º 5
0
 private void PrivateOfferedIncompatibleQos(
     IntPtr entityData,
     IntPtr writerPtr,
     IntPtr gapi_status)
 {
     if (listener != null)
     {
         IDataWriter dataWriter = (IDataWriter)OpenSplice.SacsSuperClass.fromUserData(writerPtr);
         OfferedIncompatibleQosStatus status = new OfferedIncompatibleQosStatus();
         OfferedIncompatibleQosStatusMarshaler.CopyOut(gapi_status, ref status, 0);
         listener.OnOfferedIncompatibleQos(dataWriter, status);
     }
 }
 private void PrivateOfferedIncompatibleQos(
         IntPtr entityData, 
         IntPtr writerPtr, 
         IntPtr gapi_status)
 {
     if (listener != null)
     {
         IDataWriter dataWriter = (IDataWriter)OpenSplice.SacsSuperClass.fromUserData(writerPtr);
         OfferedIncompatibleQosStatus status = new OfferedIncompatibleQosStatus();
         OfferedIncompatibleQosStatusMarshaler.CopyOut(gapi_status, ref status, 0);
         listener.OnOfferedIncompatibleQos(dataWriter, status);
     }
 }
Exemplo n.º 7
0
        public void TestGetOfferedIncompatibleQosStatus()
        {
            // Initialize entities
            DataWriterQos qos = new DataWriterQos();

            qos.Reliability.Kind = ReliabilityQosPolicyKind.BestEffortReliabilityQos;
            DataWriter writer = _publisher.CreateDataWriter(_topic, qos);

            Assert.IsNotNull(writer);

            // If not matched readers should retur the default status
            OfferedIncompatibleQosStatus status = default;
            ReturnCode result = writer.GetOfferedIncompatibleQosStatus(ref status);

            Assert.AreEqual(ReturnCode.Ok, result);
            Assert.AreEqual(0, status.TotalCount);
            Assert.AreEqual(0, status.TotalCountChange);
            Assert.IsNotNull(status.Policies);
            Assert.AreEqual(0, status.Policies.Count);
            Assert.AreEqual(0, status.LastPolicyId);

            // Create a not compatible reader
            Subscriber subscriber = _participant.CreateSubscriber();

            Assert.IsNotNull(subscriber);

            DataReaderQos drQos = new DataReaderQos();

            drQos.Reliability.Kind = ReliabilityQosPolicyKind.ReliableReliabilityQos;
            DataReader reader = subscriber.CreateDataReader(_topic, drQos);

            Assert.IsNotNull(reader);

            // Wait for discovery and check the status
            System.Threading.Thread.Sleep(100);

            status = default;
            result = writer.GetOfferedIncompatibleQosStatus(ref status);
            Assert.AreEqual(ReturnCode.Ok, result);
            Assert.AreEqual(1, status.TotalCount);
            Assert.AreEqual(1, status.TotalCountChange);
            Assert.AreEqual(11, status.LastPolicyId);
            Assert.IsNotNull(status.Policies);
            Assert.AreEqual(1, status.Policies.Count);
            Assert.AreEqual(1, status.Policies.First().Count);
            Assert.AreEqual(11, status.Policies.First().PolicyId);
        }
Exemplo n.º 8
0
 public override void OnOfferedIncompatibleQos(DataWriter writer, OfferedIncompatibleQosStatus status)
 {
     OfferedIncompatibleQos?.Invoke(writer, status);
 }