Menu

Parsing Active COV Subscription Request Responses

Help
2017-02-16
2017-02-16
  • Randy Yates

    Randy Yates - 2017-02-16

    I have searched and cannot find a function in the sourceforge project for this. Have I missed it? If not, does anyone know of a place on the web it is available? I've googled and couldn't find anything except the wireshark parser.

    Thanks in advance.

     
  • Randy Yates

    Randy Yates - 2017-02-16

    To be more precise, I should have stated "Parsing ReadProperty request responses for the BACNET_PROPERTY_ACTIVE_COV_SUBSCRIPTIONS property."

     
  • Steve Karg

    Steve Karg - 2017-02-16

    Here is one way to parse the property:

    /* BACnetCOVSubscription */
    int decode_cov_subscription(
        uint8_t * apdu,
        int max_apdu_len,
        BACNET_COV_SUBSCRIPTION * covs)
    {
        int apdu_len = 0;
        int len = 0;
        int tag_len;
        uint32_t len_value_type = 0;
        uint8_t tag_number = 0;
    
        /* recipient [0] BACnetRecipientProcess,  */
        len =
            decode_context_recipient_process(&apdu[apdu_len], 0, &covs->recipient);
        if (len < 0)
            return BACNET_STATUS_ERROR;
        apdu_len += len;
        /* monitoredPropertyReference [1] BACnetObjectPropertyReference,  */
        len =
            bacapp_decode_context_obj_property_ref(&apdu[apdu_len], 1,
            &covs->monitoredPropertyReference);
        if (len < 0)
            return BACNET_STATUS_ERROR;
        apdu_len += len;
        /* issueConfirmedNotifications [2] BOOLEAN,  */
        tag_len =
            decode_context_boolean2(&apdu[apdu_len], 2,
            &covs->issueConfirmedNotifications);
        if (tag_len < 0)
            return BACNET_STATUS_ERROR;
        apdu_len += tag_len;
        /* timeRemaining [3] Unsigned,  */
        tag_len =
            decode_tag_number_and_value(&apdu[apdu_len], &tag_number,
            &len_value_type);
        apdu_len += tag_len;
        if (tag_number != 3)
            return BACNET_STATUS_ERROR;
        apdu_len +=
            decode_unsigned(&apdu[apdu_len], len_value_type, &covs->timeRemaining);
        /* covIncrement [4] REAL OPTIONAL */
        if (decode_is_context_tag(&apdu[apdu_len], 4) &&
            !decode_is_closing_tag(&apdu[apdu_len])) {
            tag_len = decode_context_real(&apdu[apdu_len], 4, &covs->covIncrement);
            if (tag_len < 0)
                return BACNET_STATUS_ERROR;
            apdu_len += tag_len;
        } else
            covs->covIncrement = 0.0f;
        return apdu_len;
    }
    
     
  • Randy Yates

    Randy Yates - 2017-02-16

    Thanks so much, Steve! Also the answer to the tag. I see a lot of the information I was missing in section 20.2 of the spec, but I guess I was too thick to see it right off!

     

Log in to post a comment.