using Community;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
///
/// 输出信号类
///
public class OutputSignal : NotificationObject
{
public int ID { get; set; }
///
/// 卡ID
///
public ushort CardID { get; set; }
///
/// 端口号
///
public ushort IoNumber { get; set; }
private bool switchs;
///
/// 开关
///
public bool Switchs
{
get { return switchs; }
set
{
switchs = value;
if (value)
{
LevelState = 0;
}
else
{
LevelState = 1;
}
this.RaisePropertyChanged("Switchs");
}
}
private int myType;
///
/// 输出信号类型 0:机架信号 1:点胶模块信号 2:锁螺丝模块信号
///
public int MyType
{
get { return myType; }
set
{
myType = value;
this.RaisePropertyChanged("MyType");
}
}
private ushort levelState;
///
/// 输出端口电平状态
///
public ushort LevelState
{
get { return levelState; }
set
{
levelState = value;
if (value == 0)
{
this.OutputColor = ColorStr.Red;
}
else
{
this.OutputColor = ColorStr.Green;
}
OutputSwitch(value);
this.RaisePropertyChanged("LevelStart");
}
}
///
/// 输入信号的含义
///
public string OutputMeaning { get; set; }
///
/// 是否属于运动控制卡
///
public bool ToRunControlCard { get; set; }
private string outputColor;
///
/// 表示显色
///
public string OutputColor
{
get { return outputColor; }
set
{
outputColor = value;
this.RaisePropertyChanged("OutputColor");
}
}
public OutputSignal()
{
ToRunControlCard = false;
Switchs = false;
}
#region 控制卡输出信号开关
///
/// 控制卡输出信号开关
///
public void OutputSwitch(ushort onoff)
{
if (ToRunControlCard)
{
// LTDMC.dmc_write_outbit(CardID, IoNumber, onoff);
LTSMC.smc_write_outbit(CardID, IoNumber, onoff);
}
else
{
IOC0640.ioc_write_outbit(CardID, IoNumber, onoff);
}
}
#endregion
}
}