/// <summary> /// Initialize application and providers. /// </summary> public void InitApplication() { if (m_applicationHandle != System.IntPtr.Zero) { DebugLogger.GetInstance.WriteToLog(DebugLogger.EDebugLevel.DEBUG_ERROR, "Duplicated application handler"); return; } // let's hardcode depth image reoslution // but eventially we can get resolution using VideoMode interface Resolution imageResolution = new Resolution(); imageResolution.width = 320; imageResolution.height = 180; imageResolution.refreshRate = 5; Common.DepthFrameResolution = imageResolution; Common.DepthBufferSize = 320 * 180; m_applicationHandle = TangoApplicationAPI.ApplicationInitialize("[Superframes Small-Peanut]"); if (m_applicationHandle == System.IntPtr.Zero) { ErrorHandler.instance.presentErrorMessage("Application initialization failed"); } if (m_enableVio) { VIOProvider.SetAutoReset(m_vioAutoReset); VIOProvider.Init(m_operationMode, m_sparseMapPath); } if (m_enableDepth) { DepthProvider.Init(); } if (m_enableVideoOverlay) { VideoOverlayProvider.Init(); } }
/// <summary> /// Shut down the providers and application. /// </summary> public void ShutDownApplication() { if (m_enableVio) { VIOProvider.ShutDown(); } if (m_enableDepth) { DepthProvider.ShutDown(); } if (m_enableVideoOverlay) { VideoOverlayProvider.Shutdown(); } if (m_applicationHandle == System.IntPtr.Zero) { DebugLogger.GetInstance.WriteToLog( DebugLogger.EDebugLevel.DEBUG_ERROR, "No application initialized"); return; } TangoApplicationAPI.ApplicationShutdown(m_applicationHandle); m_applicationHandle = System.IntPtr.Zero; }