static void LearnDevice(ref KNXUartConnection kNXUart) { byte counter = 0; bool moreIndices; for (byte i = 1; i <= 10; i++) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadCons"); KNXmessage ReadCons = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadConns, 7, 2, new byte[] { i, 1 }); ConsoleWriteOnEmptyLine(string.Format("Sending {0} ", ReadCons.HeaderAsString)); ReadCons.Payload.ReadablePayloadPacket.PrintUnaccountedBytes(); ((FAHFunctionPropertyCommand)ReadCons.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadCons, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } } for (byte i = 1; i <= 10; i++) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadCons"); KNXmessage ReadCons = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadConns, 8, 3, new byte[] { i, 1 }); ConsoleWriteOnEmptyLine(string.Format("Sending {0} ", ReadCons.HeaderAsString)); ReadCons.Payload.ReadablePayloadPacket.PrintUnaccountedBytes(); ((FAHFunctionPropertyCommand)ReadCons.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadCons, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } } for (byte i = 1; i <= 10; i++) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadCons"); KNXmessage ReadCons = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadConns, 8, 2, new byte[] { i, 1 }); ConsoleWriteOnEmptyLine(string.Format("Sending {0} ", ReadCons.HeaderAsString)); ReadCons.Payload.ReadablePayloadPacket.PrintUnaccountedBytes(); ((FAHFunctionPropertyCommand)ReadCons.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadCons, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } } for (byte i = 1; i <= deviceToLearn.ChannelCount; i++) { for (byte propID = 2; propID <= 3; propID++) { moreIndices = true; counter = 1; while (moreIndices) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadCons ch:" + i + ":" + propID + " id:" + counter); KNXmessage ReadCons = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadConns, i, propID, new byte[] { counter++, 0x01 }); ((FAHFunctionPropertyCommand)ReadCons.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadCons, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } } } } for (byte i = 1; i <= 10; i++) { moreIndices = true; byte ix = 1; while (moreIndices) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadBasicInfo"); KNXmessage ReadBasicInfo = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadBasicInfo, i, 5, new byte[] { ix++ }); ((FAHFunctionPropertyCommand)ReadBasicInfo.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadBasicInfo, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } } } for (byte i = 1; i <= deviceToLearn.ChannelCount; i++) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadCons"); KNXmessage ReadCons = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadConns, i, 1, null); ((FAHFunctionPropertyCommand)ReadCons.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadCons, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } } for (byte i = 1; i <= 10; i++) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadCons"); KNXmessage ReadCons = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadConns, 7, i, null); ((FAHFunctionPropertyCommand)ReadCons.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadCons, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } } for (byte i = 0; i <= 10; i++) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadCons"); KNXmessage ReadCons = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadConns, 8, i, null); ((FAHFunctionPropertyCommand)ReadCons.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadCons, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } } if (true) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadDevHealth"); KNXmessage ReadDevHealth = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadDevHealth, 0, 1, null); ((FAHFunctionPropertyCommand)ReadDevHealth.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadDevHealth, true)) { return; } else if (!ProcessResponse(out moreIndices)) { return; } } if (true) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadDesc"); KNXmessage ReadDesc = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadDesc, 1, 5, null); ((FAHFunctionPropertyCommand)ReadDesc.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadDesc, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } } for (byte i = 0; i <= deviceToLearn.ChannelCount + 5; i++) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadBasicInfo Chn: " + i); KNXmessage ReadBasicInfo = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadBasicInfo, i, 1, null); ((FAHFunctionPropertyCommand)ReadBasicInfo.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadBasicInfo, true)) { return; } else if (!ProcessResponse(out moreIndices)) { Console.WriteLine("Failed"); } } if (true) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadDesc"); KNXmessage ReadDesc = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadDesc, 0, 4, new byte[] { 0x01 }); ((FAHFunctionPropertyCommand)ReadDesc.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadDesc, true)) { return; } else if (!ProcessResponse(out moreIndices)) { return; } } if (true) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadCons-ShouldFail"); KNXmessage ReadCons = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadConns, 0, 4, new byte[] { 0x01 }); ((FAHFunctionPropertyCommand)ReadCons.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadCons, true)) { return; } else if (ProcessResponse(out moreIndices)) { return; } } if (true) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadBasicInfo-ShouldFail"); KNXmessage ReadBasicInfo = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadBasicInfo, 0, 7, new byte[] { 0x01 }); ((FAHFunctionPropertyCommand)ReadBasicInfo.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadBasicInfo, true)) { return; } else if (ProcessResponse(out moreIndices)) { return; } } for (byte i = 1; i <= deviceToLearn.ChannelCount; i++) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadBasicInfo " + i); KNXmessage ReadBasicInfo = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadBasicInfo, i, 1, null); ((FAHFunctionPropertyCommand)ReadBasicInfo.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadBasicInfo, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } } if (true) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadDesc"); KNXmessage ReadDesc = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadDesc, 7, 5, null); ((FAHFunctionPropertyCommand)ReadDesc.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadDesc, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } //return; } for (byte i = 0; i < 10; i++) { moreIndices = true; counter = 1; while (moreIndices) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadFunctList"); KNXmessage ReadFunctList = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadFuncList, i, 1, new byte[] { counter++ }); ((FAHFunctionPropertyCommand)ReadFunctList.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadFunctList, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } } } moreIndices = true; counter = 1; while (moreIndices) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadDesc Ndice:" + counter); KNXmessage ReadDesc = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadDesc, 7, 4, new byte[] { (byte)counter++ }); ((FAHFunctionPropertyCommand)ReadDesc.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadDesc, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } } if (true) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadCons-ShouldFail"); KNXmessage ReadCons = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadConns, 7, 4, new byte[] { 0x01 }); ((FAHFunctionPropertyCommand)ReadCons.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadCons, true)) { return; } else if (ProcessResponse(out moreIndices)) { return; } } if (true) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadBasicInfo-ShouldFail"); KNXmessage ReadBasicInfo = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadBasicInfo, 7, 7, new byte[] { 0x01 }); ((FAHFunctionPropertyCommand)ReadBasicInfo.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadBasicInfo, true)) { return; } else if (ProcessResponse(out moreIndices)) { return; } } moreIndices = true; counter = 1; while (moreIndices) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadDesc OID:" + counter); KNXmessage ReadDesc = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadDesc, 7, 3, new byte[] { (byte)counter++ }); ((FAHFunctionPropertyCommand)ReadDesc.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadDesc, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } } moreIndices = true; counter = 1; while (moreIndices) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadDesc OID:" + counter); KNXmessage ReadDesc = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadDesc, 7, 2, new byte[] { (byte)counter++ }); ((FAHFunctionPropertyCommand)ReadDesc.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadDesc, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } } if (true) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadBasicInfo"); KNXmessage ReadBasicInfo = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadBasicInfo, 0, 4, new byte[] { 0x01 }); ((FAHFunctionPropertyCommand)ReadBasicInfo.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadBasicInfo, true)) { return; } else if (!ProcessResponse(out moreIndices)) { return; } } if (true) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadDesc"); KNXmessage ReadDesc = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadDesc, 0, 1, null); ((FAHFunctionPropertyCommand)ReadDesc.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadDesc, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } } for (byte i = 0; i <= deviceToLearn.ChannelCount + 2; i++) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadFlr_RmNr"); KNXmessage ReadCons = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadFlr_RmNr, i, 1, null); ((FAHFunctionPropertyCommand)ReadCons.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadCons, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } } for (byte i = 1; i <= deviceToLearn.ChannelCount + 2; i++) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadIconId"); KNXmessage ReadCons = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadIconId, i, 1, null); ((FAHFunctionPropertyCommand)ReadCons.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadCons, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } } if (true) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadBasicInfo"); KNXmessage ReadBasicInfo = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadBasicInfo, 0, 16, new byte[] { 0x00, 0x00 }); ((FAHFunctionPropertyCommand)ReadBasicInfo.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadBasicInfo, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } } if (true) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadDesc"); KNXmessage ReadDesc = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadDesc, 1, 1, null); ((FAHFunctionPropertyCommand)ReadDesc.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadDesc, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } } if (true) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("__UnsupportedCommand__0x07"); KNXmessage ReadDesc = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.__UnsupportedCommand__0x07, 1, 1, new byte[] { 0x07 }); ((FAHFunctionPropertyCommand)ReadDesc.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadDesc, true)) { return; } else if (ProcessResponse(out moreIndices)) { return; } } for (byte i = 1; i <= deviceToLearn.ChannelCount; i++) { for (byte propID = 2; propID <= 3; propID++) { moreIndices = true; counter = 1; while (moreIndices) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadCons ch:" + i + ":" + propID + " id:" + counter); KNXmessage ReadCons = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadConns, i, propID, new byte[] { counter++, 0x01 }); ((FAHFunctionPropertyCommand)ReadCons.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadCons, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } } } } if (true) { byte i = 7; for (byte propID = 2; propID <= 3; propID++) { moreIndices = true; counter = 1; while (moreIndices) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadCons ch:" + i + ":" + propID + " id:" + counter); KNXmessage ReadCons = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadConns, i, propID, new byte[] { counter++, 0x01 }); ((FAHFunctionPropertyCommand)ReadCons.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadCons, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } } } } for (byte channelID = 1; channelID <= deviceToLearn.ChannelCount; channelID++) { ConsoleWriteHeader("ReadBasicInfo channel:" + channelID); for (byte propID = 3; propID <= 5; propID++) { moreIndices = true; counter = 1; while (moreIndices) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadBasicInfo ch:" + channelID + ":" + propID + " id:" + counter); KNXmessage ReadBasicInfo = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadBasicInfo, channelID, propID, new byte[] { counter++ }); ((FAHFunctionPropertyCommand)ReadBasicInfo.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadBasicInfo, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } } } } if (true) { byte channelID = 7; ConsoleWriteHeader("ReadBasicInfo channel:" + channelID); for (byte propID = 3; propID <= 5; propID++) { moreIndices = true; counter = 1; while (moreIndices) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadBasicInfo ch:" + channelID + ":" + propID + " id:" + counter); KNXmessage ReadBasicInfo = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadBasicInfo, channelID, propID, new byte[] { counter++ }); ((FAHFunctionPropertyCommand)ReadBasicInfo.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadBasicInfo, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } } } } if (true) { byte channelID = 8; ConsoleWriteHeader("ReadBasicInfo channel:" + channelID); for (byte propID = 3; propID <= 5; propID++) { moreIndices = true; counter = 1; while (moreIndices) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadBasicInfo ch:" + channelID + ":" + propID + " id:" + counter); KNXmessage ReadBasicInfo = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadBasicInfo, channelID, propID, new byte[] { counter++ }); ((FAHFunctionPropertyCommand)ReadBasicInfo.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); if (!kNXUart.WriteDirect(ReadBasicInfo, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } } } } for (byte channelID = 1; channelID <= deviceToLearn.ChannelCount + 2; channelID++) { //*---------------------------------------------------------------------------- ConsoleWriteHeader("ReadDesc:" + channelID); KNXmessage ReadDesc = FAHFunctionPropertyCommand.CreateFAHFunctionPropertyCommand(deviceToLearn, FAHFunctionPropertyCommand.PropertyControlTypes.ReadDesc, channelID, 1, null); ((FAHFunctionPropertyCommand)ReadDesc.Payload.ReadablePayloadPacket).GetPropertyControlForReply(ref ByteDataParm, ref lastRequestedPropertyControl); Console.WriteLine(ReadDesc.ToHexString()); if (!kNXUart.WriteDirect(ReadDesc, true)) { return; } else if (!ProcessResponse(out moreIndices)) { ConsoleWriteLine("Invalid data"); } } Console.WriteLine("Setting Interface types we know"); if (deviceToLearn.DeviceType == FaHDeviceType.SensorSwitchactuator22gang) { Console.WriteLine("Switch 2\\2"); //Dit kunnen we sturen //deviceToLearn.WriteChannelPropertyType(1, 2, FaHDeviceProperties.ChannelType.NotDefined, FaHDeviceProperties.SensorActorInterfaceType.NotDefined); //deviceToLearn.WriteChannelPropertyType(4, 2, FaHDeviceProperties.ChannelType.NotDefined, FaHDeviceProperties.SensorActorInterfaceType.NotDefined); deviceToLearn.WriteChannelPropertyType(1, 3, FaHDeviceProperties.ChannelType.chanOutputOnClickChannelType, FaHDeviceProperties.SensorActorInterfaceType.ButtonLeft); deviceToLearn.WriteChannelPropertyType(4, 3, FaHDeviceProperties.ChannelType.chanOutputOnClickChannelType, FaHDeviceProperties.SensorActorInterfaceType.ButtonRight); //Deze moeten we monitoren deviceToLearn.WriteChannelPropertyType(7, 2, FaHDeviceProperties.ChannelType.chanInputActorGroupMessage, FaHDeviceProperties.SensorActorInterfaceType.Actor1); deviceToLearn.WriteChannelPropertyType(8, 2, FaHDeviceProperties.ChannelType.chanInputActorGroupMessage, FaHDeviceProperties.SensorActorInterfaceType.Actor2); //Dit moeten we sturen als waarde veranderd deviceToLearn.WriteChannelPropertyType(7, 3, FaHDeviceProperties.ChannelType.chanOutputActorChangedValue, FaHDeviceProperties.SensorActorInterfaceType.Actor1); deviceToLearn.WriteChannelPropertyType(8, 3, FaHDeviceProperties.ChannelType.chanOutputActorChangedValue, FaHDeviceProperties.SensorActorInterfaceType.Actor2); deviceToLearn.DeviceHealthStatus.DeviceReboots = 0; deviceToLearn.DeviceHealthStatus.Uptime = 0; } else { Console.WriteLine("Unkown"); } ConsoleWriteHeader("Read Completed:" + deviceToLearn.FaHAddress); deviceToLearn.Serialize(deviceToLearn.FaHAddress + "-learn.json"); }