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.

48 lines
1.3 KiB
C#

2 years ago
using Rs.Framework;
using Rs.Motion.Base;
using Rs.Motion.Ztm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace Rs.Motion.GugaoPulse
{
/// <summary>
/// GLink卡
/// </summary>
[XmlInclude(typeof(GLinkIO))]
public class GLinkIOCard : IIOCard
{
public override void Init(short cardID,ushort inCount, ushort outCount, ushort slaveNo)
{
for (ushort i = 0; i < outCount; i++)
{
GLinkIO io = new GLinkIO();
io.CardID = cardID;
io.CardID = (short)CardID;
io.Name = "Out" + i + "_" + slaveNo;
io.Index = i;
DOut.Add(io);
}
for (ushort i = 0; i < inCount; i++)
{
GLinkIO io = new GLinkIO();
io.CardID = cardID;
io.Card = this;
io.Name = "In" + i + "_" + slaveNo;
io.Index = i;
DIn.Add(io);
}
}
public override void Save()
{
string filename = $"config/motion/io/gugao{CardID}.xml";
XmlSerializerHelper.Instance.Serialize<GLinkIOCard>(filename, this);
}
}
}