12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- using Aitex.Core.RT.Device;
- using Aitex.Core.Util;
- using CyberX8_RT.Devices.AXIS;
- using MECF.Framework.Common.Equipment;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace CyberX8_RT.Devices.PUF
- {
- public class PufDeviceTimer : BaseDevice, IDevice
- {
- #region 内部变量
- private PeriodicJob _periodicJob;
- private JetAxisBase _puf1FlipAxis;
- private JetAxisBase _puf1RotationAxis;
- private PufVacuum _pufVacuum;
- #endregion
- /// <summary>
- /// 构造函数
- /// </summary>
- public PufDeviceTimer():base("DualPuf", "DualPuf", "DualPuf", "DualPuf")
- {
- _periodicJob = new PeriodicJob(20, OnTimer, "DualPuf.OnTimer", false);
- }
- /// <summary>
- /// 初始化
- /// </summary>
- /// <returns></returns>
- public bool Initialize()
- {
- _puf1FlipAxis = DEVICE.GetDevice<JetAxisBase>($"{ModuleName.PUF1}.Flip");
- _puf1RotationAxis = DEVICE.GetDevice<JetAxisBase>($"{ModuleName.PUF1}.Rotation");
- _pufVacuum = DEVICE.GetDevice<PufVacuum>($"{ModuleName.PUF1}.Vacuum");
- _periodicJob.Start();
- return true;
- }
- public void Monitor()
- {
- }
- public void Reset()
- {
- }
- /// <summary>
- /// 停止
- /// </summary>
- public void Terminate()
- {
- _periodicJob.Stop();
- }
- /// <summary>
- /// 定时器执行
- /// </summary>
- /// <returns></returns>
- private bool OnTimer()
- {
- if (_puf1FlipAxis != null)
- {
- _puf1FlipAxis.OnTimer();
- }
- if (_puf1RotationAxis != null)
- {
- _puf1RotationAxis.OnTimer();
- }
- if (_pufVacuum != null)
- {
- _pufVacuum.OnTimer();
- }
- return true;
- }
- }
- }
|