protected virtual void Initialize() { // Initialize the port sensorPort = DssEnvironment.ServiceForwarder <sonar.SonarOperations>(new Uri(serviceUri)); }
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); } ); }