示例#1
0
 public virtual IEnumerator <ITask> ReliableSubscribeHandler(pxsonar.ReliableSubscribe subscribe)
 {
     yield return(Arbiter.Choice(
                      SubscribeHelper(_submgrPort, subscribe.Body, subscribe.ResponsePort),
                      delegate(SuccessResult success)
     {
         _submgrPort.Post(new submgr.Submit(
                              subscribe.Body.Subscriber, dssp.DsspActions.ReplaceRequest, _state, null));
     },
                      delegate(Exception ex) { LogError(ex); }
                      ));;
 }
示例#2
0
 public IEnumerator <ITask> ReliableSubscribeHandler(sonar.ReliableSubscribe subscribe)
 {
     yield return(Arbiter.Choice(
                      SubscribeHelper(_subMgrPort, subscribe.Body, subscribe.ResponsePort),
                      delegate(SuccessResult success)
     {
         SendNotification <sonar.Replace>(_subMgrPort, subscribe.Body.Subscriber, new sonar.Replace(_state));
     },
                      delegate(Exception fault)
     {
         LogError(fault);
     }
                      ));
 }
        IEnumerator<ITask> OnConnectSonarHandler(OnConnectSonar onConnectSonar)
        {
            if (onConnectSonar.DriveControl != _driveControl)
                yield break;
            _sonarPort = ServiceForwarder<pxsonar.SonarOperations>(onConnectSonar.Service);
            _sonarShutdown = new Port<Shutdown>();

            pxsonar.ReliableSubscribe subscribe = new pxsonar.ReliableSubscribe(
                new ReliableSubscribeRequestType(5)
            );

            subscribe.NotificationPort = _sonarNotify;
            subscribe.NotificationShutdownPort = _sonarShutdown;

            _sonarPort.Post(subscribe);

            yield return Arbiter.Choice(
                subscribe.ResponsePort,
                delegate(SubscribeResponseType response)
                {
                    LogInfo("Subscribed to " + onConnectSonar.Service);
                },
                delegate(Fault fault)
                {
                    _sonarShutdown = null;
                    LogError(fault);
                }
            );
        }