Example #1
0
        /// <summary>
        /// Timer event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _timerHighSpeed_Tick(object sender, EventArgs e)
        {
            uint         notify = 0;
            List <int[]> data   = ThreadSafeBuffer.Get(ref notify);

            uint count = 0;

            foreach (int[] profile in data)
            {
                // Process received data here.
                count++;
            }
            _lblReceiveProfileCount.Text = (Convert.ToUInt32(_lblReceiveProfileCount.Text) + count).ToString();

            if ((notify & 0xFFFF) != 0)
            {
                // If the lower 16 bits of notify are not 0, high-speed communication was interrupted, so stop the timer.
                _timerHighSpeed.Stop();
                MessageBox.Show(string.Format("Communication closed. 0x{0:x8}", notify));
            }

            if ((notify & 0x10000) != 0)
            {
                // If a task is required when batch measurements end, code it here.
            }
        }
Example #2
0
        /// <summary>
        /// タイマーイベントハンドラ
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _timerHighSpeed_Tick(object sender, EventArgs e)
        {
            uint         notify = 0;
            List <int[]> data   = ThreadSafeBuffer.Get(ref notify);

            uint count = 0;

            foreach (int[] profile in data)
            {
                // ここで受信データを加工する
                count++;
            }
            _lblReceiveProfileCount.Text = (Convert.ToUInt32(_lblReceiveProfileCount.Text) + count).ToString();

            if ((notify & 0xFFFF) != 0)
            {
                // notifyの下位16bitが0でない場合、高速通信が中断されたのでタイマーをとめる。
                _timerHighSpeed.Stop();
                MessageBox.Show(string.Format("通信終了しました。0x{0:x8}", notify));
            }

            if ((notify & 0x10000) != 0)
            {
                // バッチ測定完了時の処理が必要であればここに記述する。
            }
        }