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

    index = Multistate_Input_Instance_To_Index(object_instance);
    if ((index < MAX_MULTISTATE_INPUTS) && (state_index > 0) &&
        (state_index <= MULTISTATE_NUMBER_OF_STATES)) {
        state_index--;
        status = true;
        if (new_name) {
            for (i = 0; i < sizeof(State_Text[index][state_index]); i++) {
                State_Text[index][state_index][i] = new_name[i];
                if (new_name[i] == 0) {
                    break;
                }
            }
        } else {
            for (i = 0; i < sizeof(State_Text[index][state_index]); i++) {
                State_Text[index][state_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_Input_State_Text_Set(
    uint32_t object_instance,
    uint32_t state_index,
    char *new_name)
{
    unsigned index = 0; 
    size_t i = 0;       
    bool status = false;        
    index = Multistate_Input_Instance_To_Index(object_instance);
    if ((index < MAX_MULTISTATE_INPUTS) && (state_index > 0) &&
        (state_index <= MULTISTATE_NUMBER_OF_STATES)) {
        state_index--;
        status = true;
        if (new_name) {
            for (i = 0; i < sizeof(State_Text[index][state_index]); i++) {
                State_Text[index][state_index][i] = new_name[i];
                if (new_name[i] == 0) {
                    break;
                }
            }
        } else {
            for (i = 0; i < sizeof(State_Text[index][state_index]); i++) {
                State_Text[index][state_index][i] = 0;
            }
        }
    }
    return status;;
}
bool Multistate_Input_State_Text_Set ( uint32_t object_instance , uint32_t state_index , char * new_name ) { unsigned index = 0 ; size_t i = 0 ; bool status = false ; index = Multistate_Input_Instance_To_Index ( object_instance ) ; if ( ( index < MAX_MULTISTATE_INPUTS ) && ( state_index > 0 ) && ( state_index <= MULTISTATE_NUMBER_OF_STATES ) ) { state_index -- ; status = true ; if ( new_name ) { for ( i = 0 ; i < sizeof ( State_Text [ index ] [ state_index ] ) ; i ++ ) { State_Text [ index ] [ state_index ] [ i ] = new_name [ i ] ; if ( new_name [ i ] == 0 ) { break ; } } } else { for ( i = 0 ; i < sizeof ( State_Text [ index ] [ state_index ] ) ; i ++ ) { State_Text [ index ] [ state_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 */