AllJoyn/Samples/BACnetAdapter/bacnet-stack-0.8.2/demo/object/gw_device.c
uint16_t Add_Routed_Device(
    uint32_t Object_Instance,
    BACNET_CHARACTER_STRING * sObject_Name,
    const char *sDescription)
{
    int i = Num_Managed_Devices;
    if (i < MAX_NUM_DEVICES) {
        DEVICE_OBJECT_DATA *pDev = &Devices[i];
        Num_Managed_Devices++;
        iCurrent_Device_Idx = i;
        pDev->bacObj.mObject_Type = OBJECT_DEVICE;
        pDev->bacObj.Object_Instance_Number = Object_Instance;
        if (sObject_Name != NULL)
            Routed_Device_Set_Object_Name(sObject_Name->encoding,
                sObject_Name->value, sObject_Name->length);
        else
            Routed_Device_Set_Object_Name(CHARACTER_UTF8, "No Name",
                strlen("No Name"));
        if (sDescription != NULL)
            Routed_Device_Set_Description(sDescription, strlen(sDescription));
        else
            Routed_Device_Set_Description("No Descr", strlen("No Descr"));
        pDev->Database_Revision = 0;    /* Reset/Initialize now */
        return i;
    } else
        return -1;
}
/** Add a Device to our table of Devices[].
 * The first entry must be the gateway device.
 * @param Object_Instance [in] Set the new Device to this instance number.
 * @param sObject_Name [in] Use this Object Name for the Device.
 * @param sDescription [in] Set this Description for the Device.
 * @return The index of this instance in the Devices[] array,
 *         or -1 if there isn't enough room to add this Device.
 */
Add a Device to our table of Devices[].
The first entry must be the gateway device.
@param Object_Instance [in] Set the new Device to this instance number.
@param sObject_Name [in] Use this Object Name for the Device.
@param sDescription [in] Set this Description for the Device.
@return The index of this instance in the Devices[] array,
or -1 if there isn't enough room to add this Device.
Add a Device to our table of Devices [] . The first entry must be the gateway device . @param Object_Instance [ in ] Set the new Device to this instance number . @param sObject_Name [ in ] Use this Object Name for the Device . @param sDescription [ in ] Set this Description for the Device . @return The index of this instance in the Devices [] array or - 1 if there isn ' t enough room to add this Device .
uint16_t Add_Routed_Device(
    uint32_t Object_Instance,
    BACNET_CHARACTER_STRING * sObject_Name,
    const char *sDescription)
{
    int i = Num_Managed_Devices;
    if (i < MAX_NUM_DEVICES) {
        DEVICE_OBJECT_DATA *pDev = &Devices[i];
        Num_Managed_Devices++;
        iCurrent_Device_Idx = i;
        pDev->bacObj.mObject_Type = OBJECT_DEVICE;
        pDev->bacObj.Object_Instance_Number = Object_Instance;
        if (sObject_Name != NULL)
            Routed_Device_Set_Object_Name(sObject_Name->encoding,
                sObject_Name->value, sObject_Name->length);
        else
            Routed_Device_Set_Object_Name(CHARACTER_UTF8, "No Name",
                strlen("No Name"));
        if (sDescription != NULL)
            Routed_Device_Set_Description(sDescription, strlen(sDescription));
        else
            Routed_Device_Set_Description("No Descr", strlen("No Descr"));
        pDev->Database_Revision = 0;    
        return i;
    } else
        return -1;
}
uint16_t Add_Routed_Device ( uint32_t Object_Instance , BACNET_CHARACTER_STRING * sObject_Name , const char * sDescription ) { int i = Num_Managed_Devices ; if ( i < MAX_NUM_DEVICES ) { DEVICE_OBJECT_DATA * pDev = & Devices [ i ] ; Num_Managed_Devices ++ ; iCurrent_Device_Idx = i ; pDev -> bacObj . mObject_Type = OBJECT_DEVICE ; pDev -> bacObj . Object_Instance_Number = Object_Instance ; if ( sObject_Name != NULL ) Routed_Device_Set_Object_Name ( sObject_Name -> encoding , sObject_Name -> value , sObject_Name -> length ) ; else Routed_Device_Set_Object_Name ( CHARACTER_UTF8 , " " , strlen ( " " ) ) ; if ( sDescription != NULL ) Routed_Device_Set_Description ( sDescription , strlen ( sDescription ) ) ; else Routed_Device_Set_Description ( " " , strlen ( " " ) ) ; pDev -> Database_Revision = 0 ; return i ; } else return -1 ; }
Add a Device to our table of Devices[].
Add a Device to our table of Devices [] .
/* Reset/Initialize now */