AllJoyn/Samples/BACnetAdapter/bacnet-stack-0.8.2/demo/object/msv.c
bool Multistate_Value_Name_Set(
    uint32_t object_instance,
    char *new_name)
{
    unsigned index = 0; /* offset from instance lookup */
    size_t i = 0;       /* loop counter */
    bool status = false;        /* return value */

    index = Multistate_Value_Instance_To_Index(object_instance);
    if (index < MAX_MULTISTATE_VALUES) {
        status = true;
        /* FIXME: check to see if there is a matching name */
        if (new_name) {
            for (i = 0; i < sizeof(Object_Name[index]); i++) {
                Object_Name[index][i] = new_name[i];
                if (new_name[i] == 0) {
                    break;
                }
            }
        } else {
            for (i = 0; i < sizeof(Object_Name[index]); i++) {
                Object_Name[index][i] = 0;
            }
        }
    }

    return status;
}
/* note: the object name must be unique within this device */
the object name must be unique within this device
the object name must be unique within this device
bool Multistate_Value_Name_Set(
    uint32_t object_instance,
    char *new_name)
{
    unsigned index = 0; 
    size_t i = 0;       
    bool status = false;        
    index = Multistate_Value_Instance_To_Index(object_instance);
    if (index < MAX_MULTISTATE_VALUES) {
        status = true;
        if (new_name) {
            for (i = 0; i < sizeof(Object_Name[index]); i++) {
                Object_Name[index][i] = new_name[i];
                if (new_name[i] == 0) {
                    break;
                }
            }
        } else {
            for (i = 0; i < sizeof(Object_Name[index]); i++) {
                Object_Name[index][i] = 0;
            }
        }
    }
    return status;
}
bool Multistate_Value_Name_Set ( uint32_t object_instance , char * new_name ) { unsigned index = 0 ; size_t i = 0 ; bool status = false ; index = Multistate_Value_Instance_To_Index ( object_instance ) ; if ( index < MAX_MULTISTATE_VALUES ) { status = true ; if ( new_name ) { for ( i = 0 ; i < sizeof ( Object_Name [ index ] ) ; i ++ ) { Object_Name [ index ] [ i ] = new_name [ i ] ; if ( new_name [ i ] == 0 ) { break ; } } } else { for ( i = 0 ; i < sizeof ( Object_Name [ index ] ) ; i ++ ) { Object_Name [ index ] [ i ] = 0 ; } } } return status ; }
note: the object name must be unique within this device
note : the object name must be unique within this device
/* offset from instance lookup */ /* loop counter */ /* return value */ /* FIXME: check to see if there is a matching name */