|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
namespace NDSD_TouchSocket
|
|
|
{
|
|
|
public class DOperate
|
|
|
{
|
|
|
SendAnalysis sendAnalysis;
|
|
|
|
|
|
TcpServer Server = TcpServer.Instance;
|
|
|
|
|
|
public DOperate()
|
|
|
{
|
|
|
sendAnalysis = new SendAnalysis();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 枚举类控制接口开一段时间
|
|
|
/// </summary>
|
|
|
/// <param name="port">Port枚举类D1-D16</param>
|
|
|
/// <param name="delay">延迟,1代表0.1s/100ms</param>
|
|
|
public void DTimeOpen(Port port, int delay)
|
|
|
{
|
|
|
Server.SendMessage(sendAnalysis.DTimeOpenDataAnalysis((byte)port, delay));
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// int控制接口开一段时间
|
|
|
/// </summary>
|
|
|
/// <param name="port">int1-16</param>
|
|
|
/// <param name="delay">延迟,1代表0.1s/100ms</param>
|
|
|
public void DTimeOpen(int port, int delay)
|
|
|
{
|
|
|
DTimeOpen((Port)(port + 4), delay);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 枚举类控制接口开
|
|
|
/// </summary>
|
|
|
/// <param name="port">Port枚举类D1-D16</param>
|
|
|
public void DOpen(Port port)
|
|
|
{
|
|
|
Server.SendMessage(sendAnalysis.DOpenDataAnalysis((byte)port));
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// int控制接口开
|
|
|
/// </summary>
|
|
|
/// <param name="port">int1-16</param>
|
|
|
public void DOpen(int port)
|
|
|
{
|
|
|
DOpen((Port)(port + 4));
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 枚举类控制接口关
|
|
|
/// </summary>
|
|
|
/// <param name="port">Port枚举类D1-D16</param>
|
|
|
public void DClose(Port port)
|
|
|
{
|
|
|
Server.SendMessage(sendAnalysis.DCloseDataAnlysis((byte)port));
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// int控制接口关
|
|
|
/// </summary>
|
|
|
/// <param name="port">int1-16</param>
|
|
|
public void DClose(int port)
|
|
|
{
|
|
|
DClose((Port)(port + 4));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public enum Port
|
|
|
{
|
|
|
D1 = 0x05,
|
|
|
D2,
|
|
|
D3,
|
|
|
D4,
|
|
|
D5,
|
|
|
D6,
|
|
|
D7,
|
|
|
D8,
|
|
|
D9,
|
|
|
D10,
|
|
|
D11,
|
|
|
D12,
|
|
|
D13,
|
|
|
D14,
|
|
|
D15,
|
|
|
D16,
|
|
|
}
|
|
|
|
|
|
}
|