예제 #1
0
        IEnumerator <ITask> OnConnectSickLRFHandler(OnConnectSickLRF onConnectSickLRF)
        {
            if (onConnectSickLRF.DriveControl != _driveControl)
            {
                yield break;
            }
            _laserPort     = ServiceForwarder <sicklrf.SickLRFOperations>(onConnectSickLRF.Service);
            _laserShutdown = new Port <Shutdown>();

            sicklrf.ReliableSubscribe subscribe = new sicklrf.ReliableSubscribe(
                new ReliableSubscribeRequestType(5)
                );
            subscribe.NotificationPort         = _laserNotify;
            subscribe.NotificationShutdownPort = _laserShutdown;

            _laserPort.Post(subscribe);

            yield return(Arbiter.Choice(
                             subscribe.ResponsePort,
                             delegate(SubscribeResponseType response)
            {
                LogInfo("Subscribed to " + onConnectSickLRF.Service);
            },
                             delegate(Fault fault)
            {
                _laserShutdown = null;
                LogError(fault);
            }
                             ));
        }
예제 #2
0
        IEnumerator<ITask> OnConnectSickLRFHandler(OnConnectSickLRF onConnectSickLRF)
        {
            if (onConnectSickLRF.DriveControl != _driveControl)
                yield break;
            _laserPort = ServiceForwarder<sicklrf.SickLRFOperations>(onConnectSickLRF.Service);
            _laserShutdown = new Port<Shutdown>();

            sicklrf.ReliableSubscribe subscribe = new sicklrf.ReliableSubscribe(
                new ReliableSubscribeRequestType(5)
            );
            subscribe.NotificationPort = _laserNotify;
            subscribe.NotificationShutdownPort = _laserShutdown;

            _laserPort.Post(subscribe);

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