AllJoyn/Samples/BACnetAdapter/bacnet-stack-0.8.2/demo/gateway/main.c
static void Devices_Init(
    uint32_t first_object_instance)
{
    int i;
    char nameText[MAX_DEV_NAME_LEN];
    char descText[MAX_DEV_DESC_LEN];
    BACNET_CHARACTER_STRING name_string;

    /* Gateway Device has already been initialized.
     * But give it a better Description. */
    Routed_Device_Set_Description(DEV_DESCR_GATEWAY,
        strlen(DEV_DESCR_GATEWAY));

    /* Now initialize the remote Device objects. */
    for (i = 1; i < MAX_NUM_DEVICES; i++) {
#ifdef _MSC_VER
        _snprintf(nameText, MAX_DEV_NAME_LEN, "%s %d", DEV_NAME_BASE, i + 1);
        _snprintf(descText, MAX_DEV_DESC_LEN, "%s %d", DEV_DESCR_REMOTE, i);
#else
        snprintf(nameText, MAX_DEV_NAME_LEN, "%s %d", DEV_NAME_BASE, i + 1);
        snprintf(descText, MAX_DEV_DESC_LEN, "%s %d", DEV_DESCR_REMOTE, i);
#endif
        characterstring_init_ansi(&name_string, nameText);

        Add_Routed_Device((first_object_instance + i), &name_string, descText);
    }

}
/** Initialize the Device Objects and each of the child Object instances.
 * @param first_object_instance Set the first (gateway) Device to this
            instance number, and subsequent devices to incremented values.
 */
Initialize the Device Objects and each of the child Object instances.
@param first_object_instance Set the first (gateway) Device to this
instance number, and subsequent devices to incremented values.
Initialize the Device Objects and each of the child Object instances . @param first_object_instance Set the first ( gateway ) Device to this instance number and subsequent devices to incremented values .
static void Devices_Init(
    uint32_t first_object_instance)
{
    int i;
    char nameText[MAX_DEV_NAME_LEN];
    char descText[MAX_DEV_DESC_LEN];
    BACNET_CHARACTER_STRING name_string;
    Routed_Device_Set_Description(DEV_DESCR_GATEWAY,
        strlen(DEV_DESCR_GATEWAY));
    for (i = 1; i < MAX_NUM_DEVICES; i++) {
#ifdef _MSC_VER
        _snprintf(nameText, MAX_DEV_NAME_LEN, "%s %d", DEV_NAME_BASE, i + 1);
        _snprintf(descText, MAX_DEV_DESC_LEN, "%s %d", DEV_DESCR_REMOTE, i);
#else
        snprintf(nameText, MAX_DEV_NAME_LEN, "%s %d", DEV_NAME_BASE, i + 1);
        snprintf(descText, MAX_DEV_DESC_LEN, "%s %d", DEV_DESCR_REMOTE, i);
#endif
        characterstring_init_ansi(&name_string, nameText);
        Add_Routed_Device((first_object_instance + i), &name_string, descText);
    }
}
static void Devices_Init ( uint32_t first_object_instance ) { int i ; char nameText [ MAX_DEV_NAME_LEN ] ; char descText [ MAX_DEV_DESC_LEN ] ; BACNET_CHARACTER_STRING name_string ; Routed_Device_Set_Description ( DEV_DESCR_GATEWAY , strlen ( DEV_DESCR_GATEWAY ) ) ; for ( i = 1 ; i < MAX_NUM_DEVICES ; i ++ ) { #ifdef _MSC_VER _snprintf ( nameText , MAX_DEV_NAME_LEN , " " , DEV_NAME_BASE , i + 1 ) ; _snprintf ( descText , MAX_DEV_DESC_LEN , " " , DEV_DESCR_REMOTE , i ) ; #else snprintf ( nameText , MAX_DEV_NAME_LEN , " " , DEV_NAME_BASE , i + 1 ) ; snprintf ( descText , MAX_DEV_DESC_LEN , " " , DEV_DESCR_REMOTE , i ) ; #endif characterstring_init_ansi ( & name_string , nameText ) ; Add_Routed_Device ( ( first_object_instance + i ) , & name_string , descText ) ; } }
Initialize the Device Objects and each of the child Object instances.
Initialize the Device Objects and each of the child Object instances .
/* Gateway Device has already been initialized.
     * But give it a better Description. */ /* Now initialize the remote Device objects. */