You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using GTN;
|
|
|
|
|
using gts;
|
|
|
|
|
using Rs.Framework;
|
|
|
|
|
using Rs.Motion.Base;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Net.NetworkInformation;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Rs.Motion.GugaoPulse
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 固高脉冲卡
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class GugaoPulseCardManager : ICardManager
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 执行底层接口的返回值
|
|
|
|
|
/// </summary>
|
|
|
|
|
private short apiResult = 0;
|
|
|
|
|
private short core = 1;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存一共有多少张卡
|
|
|
|
|
/// </summary>
|
|
|
|
|
Dictionary<ushort,ICard> cardDic= new Dictionary<ushort,ICard>();
|
|
|
|
|
private GugaoPulseCardManager() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static GugaoPulseCardManager instance;
|
|
|
|
|
public static GugaoPulseCardManager Instance
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if(instance==null)
|
|
|
|
|
{
|
|
|
|
|
instance = new GugaoPulseCardManager();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return instance;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 同一类卡统一初始化
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public override ErrorCode Init()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//打开运动控制卡
|
|
|
|
|
apiResult = mc_pulse.GT_Open(0, 0, 1);
|
|
|
|
|
if(apiResult!= 0)
|
|
|
|
|
{
|
|
|
|
|
return ErrorCode.CardInitFail;
|
|
|
|
|
}
|
|
|
|
|
//清楚报警和限位
|
|
|
|
|
apiResult = mc_pulse.GT_ClrSts(0, 1, 8);
|
|
|
|
|
if (apiResult != 0)
|
|
|
|
|
{
|
|
|
|
|
return ErrorCode.Fail;
|
|
|
|
|
}
|
|
|
|
|
IsInitialized = true;
|
|
|
|
|
return ErrorCode.Ok;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ICard GetCard(ushort cardID)
|
|
|
|
|
{
|
|
|
|
|
if(cardDic.ContainsKey(cardID)) return cardDic[cardID];
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if(cardID==0)
|
|
|
|
|
{
|
|
|
|
|
ICard card = new GugaoPulseCard(cardID, 8, "gugao0.xml");
|
|
|
|
|
card.Init();
|
|
|
|
|
cardDic.Add(cardID, card);
|
|
|
|
|
return card;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|