238 lines
5.6 KiB
C#
238 lines
5.6 KiB
C#
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
|
||
{
|
||
/// <summary>
|
||
/// 链接返回的句柄,可以作为卡号 众为兴控制卡
|
||
/// </summary>
|
||
public IntPtr g_handle;
|
||
|
||
#region 控制卡信息
|
||
/// <summary>
|
||
/// ID
|
||
/// </summary>
|
||
public int ID { get; set; }
|
||
|
||
|
||
private int brand;
|
||
/// <summary>
|
||
/// 品牌 1:雷赛2:众为兴
|
||
/// </summary>
|
||
public int Brand
|
||
{
|
||
get { return brand; }
|
||
set
|
||
{
|
||
brand = value;
|
||
this.RaisePropertyChanged("Brand");
|
||
}
|
||
}
|
||
|
||
private ushort cardID;
|
||
/// <summary>
|
||
/// 控制卡ID
|
||
/// </summary>
|
||
public ushort CardID
|
||
{
|
||
get { return cardID; }
|
||
set
|
||
{
|
||
cardID = value;
|
||
this.RaisePropertyChanged("CardID");
|
||
}
|
||
}
|
||
|
||
private string cardName;
|
||
/// <summary>
|
||
/// 卡名称
|
||
/// </summary>
|
||
public string CardName
|
||
{
|
||
get { return cardName; }
|
||
set
|
||
{
|
||
cardName = value;
|
||
this.RaisePropertyChanged("CardName");
|
||
}
|
||
}
|
||
|
||
|
||
private ushort interfaceType;
|
||
/// <summary>
|
||
/// 接口类型 链接类型:0-DMC,1-串口,2-网口
|
||
/// </summary>
|
||
public ushort InterfaceType
|
||
{
|
||
get { return interfaceType; }
|
||
set
|
||
{
|
||
interfaceType = value;
|
||
this.RaisePropertyChanged("InterfaceType");
|
||
}
|
||
}
|
||
|
||
|
||
private string pconnectString;
|
||
/// <summary>
|
||
/// 连接字符 对应与控制器的IP 地址或相应的COM 口
|
||
/// </summary>
|
||
public string PconnectString
|
||
{
|
||
get { return pconnectString; }
|
||
set
|
||
{
|
||
pconnectString = value;
|
||
this.RaisePropertyChanged("PconnectString");
|
||
}
|
||
}
|
||
|
||
private uint baud;
|
||
/// <summary>
|
||
/// 波特率
|
||
/// </summary>
|
||
public uint Baud
|
||
{
|
||
get { return baud; }
|
||
set
|
||
{
|
||
baud = value;
|
||
this.RaisePropertyChanged("Baud");
|
||
}
|
||
}
|
||
|
||
|
||
private uint totalAxis;
|
||
/// <summary>
|
||
/// 控制卡的轴数
|
||
/// </summary>
|
||
public uint TotalAxis
|
||
{
|
||
get { return totalAxis; }
|
||
set
|
||
{
|
||
totalAxis = value;
|
||
this.RaisePropertyChanged("TotalAxis");
|
||
}
|
||
}
|
||
|
||
private string notes;
|
||
/// <summary>
|
||
/// 备注
|
||
/// </summary>
|
||
public string Notes
|
||
{
|
||
get { return notes; }
|
||
set
|
||
{
|
||
notes = value;
|
||
this.RaisePropertyChanged("Notes");
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region Io输入信号
|
||
private ObservableCollection<InputSignal> ioInput;
|
||
/// <summary>
|
||
/// Io输入信号
|
||
/// </summary>
|
||
public ObservableCollection<InputSignal> IoInput
|
||
{
|
||
get { return ioInput; }
|
||
set
|
||
{
|
||
ioInput = value;
|
||
this.RaisePropertyChanged("IoInput");
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region Io输出信号
|
||
private ObservableCollection<OutputSignal> ioOutput;
|
||
/// <summary>
|
||
/// Io输出信号
|
||
/// </summary>
|
||
public ObservableCollection<OutputSignal> IoOutput
|
||
{
|
||
get { return ioOutput; }
|
||
set
|
||
{
|
||
ioOutput = value;
|
||
this.RaisePropertyChanged("IoOutput");
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 轴集合
|
||
private ObservableCollection<FeiYuShaft> shaftList;
|
||
/// <summary>
|
||
/// 轴集合
|
||
/// </summary>
|
||
public ObservableCollection<FeiYuShaft> 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 = "-";
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取轴数量
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public abstract bool GetCradInfo();
|
||
/// <summary>
|
||
/// 连接运动控制器
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public abstract bool Connect();
|
||
/// <summary>
|
||
/// 关闭
|
||
/// </summary>
|
||
public abstract void close();
|
||
|
||
/// <summary>
|
||
/// 所有轴紧急停止
|
||
/// </summary>
|
||
public abstract void MoveFunction_Estop();
|
||
|
||
}
|
||
}
|