|
|
|
@ -13,7 +13,7 @@ namespace Mesnac.DoUtils
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 报警灯控制类
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class DoControl
|
|
|
|
|
public sealed class DoControl
|
|
|
|
|
{
|
|
|
|
|
public SerialPort serialPort = new SerialPort("COM5");
|
|
|
|
|
private static readonly Lazy<DoControl> lazy = new Lazy<DoControl>(() => new DoControl());
|
|
|
|
@ -136,13 +136,15 @@ namespace Mesnac.DoUtils
|
|
|
|
|
/// <param name="dOOnOff">启停状态</param>
|
|
|
|
|
public void DOControl(DOName dOName, DOOnOff dOOnOff)
|
|
|
|
|
{
|
|
|
|
|
//ComOn();
|
|
|
|
|
if (!serialPort.IsOpen)
|
|
|
|
|
if (serialPort.IsOpen)
|
|
|
|
|
{
|
|
|
|
|
serialPort.Open();
|
|
|
|
|
}
|
|
|
|
|
serialPort.Write(new byte[] { 0xE3, 0x01, 0x09, (byte)dOName, (byte)dOOnOff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0, 12);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ComOn();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 文本框传输数据控制COM5串口
|
|
|
|
|