Ejemplo n.º 1
0
 private void Group_OnGroupValueChange(FaHGroupMonitor caller, byte[] data)
 {
     if (this.InvokeRequired)
     {
         this.Invoke(new Action <FaHGroupMonitor, byte[]>(Group_OnGroupValueChange), new object[] { caller, data });
     }
     else
     {
         if (caller == fah0xf80x83)
         {
             textBox1.Text = BitConverter.ToString(data) + "-->" + caller.GroupValueAsDouble;
         }
         else if (caller == fah0xE00x31)
         {
             checkBox3.Checked = caller.GroupValueAsBool;
         }
         else if (caller == fah0x940x20)
         {
             checkBox2.Checked = caller.GroupValueAsBool;
         }
     }
 }
Ejemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            /*
             * KNXUartConnection rkNXUart  = new KNXUartConnection(AppSettings.Default.ComPort)
             * {
             *  AllowWrite = true
             * };
             * if (!rkNXUart.ResetAndInit())
             * {
             *  throw new Exception("Cannot init");
             * }
             * kNXUart = rkNXUart;
             */
            TCPknxClient tCPknxClient = new TCPknxClient("172.16.16.20", 9998);

            kNXUart = tCPknxClient;

            fahABB7001 = new FaHVirtualDevice(kNXUart, "ABB700C00001");
            fahABB7001.ConsolePrintMessages = true;
            //fahABB7002 = new FaHVirtualDevice(kNXUart, "ABB700C00002");
            fah0xf80x83 = new FaHGroupMonitor(kNXUart, new KNXAddress(0xf8, 0x83));
            fah0x940x20 = new FaHGroupMonitor(kNXUart, new KNXAddress(0x94, 0x20));
            fah0xE00x31 = new FaHGroupMonitor(kNXUart, new KNXAddress(0xE0, 0x31));
            //fah0x550x13 = new FaHGroupMonitor(kNXUart, new KNXAddress(21779));
            fah0xf80x83.OnGroupValueChange += Group_OnGroupValueChange;
            fah0x940x20.OnGroupValueChange += Group_OnGroupValueChange;
            fah0xE00x31.OnGroupValueChange += Group_OnGroupValueChange;

            fahABB7001.OnActorChange += Switch_OnActorChange;
            //fahABB7002.OnActorChange += Switch_OnActorChange;

            fahABB7001.StartFaHDevice();


            //fahABB7002.StartFaHDevice();
        }