/// <summary> /// 4路调光模块 /// </summary> /// <param name="addr">地址码</param> /// <param name="port">第几路1-4</param> /// <param name="level">亮度0-8</param> public void DIM4(int addr, int port, int level) { port -= 1; byte cmd1 = 0x00; if (level == 0) { cmd1 = 0x00; } else if (level == 10) { cmd1 = 0x80; } else { cmd1 = (byte)(0x80 + level); } byte[] sendBytes = new byte[] { 0x55, 0x34, (byte)addr, (byte)(0x01 << port), 0x01, 0x01, cmd1, 0x00 }; int check = 0; foreach (var item in sendBytes) { check += Convert.ToInt32(item); } sendBytes[8] = (byte)check; this.port.Send(sendBytes); Thread.Sleep(300); }
public ILiveYamaha(INetPortDevice port) { try { this.server = port; } catch (Exception ex) { ILiveDebug.Instance.WriteLine(ex.Message); } }
public ILiveASK(INetPortDevice port) { try { this.port = port; } catch (Exception ex) { ILiveDebug.Instance.WriteLine(ex.Message); } }
public ILiveTPC5(INetPortDevice port) { try { this.iserver = port; this.iserver.NetDataReceived += new NetDataReceivedEventHandler(iserver_NetDataReceived); } catch (Exception ex) { ILiveDebug.Instance.WriteLine(ex.Message); } }
/// <summary> /// 多功能控制器 /// </summary> /// <param name="address">地址码</param> /// <param name="port">第几路 1-8</param> /// <param name="states">true:闭合 false:断开</param> public void Relay8SW8(int address, int port, bool states) { port -= 1; // ILiveDebug.Instance.WriteLine("addr:" + address + "port:" + port + "states:" + states); // 55 13 03 01 01 02 02 00 71 byte p = (byte)(0x01 << port); //00000010 00000000 00000000 00000000 //00001000 00000000 00000100 00000000 byte cmd1 = 0x00; byte cmd2 = 0x00; if (port < 4) { if (states) { cmd1 = (byte)(0x01 << (port * 2 + 1)); } else { cmd1 = (byte)(0x01 << (port * 2)); } } else { if (states) { cmd2 = (byte)(0x01 << ((port - 4) * 2 + 1)); } else { cmd2 = (byte)(0x01 << ((port - 4) * 2)); } } //0x01<<(port*2+1) 0x01<<port*2 //0x01<<3 byte[] sendBytes = new byte[] { 0x55, 0x13, (byte)address, (byte)(0x01 << port), 0x01, 0x02, cmd1, cmd2, 0x00 }; int check = 0; foreach (var item in sendBytes) { check += Convert.ToInt32(item); } sendBytes[8] = (byte)check; // ILiveDebug.Instance.WriteLine("dahua:" + ILiveUtil.ToHexString(sendBytes)); this.port.Send(sendBytes); Thread.Sleep(300); }
void client_DebugDataReceived(INetPortDevice device, NetPortSerialDataEventArgs args) { switch (args.SerialData) { case "t1": // this.logic.light.LivingAllOn(); break; case "t2": // this.logic.light.LivingAllOff(); break; case "t3": break; default: break; } }
public ILiveDaHua(INetPortDevice com) { #region 注册串口 this.port = com; #endregion }
public ILiveDM8318(INetPortDevice com) { this.port = com; }
void iserver_NetDataReceived(INetPortDevice device, NetPortSerialDataEventArgs args) { OnDataReceived(args.SerialData); // throw new NotImplementedException(); }
void port_NetDataReceived(INetPortDevice device, NetPortSerialDataEventArgs args) { // ILiveDebug.Instance.WriteLine("movie:" + ILiveUtil.ToHexString(Encoding.GetEncoding(28591).GetBytes(args.SerialData))); }
// public ComPort comMusicI3; public ILiveLDI3(INetPortDevice com) { this.port = com; }
public ILiveIRACC(INetPortDevice com) { this.port = com; }
public ILiveWintom(INetPortDevice p) { this.port = p; }
public ILiveS2(INetPortDevice com) { // this.myPort = sys.IROutputPorts[1]; // this.myPort.SetIRSerialSpec(eIRSerialBaudRates.ComspecBaudRate19200, eIRSerialDataBits.ComspecDataBits8, eIRSerialParityType.ComspecParityNone, eIRSerialStopBits.ComspecStopBits1, Encoding.ASCII); this.port = com; }
public ILiveYodar(INetPortDevice p) { this.port = p; // server.EnableUDPServer(host, 6005, port); }
public ILiveIsinDimmer(int addr, INetPortDevice port) : this(port) { this.addr = addr; }
public ILiveIsinRelay(int addr, INetPortDevice port) : this(port) { this.addr = addr; }
public ILiveYork(INetPortDevice com) { this.port = com; }
public ILiveJingMian(INetPortDevice com) { this.port = com; }
public ILiveZQWL16(int addr, INetPortDevice port) : this(port) { this.addr = addr; }