142 lines
3.2 KiB
C#
142 lines
3.2 KiB
C#
using Community;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
|
||
namespace Model
|
||
{
|
||
/// <summary>
|
||
/// 输出信号类
|
||
/// </summary>
|
||
public class OutputSignal : NotificationObject
|
||
{
|
||
|
||
public int ID { get; set; }
|
||
|
||
/// <summary>
|
||
/// 卡ID
|
||
/// </summary>
|
||
public ushort CardID { get; set; }
|
||
|
||
/// <summary>
|
||
/// 端口号
|
||
/// </summary>
|
||
public ushort IoNumber { get; set; }
|
||
|
||
|
||
private bool switchs;
|
||
/// <summary>
|
||
/// 开关
|
||
/// </summary>
|
||
public bool Switchs
|
||
{
|
||
get { return switchs; }
|
||
set
|
||
{
|
||
switchs = value;
|
||
if (value)
|
||
{
|
||
LevelState = 0;
|
||
}
|
||
else
|
||
{
|
||
LevelState = 1;
|
||
}
|
||
this.RaisePropertyChanged("Switchs");
|
||
}
|
||
}
|
||
|
||
|
||
private int myType;
|
||
/// <summary>
|
||
/// 输出信号类型 0:机架信号 1:点胶模块信号 2:锁螺丝模块信号
|
||
/// </summary>
|
||
public int MyType
|
||
{
|
||
get { return myType; }
|
||
set
|
||
{
|
||
myType = value;
|
||
this.RaisePropertyChanged("MyType");
|
||
}
|
||
}
|
||
|
||
|
||
|
||
private ushort levelState;
|
||
/// <summary>
|
||
/// 输出端口电平状态
|
||
/// </summary>
|
||
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");
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 输入信号的含义
|
||
/// </summary>
|
||
public string OutputMeaning { get; set; }
|
||
|
||
/// <summary>
|
||
/// 是否属于运动控制卡
|
||
/// </summary>
|
||
public bool ToRunControlCard { get; set; }
|
||
|
||
private string outputColor;
|
||
/// <summary>
|
||
/// 表示显色
|
||
/// </summary>
|
||
public string OutputColor
|
||
{
|
||
get { return outputColor; }
|
||
set
|
||
{
|
||
outputColor = value;
|
||
this.RaisePropertyChanged("OutputColor");
|
||
}
|
||
}
|
||
|
||
|
||
public OutputSignal()
|
||
{
|
||
ToRunControlCard = false;
|
||
Switchs = false;
|
||
}
|
||
|
||
|
||
#region 控制卡输出信号开关
|
||
/// <summary>
|
||
/// 控制卡输出信号开关
|
||
/// </summary>
|
||
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
|
||
}
|
||
}
|