Ejemplo n.º 1
1
 public static extern IntPtr create_datawriter(
     IntPtr _this,
     IntPtr a_topic,
     IntPtr qos,
     IntPtr a_listener,
     StatusKind mask
     );
Ejemplo n.º 2
0
        protected ReturnCode wlReq_SetListener(IListener aListener, StatusKind mask)
        {
            ReturnCode result = ReturnCode.Ok;

            Debug.Assert(listenerDispatcher != null);
            if (mask != 0 && aListener != null)
            {
                result = listenerDispatcher.Add(this, mask);
                if (result == DDS.ReturnCode.Ok)
                {
                    wait = true;
                }
            }
            else
            {
                V_RESULT uResult = User.Entity.SetListener(
                    rlReq_UserPeer, IntPtr.Zero, IntPtr.Zero, 0);
                result = uResultToReturnCode(uResult);
                if (result == DDS.ReturnCode.Ok)
                {
                    WaitListenerRemoved();
                    listenerDispatcher.Remove(this);
                }
            }

            if (result == DDS.ReturnCode.Ok)
            {
                listener     = aListener;
                listenerMask = mask;
            }

            return(result);
        }
Ejemplo n.º 3
0
        public ReturnCode SetListener(ITopicListener listener, StatusKind mask)
        {
            ReturnCode result = ReturnCode.Error;

            Gapi.gapi_topicListener gapiListener;
            listenerHelper.Listener = listener;
            listenerHelper.CreateListener(out gapiListener);
            if (listener != null)
            {
                lock (listener)
                {
                    using (TopicListenerMarshaler marshaler = new TopicListenerMarshaler(ref gapiListener))
                    {
                        result = Gapi.Topic.set_listener(
                            GapiPeer,
                            marshaler.GapiPtr,
                            mask);
                    }
                }
            }
            else
            {
                result = Gapi.Topic.set_listener(
                    GapiPeer,
                    IntPtr.Zero,
                    mask);
            }
            return(result);
        }
Ejemplo n.º 4
0
        public ReturnCode SetListener(ITopicListener listener, StatusKind mask)
        {
            ReturnCode result = ReturnCode.Error;

            Gapi.gapi_topicListener gapiListener;
            listenerHelper.Listener = listener;
            listenerHelper.CreateListener(out gapiListener);
            if (listener != null)
            {
                lock (listener)
                {
                    using (TopicListenerMarshaler marshaler = new TopicListenerMarshaler(ref gapiListener))
                    {
                        result = Gapi.Topic.set_listener(
                            GapiPeer,
                            marshaler.GapiPtr,
                            mask);
                    }
                }
            }
            else
            {
                result = Gapi.Topic.set_listener(
                    GapiPeer,
                    IntPtr.Zero,
                    mask);
            }
            return result;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Write a message on the status strip, with a given severity.
        /// </summary>
        /// <param name="message">Message to display.</param>
        /// <param name="kind">Severity of message.</param>
        public void Status(string message, StatusKind kind)
        {
            if (parentControl.InvokeRequired)
            {
                parentControl.Invoke(this.crossInvoke, new object[] { message, kind });
            }
            else
            {
                if (kind == StatusKind.Error)
                {
                    this.label.BackColor = Color.Red;
                }
                else
                {
                    this.label.BackColor = defaultStatusStripBackColor;
                }

                if (kind == StatusKind.LongOp)
                {
                    System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
                }
                else
                {
                    System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
                }

                this.label.Text = message;
                this.parentControl.Refresh();
                Console.WriteLine("{0}: {1}, {2}", DateTime.Now.ToString("hh:mm:ss.ff"), kind, message);
            }
        }
        public static Image GetImage(StatusKind status)
        {
            switch (status)
            {
            case StatusKind.Added:
                return(GetImage(StatusIcon.Added));

            case StatusKind.Deleted:
                return(GetImage(StatusIcon.Deleted));

            case StatusKind.Modified:
            case StatusKind.Replaced:
                return(GetImage(StatusIcon.Modified));

            case StatusKind.Normal:
                return(GetImage(StatusIcon.OK));

            case StatusKind.Conflicted:
            case StatusKind.Obstructed:
                return(GetImage(StatusIcon.Exclamation));

            default:
                return(null);
            }
        }
Ejemplo n.º 7
0
        public override void Update()
        {
            if (timer > 0)
            {
                timer--;
                return;
            }

            if (stock.stack > 0)
            {
                foreach (var container in ModContent.GetInstance <TransferAgent>().FindContainerAdjacent(Position.X, Position.Y))
                {
                    container.InjectItem(stock);

                    if (stock.stack < 1)
                    {
                        Status = StatusKind.Success;
                        break;
                    }
                }

                if (stock.stack > 0)
                {
                    timer  = 60;
                    Status = StatusKind.MissingSpace;
                }

                if (Main.netMode == 2)
                {
                    NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y);
                }
            }
        }
Ejemplo n.º 8
0
 public IDataReader CreateDataReader(
     ITopicDescription topic,
     IDataReaderListener listener,
     StatusKind mask)
 {
     return(CreateDataReader(topic, defaultDataReaderQos, listener, mask));
 }
Ejemplo n.º 9
0
        public ReturnCode SetListener(IPublisherListener listener, StatusKind mask)
        {
            ReturnCode result = ReturnCode.Error;

            if (listener != null)
            {
                Gapi.gapi_publisherDataWriterListener gapiListener;
                listenerHelper.Listener = listener;
                listenerHelper.CreateListener(out gapiListener);
                lock (listener)
                {
                    using (PublisherDataWriterListenerMarshaler marshaler =
                               new PublisherDataWriterListenerMarshaler(ref gapiListener))
                    {
                        result = Gapi.Publisher.set_listener(
                            GapiPeer,
                            marshaler.GapiPtr,
                            mask);
                    }
                }
            }
            else
            {
                result = Gapi.Publisher.set_listener(
                    GapiPeer,
                    IntPtr.Zero,
                    mask);
            }
            return(result);
        }
 public FrmCustomers(Customers c, StatusKind sta)
 {
     InitializeComponent();
     this.statusFrm = sta;
     myCust         = c;
     FillFild(myCust);
 }
Ejemplo n.º 11
0
 public override void NetReceive(BinaryReader reader, bool lightReceive)
 {
     base.NetReceive(reader, lightReceive);
     Status          = (StatusKind)reader.ReadByte();
     MissingItemType = reader.ReadInt32();
     stock           = reader.ReadItem(true);
 }
Ejemplo n.º 12
0
 public IDataWriter CreateDataWriter(
     ITopic topic,
     IDataWriterListener listener,
     StatusKind mask)
 {
     return(CreateDataWriter(topic, defaultDataWriterQos, listener, mask));
 }
Ejemplo n.º 13
0
 /// <summary>
 /// This operation creates a new IDomainParticipant which will join the domain
 /// identified by domainId (or DDS.DomainId.Default), and attaches the specified
 /// IDomainParticipantListener to it and uses the given communication StatusKind mask.
 /// </summary>
 /// <remarks>
 /// It will use default DDS.DomainParticipantQos.
 ///
 /// See
 /// @ref DDS.DomainParticipantFactory.CreateParticipant(DomainId domainId, DomainParticipantQos qos, IDomainParticipantListener listener, StatusKind mask) "CreateParticipant"
 /// for:<br>
 /// - Identifying the Domain
 /// - Communication Status
 /// - Status Propagation
 /// </remarks>
 /// @param domainId The ID of the Domain to which the IDomainParticipant is joined.
 ///                 This should be the ID as specified in the configuration file.
 /// @param listener A IDomainParticipantListener instance which will be attached to
 ///                 the new IDomainParticipant. It is permitted to use null as the
 ///                 value of the listener: this behaves as a IDomainParticipantListener
 ///                 whose operations perform no action.
 /// @param mask     A bit-mask in which each bit enables the invocation of the
 ///                 IDomainParticipantListener for a certain status.
 /// @return The newly created IDomainParticipant. In case of an error a null is returned.
 public IDomainParticipant CreateParticipant(
     DomainId domainId,
     IDomainParticipantListener listener,
     StatusKind mask)
 {
     return(CreateParticipant(domainId, defaultParticipantQos, listener, mask));
 }
Ejemplo n.º 14
0
 public Anomaly(Ichangable item, string message, string propertyInFailed, StatusKind status)
 {
     this.Item         = item;
     this.Message      = message;
     this.PropertyName = propertyInFailed;
     this.Status       = status;
 }
Ejemplo n.º 15
0
 public static extern IntPtr create_datawriter(
     IntPtr _this,
     IntPtr a_topic,
     IntPtr qos,
     IntPtr a_listener,
     StatusKind mask
     );
        internal ReturnCode Add(Entity observable, StatusKind mask)
        {
            ReturnCode result = DDS.ReturnCode.Ok;
            V_RESULT   uResult;

            uint vMask = vEventMarshaler.vEventMaskFromStatusMask(mask);

            lock (this)
            {
                uResult = User.Entity.SetListener(
                    observable.rlReq_UserPeer, rlReq_UserPeer, IntPtr.Zero, vMask);
                result = uResultToReturnCode(uResult);
                if (result == DDS.ReturnCode.Ok)
                {
                    if (!Observables.Contains(observable))
                    {
                        Observables.Add(observable);
                    }
                    Start();

                    /* result = Start();
                     * TODO: Restore original listener if thread fails to start.
                     * See cmn_listenerDispatcher_add for more information. */
                }
            }

            return(result);
        }
Ejemplo n.º 17
0
        public ReturnCode SetListener(IPublisherListener listener, StatusKind mask)
        {
            ReturnCode result = ReturnCode.Error;

            if (listener != null)
            {
                Gapi.gapi_publisherDataWriterListener gapiListener;
                listenerHelper.Listener = listener;
                listenerHelper.CreateListener(out gapiListener);
                lock (listener)
                {
                    using (PublisherDataWriterListenerMarshaler marshaler =
                            new PublisherDataWriterListenerMarshaler(ref gapiListener))
                    {
                        result = Gapi.Publisher.set_listener(
                                GapiPeer,
                                marshaler.GapiPtr,
                                mask);
                    }
                }
            }
            else
            {
                result = Gapi.Publisher.set_listener(
                        GapiPeer,
                        IntPtr.Zero,
                        mask);
            }
            return result;
        }
Ejemplo n.º 18
0
        public ReturnCode SetListener(IDomainParticipantListener listener, StatusKind mask)
        {
            ReturnCode result = ReturnCode.Error;

            if (listener != null)
            {
                Gapi.gapi_domainParticipantListener gapiListener;
                listenerHelper.Listener = listener;
                listenerHelper.CreateListener(out gapiListener);
                lock (listener)
                {
                    using (DomainParticipantListenerMarshaler marshaler = new DomainParticipantListenerMarshaler(ref gapiListener))
                    {
                        result = Gapi.DomainParticipant.set_listener(
                            GapiPeer,
                            marshaler.GapiPtr,
                            mask);
                    }
                }
            }
            else
            {
                result = Gapi.DomainParticipant.set_listener(
                    GapiPeer,
                    IntPtr.Zero,
                    mask);
            }
            return(result);
        }
Ejemplo n.º 19
0
        static void Main(string[] args)
        {
            DDSEntityManager     mgr    = new DDSEntityManager("Listener");
            ReturnCode           status = ReturnCode.Error;
            ListenerDataListener myListener;
            String partitionName = "Listener Example";
            int    count         = 0;

            // create Domain Participant
            mgr.createParticipant(partitionName);

            // create Type
            MsgTypeSupport msgTS = new MsgTypeSupport();

            mgr.registerType(msgTS);

            // create Topic
            mgr.createTopic("ListenerData_Msg");

            // create Subscriber
            mgr.createSubscriber();

            // create DataReader
            mgr.createReader(false);

            IDataReader dreader = mgr.getReader();

            myListener       = new ListenerDataListener();
            myListener.MsgDR = dreader as MsgDataReader;

            Console.WriteLine("=== [ListenerDataSubscriber] SetListener");
            StatusKind kind = StatusKind.DataAvailable | StatusKind.RequestedDeadlineMissed;

            status = myListener.MsgDR.SetListener(myListener, kind);
            ErrorHandler.checkStatus(status, "DataReader.SetListener");

            Console.WriteLine("=== [ListenerDataSubscriber] Ready...");
            myListener.terminated = false;

            WaitSet ws = new WaitSet();

            ws.AttachCondition(myListener.guardCond);
            ICondition[] cond = null;

            while (!myListener.terminated && count < 1500)
            {
                Console.WriteLine("=== [SubscriberUsingListener] waiting waitset ...");
                ws.Wait(ref cond, Duration.Infinite);
                myListener.guardCond.SetTriggerValue(false);
                ++count;
            }

            Console.WriteLine("===[ListenerDataSubscriber] Market Closed.");

            mgr.getSubscriber().DeleteDataReader(myListener.MsgDR);
            mgr.deleteSubscriber();
            mgr.deleteTopic();
            mgr.deleteParticipant();
        }
Ejemplo n.º 20
0
 internal StatusMessage(StatusKind statusKind, string message, int progressValue, int progressMaximumValue, DateTime timeStamp)
 {
     _statusKind = statusKind;
     _message = message;
     _progressValue = progressValue;
     _progressMaximumValue = progressMaximumValue;
     _timeStamp = timeStamp;
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Display a status message.
 /// </summary>
 /// <param name="message">Message to display.</param>
 /// <param name="statusKind">Message severity.</param>
 public void Status(string message, StatusKind statusKind)
 {
     if (this.canceled || this.IsDisposed)
     {
         return;
     }
     this.status.Status(message, statusKind);
 }
Ejemplo n.º 22
0
 public static extern IntPtr create_topic(
     IntPtr _this,
     string topic_name,
     string type_name,
     IntPtr qos,
     IntPtr a_listener,
     StatusKind mask
     );
Ejemplo n.º 23
0
 public static extern IntPtr create_participant(
     IntPtr _this,
     string domainId,
     IntPtr qos,
     IntPtr a_listener,
     StatusKind mask,
     IntPtr thread_start_action,
     IntPtr thread_stop_action,
     IntPtr thread_action_arg);
Ejemplo n.º 24
0
 public static extern IntPtr create_participant(
     IntPtr _this,
     string domainId,
     IntPtr qos,
     IntPtr a_listener,
     StatusKind mask,
     IntPtr thread_start_action,
     IntPtr thread_stop_action,
     IntPtr thread_action_arg);
Ejemplo n.º 25
0
 internal StatusMessage
     (StatusKind statusKind, string message, int progressValue, int progressMaximumValue, DateTime timeStamp)
 {
     _statusKind           = statusKind;
     _message              = message;
     _progressValue        = progressValue;
     _progressMaximumValue = progressMaximumValue;
     _timeStamp            = timeStamp;
 }
Ejemplo n.º 26
0
        /// <summary>
        /// This operation creates a new IDomainParticipant which will join the domain
        /// identified by domainId, with the desired DomainParticipantQos and attaches
        /// the specified IDomainParticipantListener to it and uses the given communication
        /// StatusKind mask.
        /// </summary>
        /// <remarks>
        /// <i><b>Identifying the Domain</b></i><br>
        /// The IDomainParticipant will attach to the Domain that is specified by the
        /// domainId parameter. This parameter consists of an integer specified in the Id tag
        /// in the configuration file. Note that to make multiple connections to a Domain (create
        /// multiple Participants for the same Domain) within a single process, all of the
        /// Participants must use the same identification (i.e. all use the same domain Id).
        ///
        /// The constant DDS.DomainId.Default can be used for this parameter. If this is done
        /// the value of Id tag from the configuration file specified by the environment variable
        /// called OSPL_URI will be used.
        ///
        /// It is recommended to use this domain Id in conjunction with the OSPL_URI
        /// environment variable instead of hard-coding a domain Id into your application,
        /// since this gives you much more flexibility in the deployment phase of your product.<br>
        /// See also Section 1.3.2.1, The OSPL_URI environment variable, in the Deployment
        /// Guide.
        ///
        /// <i><b>Communication Status</b></i><br>
        /// For each communication status, the StatusChangedFlag flag is initially set to
        /// false. It becomes true whenever that communication status changes. For each
        /// communication status activated in the mask , the associated
        /// IDomainParticipantListener operation is invoked and the communication
        /// status is reset to false , as the listener implicitly accesses the status which is passed
        /// as a parameter to that operation. The fact that the status is reset prior to calling the
        /// listener means that if the application calls the Get<status_name>Status from
        /// inside the listener it will see the status already reset.
        ///
        /// The following statuses are applicable to the IDomainParticipant
        /// - DDS.StatusKind InconsistentTopic (propagated)
        /// - DDS.StatusKind OfferedDeadlineMissed (propagated)
        /// - DDS.StatusKind RequestedDeadlineMissed (propagated)
        /// - DDS.StatusKind OfferedIncompatibleQos (propagated)
        /// - DDS.StatusKind RequestedIncompatibleQos (propagated)
        /// - DDS.StatusKind SampleLost (propagated)
        /// - DDS.StatusKind SampleRejected (propagated)
        /// - DDS.StatusKind DataOnReaders (propagated)
        /// - DDS.StatusKind DataAvailable (propagated)
        /// - DDS.StatusKind LivelinessLost (propagated)
        /// - DDS.StatusKind LivelinessChanged (propagated)
        /// - DDS.StatusKind PublicationMatched (propagated)
        /// - DDS.StatusKind SubscriptionMatched (propagated)
        ///
        /// Be aware that the PublicationMatched and SubscriptionMatched
        /// statuses are not applicable when the infrastructure does not have the
        /// information available to determine connectivity. This is the case when OpenSplice
        /// is configured not to maintain discovery information in the Networking Service. (See
        /// the description for the NetworkingService/Discovery/enabled property in
        /// the Deployment Manual for more information about this subject.) In this case the
        /// operation will return NULL.
        ///
        /// Status bits are declared as a constant and can be used by the application in an OR
        /// operation to create a tailored mask. The special constant 0 can
        /// be used to indicate that the created entity should not respond to any of its available
        /// statuses. The DDS will therefore attempt to propagate these statuses to its factory.
        ///
        /// <i><b>Status Propagation</b></i><br>
        /// The Data Distribution Service will trigger the most specific and relevant Listener.<br>
        /// In other words, in case a communication status is also activated on the Listener of
        /// a contained entity, the Listener on that contained entity is invoked instead of the
        /// IDomainParticipantListener. This means that a status change on a contained
        /// entity only invokes the IDomainParticipantListener if the contained entity
        /// itself does not handle the trigger event generated by the status change.
        ///
        /// The statuses DataOnReaders and DataAvailable are
        /// “Read Communication Statuses” and are an exception to all other plain
        /// communication statuses: they have no corresponding status structure that can be
        /// obtained with a Get<status_name>Status operation and they are mutually
        /// exclusive. When new information becomes available to a IDataReader, the Data
        /// Distribution Service will first look in an attached and activated
        /// ISubscriberListener or IDomainParticipantListener (in that order) for the
        /// DataOnReaders. In case the DataOnReaders can not be
        /// handled, the Data Distribution Service will look in an attached and activated
        /// IDataReaderListener, ISubscriberListener or IDomainParticipantListener for
        /// the DataAvailable (in that order).
        /// </remarks>
        /// @param domainId The ID of the Domain to which the IDomainParticipant is joined.
        ///                 This should be the ID as specified in the configuration file.
        /// @param qos      a DomainParticipantQos for the new IDomainParticipant. When
        ///                 this set of QosPolicy settings is inconsistent, no
        ///                 IDomainParticipant is created.
        /// @param listener A IDomainParticipantListener instance which will be attached to
        ///                 the new IDomainParticipant. It is permitted to use null as the
        ///                 value of the listener: this behaves as a IDomainParticipantListener
        ///                 whose operations perform no action.
        /// @param mask     A bit-mask in which each bit enables the invocation of the
        ///                 IDomainParticipantListener for a certain status.
        /// @return The newly created IDomainParticipant. In case of an error a null is returned.
        public IDomainParticipant CreateParticipant(
            DomainId domainId,
            DomainParticipantQos qos,
            IDomainParticipantListener listener,
            StatusKind mask)
        {
            DomainParticipant participant = null;
            ReturnCode        result;

            ReportStack.Start();
            result = QosManager.checkQos(qos);
            if (result == DDS.ReturnCode.Ok)
            {
                if (domainId != DDS.DomainId.Invalid)
                {
                    lock (singleton_lock)
                    {
                        participant = new OpenSplice.DomainParticipant();
                        result      = participant.init(domainId, qos);
                        if (result == ReturnCode.Ok)
                        {
                            result = participant.SetListener(listener, mask);
                        }
                        else
                        {
                            participant = null;
                        }

                        if (result == ReturnCode.Ok)
                        {
                            participantList.Add(participant);
                            if (myQos.EntityFactory.AutoenableCreatedEntities)
                            {
                                result = participant.Enable();
                            }
                        }
                    }
                }
                else
                {
                    ReportStack.Report(DDS.ReturnCode.BadParameter,
                                       "DomainParticipant is using an invalid domain identifier (" + domainId + ").");
                }
            }

            if (result != ReturnCode.Ok && participant != null)
            {
                // Ignore result because we prefer the original error.
                DeleteParticipant(participant);
                participant = null;
            }

            ReportStack.Flush(null, result != ReturnCode.Ok);
            return(participant);
        }
Ejemplo n.º 27
0
        public IPublisher CreatePublisher(IPublisherListener listener, StatusKind mask)
        {
            IPublisher publisher = null;

            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.DomainParticipant.create_publisher(
                        GapiPeer,
                        Gapi.NativeConstants.GapiPublisherQosDefault,
                        listenerMarshaler.GapiPtr,
                        mask);
                    if (gapiPtr != IntPtr.Zero)
                    {
                        publisher = new Publisher(gapiPtr, listenerHelper);
                    }
                }
            }
            else
            {
                IntPtr gapiPtr = Gapi.DomainParticipant.create_publisher(
                    GapiPeer,
                    Gapi.NativeConstants.GapiPublisherQosDefault,
                    IntPtr.Zero,
                    mask);
                if (gapiPtr != IntPtr.Zero)
                {
                    publisher = new Publisher(gapiPtr);
                }
            }

            if (publisher != null)
            {
                DomainParticipantQos dpQos  = null;
                ReturnCode           result = GetQos(ref dpQos);
                if (result == ReturnCode.Ok)
                {
                    if (dpQos.EntityFactory.AutoenableCreatedEntities)
                    {
                        publisher.Enable();
                    }
                }
            }

            return(publisher);
        }
Ejemplo n.º 28
0
 public static bool IsInSourceControl(string fileName)
 {
     if (Commands.RegisterEventsCommand.CanBeVersionControlledFile(fileName))
     {
         StatusKind status = OverlayIconManager.GetStatus(fileName);
         return(status != StatusKind.None && status != StatusKind.Unversioned && status != StatusKind.Ignored);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 29
0
        public ISubscriber CreateSubscriber(ISubscriberListener listener, StatusKind mask)
        {
            ISubscriber subscriber = null;

            if (listener != null)
            {
                OpenSplice.Gapi.gapi_subscriberListener gapiListener;
                SubscriberListenerHelper listenerHelper = new SubscriberListenerHelper();
                listenerHelper.Listener = listener;
                listenerHelper.CreateListener(out gapiListener);
                using (SubscriberListenerMarshaler listenerMarshaler =
                           new SubscriberListenerMarshaler(ref gapiListener))
                {
                    IntPtr gapiPtr = Gapi.DomainParticipant.create_subscriber(
                        GapiPeer,
                        Gapi.NativeConstants.GapiSubscriberQosDefault,
                        listenerMarshaler.GapiPtr,
                        mask);
                    if (gapiPtr != IntPtr.Zero)
                    {
                        subscriber = new Subscriber(gapiPtr, listenerHelper);
                    }
                }
            }
            else
            {
                IntPtr gapiPtr = Gapi.DomainParticipant.create_subscriber(
                    GapiPeer,
                    Gapi.NativeConstants.GapiSubscriberQosDefault,
                    IntPtr.Zero,
                    mask);
                if (gapiPtr != IntPtr.Zero)
                {
                    subscriber = new Subscriber(gapiPtr);
                }
            }

            if (subscriber != null)
            {
                DomainParticipantQos dpQos  = null;
                ReturnCode           result = GetQos(ref dpQos);
                if (result == ReturnCode.Ok)
                {
                    if (dpQos.EntityFactory.AutoenableCreatedEntities)
                    {
                        subscriber.Enable();
                    }
                }
            }

            return(subscriber);
        }
Ejemplo n.º 30
0
        internal bool BeginOperation(StatusKind operationStatus, out Guid operationId, out CancellationToken cancelToken)
        {
            if (!BeginOperation(operationStatus, out operationId))
            {
                return(false);
            }

            CurrentOperationCancellationTokenSource = new CancellationTokenSource();
            cancelToken = CurrentOperationCancellationTokenSource.Token;

            _OngoingOperations[operationId].CancelTokenSource = CurrentOperationCancellationTokenSource;
            return(true);
        }
Ejemplo n.º 31
0
        public ReturnCode SetListener(IPublisherListener listener, StatusKind mask)
        {
            ReturnCode result = DDS.ReturnCode.AlreadyDeleted;

            ReportStack.Start();
            lock (this)
            {
                if (this.rlReq_isAlive)
                {
                    result = wlReq_SetListener(listener, mask);
                }
            }
            ReportStack.Flush(this, result != ReturnCode.Ok);

            return(result);
        }
Ejemplo n.º 32
0
        /// <summary>
        /// This operation returns the list of enabled communication statuses of the StatusCondition.
        /// </summary>
        /// <returns>StatusKind - a bit mask in which each bit shows which status is taken into account
        /// for the StatusCondition</returns>
        public StatusKind GetEnabledStatuses()
        {
            StatusKind mask = 0;
            bool       isAlive;

            ReportStack.Start();
            lock (this)
            {
                isAlive = this.rlReq_isAlive;
                if (isAlive)
                {
                    mask = enabledStatusMask;
                }
            }
            ReportStack.Flush(this, !isAlive);

            return(mask);
        }
Ejemplo n.º 33
0
		public static Image GetImage(StatusKind status)
		{
			switch (status) {
				case StatusKind.Added:
					return GetImage(StatusIcon.Added);
				case StatusKind.Deleted:
					return GetImage(StatusIcon.Deleted);
				case StatusKind.Modified:
				case StatusKind.Replaced:
					return GetImage(StatusIcon.Modified);
				case StatusKind.Normal:
					return GetImage(StatusIcon.OK);
				case StatusKind.Conflicted:
				case StatusKind.Obstructed:
					return GetImage(StatusIcon.Exclamation);
				default:
					return null;
			}
		}
        public void ShowStatus(string msg, StatusKind kind)
        {
            switch (kind)
            {
            case StatusKind.Error:
                lblStatusText.Foreground = new SolidColorBrush(Colors.OrangeRed);
                break;

            case StatusKind.Good:
                lblStatusText.Foreground = new SolidColorBrush(Colors.LawnGreen);
                break;

            case StatusKind.Warning:
                lblStatusText.Foreground = new SolidColorBrush(Colors.Yellow);
                break;
            }
            lblStatusText.Text = msg;
            ((Storyboard)FindResource("animate")).Begin(theStatusBar);
        }
Ejemplo n.º 35
0
        internal bool BeginOperation(StatusKind operationKind, out Guid operationId)
        {
            operationId = Guid.Empty;

            if (!IsReady)
            {
                SignalOperationInProgress();
                return(false);
            }

            ErrorProvider.Instance.LogInfo("BeginOperation " + operationKind.ToString());
            Status = operationKind;

            operationId = Guid.NewGuid();
            _OngoingOperations.Add(operationId, new OperationData {
                Status = operationKind
            });

            return(true);
        }
Ejemplo n.º 36
0
        internal ReturnCode init(Entity entity)
        {
            ReturnCode result;

            ReportStack.Start();
            IntPtr userPtr = User.StatusCondition.New(entity.rlReq_UserPeer);

            if (userPtr != IntPtr.Zero)
            {
                this.entity       = entity;
                enabledStatusMask = StatusKind.Any;
                result            = base.init(userPtr, false);
            }
            else
            {
                result = DDS.ReturnCode.Error;
                ReportStack.Report(result, "Could not create StatusCondition.");
            }
            ReportStack.Flush(this, result != ReturnCode.Ok);
            return(result);
        }
Ejemplo n.º 37
0
        /// <summary>
        /// Write a message on the status strip, with a given severity.
        /// </summary>
        /// <param name="message">Message to display.</param>
        /// <param name="kind">Severity of message.</param>
        public void Status(string message, StatusKind kind)
        {
            if (parentControl.InvokeRequired)
            {
                parentControl.Invoke(this.crossInvoke, new object[] { message, kind });
            }
            else
            {
                if (kind == StatusKind.Error)
                    this.label.BackColor = Color.Red;
                else
                    this.label.BackColor = defaultStatusStripBackColor;

                if (kind == StatusKind.LongOp)
                    System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
                else
                    System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;

                this.label.Text = message;
                this.parentControl.Refresh();
                Console.WriteLine("{0}: {1}, {2}", DateTime.Now.ToString("hh:mm:ss.ff"), kind, message);
            }
        }
Ejemplo n.º 38
0
        public ReturnCode SetListener(IDataWriterListener listener, StatusKind mask)
        {
            ReturnCode result = ReturnCode.Error;

            if (listener != null)
            {
                Gapi.gapi_publisherDataWriterListener gapiListener;
                if (listenerHelper == null)
                {
                    // Since the real DataWriter is created from the TypeSupport,
                    // the listenerHelper is not "readonly"
                    listenerHelper = new PublisherDataWriterListenerHelper();
                }
                listenerHelper.Listener = listener;
                listenerHelper.CreateListener(out gapiListener);
                lock (listener)
                {
                    using (PublisherDataWriterListenerMarshaler marshaler = 
                            new PublisherDataWriterListenerMarshaler(ref gapiListener))
                    {
                        result = Gapi.DataWriter.set_listener(
                            GapiPeer,
                            marshaler.GapiPtr,
                            mask);
                    }
                }
            }
            else
            {
                result = Gapi.DataWriter.set_listener(
                    GapiPeer,
                    IntPtr.Zero,
                    mask);
            }

            return result;
        }
Ejemplo n.º 39
0
 public IPublisher CreatePublisher(PublisherQos qos, IPublisherListener listener, StatusKind mask)
 {
     return realParticipant.CreatePublisher(qos, listener, mask);
 }
Ejemplo n.º 40
0
 public IPublisher CreatePublisher(IPublisherListener listener, StatusKind mask)
 {
     return realParticipant.CreatePublisher(listener, mask);
 }
Ejemplo n.º 41
0
 /// <summary>
 /// Display the current status.
 /// </summary>
 /// <param name="msg">Message to display.</param>
 /// <param name="kind">Kind of status message.</param>
 public void Status(string msg, StatusKind kind)
 {
     this.status.Status(msg, kind);
 }
Ejemplo n.º 42
0
 internal StatusMessage(StatusKind statusKind, string message, DateTime timeStamp)
 {
     _statusKind = statusKind;
     _message = message;
     _timeStamp = timeStamp;
 }
Ejemplo n.º 43
0
        /// <summary>
        /// This operation creates a Publisher with the desired QosPolicy settings and if applicable,
        /// attaches the optionally specified PublisherListener to it.
        /// </summary>
        /// <remarks>
        /// This operation creates a Publisher with the desired QosPolicy settings and if
        /// applicable, attaches the optionally specified PublisherListener to it. When the
        /// PublisherListener is not applicable, the NULL pointer must be supplied instead.
        /// To delete the Publisher the operation DeletePublisher or
        /// DeleteContainedEntities must be used.
        /// In case the specified QosPolicy settings are not consistent, no Publisher is
        /// created and the NULL pointer is returned.
        /// </remarks>
        /// <param name="qos">A collection of QosPolicy settings for the new Publisher.
        /// In case these settings are not self consistent, no Publisher is created.</param>
        /// <param name="listener">The PublisherListener instance which will be attached to the new Publisher.
        /// It is permitted to use null as the value of the listener: this behaves as a PublisherListener
        /// whose operations perform no action.</param>
        /// <param name="mask">A bit-mask in which each bit enables the invocation of the PublisherListener
        /// for a certain status.</param>
        /// <returns>The newly created Publisher. In case of an error, a null Publisher is returned.</returns>
        public IPublisher CreatePublisher(PublisherQos qos, IPublisherListener listener, StatusKind mask)
        {
            IPublisher publisher = null;

            using (OpenSplice.CustomMarshalers.PublisherQosMarshaler marshaler =
                    new OpenSplice.CustomMarshalers.PublisherQosMarshaler())
            {
                // Note: we use the same gapi lister as the DataWriter since the
                // publisher doesn't add anything unique
                if (marshaler.CopyIn(qos) == ReturnCode.Ok)
                {
                    if (listener != null)
                    {
                        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.DomainParticipant.create_publisher(
                                    GapiPeer,
                                    marshaler.GapiPtr,
                                    listenerMarshaler.GapiPtr,
                                    mask);
                            if (gapiPtr != IntPtr.Zero)
                            {
                                publisher = new Publisher(gapiPtr, listenerHelper);
                            }
                        }
                    }
                    else
                    {
                        // Invoke the corresponding gapi function.
                        IntPtr gapiPtr = Gapi.DomainParticipant.create_publisher(
                                GapiPeer,
                                marshaler.GapiPtr,
                                IntPtr.Zero,
                                mask);
                        if (gapiPtr != IntPtr.Zero)
                        {
                            publisher = new Publisher(gapiPtr);
                        }
                    }
                }
            }

            if (publisher != null)
            {
                DomainParticipantQos dpQos = null;
                ReturnCode result = GetQos(ref dpQos);
                if (result == ReturnCode.Ok)
                {
                    if (dpQos.EntityFactory.AutoenableCreatedEntities)
                    {
                        publisher.Enable();
                    }
                }
            }

            return publisher;
        }
Ejemplo n.º 44
0
 public ReturnCode SetListener(IDomainParticipantListener a_listener, StatusKind mask)
 {
     return realParticipant.SetListener(a_listener, mask);
 }
Ejemplo n.º 45
0
 public static extern IntPtr create_topic(
     IntPtr _this,
     string topic_name,
     string type_name,
     IntPtr qos,
     IntPtr a_listener,
     StatusKind mask
     );
Ejemplo n.º 46
0
        public IDataWriter CreateDataWriter(
                ITopic topic,
                IDataWriterListener listener, 
                StatusKind mask)
        {
            DataWriter dataWriter = null;
            Topic topicObj = topic as Topic;

            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,
                            Gapi.NativeConstants.GapiDataWriterQosDefault,
                            listenerMarshaler.GapiPtr,
                            mask);
                    if (gapiPtr != IntPtr.Zero)
                    {
                        DDS.OpenSplice.DomainParticipant participantImpl;
                    
                        participantImpl = topic.Participant as DDS.OpenSplice.DomainParticipant;
                        TypeSupportFactory tsFactory = participantImpl.GetTypeSupportFactory(topic.TypeName);
                        dataWriter = tsFactory.CreateDataWriter(gapiPtr);
                        dataWriter.SetListener(listenerHelper);
                    }
                }
            }
            else
            {
                IntPtr gapiPtr = Gapi.Publisher.create_datawriter(
                            GapiPeer,
                            topicObj.GapiPeer,
                            Gapi.NativeConstants.GapiDataWriterQosDefault,
                            IntPtr.Zero,
                            mask);
                if (gapiPtr != IntPtr.Zero)
                {
                    DDS.OpenSplice.DomainParticipant participantImpl;
                    
                    participantImpl = topic.Participant as DDS.OpenSplice.DomainParticipant;
                    TypeSupportFactory tsFactory = participantImpl.GetTypeSupportFactory(topic.TypeName);
                    dataWriter = tsFactory.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;
        }
Ejemplo n.º 47
0
        public ReturnCode SetListener(IDomainParticipantListener listener, StatusKind mask)
        {
            ReturnCode result = ReturnCode.Error;

            if (listener != null)
            {
                Gapi.gapi_domainParticipantListener gapiListener;
                listenerHelper.Listener = listener;
                listenerHelper.CreateListener(out gapiListener);
                lock (listener)
                {
                    using (DomainParticipantListenerMarshaler marshaler = new DomainParticipantListenerMarshaler(ref gapiListener))
                    {
                        result = Gapi.DomainParticipant.set_listener(
                                GapiPeer,
                                marshaler.GapiPtr,
                                mask);
                    }
                }
            }
            else
            {
                result = Gapi.DomainParticipant.set_listener(
                        GapiPeer,
                        IntPtr.Zero,
                        mask);
            }
            return result;
        }
Ejemplo n.º 48
0
        public ITopic CreateTopic(
                string topicName,
                string typeName,
                TopicQos qos,
                ITopicListener listener,
                StatusKind mask)
        {
            ITopic topic = null;

            using (OpenSplice.CustomMarshalers.TopicQosMarshaler marshaler =
                    new OpenSplice.CustomMarshalers.TopicQosMarshaler())
            {
                if (marshaler.CopyIn(qos) == ReturnCode.Ok)
                {
                    if (listener != null)
                    {
                        OpenSplice.Gapi.gapi_topicListener gapiListener;
                        TopicListenerHelper listenerHelper = new TopicListenerHelper();
                        listenerHelper.Listener = listener;
                        listenerHelper.CreateListener(out gapiListener);
                        using (TopicListenerMarshaler listenerMarshaler =
                                new TopicListenerMarshaler(ref gapiListener))
                        {
                            IntPtr gapiPtr = Gapi.DomainParticipant.create_topic(
                                    GapiPeer,
                                    topicName,
                                    typeName,
                                    marshaler.GapiPtr,
                                    listenerMarshaler.GapiPtr,
                                    mask);
                            if (gapiPtr != IntPtr.Zero)
                            {
                                topic = new Topic(gapiPtr, listenerHelper);
                            }
                        }
                    }
                    else
                    {
                        // Invoke the corresponding gapi function.
                        IntPtr gapiPtr = Gapi.DomainParticipant.create_topic(
                                GapiPeer,
                                topicName,
                                typeName,
                                marshaler.GapiPtr,
                                IntPtr.Zero,
                                mask);

                        if (gapiPtr != IntPtr.Zero)
                        {
                            topic = new Topic(gapiPtr);
                        }
                    }
                }
            }

            if (topic != null)
            {
                DomainParticipantQos dpQos = null;
                ReturnCode result = GetQos(ref dpQos);
                if (result == ReturnCode.Ok)
                {
                    if (dpQos.EntityFactory.AutoenableCreatedEntities)
                    {
                        topic.Enable();
                    }
                }
            }

            return topic;
        }
Ejemplo n.º 49
0
        public ITopic CreateTopic(
                string topicName,
                string typeName,
                ITopicListener listener,
                StatusKind mask)
        {
            ITopic topic = null;

            if (listener != null)
            {
                OpenSplice.Gapi.gapi_topicListener gapiListener;
                TopicListenerHelper listenerHelper = new TopicListenerHelper();
                listenerHelper.Listener = listener;
                listenerHelper.CreateListener(out gapiListener);
                using (TopicListenerMarshaler listenerMarshaler =
                        new TopicListenerMarshaler(ref gapiListener))
                {
                    IntPtr gapiPtr = Gapi.DomainParticipant.create_topic(
                            GapiPeer,
                            topicName,
                            typeName,
                            Gapi.NativeConstants.GapiTopicQosDefault,
                            listenerMarshaler.GapiPtr,
                            mask);
                    if (gapiPtr != IntPtr.Zero)
                    {
                        topic = new Topic(gapiPtr, listenerHelper);
                    }
                }
            }
            else
            {
                IntPtr gapiPtr = Gapi.DomainParticipant.create_topic(
                        GapiPeer,
                        topicName,
                        typeName,
                        Gapi.NativeConstants.GapiTopicQosDefault,
                        IntPtr.Zero,
                        mask);

                if (gapiPtr != IntPtr.Zero)
                {
                    topic = new Topic(gapiPtr);
                }
            }

            if (topic != null)
            {
                DomainParticipantQos dpQos = null;
                ReturnCode result = GetQos(ref dpQos);
                if (result == ReturnCode.Ok)
                {
                    if (dpQos.EntityFactory.AutoenableCreatedEntities)
                    {
                        topic.Enable();
                    }
                }
            }

            return topic;
        }
Ejemplo n.º 50
0
        public ISubscriber CreateSubscriber(SubscriberQos qos, ISubscriberListener listener, StatusKind mask)
        {
            ISubscriber subscriber = null;

            using (OpenSplice.CustomMarshalers.SubscriberQosMarshaler marshaler =
                    new OpenSplice.CustomMarshalers.SubscriberQosMarshaler())
            {
                if (marshaler.CopyIn(qos) == ReturnCode.Ok)
                {
                    if (listener != null)
                    {
                        OpenSplice.Gapi.gapi_subscriberListener gapiListener;
                        SubscriberListenerHelper listenerHelper = new SubscriberListenerHelper();
                        listenerHelper.Listener = listener;
                        listenerHelper.CreateListener(out gapiListener);
                        using (SubscriberListenerMarshaler listenerMarshaler =
                                new SubscriberListenerMarshaler(ref gapiListener))
                        {
                            IntPtr gapiPtr = Gapi.DomainParticipant.create_subscriber(
                                    GapiPeer,
                                    marshaler.GapiPtr,
                                    listenerMarshaler.GapiPtr,
                                    mask);
                            if (gapiPtr != IntPtr.Zero)
                            {
                                subscriber = new Subscriber(gapiPtr, listenerHelper);
                            }
                        }
                    }
                    else
                    {
                        // Invoke the corresponding gapi function.
                        IntPtr gapiPtr = Gapi.DomainParticipant.create_subscriber(
                                GapiPeer,
                                marshaler.GapiPtr,
                                IntPtr.Zero,
                                mask);
                        if (gapiPtr != IntPtr.Zero)
                        {
                            subscriber = new Subscriber(gapiPtr);
                        }
                    }
                }
            }

            if (subscriber != null)
            {
                DomainParticipantQos dpQos = null;
                ReturnCode result = GetQos(ref dpQos);
                if (result == ReturnCode.Ok)
                {
                    if (dpQos.EntityFactory.AutoenableCreatedEntities)
                    {
                        subscriber.Enable();
                    }
                }
            }

            return subscriber;
        }
Ejemplo n.º 51
0
        public ISubscriber CreateSubscriber(ISubscriberListener listener, StatusKind mask)
        {
            ISubscriber subscriber = null;

            if (listener != null)
            {
                OpenSplice.Gapi.gapi_subscriberListener gapiListener;
                SubscriberListenerHelper listenerHelper = new SubscriberListenerHelper();
                listenerHelper.Listener = listener;
                listenerHelper.CreateListener(out gapiListener);
                using (SubscriberListenerMarshaler listenerMarshaler =
                        new SubscriberListenerMarshaler(ref gapiListener))
                {
                    IntPtr gapiPtr = Gapi.DomainParticipant.create_subscriber(
                            GapiPeer,
                            Gapi.NativeConstants.GapiSubscriberQosDefault,
                            listenerMarshaler.GapiPtr,
                            mask);
                    if (gapiPtr != IntPtr.Zero)
                    {
                        subscriber = new Subscriber(gapiPtr, listenerHelper);
                    }
                }
            }
            else
            {
                IntPtr gapiPtr = Gapi.DomainParticipant.create_subscriber(
                            GapiPeer,
                            Gapi.NativeConstants.GapiSubscriberQosDefault,
                            IntPtr.Zero,
                            mask);
                if (gapiPtr != IntPtr.Zero)
                {
                    subscriber = new Subscriber(gapiPtr);
                }
            }

            if (subscriber != null)
            {
                DomainParticipantQos dpQos = null;
                ReturnCode result = GetQos(ref dpQos);
                if (result == ReturnCode.Ok)
                {
                    if (dpQos.EntityFactory.AutoenableCreatedEntities)
                    {
                        subscriber.Enable();
                    }
                }
            }

            return subscriber;
        }
Ejemplo n.º 52
0
 public ISubscriber CreateSubscriber(SubscriberQos qos, ISubscriberListener listener, StatusKind mask)
 {
     return realParticipant.CreateSubscriber(qos, listener, mask);
 }
Ejemplo n.º 53
0
 public ITopic CreateTopic(string topicName, string typeName, TopicQos qos, ITopicListener listener, StatusKind mask)
 {
     return realParticipant.CreateTopic(topicName, typeName, qos, listener, mask);
 }
Ejemplo n.º 54
0
        public IDomainParticipant CreateParticipant(
            DomainId domainId,
            IDomainParticipantListener listener,
            StatusKind mask)
        {
            IDomainParticipant participant = null;
            string className = null;

             
            if (listener != null)
            {
                OpenSplice.Gapi.gapi_domainParticipantListener gapiListener;
                DomainParticipantListenerHelper listenerHelper = new DomainParticipantListenerHelper();
                listenerHelper.Listener = listener;
                listenerHelper.CreateListener(out gapiListener);
                using (DomainParticipantListenerMarshaler listenerMarshaler = 
                        new DomainParticipantListenerMarshaler(ref gapiListener))
                {
                    // Invoke the corresponding gapi function.
                    IntPtr gapiParticipant = OpenSplice.Gapi.DomainParticipantFactory.create_participant(
                            GapiPeer,
                            domainId,
                            OpenSplice.Gapi.NativeConstants.GapiParticipantQosDefault,
                            listenerMarshaler.GapiPtr,
                            mask,
                            IntPtr.Zero,
                            IntPtr.Zero,
                            IntPtr.Zero,
                            className);
                    if (gapiParticipant != IntPtr.Zero)
                    {
                        participant = new OpenSplice.DomainParticipant(gapiParticipant, listenerHelper);
                    }
                }
            }
            else
            {
                // Invoke the corresponding gapi function.
                IntPtr gapiParticipant = OpenSplice.Gapi.DomainParticipantFactory.create_participant(
                    GapiPeer,
                    domainId,
                    OpenSplice.Gapi.NativeConstants.GapiParticipantQosDefault,
                    IntPtr.Zero,
                    mask,
                    IntPtr.Zero,
                    IntPtr.Zero,
                    IntPtr.Zero,
                    className);

                if (gapiParticipant != IntPtr.Zero)
                {
                    participant = new OpenSplice.DomainParticipant(gapiParticipant);
                }
            }
            
            if (participant != null)
            {
                DomainParticipantFactoryQos dpfQos = null;
                ReturnCode result = GetQos(ref dpfQos);
                if (result == ReturnCode.Ok)
                {
                    if (dpfQos.EntityFactory.AutoenableCreatedEntities)
                    {
                        participant.Enable();
                    }
                }
            }       
                
            return participant;
        }
Ejemplo n.º 55
0
 public StatusMessage(StatusKind statusKind, string message, int progressValue, int progressMaximumValue)
     : this(statusKind, message, progressValue, progressMaximumValue, DateTime.Now)
 {
 }
Ejemplo n.º 56
0
 public static extern IntPtr create_subscriber(
     IntPtr _this,
     IntPtr qos,
     IntPtr a_listener,
     StatusKind mask
     );
Ejemplo n.º 57
0
        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;
        }
Ejemplo n.º 58
0
        public IPublisher CreatePublisher(IPublisherListener listener, StatusKind mask)
        {
            IPublisher publisher = null;

            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.DomainParticipant.create_publisher(
                            GapiPeer,
                            Gapi.NativeConstants.GapiPublisherQosDefault,
                            listenerMarshaler.GapiPtr,
                            mask);
                    if (gapiPtr != IntPtr.Zero)
                    {
                        publisher = new Publisher(gapiPtr, listenerHelper);
                    }
                }
            }
            else
            {
                IntPtr gapiPtr = Gapi.DomainParticipant.create_publisher(
                            GapiPeer,
                            Gapi.NativeConstants.GapiPublisherQosDefault,
                            IntPtr.Zero,
                            mask);
                if (gapiPtr != IntPtr.Zero)
                {
                    publisher = new Publisher(gapiPtr);
                }
            }

            if (publisher != null)
            {
                DomainParticipantQos dpQos = null;
                ReturnCode result = GetQos(ref dpQos);
                if (result == ReturnCode.Ok)
                {
                    if (dpQos.EntityFactory.AutoenableCreatedEntities)
                    {
                        publisher.Enable();
                    }
                }
            }

            return publisher;
        }
Ejemplo n.º 59
0
 public static extern ReturnCode set_listener(
     IntPtr _this,
     IntPtr a_listener,
     StatusKind mask
     );
Ejemplo n.º 60
0
 /// <summary>
 /// Display a status message.
 /// </summary>
 /// <param name="message">Message to display.</param>
 /// <param name="statusKind">Message severity.</param>
 public void Status(string message, StatusKind statusKind)
 {
     this.status.Status(message, statusKind);
 }