Esempio n. 1
0
        public IEnumerator <ITask> SubscribeHandler(webcam.Subscribe subscribe)
        {
#if !URT_MINCLR
            yield return(Arbiter.Choice(
                             SubscribeHelper(_submgrPort, subscribe.Body, subscribe.ResponsePort),
                             delegate(SuccessResult success)
            {
                LogInfo("Subscription from: " + subscribe.Body.Subscriber);
            },
                             delegate(Exception e)
            {
                LogError(null, "Subscription failed", e);
            }
                             ));
#else
            string key = subscribe.Body.Subscriber.ToLower();

            if (!_subscribers.ContainsKey(key))
            {
                Port <DsspOperation> notificationPort = ServiceForwarderUnknownType(new Uri(subscribe.Body.Subscriber));
                _subscribers.Add(key, notificationPort);
            }

            subscribe.ResponsePort.Post(new SubscribeResponseType());
            yield break;
#endif
        }
        public IEnumerator <ITask> SubscribeHandler(webcam.Subscribe subscribe)
        {
            // We share a subscription manager with the WebCamSensor alternate, so this ensures we that
            // we automatically filter notifcations based on the contract that the subscription came
            // through
            if (subscribe.Body.TypeFilter == null || subscribe.Body.TypeFilter.Length == 0)
            {
                subscribe.Body.TypeFilter = new[]
                {
                    GetTypeFilterDescription <webcam.Replace>(),
                    GetTypeFilterDescription <webcam.UpdateFrame>()
                };
            }

            yield return(Arbiter.Choice(
                             SubscribeHelper(_subMgrPort, subscribe.Body, subscribe.ResponsePort),
                             delegate(SuccessResult success)
            {
                LogInfo("Subscription from: " + subscribe.Body.Subscriber);
            },
                             delegate(Exception e)
            {
                LogError(e);
            }
                             ));
        }
Esempio n. 3
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;
        }