Ejemplo n.º 1
0
        //private const UInt16 PACKET_PAYLOAD_ASSIGNCONN = 3;

        public KNXmessage Process(FaHDevice atHomeDevice)
        {
            if (PropertyControl != FAHFunctionPropertyCommand.PropertyControlTypes.AssignConn)
            {
                throw new InvalidCastException();
            }

            int  ChannelIndex = ObjectID;
            int  propIndex    = PropertyID;
            bool hasMoreIndices;

            if (propIndex == 1) //Description
            {
                throw new Exception();
            }
            else
            {
                atHomeDevice.WriteConnectionValue(ChannelIndex, PropertyID, ConnectionID, 1, new KNXAddress[] { GroupValueAddress }, out hasMoreIndices);
            }

            return(CreateEmptySuccessMessage(hasMoreIndices));
        }
Ejemplo n.º 2
0
        public override bool SaveToDevice(ref FaHDevice faHDevice, out bool moreIndices)
        {
            if (this.resultCode == KNXHelpers.knxPropertyReturnValues.MoreIndices)
            {
                faHDevice.WriteConnectionMoreIncides(ObjectID, PropertyID, (ushort)(this.FPSRpayload[0] + 1));
            }

            if (this.requestDataParms == null)
            {
                if (FPSRpayload.Length == 4)
                {
                    //There is a knxaddress in response; save
                    faHDevice.WriteConnectionValue(ObjectID, PropertyID, this.FPSRpayload[0], this.FPSRpayload[1], new KNXAddress[] { new KNXAddress(FPSRpayload, 2) }, out moreIndices);
                }
                else if (FPSRpayload.Length == 2)
                {
                    //There is knxaddress in response; save as null
                    faHDevice.WriteConnectionValue(ObjectID, PropertyID, this.FPSRpayload[0], this.FPSRpayload[1], null, out moreIndices);
                }
                else
                {
                    throw new NotImplementedException();
                }
                return(true);
            }
            else
            {
                if (this.requestDataParms.Length == 2)
                {
                    //Contains groupvalue
                    if (FPSRpayload.Length >= 4)
                    {
                        if (this.requestDataParms[0] == this.ConnectionID && this.requestDataParms[1] == this.ConnectionSubIndexID)
                        {
                            faHDevice.WriteConnectionValue(ObjectID, PropertyID, (ushort)this.ConnectionID, (byte)this.ConnectionSubIndexID, this.GroupValueAddress, out moreIndices);
                            return(true);
                        }
                        else
                        {
                            throw new InvalidDataException();
                        }
                    }
                    //Empty groupvalue
                    else if (FPSRpayload.Length == 2)
                    {
                        if (this.requestDataParms[0] == this.ConnectionID && this.requestDataParms[1] == this.ConnectionSubIndexID)
                        {
                            faHDevice.WriteConnectionValue(ObjectID, PropertyID, (ushort)this.ConnectionID, (byte)this.ConnectionSubIndexID, null, out moreIndices);
                            return(true);
                        }
                        else
                        {
                            throw new InvalidDataException();
                        }
                    }

                    /*else
                     * {
                     *  if (this.requestDataParms[0] == this.ConnectionID && this.requestDataParms[1] == this.ConnectionSubIndexID)
                     *  {
                     *      faHDevice.WriteConnectionValue(ObjectID, PropertyID, (ushort)this.ConnectionID, (byte)this.ConnectionSubIndexID, GroupValueAddress, AdditionalData, out moreIndices);
                     *      return true;
                     *  }
                     *  else
                     *  {
                     *      throw new InvalidDataException();
                     *  }
                     * }*/
                }
                moreIndices = false;
                return(false);
            }
        }