Пример #1
0
 protected virtual void Initialize()
 {
     // Initialize the port
     sensorPort = DssEnvironment.ServiceForwarder <sonar.SonarOperations>(new Uri(serviceUri));
 }
Пример #2
0
        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);
                }
            );
        }