Esempio n. 1
0
        public bool StartAcquisition()
        {
            bool result = true;

            if (m_sensor != null)
            {
                sError = m_sensor.StartAcquisition_Measurement(acqParamMeasurement);
                if (sError != enSensorError.MCHR_ERROR_NONE)
                {
                    MessageBox.Show(string.Format("传感器获取数据错误 {0}", sError.ToString()));
                }
            }
            else
            {
                MessageBox.Show("传感器获取数据错误 (传感器没有连接或者连接错误)");
                result = false;
            }
            return(result);
        }
Esempio n. 2
0
        public List <AcqData> Execute()
        {
            float[]        Altitude        = null;
            float[]        Counter         = null;
            float[]        BufferNullFloat = null;
            uint           Len             = 0;
            List <AcqData> acqDatas        = new List <AcqData>();

            while (m_exit_event.Wait(0) == false)
            {
                if (m_measurement_event.Wait(10))
                {
                    sError = m_sensor.GetAltitudeAcquisitionData(ref Altitude, ref BufferNullFloat, ref Counter, ref BufferNullFloat, ref BufferNullFloat, ref Len);
                    if (sError == enSensorError.MCHR_ERROR_NONE)
                    {
                        Console.WriteLine("");
                        for (uint idx = 0; idx < Len; idx++)
                        {
                            AcqData acqData;
                            acqData.Altitude = (float)Altitude[idx];
                            acqData.Counter  = Counter[idx];
                            acqDatas.Add(acqData);
                            Debug.WriteLine(string.Format("[{0:D3}] 数值  = {1:F2} (强度 : {2})", idx, (float)Altitude[idx], Counter[idx]));
                        }
                    }
                    else
                    {
                        MessageBox.Show(string.Format("FuncEventMeasurement : 错误 : GetAltitudeAcquisitionData : {0}", sError.ToString()));
                    }
                }
            }
            m_exit_event_do.Set();

            return(acqDatas);
        }