public static void GetProfile(out double[] adValueX, out double[] adValueZ) { int iRetValue; uint uiLostProfiles = 0; adValueX = new double[m_uiResolution]; adValueZ = new double[m_uiResolution]; //Resize the profile buffer to the maximal profile size byte[] abyProfileBuffer = new byte[m_uiResolution * 4 + 16]; byte[] abyTimestamp = new byte[16]; CLLTI.TransferProfiles(m_hLLT, CLLTI.TTransferProfileType.NORMAL_TRANSFER, 1); //Sleep for a while to warm up the transfer System.Threading.Thread.Sleep(12); //Gets 1 profile in "polling-mode" and PURE_PROFILE configuration CLLTI.GetActualProfile(m_hLLT, abyProfileBuffer, abyProfileBuffer.GetLength(0), CLLTI.TProfileConfig.PURE_PROFILE, ref uiLostProfiles); iRetValue = CLLTI.ConvertProfile2Values(m_hLLT, abyProfileBuffer, m_uiResolution, CLLTI.TProfileConfig.PURE_PROFILE, m_tscanCONTROLType, 0, 1, null, null, null, adValueX, adValueZ, null, null); //if (((iRetValue & CLLTI.CONVERT_X) == 0) || ((iRetValue & CLLTI.CONVERT_Z) == 0)) { // Console.WriteLine("Error during Converting of profile data", iRetValue); // return; //} }
/* * Evalute reveived profiles in polling mode */ static void GetProfiles_Poll() { int iRetValue; uint uiLostProfiles = 0; double[] adValueX = new double[m_uiResolution]; double[] adValueZ = new double[m_uiResolution]; // Allocate profile buffer to the maximal profile size byte[] abyProfileBuffer = new byte[m_uiResolution * 64]; byte[] abyTimestamp = new byte[16]; // Allocate buffer for multiple profiles byte[] abyFullProfileBuffer = new byte[m_uiResolution * 64 * m_uiNeededProfileCount]; Console.WriteLine("Demonstrate the profile transfer via poll function"); // Start continous profile transmission Console.WriteLine("Enable the measurement"); if ((iRetValue = CLLTI.TransferProfiles(m_hLLT, CLLTI.TTransferProfileType.NORMAL_TRANSFER, 1)) < CLLTI.GENERAL_FUNCTION_OK) { OnError("Error during TransferProfiles", iRetValue); return; } //Sleep for a while to warm up the transfer System.Threading.Thread.Sleep(100); /* * This shows how to get multiple Profile in polling mode with PROFILE config, which means all data is evaluated. * To see how to get a single profiles with the PURE_PROFILE config, see the Firewire Poll example! */ while (m_uiRecivedProfileCount < m_uiNeededProfileCount) { // Get the next transmitted partial profile if ((iRetValue = CLLTI.GetActualProfile(m_hLLT, abyProfileBuffer, abyProfileBuffer.GetLength(0), CLLTI.TProfileConfig.PROFILE, ref uiLostProfiles)) != abyProfileBuffer.GetLength(0)) { OnError("Error during GetActualProfile", iRetValue); return; } Console.WriteLine("Get profile in polling-mode and PROFILE configuration OK"); // Copy received buffer to buffer for multiple profiles Array.Copy(abyProfileBuffer, 0, abyFullProfileBuffer, m_uiRecivedProfileCount * m_uiResolution * 64, abyProfileBuffer.GetLength(0)); // Sleep according to scanner frequency (for high frequencies it is recommended to use the callback example) System.Threading.Thread.Sleep((int)(m_uiShutterTime + m_uiIdleTime) / 100); m_uiRecivedProfileCount++; } // Convert partial profile to x and z values Console.WriteLine("Converting of profile data from the first reflection"); iRetValue = CLLTI.ConvertProfile2Values(m_hLLT, abyProfileBuffer, m_uiResolution, CLLTI.TProfileConfig.PROFILE, m_tscanCONTROLType, 0, 1, null, null, null, adValueX, adValueZ, null, null); if (((iRetValue & CLLTI.CONVERT_X) == 0) || ((iRetValue & CLLTI.CONVERT_Z) == 0)) { OnError("Error during Converting of profile data", iRetValue); return; } // Display x and z values DisplayProfile(adValueX, adValueZ, m_uiResolution); Console.WriteLine("Display the timestamp from the profile:"); // Extract the 16-byte timestamp from the profile buffer into timestamp buffer and display it for (int i = 1; i < m_uiNeededProfileCount; i++) { for (int iPos = 0; iPos < 16; iPos++) { abyTimestamp[iPos] = abyFullProfileBuffer[(i * m_uiResolution * 64 - 16) + iPos]; } DisplayTimestamp(abyTimestamp); } // Stop continous profile transmission Console.WriteLine("Disable the measurement"); if ((iRetValue = CLLTI.TransferProfiles(m_hLLT, CLLTI.TTransferProfileType.NORMAL_TRANSFER, 0)) < CLLTI.GENERAL_FUNCTION_OK) { OnError("Error during TransferProfiles", iRetValue); return; } }