AllJoyn/Samples/BACnetAdapter/bacnet-stack-0.8.2/demo/epics/main.c
static uint8_t Read_Properties(
    uint32_t device_instance,
    BACNET_OBJECT_ID * pMyObject)
{
    uint8_t invoke_id = 0;
    struct special_property_list_t PropertyListStruct;
    unsigned int i = 0, j = 0;

    if ((!Has_RPM && (Property_List_Index == 0)) ||
        (Property_List_Length == 0)) {
        /* If we failed to get the Properties with RPM, just settle for what we
         * know is the fixed list of Required and Optional properties.
         * In practice, this should only happen for simple devices that don't
         * implement RPM or have really limited MAX_APDU size.
         */
        property_list_special(pMyObject->type, &PropertyListStruct);
        if (Optional_Properties) {
            Property_List_Length =
                PropertyListStruct.Required.count +
                PropertyListStruct.Optional.count;
        } else {
            Property_List_Length = PropertyListStruct.Required.count;
        }
        if (Property_List_Length > MAX_PROPS) {
            Property_List_Length = MAX_PROPS;
        }
        /* Copy this list for later one-by-one processing */
        for (i = 0; i < Property_List_Length; i++) {
            if (i < PropertyListStruct.Required.count) {
                Property_List[i] = PropertyListStruct.Required.pList[i];
            } else if (Optional_Properties) {
                Property_List[i] = PropertyListStruct.Optional.pList[j];
                j++;
            }
        }
        /* Just to be sure we terminate */
        Property_List[i] = -1;
    }
    if (Property_List[Property_List_Index] != -1) {
        int prop = Property_List[Property_List_Index];
        uint32_t array_index;
        IsLongArray = false;
        if (Using_Walked_List) {
            if (Walked_List_Length == 0) {
                array_index = 0;
            } else {
                array_index = Walked_List_Index;
            }
        } else {
            fprintf(stdout, "    ");
            Print_Property_Identifier(prop);
            fprintf(stdout, ": ");
            array_index = BACNET_ARRAY_ALL;

            switch (prop) {
                    /* These are all potentially long arrays, so they may abort */
                case PROP_OBJECT_LIST:
                case PROP_STATE_TEXT:
                case PROP_STRUCTURED_OBJECT_LIST:
                case PROP_SUBORDINATE_ANNOTATIONS:
                case PROP_SUBORDINATE_LIST:
                    IsLongArray = true;
                    break;
            }
        }
        invoke_id =
            Send_Read_Property_Request(device_instance, pMyObject->type,
            pMyObject->instance, prop, array_index);

    }

    return invoke_id;
}
/** Send an RP request to read one property from the current Object.
 * Singly process large arrays too, like the Device Object's Object_List.
 * If GET_LIST_OF_ALL_RESPONSE failed, we will fall back to using just
 * the list of known Required properties for this type of object.
 *
 * @param device_instance [in] Our target device's instance.
 * @param pMyObject [in] The current Object's type and instance numbers.
 * @return The invokeID of the message sent, or 0 if reached the end
 *         of the property list.
 */
Send an RP request to read one property from the current Object.
Singly process large arrays too, like the Device Object's Object_List.
If GET_LIST_OF_ALL_RESPONSE failed, we will fall back to using just
the list of known Required properties for this type of object.

@param device_instance [in] Our target device's instance.
@param pMyObject [in] The current Object's type and instance numbers.
@return The invokeID of the message sent, or 0 if reached the end
of the property list.
Send an RP request to read one property from the current Object . Singly process large arrays too like the Device Object ' s Object_List . If GET_LIST_OF_ALL_RESPONSE failed we will fall back to using just the list of known Required properties for this type of object . @param device_instance [ in ] Our target device ' s instance . @param pMyObject [ in ] The current Object ' s type and instance numbers . @return The invokeID of the message sent or 0 if reached the end of the property list .
static uint8_t Read_Properties(
    uint32_t device_instance,
    BACNET_OBJECT_ID * pMyObject)
{
    uint8_t invoke_id = 0;
    struct special_property_list_t PropertyListStruct;
    unsigned int i = 0, j = 0;
    if ((!Has_RPM && (Property_List_Index == 0)) ||
        (Property_List_Length == 0)) {
        property_list_special(pMyObject->type, &PropertyListStruct);
        if (Optional_Properties) {
            Property_List_Length =
                PropertyListStruct.Required.count +
                PropertyListStruct.Optional.count;
        } else {
            Property_List_Length = PropertyListStruct.Required.count;
        }
        if (Property_List_Length > MAX_PROPS) {
            Property_List_Length = MAX_PROPS;
        }
        for (i = 0; i < Property_List_Length; i++) {
            if (i < PropertyListStruct.Required.count) {
                Property_List[i] = PropertyListStruct.Required.pList[i];
            } else if (Optional_Properties) {
                Property_List[i] = PropertyListStruct.Optional.pList[j];
                j++;
            }
        }
        Property_List[i] = -1;
    }
    if (Property_List[Property_List_Index] != -1) {
        int prop = Property_List[Property_List_Index];
        uint32_t array_index;
        IsLongArray = false;
        if (Using_Walked_List) {
            if (Walked_List_Length == 0) {
                array_index = 0;
            } else {
                array_index = Walked_List_Index;
            }
        } else {
            fprintf(stdout, "    ");
            Print_Property_Identifier(prop);
            fprintf(stdout, ": ");
            array_index = BACNET_ARRAY_ALL;
            switch (prop) {
                case PROP_OBJECT_LIST:
                case PROP_STATE_TEXT:
                case PROP_STRUCTURED_OBJECT_LIST:
                case PROP_SUBORDINATE_ANNOTATIONS:
                case PROP_SUBORDINATE_LIST:
                    IsLongArray = true;
                    break;
            }
        }
        invoke_id =
            Send_Read_Property_Request(device_instance, pMyObject->type,
            pMyObject->instance, prop, array_index);
    }
    return invoke_id;
}
static uint8_t Read_Properties ( uint32_t device_instance , BACNET_OBJECT_ID * pMyObject ) { uint8_t invoke_id = 0 ; struct special_property_list_t PropertyListStruct ; unsigned int i = 0 , j = 0 ; if ( ( ! Has_RPM && ( Property_List_Index == 0 ) ) || ( Property_List_Length == 0 ) ) { property_list_special ( pMyObject -> type , & PropertyListStruct ) ; if ( Optional_Properties ) { Property_List_Length = PropertyListStruct . Required . count + PropertyListStruct . Optional . count ; } else { Property_List_Length = PropertyListStruct . Required . count ; } if ( Property_List_Length > MAX_PROPS ) { Property_List_Length = MAX_PROPS ; } for ( i = 0 ; i < Property_List_Length ; i ++ ) { if ( i < PropertyListStruct . Required . count ) { Property_List [ i ] = PropertyListStruct . Required . pList [ i ] ; } else if ( Optional_Properties ) { Property_List [ i ] = PropertyListStruct . Optional . pList [ j ] ; j ++ ; } } Property_List [ i ] = -1 ; } if ( Property_List [ Property_List_Index ] != -1 ) { int prop = Property_List [ Property_List_Index ] ; uint32_t array_index ; IsLongArray = false ; if ( Using_Walked_List ) { if ( Walked_List_Length == 0 ) { array_index = 0 ; } else { array_index = Walked_List_Index ; } } else { fprintf ( stdout , " " ) ; Print_Property_Identifier ( prop ) ; fprintf ( stdout , " " ) ; array_index = BACNET_ARRAY_ALL ; switch ( prop ) { case PROP_OBJECT_LIST : case PROP_STATE_TEXT : case PROP_STRUCTURED_OBJECT_LIST : case PROP_SUBORDINATE_ANNOTATIONS : case PROP_SUBORDINATE_LIST : IsLongArray = true ; break ; } } invoke_id = Send_Read_Property_Request ( device_instance , pMyObject -> type , pMyObject -> instance , prop , array_index ) ; } return invoke_id ; }
Send an RP request to read one property from the current Object.
Send an RP request to read one property from the current Object .
/* If we failed to get the Properties with RPM, just settle for what we
         * know is the fixed list of Required and Optional properties.
         * In practice, this should only happen for simple devices that don't
         * implement RPM or have really limited MAX_APDU size.
         */ /* Copy this list for later one-by-one processing */ /* Just to be sure we terminate */ /* These are all potentially long arrays, so they may abort */