using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NewLife;
namespace NDSD_TouchSocket
{
public class DOperate
{
SendAnalysis sendAnalysis;
TcpServer Server = TcpServer.Instance;
public DOperate()
{
sendAnalysis = new SendAnalysis();
}
///
/// 枚举类控制接口开一段时间
///
/// Port枚举类D1-D16
/// 延迟,1代表0.1s/100ms
public void DTimeOpen(Port port, int delay)
{
// string str = sendAnalysis.DTimeOpenDataAnalysis((byte)port, delay).ToHex(" ");
Server.SendMessage(sendAnalysis.DTimeOpenDataAnalysis((byte)port, delay));
}
///
/// int控制接口开一段时间
///
/// int1-16
/// 延迟,1代表0.1s/100ms
public void DTimeOpen(int port, int delay)
{
DTimeOpen((Port)(port + 4), delay);
}
///
/// 枚举类控制接口开
///
/// Port枚举类D1-D16
public void DOpen(Port port)
{
Server.SendMessage(sendAnalysis.DOpenDataAnalysis((byte)port));
}
///
/// int控制接口开
///
/// int1-16
public void DOpen(int port)
{
DOpen((Port)(port + 4));
}
///
/// 枚举类控制接口关
///
/// Port枚举类D1-D16
public void DClose(Port port)
{
Server.SendMessage(sendAnalysis.DCloseDataAnlysis((byte)port));
}
///
/// int控制接口关
///
/// int1-16
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,
}
}