Refactor/write property object name (#504)
* refactor WriteProperty of object-name property rules into device object. * remove dependence on device object inside some dynamic objects * improve device object unit test coverage --------- Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
@@ -37,7 +37,6 @@
|
||||
#include "bacnet/npdu.h"
|
||||
#include "bacnet/apdu.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include "bacnet/arf.h"
|
||||
#include "bacnet/awf.h"
|
||||
#include "bacnet/rp.h"
|
||||
@@ -218,30 +217,12 @@ bool bacfile_object_name(
|
||||
bool bacfile_object_name_set(uint32_t object_instance, char *new_name)
|
||||
{
|
||||
bool status = false; /* return value */
|
||||
BACNET_CHARACTER_STRING object_name;
|
||||
BACNET_OBJECT_TYPE found_type = 0;
|
||||
uint32_t found_instance = 0;
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject && new_name) {
|
||||
/* All the object names in a device must be unique */
|
||||
characterstring_init_ansi(&object_name, new_name);
|
||||
if (Device_Valid_Object_Name(
|
||||
&object_name, &found_type, &found_instance)) {
|
||||
if ((found_type == Object_Type) &&
|
||||
(found_instance == object_instance)) {
|
||||
/* writing same name to same object */
|
||||
status = true;
|
||||
} else {
|
||||
/* duplicate name! */
|
||||
status = false;
|
||||
}
|
||||
} else {
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
Device_Inc_Database_Revision();
|
||||
}
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
}
|
||||
|
||||
return status;
|
||||
|
||||
Reference in New Issue
Block a user