public void OnEnter() { _packetEndpoint = _packetEndpointFactory.CreateEndpoint(); _subscription = _packetEndpoint.Readings.Subscribe(Publish); _packetEndpoint.Open(); _eventMediator.Publish(new Gateway.Event.Started()); }
public void OnExit() { if (_subscription != null) { _subscription.Dispose(); _subscription = null; } if (_packetEndpoint != null) { _packetEndpoint.Close(); _packetEndpoint.Dispose(); _packetEndpoint = null; } }