AllJoyn/Samples/BACnetAdapter/bacnet-stack-0.8.2/demo/object/gw_device.c
int Routed_Device_Read_Property_Local(
    BACNET_READ_PROPERTY_DATA * rpdata)
{
    int apdu_len = 0;   /* return value */
    BACNET_CHARACTER_STRING char_string;
    uint8_t *apdu = NULL;
    DEVICE_OBJECT_DATA *pDev = &Devices[iCurrent_Device_Idx];

    if ((rpdata == NULL) || (rpdata->application_data == NULL) ||
        (rpdata->application_data_len == 0)) {
        return 0;
    }
    apdu = rpdata->application_data;
    switch (rpdata->object_property) {
        case PROP_OBJECT_IDENTIFIER:
            apdu_len =
                encode_application_object_id(&apdu[0], OBJECT_DEVICE,
                pDev->bacObj.Object_Instance_Number);
            break;
        case PROP_OBJECT_NAME:
            characterstring_init_ansi(&char_string, pDev->bacObj.Object_Name);
            apdu_len =
                encode_application_character_string(&apdu[0], &char_string);
            break;
        case PROP_DESCRIPTION:
            characterstring_init_ansi(&char_string, pDev->Description);
            apdu_len =
                encode_application_character_string(&apdu[0], &char_string);
            break;
        case PROP_DATABASE_REVISION:
            apdu_len =
                encode_application_unsigned(&apdu[0], pDev->Database_Revision);
            break;
        default:
            apdu_len = Device_Read_Property_Local(rpdata);
            break;
    }

    return (apdu_len);
}
/** Manages ReadProperty service for fields which are different for routed
 * Devices, or hands off to the default Device RP function for the rest.
 * @param rpdata [in] Structure which describes the property to be read.
 * @return The length of the apdu encoded, or BACNET_STATUS_ERROR for error or
 * BACNET_STATUS_ABORT for abort message.
 */
Manages ReadProperty service for fields which are different for routed
Devices, or hands off to the default Device RP function for the rest.
@param rpdata [in] Structure which describes the property to be read.
@return The length of the apdu encoded, or BACNET_STATUS_ERROR for error or
BACNET_STATUS_ABORT for abort message.
Manages ReadProperty service for fields which are different for routed Devices or hands off to the default Device RP function for the rest . @param rpdata [ in ] Structure which describes the property to be read . @return The length of the apdu encoded or BACNET_STATUS_ERROR for error or BACNET_STATUS_ABORT for abort message .
int Routed_Device_Read_Property_Local(
    BACNET_READ_PROPERTY_DATA * rpdata)
{
    int apdu_len = 0;   
    BACNET_CHARACTER_STRING char_string;
    uint8_t *apdu = NULL;
    DEVICE_OBJECT_DATA *pDev = &Devices[iCurrent_Device_Idx];
    if ((rpdata == NULL) || (rpdata->application_data == NULL) ||
        (rpdata->application_data_len == 0)) {
        return 0;
    }
    apdu = rpdata->application_data;
    switch (rpdata->object_property) {
        case PROP_OBJECT_IDENTIFIER:
            apdu_len =
                encode_application_object_id(&apdu[0], OBJECT_DEVICE,
                pDev->bacObj.Object_Instance_Number);
            break;
        case PROP_OBJECT_NAME:
            characterstring_init_ansi(&char_string, pDev->bacObj.Object_Name);
            apdu_len =
                encode_application_character_string(&apdu[0], &char_string);
            break;
        case PROP_DESCRIPTION:
            characterstring_init_ansi(&char_string, pDev->Description);
            apdu_len =
                encode_application_character_string(&apdu[0], &char_string);
            break;
        case PROP_DATABASE_REVISION:
            apdu_len =
                encode_application_unsigned(&apdu[0], pDev->Database_Revision);
            break;
        default:
            apdu_len = Device_Read_Property_Local(rpdata);
            break;
    }
    return (apdu_len);
}
int Routed_Device_Read_Property_Local ( BACNET_READ_PROPERTY_DATA * rpdata ) { int apdu_len = 0 ; BACNET_CHARACTER_STRING char_string ; uint8_t * apdu = NULL ; DEVICE_OBJECT_DATA * pDev = & Devices [ iCurrent_Device_Idx ] ; if ( ( rpdata == NULL ) || ( rpdata -> application_data == NULL ) || ( rpdata -> application_data_len == 0 ) ) { return 0 ; } apdu = rpdata -> application_data ; switch ( rpdata -> object_property ) { case PROP_OBJECT_IDENTIFIER : apdu_len = encode_application_object_id ( & apdu [ 0 ] , OBJECT_DEVICE , pDev -> bacObj . Object_Instance_Number ) ; break ; case PROP_OBJECT_NAME : characterstring_init_ansi ( & char_string , pDev -> bacObj . Object_Name ) ; apdu_len = encode_application_character_string ( & apdu [ 0 ] , & char_string ) ; break ; case PROP_DESCRIPTION : characterstring_init_ansi ( & char_string , pDev -> Description ) ; apdu_len = encode_application_character_string ( & apdu [ 0 ] , & char_string ) ; break ; case PROP_DATABASE_REVISION : apdu_len = encode_application_unsigned ( & apdu [ 0 ] , pDev -> Database_Revision ) ; break ; default : apdu_len = Device_Read_Property_Local ( rpdata ) ; break ; } return ( apdu_len ) ; }
Manages ReadProperty service for fields which are different for routed
 Devices, or hands off to the default Device RP function for the rest.
Manages ReadProperty service for fields which are different for routed Devices or hands off to the default Device RP function for the rest .
/* return value */