Example #1
0
        public static KNXmessage UpdateConsistancyTag(FAHFunctionPropertyCommand MessageToRespondTo, FaHDevice atHomeDevice)
        {
            if (MessageToRespondTo.PropertyControl != FAHFunctionPropertyCommand.PropertyControlTypes.UpdConsistencyTag)
            {
                throw new InvalidCastException();
            }

            KNXmessage kNXmessage = new KNXmessage(knxControlField.KnxPacketType.KNX_PacketShort);

            kNXmessage.DestinationAddressType = KNXmessage.DestinationAddressFieldType.Individual;

            uint payloadSize = (uint)(FPSRHEADERSIZE + 2);

            kNXmessage.Payload.NewPayload(KNXAdpu.ApduType.FunctionPropertyStateResponse, payloadSize);
            kNXmessage.Payload.ReadablePayloadPacket = new FPSR_ConsistancyTag(kNXmessage.Payload);
            FPSR_ConsistancyTag newPkg = (FPSR_ConsistancyTag)kNXmessage.Payload.ReadablePayloadPacket;

            newPkg.UpdatePacketSettings();
            newPkg.PropertyID       = MessageToRespondTo.PropertyID;
            newPkg.ObjectID         = MessageToRespondTo.ObjectID;
            newPkg.resultCode       = KNXHelpers.knxPropertyReturnValues.Success;
            newPkg.ConsistancyValue = atHomeDevice.GenerateNewConsistancyTag();
            return(kNXmessage);
        }