Exemplo n.º 1
0
        public override APDUService Decode(BACPacket cm)
        {
            if (cm.hasMore() == true)
            {
                ObjId = (BACVnetObjectIdentifier) new BACVnetObjectIdentifier().Decode(cm, BACVnetVar.CONTEXT_TAG.OBJECT);
            }
            else
            {
                MissReqPar = true;
                return(this);
            }
            if (cm.hasMore() == true)
            {
                PropId = new BACVnetPropertyId().Decode(cm, BACVnetVar.CONTEXT_TAG.ENUM);
            }
            else
            {
                MissReqPar = true;
                return(this);
            }

            // Index of the desired property to read (if requesting the data)
            // If omitted with an array value; returns the entire array list

            if (cm.hasMore() == true)
            {
                if (cm.GetAction() == BACPacket.Action_Type.REQUEST)
                {
                    switch (ObjId.getObjectType())
                    {
                    case BACVnetObjectIdentifier.BACnetObjectType.ANALOG_INPUT:
                    case BACVnetObjectIdentifier.BACnetObjectType.ANALOG_OUTPUT:
                    case BACVnetObjectIdentifier.BACnetObjectType.ANALOG_VALUE:
                        AnyVar = new BACVnetVar().Decode(cm, BACVnetVar.CONTEXT_TAG.REAL);
                        break;

                    case BACVnetObjectIdentifier.BACnetObjectType.BINARY_INPUT:
                    case BACVnetObjectIdentifier.BACnetObjectType.BINARY_OUTPUT:
                    case BACVnetObjectIdentifier.BACnetObjectType.BINARY_VALUE:
                        AnyVar = new BACVnetVar().Decode(cm, BACVnetVar.CONTEXT_TAG.BSTRING);
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    AnyVar = new BACVnetVar().Decode(cm);
                }
            }

            return(this);
        }