/// <summary>
        /// Subscribe to LBR3 arm service
        /// </summary>
        /// <param name="subscribe"></param>
        /// <returns></returns>
        public IEnumerator <ITask> SubscribeHandler(arm.Subscribe subscribe)
        {
            SubscribeRequestType request = subscribe.Body;

            SubscribeHelper(_submgrPort, request, subscribe.ResponsePort);
            yield break;
        }
Example #2
0
 /// <summary>
 /// Post Subscribe and return the response port.
 /// </summary>
 /// <param name="body"></param>
 /// <param name="notificationPort"></param>
 /// <returns></returns>
 public virtual PortSet <SubscribeResponseType, Fault> Subscribe(SubscribeRequestType body, IPort notificationPort)
 {
     sensorupdates.Subscribe op = new sensorupdates.Subscribe();
     op.Body             = body ?? new SubscribeRequestType();
     op.NotificationPort = notificationPort;
     this.Post(op);
     return(op.ResponsePort);
 }
Example #3
0
        public IEnumerator <ITask> OnSubscribe(Subscribe subscribe)
        {
            SubscribeRequestType request = subscribe.Body;

            yield return(Arbiter.Choice(
                             SubscribeHelper(_submgrPort, request, subscribe.ResponsePort),
                             EmptyHandler,
                             EmptyHandler
                             ));
        }
        public virtual IEnumerator <ITask> SubscribeHandler(Subscribe subscribe)
        {
            SubscribeRequestType request = subscribe.Body;

            yield return(Arbiter.Choice(SubscribeHelper(_submgr, request, subscribe.ResponsePort),
                                        delegate(SuccessResult success)
            {
                SendNotificationToTarget <Replace>(request.Subscriber, _submgr, _state);
            },
                                        delegate(Exception failure){}
                                        ));
        }
Example #5
0
        public IEnumerator <ITask> SubscribeHandler(webcam.Subscribe subscribe)
        {
            SubscribeRequestType request = subscribe.Body;

            yield return(Arbiter.Choice(
                             SubscribeHelper(_subMgrPort, request, subscribe.ResponsePort),
                             delegate(SuccessResult success)
            {
                SendNotificationToTarget <webcam.Replace>(request.Subscriber, _subMgrPort, _state);
            },
                             delegate(Exception e)
            {
                LogError(null, "Failure while processing Subscribe Request", Fault.FromException(e));
            }
                             ));

            yield break;
        }
        public IEnumerator <ITask> SubscribeHandler(Subscribe subscribe)
        {
            SubscribeRequestType request = subscribe.Body;

            LogInfo("Subscribe request from: " + request.Subscriber);

            yield return(Arbiter.Choice(
                             SubscribeHelper(_submgrPort, request, subscribe.ResponsePort),
                             delegate(SuccessResult success)
            {
                _state.Subscribers++;
                base.SendNotification <Replace>(_submgrPort, request.Subscriber, _state);
            },
                             delegate(Exception e)
            {
                LogError(null, "Subscribe failed", e);
            }
                             ));
        }
Example #7
0
        public virtual IEnumerator <ITask> SubscribeHandler(pxsonar.Subscribe subscribe)
        {
            SubscribeRequestType request = subscribe.Body;

            LogInfo("Subscribe request from: " + request.Subscriber);

            // Use the Subscription Manager to insert the new subscriber
            yield return(Arbiter.Choice(
                             SubscribeHelper(_submgrPort, request, subscribe.ResponsePort),
                             delegate(SuccessResult success)
            {
                base.SendNotification <Replace>(_submgrPort, request.Subscriber, _state);
            },
                             delegate(Exception e)
            {
                LogError(null, "Subscribe failed", e);
            }
                             ));

            yield break;
        }
Example #8
0
        public virtual IEnumerator <ITask> SubscribeHandler(Subscribe subscribe)
        {
            SubscribeRequestType request = subscribe.Body;

            LogInfo("TrackRoamerBrickPowerService:SubscribeHandler() -- Subscribe request from: " + request.Subscriber);

            yield return(Arbiter.Choice(
                             SubscribeHelper(_subMgrPort, request, subscribe.ResponsePort),
                             delegate(SuccessResult success) { },
                             delegate(Exception ex)
            {
                LogError(ex);
                throw ex;
            }
                             ));

            //_subMgrPort.Post(new submgr.Submit(request.Subscriber, DsspActions.UpdateRequest, _state.MotorSpeed, null));
            //_subMgrPort.Post(new submgr.Submit(request.Subscriber, DsspActions.UpdateRequest, _state.Whiskers, null));

            yield break;
        }
        /// <summary>
        /// Forwards a subscription to a partner
        /// </summary>
        /// <param name="partner">The partner.</param>
        /// <param name="request">The request.</param>
        /// <param name="responsePort">The response port.</param>
        private void ForwardSubscription(
            IPort partner,
            SubscribeRequestType request,
            PortSet <SubscribeResponseType, Fault> responsePort)
        {
            var lookup = new DsspDefaultLookup();

            partner.PostUnknownType(lookup);
            this.Activate(
                lookup.ResponsePort.Choice(
                    svcinfo =>
            {
                var submgrInfo = svcinfo.PartnerList.Find(p => p.Contract == submgr.Contract.Identifier);
                var subMgrOps  = ServiceForwarder <submgr.SubscriptionManagerPort>(submgrInfo.Service);
                var insert     = new submgr.InsertSubscription(request)
                {
                    ResponsePort = responsePort
                };
                subMgrOps.Post(insert);
            },
                    responsePort.Post));
        }
        public IEnumerator <ITask> SubscribeHandler(Subscribe subscribe)
        {
            SubscribeRequestType request       = subscribe.Body;
            SuccessFailurePort   subscribePort = SubscribeHelper(
                _subMgrPort,
                request,
                subscribe.ResponsePort
                );

            yield return((Choice)subscribePort);

            Exception exception = (Exception)subscribePort;

            if (exception != null)
            {
                LogError("Subscribe failed", exception);
                yield break;
            }

            SendNotificationToTarget <Replace>(request.Subscriber, _subMgrPort, _state);
            yield break;
        }
        public IEnumerator <ITask> SubscribeHandler(Subscribe subscribe)
        {
            SubscribeRequestType request = subscribe.Body;

            LogInfo("Subscribe request from: " + request.Subscriber);

            // Use the Subscription Manager to handle the subscribers
            yield return(Arbiter.Choice(
                             SubscribeHelper(_submgrPort, request, subscribe.ResponsePort),
                             delegate(SuccessResult success)
            {
                // Send a notification on successful subscription so that the
                // subscriber can initialize its own state
                base.SendNotificationToTarget <Replace>(request.Subscriber, _submgrPort, _state);
            },
                             delegate(Exception e)
            {
                LogError(null, "Subscribe failed", e);
            }
                             ));

            yield break;
        }
Example #12
0
 /// <summary>
 /// Creates a new instance of Subscribe
 /// </summary>
 /// <param name="body">The request message body</param>
 /// <param name="responsePort">The response port for the request</param>
 public Subscribe(SubscribeRequestType body, PortSet <SubscribeResponseType, Fault> responsePort)
     : base(body, responsePort)
 {
 }
Example #13
0
 /// <summary>
 /// Creates a new instance of Subscribe
 /// </summary>
 /// <param name="body">The request message body</param>
 public Subscribe(SubscribeRequestType body)
     : base(body)
 {
 }
Example #14
0
 public Subscribe(SubscribeRequestType body, DsspResponsePort <SubscribeResponseType> responsePort)
     : base(body, responsePort)
 {
 }