Ejemplo n.º 1
0
        public static bool PublicationMatchValid(DDS.IDataWriter writer, int totalCount, int
                                                 totalCountChange)
        {
            bool result = false;

            DDS.PublicationMatchedStatus holder = null;
            DDS.ReturnCode rc = writer.GetPublicationMatchedStatus(ref holder);
            if (rc == DDS.ReturnCode.Ok)
            {
                DDS.PublicationMatchedStatus status = holder;
                if (status.TotalCount == totalCount)
                {
                    if (status.TotalCountChange == totalCountChange)
                    {
                        result = true;
                    }
                    else
                    {
                        System.Console.Error.WriteLine("publication_matched.TotalCountChange != '" + totalCountChange
                                                       + "', but '" + status.TotalCountChange + "'.");
                    }
                }
                else
                {
                    System.Console.Error.WriteLine("publication_matched.TotalCount != '" + totalCount
                                                   + "', but '" + status.TotalCount + "'.");
                }
            }
            else
            {
                System.Console.Error.WriteLine("get_publication_matched_status returned " + rc);
            }
            return(result);
        }
        public static bool OfferedIncompatibleQosValid(DDS.IDataWriter writer, int totalCount
                                                       , int totalCountChange)
        {
            bool result = false;

            DDS.OfferedIncompatibleQosStatus holder = null;
            DDS.ReturnCode rc = writer.GetOfferedIncompatibleQosStatus(ref holder);
            if (rc == DDS.ReturnCode.Ok)
            {
                DDS.OfferedIncompatibleQosStatus status = holder;
                if (status.TotalCount == totalCount)
                {
                    if (status.TotalCountChange == totalCountChange)
                    {
                        result = true;
                    }
                    else
                    {
                        System.Console.Error.WriteLine("offered_incompatible_qos.TotalCountChange != '"
                                                       + totalCountChange + "', but '" + status.TotalCountChange + "'.");
                    }
                }
                else
                {
                    System.Console.Error.WriteLine("offered_incompatible_qos.TotalCount != '" + totalCount
                                                   + "', but '" + status.TotalCount + "'.");
                }
            }
            else
            {
                System.Console.Error.WriteLine("get_offered_incompatible_qos_status returned " +
                                               rc);
            }
            return(result);
        }
        public static bool LivelinessLostValid(DDS.IDataWriter writer, int totalCount, int
                                               totalCountChange)
        {
            bool result = false;

            DDS.LivelinessLostStatus holder = null;
            DDS.ReturnCode           rc     = writer.GetLivelinessLostStatus(ref holder);
            if (rc == DDS.ReturnCode.Ok)
            {
                DDS.LivelinessLostStatus status = holder;
                if (status.TotalCount == totalCount)
                {
                    if (status.TotalCountChange == totalCountChange)
                    {
                        result = true;
                    }
                    else
                    {
                        System.Console.Error.WriteLine("liveliness_lost.TotalCountChange != '" + totalCountChange
                                                       + "', but '" + status.TotalCountChange + "'.");
                    }
                }
                else
                {
                    System.Console.Error.WriteLine("liveliness_lost.TotalCount != '" + totalCount +
                                                   "', but '" + status.TotalCount + "'.");
                }
            }
            else
            {
                System.Console.Error.WriteLine("get_liveliness_lost_status returned " + rc);
            }
            return(result);
        }
Ejemplo n.º 4
0
 private void PrintStatusses(DDS.IDataWriter writer)
 {
     DDS.ReturnCode rc;
     DDS.OfferedDeadlineMissedStatus odsHolder = null;
     rc = writer.GetOfferedDeadlineMissedStatus(ref odsHolder);
     DDS.OfferedDeadlineMissedStatus ods = odsHolder;
     if (rc != DDS.ReturnCode.Ok)
     {
         System.Console.Error.WriteLine("Unable to resolve status!");
         return;
     }
     DDS.OfferedIncompatibleQosStatus oisHolder = null;
     rc = writer.GetOfferedIncompatibleQosStatus(ref oisHolder);
     DDS.OfferedIncompatibleQosStatus ois = oisHolder;
     if (rc != DDS.ReturnCode.Ok)
     {
         System.Console.Error.WriteLine("Unable to resolve status!");
         return;
     }
     DDS.LivelinessLostStatus llsHolder = null;
     rc = writer.GetLivelinessLostStatus(ref llsHolder);
     DDS.LivelinessLostStatus lls = llsHolder;
     if (rc != DDS.ReturnCode.Ok)
     {
         System.Console.Error.WriteLine("Unable to resolve status!");
         return;
     }
     DDS.PublicationMatchedStatus pmsHolder = null;
     rc = writer.GetPublicationMatchedStatus(ref pmsHolder);
     DDS.PublicationMatchedStatus pms = pmsHolder;
     if (rc != DDS.ReturnCode.Ok)
     {
         System.Console.Error.WriteLine("Unable to resolve status!");
         return;
     }
     System.Console.Out.WriteLine("offered_deadline_missed.TotalCount           : " +
                                  ods.TotalCount);
     System.Console.Out.WriteLine("offered_deadline_missed.TotalCountChange    : " +
                                  ods.TotalCountChange);
     System.Console.Out.WriteLine("offered_deadline_missed.LastInstanceHandle  : " +
                                  ods.LastInstanceHandle);
     System.Console.Out.WriteLine("offered_incompatible_qos.TotalCount          : " +
                                  ois.TotalCount);
     System.Console.Out.WriteLine("offered_incompatible_qos.TotalCountChange   : " +
                                  ois.TotalCountChange);
     System.Console.Out.WriteLine("offered_incompatible_qos.LastPolicyId       : " +
                                  ois.LastPolicyId);
     System.Console.Out.WriteLine("liveliness_lost.TotalCount                   : " +
                                  lls.TotalCount);
     System.Console.Out.WriteLine("liveliness_lost.TotalCountChange            : " +
                                  lls.TotalCountChange);
     System.Console.Out.WriteLine("publication_matched.TotalCount               : " +
                                  pms.TotalCount);
     System.Console.Out.WriteLine("publication_matched.TotalCountChange        : " +
                                  pms.TotalCountChange);
     System.Console.Out.WriteLine("publication_matched.LastSubscriptionHandle  : " +
                                  pms.LastSubscriptionHandle);
 }
Ejemplo n.º 5
0
        public override Test.Framework.TestResult Run()
        {
            DDS.IPublisher    publisher;
            DDS.DataWriterQos dataWriterQos = null;
            DDS.DataWriterQos qosHolder1    = null;
            DDS.DataWriterQos qosHolder2    = null;
            DDS.IDataWriter   writer        = null;
            DDS.ITopic        topic;
            string            expResult = "Default DataWriterQos is used when DATAWRITER_QOS_DEFAULT is specified.";

            Test.Framework.TestResult result;
            DDS.ReturnCode            rc;
            result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict.Pass,
                                                   Test.Framework.TestVerdict.Fail);
            publisher = (DDS.IPublisher) this.ResolveObject("publisher");
            topic     = (DDS.ITopic) this.ResolveObject("topic");

            if (publisher.GetDefaultDataWriterQos(ref qosHolder1) != DDS.ReturnCode.Ok)
            {
                result.Result = "Could not retrieve default DataWriterQos";
                return(result);
            }
            dataWriterQos = qosHolder1;
            dataWriterQos.History.Kind  = DDS.HistoryQosPolicyKind.KeepAllHistoryQos;
            dataWriterQos.History.Depth = 150;
            publisher.SetDefaultDataWriterQos(dataWriterQos);

            //TODO: JLS, DDS.DataWriterQos.Default does not exist
            writer = publisher.CreateDataWriter(topic, qosHolder1);
            if (writer == null)
            {
                result.Result = "Could not create a DataWriter.";
                return(result);
            }

            if (writer.GetQos(ref qosHolder2) != DDS.ReturnCode.Ok)
            {
                result.Result = "Could not retrieve DataWriter qos";
                return(result);
            }
            if (!test.sacs.QosComparer.DataWriterQosEquals(qosHolder1, qosHolder2))
            {
                result.Result = "Default DataWriterQos is not used when DATAWRITER_QOS_DEFAULT is specified.";
                return(result);
            }
            rc = publisher.DeleteDataWriter(writer);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "Could not delete a DataWriter (RETCODE = " + rc + ").";
                return(result);
            }
            result.Result  = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }
Ejemplo n.º 6
0
        public override void OnLivelinessLost(DDS.IDataWriter writer, DDS.LivelinessLostStatus status)
        {
            onLivelinessLostCalled = true;
            llStatus = status;
            Semaphore sem = null;

            if (semaphores.TryGetValue(DDS.StatusKind.LivelinessLost, out sem) == true)
            {
                sem.Release();
            }
        }
Ejemplo n.º 7
0
        public override void OnPublicationMatched(DDS.IDataWriter writer, DDS.PublicationMatchedStatus status)
        {
            onPublicationMatchStatus = true;
            pmStatus = status;
            Semaphore sem = null;

            if (semaphores.TryGetValue(DDS.StatusKind.PublicationMatched, out sem) == true)
            {
                sem.Release();
            }
        }
Ejemplo n.º 8
0
        public override void OnOfferedIncompatibleQos(DDS.IDataWriter writer, DDS.OfferedIncompatibleQosStatus status)
        {
            onOfferedIncompatibleQosCalled = true;
            oiqStatus = status;
            Semaphore sem = null;

            if (semaphores.TryGetValue(DDS.StatusKind.OfferedIncompatibleQos, out sem) == true)
            {
                sem.Release();
            }
        }
        public static bool StatussesValid(DDS.IDataWriter writer, int odmTotalCount, int odmTotalCountChange
                                          , int oiqsTotalCount, int oiqsTotalCountChange, int llTotalCount, int llTotalCountChange
                                          , int pmTotalCount, int pmTotalCountChange, int pmCurrentCount, int pmCurrentCountChange)
        {
            bool result = false;

            if (OfferedDeadlineMissedValid(writer, odmTotalCount, odmTotalCountChange))
            {
                if (OfferedIncompatibleQosValid(writer, oiqsTotalCount, oiqsTotalCountChange))
                {
                    if (LivelinessLostValid(writer, llTotalCount, llTotalCountChange))
                    {
                        if (PublicationMatchValid(writer, pmTotalCount, pmTotalCountChange, pmCurrentCount, pmCurrentCountChange))
                        {
                            result = true;
                        }
                    }
                }
            }
            return(result);
        }
 void DDS.IDataWriterListener.OnPublicationMatched(DDS.IDataWriter entityInterface, DDS.PublicationMatchedStatus status)
 {
     onPublicationMatchStatus = true;
     pmStatus = status;
 }
Ejemplo n.º 11
0
 public override void OnPublicationMatched(DDS.IDataWriter writer, DDS.PublicationMatchedStatus status)
 {
     onPublicationMatchStatus = true;
     pmStatus = status;
 }
Ejemplo n.º 12
0
 public override void OnOfferedDeadlineMissed(DDS.IDataWriter writer, DDS.OfferedDeadlineMissedStatus status)
 {
     onOfferedDeadlineMissedCalled = true;
     odmStatus = status;
 }
Ejemplo n.º 13
0
 public override void OnLivelinessLost(DDS.IDataWriter writer, DDS.LivelinessLostStatus status)
 {
     onLivelinessLostCalled = true;
     llStatus = status;
 }
Ejemplo n.º 14
0
 public void Run()
 {
     System.Console.Out.WriteLine("Thread " + this.id + " started...");
     System.Threading.Thread.Sleep(0);
     if (this.entity is DDS.IDomainParticipant)
     {
         DDS.IDomainParticipantListener listener     = new test.sacs.MyParticipantListener();
         DDS.IDomainParticipant         domainEntity = (DDS.IDomainParticipant) this.entity;
         this.rc = (domainEntity).SetListener(listener, DDS.StatusKind.DataAvailable);
         if (this.rc == DDS.ReturnCode.Ok)
         {
             this.rc = domainEntity.SetListener(null, 0);
             if (this.rc == DDS.ReturnCode.Ok)
             {
                 this.rc = domainEntity.SetListener(listener, DDS.StatusKind.OfferedDeadlineMissed);
             }
         }
     }
     else if (this.entity is DDS.IPublisher)
     {
         DDS.IPublisherListener listener     = new test.sacs.MyPublisherListener();
         DDS.IPublisher         domainEntity = (DDS.IPublisher) this.entity;
         this.rc = domainEntity.SetListener(listener, DDS.StatusKind.RequestedDeadlineMissed);
         if (this.rc == DDS.ReturnCode.Ok)
         {
             this.rc = domainEntity.SetListener(null, 0);
             if (this.rc == DDS.ReturnCode.Ok)
             {
                 this.rc = domainEntity.SetListener(listener, DDS.StatusKind.RequestedIncompatibleQos);
             }
         }
     }
     else if (this.entity is DDS.IDataWriter)
     {
         DDS.DataWriterListener listener     = new test.sacs.MyDataWriterListener();
         DDS.IDataWriter        domainEntity = (DDS.IDataWriter) this.entity;
         this.rc = (domainEntity).SetListener(listener, DDS.StatusKind.RequestedDeadlineMissed);
         if (this.rc == DDS.ReturnCode.Ok)
         {
             this.rc = domainEntity.SetListener(null, 0);
             if (this.rc == DDS.ReturnCode.Ok)
             {
                 this.rc = domainEntity.SetListener(listener, DDS.StatusKind.RequestedIncompatibleQos);
             }
         }
     }
     else if (this.entity is DDS.IDataReader)
     {
         DDS.IDataReaderListener listener     = new test.sacs.MyDataReaderListener();
         DDS.IDataReader         domainEntity = (DDS.IDataReader) this.entity;
         this.rc = (domainEntity).SetListener(listener, DDS.StatusKind.OfferedDeadlineMissed);
         if (this.rc == DDS.ReturnCode.Ok)
         {
             this.rc = domainEntity.SetListener(null, 0);
             if (this.rc == DDS.ReturnCode.Ok)
             {
                 this.rc = domainEntity.SetListener(listener, DDS.StatusKind.OfferedIncompatibleQos);
             }
         }
     }
     else if (this.entity is DDS.ITopic)
     {
         DDS.TopicListener listener     = new test.sacs.MyTopicListener();
         DDS.ITopic        domainEntity = (DDS.ITopic) this.entity;
         this.rc = (domainEntity).SetListener(listener, DDS.StatusKind.InconsistentTopic);
         if (this.rc == DDS.ReturnCode.Ok)
         {
             this.rc = domainEntity.SetListener(null, 0);
             if (this.rc == DDS.ReturnCode.Ok)
             {
                 this.rc = domainEntity.SetListener(listener, DDS.StatusKind.InconsistentTopic);
             }
         }
     }
     else if (this.entity is DDS.ISubscriber)
     {
         DDS.ISubscriberListener listener     = new test.sacs.MySubscriberListener();
         DDS.ISubscriber         domainEntity = (DDS.ISubscriber) this.entity;
         this.rc = (domainEntity).SetListener(listener, DDS.StatusKind.OfferedDeadlineMissed);
         if (this.rc == DDS.ReturnCode.Ok)
         {
             this.rc = domainEntity.SetListener(null, 0);
             if (this.rc == DDS.ReturnCode.Ok)
             {
                 this.rc = domainEntity.SetListener(listener, DDS.StatusKind.DataOnReaders);
             }
         }
     }
     else
     {
         System.Console.Out.WriteLine("Entity type: " + this.entity.ToString() + " not supported.");
     }
     System.Console.Out.WriteLine("Thread " + this.id + " finished.");
 }
 void DDS.IDataWriterListener.OnOfferedIncompatibleQos(DDS.IDataWriter entityInterface, DDS.OfferedIncompatibleQosStatus status)
 {
     onOfferedIncompatibleQosCalled = true;
     oiqStatus = status;
 }
 void DDS.IDataWriterListener.OnOfferedDeadlineMissed(DDS.IDataWriter entityInterface, DDS.OfferedDeadlineMissedStatus status)
 {
     onOfferedDeadlineMissedCalled = true;
     odmStatus = status;
 }
 void DDS.IDataWriterListener.OnLivelinessLost(DDS.IDataWriter entityInterface, DDS.LivelinessLostStatus status)
 {
     onLivelinessLostCalled = true;
     llStatus = status;
 }
Ejemplo n.º 18
0
        private static void runListeners(Listener7 listener7, DDS.IEntity entity, int id)
        {
            DDS.ReturnCode rc = DDS.ReturnCode.Error;

            System.Console.Out.WriteLine("Thread {0} started...", id);
            System.Threading.Thread.Sleep(0);
            if (entity is DDS.IDomainParticipant)
            {
                DDS.IDomainParticipantListener listener     = new test.sacs.MyParticipantListener();
                DDS.IDomainParticipant         domainEntity = (DDS.IDomainParticipant)entity;
                rc = (domainEntity).SetListener(listener, DDS.StatusKind.DataAvailable);
                if (rc == DDS.ReturnCode.Ok)
                {
                    rc = domainEntity.SetListener(null, 0);
                    if (rc == DDS.ReturnCode.Ok)
                    {
                        rc = domainEntity.SetListener(listener, DDS.StatusKind.OfferedDeadlineMissed);
                    }
                }
            }
            else
            {
                if (entity is DDS.IPublisher)
                {
                    DDS.IPublisherListener listener     = new test.sacs.MyPublisherListener();
                    DDS.IPublisher         domainEntity = (DDS.IPublisher)entity;
                    rc = domainEntity.SetListener(listener, DDS.StatusKind.RequestedDeadlineMissed);
                    if (rc == DDS.ReturnCode.Ok)
                    {
                        rc = domainEntity.SetListener(null, 0);
                        if (rc == DDS.ReturnCode.Ok)
                        {
                            rc = domainEntity.SetListener(listener, DDS.StatusKind.RequestedIncompatibleQos);
                        }
                    }
                }
                else
                {
                    if (entity is DDS.IDataWriter)
                    {
                        DDS.DataWriterListener listener     = new test.sacs.MyDataWriterListener();
                        DDS.IDataWriter        domainEntity = (DDS.IDataWriter)entity;
                        rc = (domainEntity).SetListener(listener, DDS.StatusKind.RequestedDeadlineMissed);
                        if (rc == DDS.ReturnCode.Ok)
                        {
                            rc = domainEntity.SetListener(null, 0);
                            if (rc == DDS.ReturnCode.Ok)
                            {
                                rc = domainEntity.SetListener(listener, DDS.StatusKind.RequestedIncompatibleQos);
                            }
                        }
                    }
                    else
                    {
                        if (entity is DDS.IDataReader)
                        {
                            DDS.IDataReaderListener listener     = new test.sacs.MyDataReaderListener();
                            DDS.IDataReader         domainEntity = (DDS.IDataReader)entity;
                            rc = (domainEntity).SetListener(listener, DDS.StatusKind.OfferedDeadlineMissed);
                            if (rc == DDS.ReturnCode.Ok)
                            {
                                rc = domainEntity.SetListener(null, 0);
                                if (rc == DDS.ReturnCode.Ok)
                                {
                                    rc = domainEntity.SetListener(listener, DDS.StatusKind.OfferedIncompatibleQos);
                                }
                            }
                        }
                        else
                        {
                            if (entity is DDS.ITopic)
                            {
                                DDS.TopicListener listener     = new test.sacs.MyTopicListener();
                                DDS.ITopic        domainEntity = (DDS.ITopic)entity;
                                rc = (domainEntity).SetListener(listener, DDS.StatusKind.InconsistentTopic);
                                if (rc == DDS.ReturnCode.Ok)
                                {
                                    rc = domainEntity.SetListener(null, 0);
                                    if (rc == DDS.ReturnCode.Ok)
                                    {
                                        rc = domainEntity.SetListener(listener, DDS.StatusKind.InconsistentTopic);
                                    }
                                }
                            }
                            else
                            {
                                if (entity is DDS.ISubscriber)
                                {
                                    DDS.ISubscriberListener listener     = new test.sacs.MySubscriberListener();
                                    DDS.ISubscriber         domainEntity = (DDS.ISubscriber)entity;
                                    rc = (domainEntity).SetListener(listener, DDS.StatusKind.OfferedDeadlineMissed);
                                    if (rc == DDS.ReturnCode.Ok)
                                    {
                                        rc = domainEntity.SetListener(null, 0);
                                        if (rc == DDS.ReturnCode.Ok)
                                        {
                                            rc = domainEntity.SetListener(listener, DDS.StatusKind.DataOnReaders);
                                        }
                                    }
                                }
                                else
                                {
                                    System.Console.Out.WriteLine("Entity type: " + entity.ToString() + " not supported.");
                                }
                            }
                        }
                    }
                }
            }
            System.Console.Out.WriteLine("Thread " + id + " finished.");
        }
Ejemplo n.º 19
0
 public override void OnOfferedIncompatibleQos(DDS.IDataWriter writer, DDS.OfferedIncompatibleQosStatus status)
 {
     onOfferedIncompatibleQosCalled = true;
     oiqStatus = status;
 }