private void Switch_OnActorChange(FaHVirtualDevice caller, FreeAtHomeDevices.FaHDeviceProperties.SensorActorInterfaceType SensorActor, ushort state) { if (this.InvokeRequired) { this.Invoke(new Action <FaHVirtualDevice, FreeAtHomeDevices.FaHDeviceProperties.SensorActorInterfaceType, ushort>(Switch_OnActorChange), new object[] { caller, SensorActor, state }); } else { if (caller == fahABB7001) { if (SensorActor == FreeAtHomeDevices.FaHDeviceProperties.SensorActorInterfaceType.Actor1) { ActorAbb7001_1.Checked = state == 1; } if (SensorActor == FreeAtHomeDevices.FaHDeviceProperties.SensorActorInterfaceType.Actor2) { ActorAbb7001_2.Checked = state == 1; } } Console.WriteLine("************************************************************************"); Console.WriteLine("Switch:" + caller.FahDeviceName + " SensorActor: " + SensorActor + " State: " + state); Console.WriteLine("************************************************************************"); } }
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(); }