bool Device_Set_Object_Name( BACNET_CHARACTER_STRING * object_name) { bool status = false; /*return value */ if (!characterstring_same(&My_Object_Name, object_name)) { /* Make the change and update the database revision */ status = characterstring_copy(&My_Object_Name, object_name); Device_Inc_Database_Revision(); } return status; }
bool Device_Set_Object_Instance_Number(uint32_t object_id) { bool status = true; /* return value */ if (object_id <= BACNET_MAX_INSTANCE) { if (object_id != Object_Instance_Number) { Device_Inc_Database_Revision(); Object_Instance_Number = object_id; } } else status = false; return status; }
bool Device_Set_Object_Instance_Number( uint32_t object_id) { bool status = true; /* return value */ if (object_id <= BACNET_MAX_INSTANCE) { /* Make the change and update the database revision */ Object_Instance_Number = object_id; Device_Inc_Database_Revision(); } else status = false; return status; }
bool bacnet_name_write_unique(uint16_t offset, int object_type, uint32_t object_instance, 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; int duplicate_type = 0; uint32_t duplicate_instance = 0; length = characterstring_length(char_string); if (length < 1) { *error_class = ERROR_CLASS_PROPERTY; *error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; } else if (length <= NVM_NAME_SIZE) { encoding = characterstring_encoding(char_string); if (encoding < MAX_CHARACTER_STRING_ENCODING) { if (Device_Valid_Object_Name(char_string, &duplicate_type, &duplicate_instance)) { if ((duplicate_type == object_type) && (duplicate_instance == object_instance)) { /* writing same name to same object */ status = true; } else { *error_class = ERROR_CLASS_PROPERTY; *error_code = ERROR_CODE_DUPLICATE_NAME; } } else { status = bacnet_name_set(offset, char_string); if (status) { Device_Inc_Database_Revision(); } else { *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; }