/// <summary> /// Closes the sensor and disposes any resources. /// </summary> public void Close() { OnFrameDataArrived = null; if (_streamingThread != null) { _streamingEvent.Set(); _streamingThread.Join(); } if (_pipeline != null) { if (IsOpen) { _pipeline.Stop(); } _pipeline.Release(); _pipeline = null; } if (ActiveProfile != null) { ActiveProfile.Dispose(); ActiveProfile = null; } if (_pipeline != null) { _pipeline.Release(); _pipeline = null; } IsOpen = false; }
void OnDisable() { OnNewSample = null; // OnNewSampleSet = null; if (worker != null) { stopEvent.Set(); worker.Join(); } if (Streaming && OnStop != null) { OnStop(); } if (ActiveProfile != null) { ActiveProfile.Dispose(); ActiveProfile = null; } if (m_pipeline != null) { // if (Streaming) // m_pipeline.Stop(); m_pipeline.Dispose(); m_pipeline = null; } Streaming = false; }
internal void ChangeActiveProfile(Profile profile, ArtemisSurface surface) { if (profile != null && profile.Module != this) { throw new ArtemisCoreException($"Cannot activate a profile of module {profile.Module} on a module of plugin {PluginInfo}."); } if (!IsActivated) { throw new ArtemisCoreException("Cannot activate a profile on a deactivated module"); } lock (this) { if (profile == ActiveProfile) { return; } ActiveProfile?.Dispose(); ActiveProfile = profile; ActiveProfile?.Activate(surface); } OnActiveProfileChanged(); }
void OnDestroy() { // OnStart = null; OnStop = null; if (ActiveProfile != null) { ActiveProfile.Dispose(); ActiveProfile = null; } if (m_pipeline != null) { m_pipeline.Dispose(); m_pipeline = null; } }