From e7365ecaa5f1422466f302a781555533a0781ad1 Mon Sep 17 00:00:00 2001 From: tbrennan3 Date: Mon, 22 Aug 2011 19:40:08 +0000 Subject: [PATCH] Fixed up Device_Object_Name_Copy() for these ports. --- bacnet-stack/ports/at91sam7s/device.c | 19 ++++--------------- bacnet-stack/ports/bdk-atxx4-mstp/device.c | 20 ++++---------------- bacnet-stack/ports/stm32f10x/device.c | 20 ++++---------------- 3 files changed, 12 insertions(+), 47 deletions(-) diff --git a/bacnet-stack/ports/at91sam7s/device.c b/bacnet-stack/ports/at91sam7s/device.c index 2fc33618..50a668c8 100644 --- a/bacnet-stack/ports/at91sam7s/device.c +++ b/bacnet-stack/ports/at91sam7s/device.c @@ -592,27 +592,16 @@ bool Device_Valid_Object_Id( } bool Device_Object_Name_Copy( - int object_type, + BACNET_OBJECT_TYPE object_type, uint32_t object_instance, BACNET_CHARACTER_STRING * object_name) { struct my_object_functions *pObject = NULL; bool found = false; - int type = 0; - uint32_t instance; - unsigned max_objects = 0, i = 0; - bool check_id = false; - max_objects = Device_Object_List_Count(); - for (i = 0; i < max_objects; i++) { - check_id = Device_Object_List_Identifier(i, &type, &instance); - if (check_id) { - pObject = Device_Objects_Find_Functions(type); - if ((pObject != NULL) && (pObject->Object_Name != NULL)) { - found = pObject->Object_Name(instance, object_name); - break; - } - } + pObject = Device_Objects_Find_Functions(object_type); + if ((pObject != NULL) && (pObject->Object_Valid_Instance != NULL)) { + found = pObject->Object_Name(object_instance, object_name); } return found; diff --git a/bacnet-stack/ports/bdk-atxx4-mstp/device.c b/bacnet-stack/ports/bdk-atxx4-mstp/device.c index 50c54a2b..8e931ae9 100644 --- a/bacnet-stack/ports/bdk-atxx4-mstp/device.c +++ b/bacnet-stack/ports/bdk-atxx4-mstp/device.c @@ -623,27 +623,15 @@ bool Device_Valid_Object_Id( } bool Device_Object_Name_Copy( - int object_type, + BACNET_OBJECT_TYPE object_type, uint32_t object_instance, BACNET_CHARACTER_STRING * object_name) { struct my_object_functions *pObject = NULL; bool found = false; - int type = 0; - uint32_t instance; - unsigned max_objects = 0, i = 0; - bool check_id = false; - - max_objects = Device_Object_List_Count(); - for (i = 0; i < max_objects; i++) { - check_id = Device_Object_List_Identifier(i, &type, &instance); - if (check_id) { - pObject = Device_Objects_Find_Functions(type); - if ((pObject != NULL) && (pObject->Object_Name != NULL)) { - found = pObject->Object_Name(instance, object_name); - break; - } - } + pObject = Device_Objects_Find_Functions(object_type); + if ((pObject != NULL) && (pObject->Object_Valid_Instance != NULL)) { + found = pObject->Object_Name(object_instance, object_name); } return found; diff --git a/bacnet-stack/ports/stm32f10x/device.c b/bacnet-stack/ports/stm32f10x/device.c index 4c7a2aa5..d9154271 100644 --- a/bacnet-stack/ports/stm32f10x/device.c +++ b/bacnet-stack/ports/stm32f10x/device.c @@ -575,27 +575,15 @@ bool Device_Valid_Object_Id( } bool Device_Object_Name_Copy( - int object_type, + BACNET_OBJECT_TYPE object_type, uint32_t object_instance, BACNET_CHARACTER_STRING * object_name) { struct my_object_functions *pObject = NULL; bool found = false; - int type = 0; - uint32_t instance; - unsigned max_objects = 0, i = 0; - bool check_id = false; - - max_objects = Device_Object_List_Count(); - for (i = 0; i < max_objects; i++) { - check_id = Device_Object_List_Identifier(i, &type, &instance); - if (check_id) { - pObject = Device_Objects_Find_Functions((BACNET_OBJECT_TYPE) type); - if ((pObject != NULL) && (pObject->Object_Name != NULL)) { - found = pObject->Object_Name(instance, object_name); - break; - } - } + pObject = Device_Objects_Find_Functions(object_type); + if ((pObject != NULL) && (pObject->Object_Valid_Instance != NULL)) { + found = pObject->Object_Name(object_instance, object_name); } return found;