/// <summary> /// Shuts down the communicator and unsubscribes from channels, whatnot /// </summary> public void Shutdown() { try { if (vehicleStateChannel != null) { // unsubscribe from channels vehicleStateChannel.Unsubscribe(vehicleStateChannelToken); observedObstacleChannel.Unsubscribe(observedObstacleChannelToken); observedVehicleChannel.Unsubscribe(observedVehicleChannelToken); vehicleSpeedChannel.Unsubscribe(vehicleSpeedChannelToken); arbiterOutputChannel.Unsubscribe(arbiterOutputChannelToken); arbiterInformationChannel.Unsubscribe(arbiterInformationChannelToken); sideObstacleChannel.Unsubscribe(sideObstacleChannelToken); this.arbiterRemote = null; this.operationalFacade = null; // notify RemoraOutput.WriteLine("Unsubscribed from channels", OutputType.Remora); } } catch (Exception e) { // notify RemoraOutput.WriteLine("Error in shutting down registered channels", OutputType.Remora); Console.WriteLine(e.ToString()); } }
public void ResgisterWithClient() { try { // get vehicle state channel vehicleStateChannel = channelFactory.GetChannel("ArbiterSceneEstimatorPositionChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); vehicleStateChannelToken = vehicleStateChannel.Subscribe(messagingListener); // get observed obstacle channel observedObstacleChannel = channelFactory.GetChannel("ObservedObstacleChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); observedObstacleChannelToken = observedObstacleChannel.Subscribe(messagingListener); // get observed vehicle channel observedVehicleChannel = channelFactory.GetChannel("ObservedVehicleChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); observedVehicleChannelToken = observedVehicleChannel.Subscribe(messagingListener); // get vehicle speed channel vehicleSpeedChannel = channelFactory.GetChannel("VehicleSpeedChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); vehicleSpeedChannelToken = vehicleSpeedChannel.Subscribe(messagingListener); // get output channel arbiterOutputChannel = channelFactory.GetChannel("ArbiterOutputChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); arbiterOutputChannelToken = arbiterOutputChannel.Subscribe(messagingListener); // get information channel arbiterInformationChannel = channelFactory.GetChannel("ArbiterInformationChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); arbiterInformationChannelToken = arbiterInformationChannel.Subscribe(messagingListener); // get side obstacle channel sideObstacleChannel = channelFactory.GetChannel("SideObstacleChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); sideObstacleChannelToken = sideObstacleChannel.Subscribe(messagingListener); // get ai this.arbiterRemote = (ArbiterAdvancedRemote)objectDirectory.Resolve("ArbiterAdvancedRemote" + this.RemotingSuffix); // get the operational layer this.operationalFacade = (OperationalFacade)objectDirectory.Resolve("OperationalService" + this.RemotingSuffix); // register RemoraOutput.WriteLine("Resgistered To Client with suffix: " + this.RemotingSuffix, OutputType.Remora); } catch (Exception e) { RemoraOutput.WriteLine("Error registering with client: " + e.ToString(), OutputType.Remora); } }