Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
 public ILiveYamaha(INetPortDevice port)
 {
     try
     {
         this.server = port;
     }
     catch (Exception ex)
     {
         ILiveDebug.Instance.WriteLine(ex.Message);
     }
 }
Esempio n. 3
0
 public ILiveASK(INetPortDevice port)
 {
     try
     {
         this.port = port;
     }
     catch (Exception ex)
     {
         ILiveDebug.Instance.WriteLine(ex.Message);
     }
 }
Esempio n. 4
0
 public ILiveTPC5(INetPortDevice port)
 {
     try
     {
         this.iserver = port;
         this.iserver.NetDataReceived += new NetDataReceivedEventHandler(iserver_NetDataReceived);
     }
     catch (Exception ex)
     {
         ILiveDebug.Instance.WriteLine(ex.Message);
     }
 }
Esempio n. 5
0
        /// <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);
        }
Esempio n. 6
0
        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;
            }
        }
Esempio n. 7
0
 public ILiveDaHua(INetPortDevice com)
 {
     #region 注册串口
     this.port = com;
     #endregion
 }
Esempio n. 8
0
 public ILiveDM8318(INetPortDevice com)
 {
     this.port = com;
 }
Esempio n. 9
0
 void iserver_NetDataReceived(INetPortDevice device, NetPortSerialDataEventArgs args)
 {
     OnDataReceived(args.SerialData);
     //  throw new NotImplementedException();
 }
Esempio n. 10
0
 void port_NetDataReceived(INetPortDevice device, NetPortSerialDataEventArgs args)
 {
     //   ILiveDebug.Instance.WriteLine("movie:" + ILiveUtil.ToHexString(Encoding.GetEncoding(28591).GetBytes(args.SerialData)));
 }
Esempio n. 11
0
 // public ComPort comMusicI3;
 public ILiveLDI3(INetPortDevice com)
 {
     this.port = com;
 }
Esempio n. 12
0
 public ILiveIRACC(INetPortDevice com)
 {
     this.port = com;
 }
Esempio n. 13
0
 public ILiveWintom(INetPortDevice p)
 {
     this.port = p;
 }
Esempio n. 14
0
 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;
 }
Esempio n. 15
0
 public ILiveYodar(INetPortDevice p)
 {
     this.port = p;
     // server.EnableUDPServer(host, 6005, port);
 }
Esempio n. 16
0
 public ILiveIsinDimmer(int addr, INetPortDevice port)
     : this(port)
 {
     this.addr = addr;
 }
Esempio n. 17
0
 public ILiveIsinRelay(int addr, INetPortDevice port)
     : this(port)
 {
     this.addr = addr;
 }
Esempio n. 18
0
 public ILiveYork(INetPortDevice com)
 {
     this.port = com;
 }
Esempio n. 19
0
 public ILiveJingMian(INetPortDevice com)
 {
     this.port = com;
 }
Esempio n. 20
0
 public ILiveZQWL16(int addr, INetPortDevice port) : this(port)
 {
     this.addr = addr;
 }