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.

98 lines
2.4 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NDSD_TouchSocket
{
public class DOperate
{
SendAnalysis sendAnalysis;
private static 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)
{
Server.SendMessage(sendAnalysis.DTimeOpenDataAnalysis((byte)(port + 4), delay));
}
/// <summary>
/// 枚举类控制接口开
/// </summary>
/// <param name="port">Port枚举类D1-D16</param>
public void DOpen(Port port)
{
Server.SendMessage(sendAnalysis.DOpenDataAnalysis((byte)port));
}
/// <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 DOpen(int port)
{
Server.SendMessage(sendAnalysis.DOpenDataAnalysis((byte)(port + 4)));
}
/// <summary>
/// int控制接口关
/// </summary>
/// <param name="port">int1-16</param>
public void DClose(int port)
{
Server.SendMessage(sendAnalysis.DCloseDataAnlysis((byte)(port + 4)));
}
}
public enum Port
{
D1 = 0x05,
D2,
D3,
D4,
D5,
D6,
D7,
D8,
D9,
D10,
D11,
D12,
D13,
D14,
D15,
D16,
}
}