using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Community;
using System.Collections.ObjectModel;
namespace Model.MotionControl
{
public abstract class FeiYuCard : NotificationObject
{
///
/// 链接返回的句柄,可以作为卡号 众为兴控制卡
///
public IntPtr g_handle;
#region 控制卡信息
///
/// ID
///
public int ID { get; set; }
private int brand;
///
/// 品牌 1:雷赛2:众为兴
///
public int Brand
{
get { return brand; }
set
{
brand = value;
this.RaisePropertyChanged("Brand");
}
}
private ushort cardID;
///
/// 控制卡ID
///
public ushort CardID
{
get { return cardID; }
set
{
cardID = value;
this.RaisePropertyChanged("CardID");
}
}
private string cardName;
///
/// 卡名称
///
public string CardName
{
get { return cardName; }
set
{
cardName = value;
this.RaisePropertyChanged("CardName");
}
}
private ushort interfaceType;
///
/// 接口类型 链接类型:0-DMC,1-串口,2-网口
///
public ushort InterfaceType
{
get { return interfaceType; }
set
{
interfaceType = value;
this.RaisePropertyChanged("InterfaceType");
}
}
private string pconnectString;
///
/// 连接字符 对应与控制器的IP 地址或相应的COM 口
///
public string PconnectString
{
get { return pconnectString; }
set
{
pconnectString = value;
this.RaisePropertyChanged("PconnectString");
}
}
private uint baud;
///
/// 波特率
///
public uint Baud
{
get { return baud; }
set
{
baud = value;
this.RaisePropertyChanged("Baud");
}
}
private uint totalAxis;
///
/// 控制卡的轴数
///
public uint TotalAxis
{
get { return totalAxis; }
set
{
totalAxis = value;
this.RaisePropertyChanged("TotalAxis");
}
}
private string notes;
///
/// 备注
///
public string Notes
{
get { return notes; }
set
{
notes = value;
this.RaisePropertyChanged("Notes");
}
}
#endregion
#region Io输入信号
private ObservableCollection ioInput;
///
/// Io输入信号
///
public ObservableCollection IoInput
{
get { return ioInput; }
set
{
ioInput = value;
this.RaisePropertyChanged("IoInput");
}
}
#endregion
#region Io输出信号
private ObservableCollection ioOutput;
///
/// Io输出信号
///
public ObservableCollection IoOutput
{
get { return ioOutput; }
set
{
ioOutput = value;
this.RaisePropertyChanged("IoOutput");
}
}
#endregion
#region 轴集合
private ObservableCollection shaftList;
///
/// 轴集合
///
public ObservableCollection ShaftList
{
get { return shaftList; }
set
{
shaftList = value;
if (value != null && value.Count > 0)
{
foreach (FeiYuShaft sf in value)
{
//if (InterfaceType > 1)
//{
// sf.LanControl = true;
//}else
//{
// sf.LanControl = false;
//}
sf.MyCard = this;
sf.Initialize();
}
}
this.RaisePropertyChanged("ShaftList");
}
}
#endregion
public FeiYuCard()
{
Baud = 115200;
Notes = "-";
}
///
/// 获取轴数量
///
///
public abstract bool GetCradInfo();
///
/// 连接运动控制器
///
///
public abstract bool Connect();
///
/// 关闭
///
public abstract void close();
///
/// 所有轴紧急停止
///
public abstract void MoveFunction_Estop();
}
}