using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace TeamAAS.Feeder.Models
{
///
/// 料斗(输入输出)参数:对应设备地址 742+8*n 起的 8 个参数。
/// 数字量输出1/2、模拟量输出1/2、料斗振动振幅/频率/波形、振动持续时间。
///
public class HopperOutputParam : INotifyPropertyChanged
{
private bool _hopperDigitalOutput1;
[Category("料斗输出"), DisplayName("数字量输出1")]
public bool HopperDigitalOutput1
{
get { return _hopperDigitalOutput1; }
set { SetProperty(ref _hopperDigitalOutput1, value); }
}
private int _hopperAnalogOutput1;
[Category("料斗输出"), DisplayName("模拟量输出1")]
public int HopperAnalogOutput1
{
get { return _hopperAnalogOutput1; }
set { SetProperty(ref _hopperAnalogOutput1, value); }
}
private bool _hopperDigitalOutput2;
[Category("料斗输出"), DisplayName("数字量输出2")]
public bool HopperDigitalOutput2
{
get { return _hopperDigitalOutput2; }
set { SetProperty(ref _hopperDigitalOutput2, value); }
}
private int _hopperAnalogOutput2;
[Category("料斗输出"), DisplayName("模拟量输出2")]
public int HopperAnalogOutput2
{
get { return _hopperAnalogOutput2; }
set { SetProperty(ref _hopperAnalogOutput2, value); }
}
private int _hopperVibrationAmpl;
[Category("料斗振动"), DisplayName("振幅")]
public int HopperVibrationAmpl
{
get { return _hopperVibrationAmpl; }
set { SetProperty(ref _hopperVibrationAmpl, value); }
}
private int _hopperVibrationFreq;
[Category("料斗振动"), DisplayName("频率")]
public int HopperVibrationFreq
{
get { return _hopperVibrationFreq; }
set { SetProperty(ref _hopperVibrationFreq, value); }
}
private int _hopperVibrationWaveform;
[Category("料斗振动"), DisplayName("波形")]
public int HopperVibrationWaveform
{
get { return _hopperVibrationWaveform; }
set { SetProperty(ref _hopperVibrationWaveform, value); }
}
private int _hopperDuration = 500;
[Category("料斗输出"), DisplayName("振动持续时间(ms)")]
public int HopperDuration
{
get { return _hopperDuration; }
set { SetProperty(ref _hopperDuration, value); }
}
public HopperOutputParam Clone()
{
return new HopperOutputParam
{
HopperDigitalOutput1 = HopperDigitalOutput1,
HopperAnalogOutput1 = HopperAnalogOutput1,
HopperDigitalOutput2 = HopperDigitalOutput2,
HopperAnalogOutput2 = HopperAnalogOutput2,
HopperVibrationAmpl = HopperVibrationAmpl,
HopperVibrationFreq = HopperVibrationFreq,
HopperVibrationWaveform = HopperVibrationWaveform,
HopperDuration = HopperDuration,
};
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual bool SetProperty(ref T storage, T value, [CallerMemberName] string propertyName = null)
{
if (EqualityComparer.Default.Equals(storage, value)) return false;
storage = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
return true;
}
}
///
/// 系统参数(超时相关):背光超时/亮度/闪烁、平台振动超时、料斗振动超时。
/// 对应设备全局参数地址 44 / 34 / 33 / 65 / 66,写入后经 {DG} 存至非易失内存。
///
public class FeederSystemParam : INotifyPropertyChanged
{
private ushort _lightTimeout = 3000;
[Category("背光"), DisplayName("背光超时(ms)")]
public ushort LightTimeout
{
get { return _lightTimeout; }
set { SetProperty(ref _lightTimeout, value); }
}
private ushort _lightBrightness = 80;
[Category("背光"), DisplayName("光源亮度(%)")]
public ushort LightBrightness
{
get { return _lightBrightness; }
set { SetProperty(ref _lightBrightness, value); }
}
private ushort _lightFlashTime = 500;
[Category("背光"), DisplayName("背光闪烁时间(ms)")]
public ushort LightFlashTime
{
get { return _lightFlashTime; }
set { SetProperty(ref _lightFlashTime, value); }
}
private ushort _platShakeTimeout = 5000;
[Category("振动超时"), DisplayName("平台振动超时(ms)")]
public ushort PlatShakeTimeout
{
get { return _platShakeTimeout; }
set { SetProperty(ref _platShakeTimeout, value); }
}
private ushort _hopperShakeTimeout = 5000;
[Category("振动超时"), DisplayName("料斗振动超时(ms)")]
public ushort HopperShakeTimeout
{
get { return _hopperShakeTimeout; }
set { SetProperty(ref _hopperShakeTimeout, value); }
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual bool SetProperty(ref T storage, T value, [CallerMemberName] string propertyName = null)
{
if (EqualityComparer.Default.Equals(storage, value)) return false;
storage = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
return true;
}
}
}