AllJoyn/Samples/BACnetAdapter/bacnet-stack-0.8.2/ports/xplained/bname.c
bool bacnet_name_write(uint16_t offset,
    BACNET_CHARACTER_STRING * char_string,
    BACNET_ERROR_CLASS * error_class,
    BACNET_ERROR_CODE * error_code)
{
    bool status = false;
    size_t length = 0;
    uint8_t encoding = 0;

    length = characterstring_length(char_string);
    if (length <= NVM_NAME_SIZE) {
        encoding = characterstring_encoding(char_string);
        if (encoding < MAX_CHARACTER_STRING_ENCODING) {
            status = bacnet_name_set(offset, char_string);
            if (!status) {
                *error_class = ERROR_CLASS_PROPERTY;
                *error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
            }
        } else {
            *error_class = ERROR_CLASS_PROPERTY;
            *error_code = ERROR_CODE_CHARACTER_SET_NOT_SUPPORTED;
        }
    } else {
        *error_class = ERROR_CLASS_PROPERTY;
        *error_code = ERROR_CODE_NO_SPACE_TO_WRITE_PROPERTY;
    }

    return status;
}
/* no required minumum length or duplicate checking */
no required minumum length or duplicate checking
no required minumum length or duplicate checking
bool bacnet_name_write(uint16_t offset,
    BACNET_CHARACTER_STRING * char_string,
    BACNET_ERROR_CLASS * error_class,
    BACNET_ERROR_CODE * error_code)
{
    bool status = false;
    size_t length = 0;
    uint8_t encoding = 0;
    length = characterstring_length(char_string);
    if (length <= NVM_NAME_SIZE) {
        encoding = characterstring_encoding(char_string);
        if (encoding < MAX_CHARACTER_STRING_ENCODING) {
            status = bacnet_name_set(offset, char_string);
            if (!status) {
                *error_class = ERROR_CLASS_PROPERTY;
                *error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
            }
        } else {
            *error_class = ERROR_CLASS_PROPERTY;
            *error_code = ERROR_CODE_CHARACTER_SET_NOT_SUPPORTED;
        }
    } else {
        *error_class = ERROR_CLASS_PROPERTY;
        *error_code = ERROR_CODE_NO_SPACE_TO_WRITE_PROPERTY;
    }
    return status;
}
bool bacnet_name_write ( uint16_t offset , BACNET_CHARACTER_STRING * char_string , BACNET_ERROR_CLASS * error_class , BACNET_ERROR_CODE * error_code ) { bool status = false ; size_t length = 0 ; uint8_t encoding = 0 ; length = characterstring_length ( char_string ) ; if ( length <= NVM_NAME_SIZE ) { encoding = characterstring_encoding ( char_string ) ; if ( encoding < MAX_CHARACTER_STRING_ENCODING ) { status = bacnet_name_set ( offset , char_string ) ; if ( ! status ) { * error_class = ERROR_CLASS_PROPERTY ; * error_code = ERROR_CODE_VALUE_OUT_OF_RANGE ; } } else { * error_class = ERROR_CLASS_PROPERTY ; * error_code = ERROR_CODE_CHARACTER_SET_NOT_SUPPORTED ; } } else { * error_class = ERROR_CLASS_PROPERTY ; * error_code = ERROR_CODE_NO_SPACE_TO_WRITE_PROPERTY ; } return status ; }
no required minumum length or duplicate checking
no required minumum length or duplicate checking