AllJoyn/Samples/BACnetAdapter/bacnet-stack-0.8.2/ports/xplained/bname.c
bool bacnet_name_save(
    uint16_t offset,
    uint8_t encoding,
    char *str,
    uint8_t str_len)
{
    uint8_t buffer[NVM_NAME_SIZE] = { 0 };
    uint8_t length = 0;

    if (bacnet_name_isvalid(encoding, str_len, str)) {
        length = bacnet_name_encode(
            buffer,
            sizeof(buffer),
            encoding,
            str,
            str_len);
        if (length) {
            nvm_write(
                offset,
                &buffer[0],length);
            return true;
        }
    }

    return false;
}
/*************************************************************************
* DESCRIPTION: Store the name to non-volatile memory at offset
* RETURN: true if name is a valid set of characters
* NOTES: none
**************************************************************************/
Store the name to non-volatile memory at offset
RETURN: true if name is a valid set of characters
NOTES: none
Store the name to non - volatile memory at offset RETURN : true if name is a valid set of characters NOTES : none
bool bacnet_name_save(
    uint16_t offset,
    uint8_t encoding,
    char *str,
    uint8_t str_len)
{
    uint8_t buffer[NVM_NAME_SIZE] = { 0 };
    uint8_t length = 0;
    if (bacnet_name_isvalid(encoding, str_len, str)) {
        length = bacnet_name_encode(
            buffer,
            sizeof(buffer),
            encoding,
            str,
            str_len);
        if (length) {
            nvm_write(
                offset,
                &buffer[0],length);
            return true;
        }
    }
    return false;
}
bool bacnet_name_save ( uint16_t offset , uint8_t encoding , char * str , uint8_t str_len ) { uint8_t buffer [ NVM_NAME_SIZE ] = { 0 } ; uint8_t length = 0 ; if ( bacnet_name_isvalid ( encoding , str_len , str ) ) { length = bacnet_name_encode ( buffer , sizeof ( buffer ) , encoding , str , str_len ) ; if ( length ) { nvm_write ( offset , & buffer [ 0 ] , length ) ; return true ; } } return false ; }
DESCRIPTION: Store the name to non-volatile memory at offset
RETURN: true if name is a valid set of characters
NOTES: none
DESCRIPTION : Store the name to non - volatile memory at offset RETURN : true if name is a valid set of characters NOTES : none