コード例 #1
0
ファイル: DepthProvider.cs プロジェクト: ghvg1313/XTune
        /// <summary>
        /// Gets the latest depth frame.
        /// </summary>
        /// <param name="buffer"> Buffer to be filled out for depth.</param>
        /// <param name="timestamp"> Gets filled with the current depth timestamp.</param>
        /// <returns> True if the API returns success.</returns>
        public static bool GetLatestFrame(ref int[] buffer, ref double timestamp)
        {
            if (!m_isInit)
            {
                DebugLogger.GetInstance.WriteToLog(DebugLogger.EDebugLevel.DEBUG_WARN,
                                                   "DepthProvider.GetLatestFrame : Not Initialized!");
                return(false);
            }

            if (buffer.Length < Common.DepthBufferSize)
            {
                DebugLogger.GetInstance.WriteToLog(DebugLogger.EDebugLevel.DEBUG_WARN, "Wrong depth buffer size");
                return(false);
            }
            GCHandle bufferHandler = GCHandle.Alloc(buffer, GCHandleType.Pinned);

            Common.RetCodes retCode = (Common.RetCodes)TangoDepthAPI.DepthGetLatestFrame(TangoApplication.Instance.Handle,
                                                                                         bufferHandler.AddrOfPinnedObject(),
                                                                                         Common.DepthBufferSize,
                                                                                         ref timestamp);
            if (retCode != Common.RetCodes.kCAPISuccess)
            {
                DebugLogger.GetInstance.WriteToLog(DebugLogger.EDebugLevel.DEBUG_WARN,
                                                   "Failed to get depth buffer with error:" + retCode);
            }
            bufferHandler.Free();
            return(retCode == Common.RetCodes.kCAPISuccess);
        }
コード例 #2
0
ファイル: DepthProvider.cs プロジェクト: ghvg1313/XTune
 /// <summary>
 /// Shutdown the depth provider.
 /// </summary>
 public static void ShutDown()
 {
     m_isInit = false;
     TangoDepthAPI.DepthStopBuffering(TangoApplication.Instance.Handle);
 }
コード例 #3
0
ファイル: DepthProvider.cs プロジェクト: ghvg1313/XTune
 /// <summary>
 /// Initialize the depth provider.
 /// </summary>
 public static void Init()
 {
     m_isInit = true;
     TangoDepthAPI.DepthStartBuffering(TangoApplication.Instance.Handle);
 }