Feature/add-device-object-functions-find-api (#1115)

* Added Device_Object_Functions_Find() API to enable override of basic object API function.

* Added Device_Object_Functions() API to return basic object API table of functions for all objects.
This commit is contained in:
Steve Karg
2025-09-30 15:59:08 -05:00
committed by GitHub
parent 83dfe50294
commit 5b7932ee62
7 changed files with 107 additions and 81 deletions
+3
View File
@@ -22,6 +22,9 @@ The git repositories are hosted at the following sites:
### Added
* Added Device_Object_Functions() API to return basic object API table
of functions for all objects. Added Device_Object_Functions_Find() API
to enable override of basic object API function. (#1115)
* Added new enumerations, text, BACnetARRAY and BACnetList from
protocol-revision 30 (#1114)
* Added a context variable in basic object data structure and API
+19 -19
View File
@@ -215,20 +215,20 @@ static object_functions_t My_Object_Table[] = {
/** Glue function to let the Device object, when called by a handler,
* lookup which Object type needs to be invoked.
* @ingroup ObjHelpers
* @param Object_Type [in] The type of BACnet Object the handler wants to
* @param object_type [in] The type of BACnet Object the handler wants to
* access.
* @return Pointer to the group of object helper functions that implement this
* type of Object.
*/
static struct object_functions *
Device_Objects_Find_Functions(BACNET_OBJECT_TYPE Object_Type)
struct object_functions *
Device_Object_Functions_Find(BACNET_OBJECT_TYPE object_type)
{
struct object_functions *pObject = NULL;
pObject = Object_Table;
while (pObject->Object_Type < MAX_BACNET_OBJECT_TYPE) {
/* handle each object type */
if (pObject->Object_Type == Object_Type) {
if (pObject->Object_Type == object_type) {
return (pObject);
}
pObject++;
@@ -252,7 +252,7 @@ rr_info_function Device_Objects_RR_Info(BACNET_OBJECT_TYPE object_type)
{
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
return (pObject != NULL ? pObject->Object_RR_Info : NULL);
}
@@ -284,7 +284,7 @@ void Device_Objects_Property_List(
* to populate the pointers to the individual list counters.
*/
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if ((pObject != NULL) && (pObject->Object_RPM_List != NULL)) {
pObject->Object_RPM_List(
&pPropertyList->Required.pList, &pPropertyList->Optional.pList,
@@ -976,7 +976,7 @@ bool Device_Valid_Object_Name(
for (i = 1; i <= max_objects; i++) {
check_id = Device_Object_List_Identifier(i, &type, &instance);
if (check_id) {
pObject = Device_Objects_Find_Functions(type);
pObject = Device_Object_Functions_Find(type);
if ((pObject != NULL) && (pObject->Object_Name != NULL) &&
(pObject->Object_Name(instance, &object_name2) &&
characterstring_same(object_name1, &object_name2))) {
@@ -1006,7 +1006,7 @@ bool Device_Valid_Object_Id(
bool status = false; /* return value */
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if ((pObject != NULL) && (pObject->Object_Valid_Instance != NULL)) {
status = pObject->Object_Valid_Instance(object_instance);
}
@@ -1028,7 +1028,7 @@ bool Device_Object_Name_Copy(
struct object_functions *pObject = NULL;
bool found = false;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(object_instance)) {
@@ -1409,7 +1409,7 @@ int Device_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
/* initialize the default return values */
rpdata->error_class = ERROR_CLASS_OBJECT;
rpdata->error_code = ERROR_CODE_UNKNOWN_OBJECT;
pObject = Device_Objects_Find_Functions(rpdata->object_type);
pObject = Device_Object_Functions_Find(rpdata->object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(rpdata->object_instance)) {
@@ -1764,7 +1764,7 @@ bool Device_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
/* initialize the default return values */
wp_data->error_class = ERROR_CLASS_OBJECT;
wp_data->error_code = ERROR_CODE_UNKNOWN_OBJECT;
pObject = Device_Objects_Find_Functions(wp_data->object_type);
pObject = Device_Object_Functions_Find(wp_data->object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(wp_data->object_instance)) {
@@ -1819,7 +1819,7 @@ int Device_Add_List_Element(BACNET_LIST_ELEMENT_DATA *list_element)
int status = BACNET_STATUS_ERROR;
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(list_element->object_type);
pObject = Device_Object_Functions_Find(list_element->object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(list_element->object_instance)) {
@@ -1853,7 +1853,7 @@ int Device_Remove_List_Element(BACNET_LIST_ELEMENT_DATA *list_element)
int status = BACNET_STATUS_ERROR;
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(list_element->object_type);
pObject = Device_Object_Functions_Find(list_element->object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(list_element->object_instance)) {
@@ -1891,7 +1891,7 @@ bool Device_Encode_Value_List(
bool status = false; /* Ever the pessimist! */
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(object_instance)) {
@@ -1916,7 +1916,7 @@ bool Device_COV(BACNET_OBJECT_TYPE object_type, uint32_t object_instance)
bool status = false; /* Ever the pessamist! */
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(object_instance)) {
@@ -1938,7 +1938,7 @@ void Device_COV_Clear(BACNET_OBJECT_TYPE object_type, uint32_t object_instance)
{
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(object_instance)) {
@@ -1961,7 +1961,7 @@ bool Device_Create_Object(BACNET_CREATE_OBJECT_DATA *data)
struct object_functions *pObject = NULL;
uint32_t object_instance;
pObject = Device_Objects_Find_Functions(data->object_type);
pObject = Device_Object_Functions_Find(data->object_type);
if (pObject != NULL) {
if (!pObject->Object_Create) {
/* The device supports the object type and may have
@@ -2020,7 +2020,7 @@ bool Device_Delete_Object(BACNET_DELETE_OBJECT_DATA *data)
bool status = false;
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(data->object_type);
pObject = Device_Object_Functions_Find(data->object_type);
if (pObject != NULL) {
if (!pObject->Object_Delete) {
/* The device supports the object type
@@ -2064,7 +2064,7 @@ bool Device_Value_List_Supported(BACNET_OBJECT_TYPE object_type)
bool status = false; /* Ever the pessamist! */
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if (pObject != NULL) {
if (pObject->Object_Value_List) {
status = true;
+17 -17
View File
@@ -169,8 +169,8 @@ static object_functions_t My_Object_Table[] = {
* @return Pointer to the group of object helper functions that implement this
* type of Object.
*/
static struct object_functions *
Device_Objects_Find_Functions(BACNET_OBJECT_TYPE Object_Type)
struct object_functions *
Device_Object_Functions_Find(BACNET_OBJECT_TYPE Object_Type)
{
struct object_functions *pObject = NULL;
@@ -201,7 +201,7 @@ rr_info_function Device_Objects_RR_Info(BACNET_OBJECT_TYPE object_type)
{
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
return (pObject != NULL ? pObject->Object_RR_Info : NULL);
}
@@ -233,7 +233,7 @@ void Device_Objects_Property_List(
* to populate the pointers to the individual list counters.
*/
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if ((pObject != NULL) && (pObject->Object_RPM_List != NULL)) {
pObject->Object_RPM_List(
&pPropertyList->Required.pList, &pPropertyList->Optional.pList,
@@ -917,7 +917,7 @@ bool Device_Valid_Object_Name(
for (i = 1; i <= max_objects; i++) {
check_id = Device_Object_List_Identifier(i, &type, &instance);
if (check_id) {
pObject = Device_Objects_Find_Functions(type);
pObject = Device_Object_Functions_Find(type);
if ((pObject != NULL) && (pObject->Object_Name != NULL) &&
(pObject->Object_Name(instance, &object_name2) &&
characterstring_same(object_name1, &object_name2))) {
@@ -947,7 +947,7 @@ bool Device_Valid_Object_Id(
bool status = false; /* return value */
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if ((pObject != NULL) && (pObject->Object_Valid_Instance != NULL)) {
status = pObject->Object_Valid_Instance(object_instance);
}
@@ -969,7 +969,7 @@ bool Device_Object_Name_Copy(
struct object_functions *pObject = NULL;
bool found = false;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(object_instance)) {
@@ -1350,7 +1350,7 @@ int Device_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
/* initialize the default return values */
rpdata->error_class = ERROR_CLASS_OBJECT;
rpdata->error_code = ERROR_CODE_UNKNOWN_OBJECT;
pObject = Device_Objects_Find_Functions(rpdata->object_type);
pObject = Device_Object_Functions_Find(rpdata->object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(rpdata->object_instance)) {
@@ -1705,7 +1705,7 @@ bool Device_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
/* initialize the default return values */
wp_data->error_class = ERROR_CLASS_OBJECT;
wp_data->error_code = ERROR_CODE_UNKNOWN_OBJECT;
pObject = Device_Objects_Find_Functions(wp_data->object_type);
pObject = Device_Object_Functions_Find(wp_data->object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(wp_data->object_instance)) {
@@ -1751,7 +1751,7 @@ int Device_Add_List_Element(BACNET_LIST_ELEMENT_DATA *list_element)
int status = BACNET_STATUS_ERROR;
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(list_element->object_type);
pObject = Device_Object_Functions_Find(list_element->object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(list_element->object_instance)) {
@@ -1785,7 +1785,7 @@ int Device_Remove_List_Element(BACNET_LIST_ELEMENT_DATA *list_element)
int status = BACNET_STATUS_ERROR;
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(list_element->object_type);
pObject = Device_Object_Functions_Find(list_element->object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(list_element->object_instance)) {
@@ -1823,7 +1823,7 @@ bool Device_Encode_Value_List(
bool status = false; /* Ever the pessamist! */
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(object_instance)) {
@@ -1848,7 +1848,7 @@ bool Device_COV(BACNET_OBJECT_TYPE object_type, uint32_t object_instance)
bool status = false; /* Ever the pessamist! */
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(object_instance)) {
@@ -1870,7 +1870,7 @@ void Device_COV_Clear(BACNET_OBJECT_TYPE object_type, uint32_t object_instance)
{
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(object_instance)) {
@@ -1893,7 +1893,7 @@ bool Device_Create_Object(BACNET_CREATE_OBJECT_DATA *data)
struct object_functions *pObject = NULL;
uint32_t object_instance;
pObject = Device_Objects_Find_Functions(data->object_type);
pObject = Device_Object_Functions_Find(data->object_type);
if (pObject != NULL) {
if (!pObject->Object_Create) {
/* The device supports the object type and may have
@@ -1952,7 +1952,7 @@ bool Device_Delete_Object(BACNET_DELETE_OBJECT_DATA *data)
bool status = false;
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(data->object_type);
pObject = Device_Object_Functions_Find(data->object_type);
if (pObject != NULL) {
if (!pObject->Object_Delete) {
/* The device supports the object type
@@ -1996,7 +1996,7 @@ bool Device_Value_List_Supported(BACNET_OBJECT_TYPE object_type)
bool status = false; /* Ever the pessamist! */
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if (pObject != NULL) {
if (pObject->Object_Value_List) {
status = true;
@@ -187,8 +187,8 @@ static object_functions_t Object_Table[] = {
* @return Pointer to the group of object helper functions that implement this
* type of Object.
*/
static struct object_functions *
Device_Objects_Find_Functions(BACNET_OBJECT_TYPE Object_Type)
struct object_functions *
Device_Object_Functions_Find(BACNET_OBJECT_TYPE Object_Type)
{
struct object_functions *pObject = NULL;
@@ -220,7 +220,7 @@ rr_info_function Device_Objects_RR_Info(BACNET_OBJECT_TYPE object_type)
{
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
return (pObject != NULL ? pObject->Object_RR_Info : NULL);
}
@@ -252,7 +252,7 @@ void Device_Objects_Property_List(
* to populate the pointers to the individual list counters.
*/
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if ((pObject != NULL) && (pObject->Object_RPM_List != NULL)) {
pObject->Object_RPM_List(
&pPropertyList->Required.pList, &pPropertyList->Optional.pList,
@@ -860,7 +860,7 @@ bool Device_Valid_Object_Name(
for (i = 1; i <= max_objects; i++) {
check_id = Device_Object_List_Identifier(i, &type, &instance);
if (check_id) {
pObject = Device_Objects_Find_Functions(type);
pObject = Device_Object_Functions_Find(type);
if ((pObject != NULL) && (pObject->Object_Name != NULL) &&
(pObject->Object_Name(instance, &object_name2) &&
characterstring_same(object_name1, &object_name2))) {
@@ -890,7 +890,7 @@ bool Device_Valid_Object_Id(
bool status = false; /* return value */
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if ((pObject != NULL) && (pObject->Object_Valid_Instance != NULL)) {
status = pObject->Object_Valid_Instance(object_instance);
}
@@ -912,7 +912,7 @@ bool Device_Object_Name_Copy(
struct object_functions *pObject = NULL;
bool found = false;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(object_instance)) {
@@ -1219,7 +1219,7 @@ int Device_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
/* initialize the default return values */
rpdata->error_class = ERROR_CLASS_OBJECT;
rpdata->error_code = ERROR_CODE_UNKNOWN_OBJECT;
pObject = Device_Objects_Find_Functions(rpdata->object_type);
pObject = Device_Object_Functions_Find(rpdata->object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(rpdata->object_instance)) {
@@ -1335,7 +1335,7 @@ bool Device_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
/* initialize the default return values */
wp_data->error_class = ERROR_CLASS_OBJECT;
wp_data->error_code = ERROR_CODE_UNKNOWN_OBJECT;
pObject = Device_Objects_Find_Functions(wp_data->object_type);
pObject = Device_Object_Functions_Find(wp_data->object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(wp_data->object_instance)) {
+27 -18
View File
@@ -404,8 +404,8 @@ static object_functions_t My_Object_Table[] = {
* @return Pointer to the group of object helper functions that implement this
* type of Object.
*/
static struct object_functions *
Device_Objects_Find_Functions(BACNET_OBJECT_TYPE Object_Type)
struct object_functions *
Device_Object_Functions_Find(BACNET_OBJECT_TYPE Object_Type)
{
struct object_functions *pObject = NULL;
@@ -436,7 +436,7 @@ rr_info_function Device_Objects_RR_Info(BACNET_OBJECT_TYPE object_type)
{
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
return (pObject != NULL ? pObject->Object_RR_Info : NULL);
}
@@ -468,7 +468,7 @@ void Device_Objects_Property_List(
* to populate the pointers to the individual list counters.
*/
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if ((pObject != NULL) && (pObject->Object_RPM_List != NULL)) {
pObject->Object_RPM_List(
&pPropertyList->Required.pList, &pPropertyList->Optional.pList,
@@ -1294,7 +1294,7 @@ bool Device_Valid_Object_Name(
for (i = 1; i <= max_objects; i++) {
check_id = Device_Object_List_Identifier(i, &type, &instance);
if (check_id) {
pObject = Device_Objects_Find_Functions(type);
pObject = Device_Object_Functions_Find(type);
if ((pObject != NULL) && (pObject->Object_Name != NULL) &&
(pObject->Object_Name(instance, &object_name2) &&
characterstring_same(object_name1, &object_name2))) {
@@ -1324,7 +1324,7 @@ bool Device_Valid_Object_Id(
bool status = false; /* return value */
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if ((pObject != NULL) && (pObject->Object_Valid_Instance != NULL)) {
status = pObject->Object_Valid_Instance(object_instance);
}
@@ -1346,7 +1346,7 @@ bool Device_Object_Name_Copy(
struct object_functions *pObject = NULL;
bool found = false;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(object_instance)) {
@@ -1741,7 +1741,7 @@ int Device_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
/* initialize the default return values */
rpdata->error_class = ERROR_CLASS_OBJECT;
rpdata->error_code = ERROR_CODE_UNKNOWN_OBJECT;
pObject = Device_Objects_Find_Functions(rpdata->object_type);
pObject = Device_Object_Functions_Find(rpdata->object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(rpdata->object_instance)) {
@@ -2095,7 +2095,7 @@ bool Device_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
/* initialize the default return values */
wp_data->error_class = ERROR_CLASS_OBJECT;
wp_data->error_code = ERROR_CODE_UNKNOWN_OBJECT;
pObject = Device_Objects_Find_Functions(wp_data->object_type);
pObject = Device_Object_Functions_Find(wp_data->object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(wp_data->object_instance)) {
@@ -2153,7 +2153,7 @@ int Device_Add_List_Element(BACNET_LIST_ELEMENT_DATA *list_element)
int status = BACNET_STATUS_ERROR;
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(list_element->object_type);
pObject = Device_Object_Functions_Find(list_element->object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(list_element->object_instance)) {
@@ -2187,7 +2187,7 @@ int Device_Remove_List_Element(BACNET_LIST_ELEMENT_DATA *list_element)
int status = BACNET_STATUS_ERROR;
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(list_element->object_type);
pObject = Device_Object_Functions_Find(list_element->object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(list_element->object_instance)) {
@@ -2225,7 +2225,7 @@ bool Device_Encode_Value_List(
bool status = false; /* Ever the pessimist! */
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(object_instance)) {
@@ -2250,7 +2250,7 @@ bool Device_COV(BACNET_OBJECT_TYPE object_type, uint32_t object_instance)
bool status = false; /* Ever the pessamist! */
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(object_instance)) {
@@ -2272,7 +2272,7 @@ void Device_COV_Clear(BACNET_OBJECT_TYPE object_type, uint32_t object_instance)
{
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(object_instance)) {
@@ -2295,7 +2295,7 @@ bool Device_Create_Object(BACNET_CREATE_OBJECT_DATA *data)
struct object_functions *pObject = NULL;
uint32_t object_instance;
pObject = Device_Objects_Find_Functions(data->object_type);
pObject = Device_Object_Functions_Find(data->object_type);
if (pObject != NULL) {
if (!pObject->Object_Create) {
/* The device supports the object type and may have
@@ -2354,7 +2354,7 @@ bool Device_Delete_Object(BACNET_DELETE_OBJECT_DATA *data)
bool status = false;
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(data->object_type);
pObject = Device_Object_Functions_Find(data->object_type);
if (pObject != NULL) {
if (!pObject->Object_Delete) {
/* The device supports the object type
@@ -2403,7 +2403,7 @@ void Device_local_reporting(void)
for (idx = 1; idx <= objects_count; idx++) {
Device_Object_List_Identifier(idx, &object_type, &object_instance);
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(object_instance)) {
@@ -2426,7 +2426,7 @@ bool Device_Value_List_Supported(BACNET_OBJECT_TYPE object_type)
bool status = false; /* Ever the pessamist! */
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if (pObject != NULL) {
if (pObject->Object_Value_List) {
status = true;
@@ -2436,6 +2436,15 @@ bool Device_Value_List_Supported(BACNET_OBJECT_TYPE object_type)
return (status);
}
/**
* @brief Get the Device object functions table
* @return the Device object function table
*/
struct object_functions *Device_Object_Functions(void)
{
return Object_Table;
}
/** Initialize the Device Object.
Initialize the group of object helper functions for any supported Object.
Initialize each of the Device Object child Object instances.
+6 -1
View File
@@ -197,6 +197,11 @@ extern "C" {
BACNET_STACK_EXPORT
void Device_Init(object_functions_t *object_table);
BACNET_STACK_EXPORT
struct object_functions *Device_Object_Functions(void);
BACNET_STACK_EXPORT
struct object_functions *
Device_Object_Functions_Find(BACNET_OBJECT_TYPE Object_Type);
BACNET_STACK_EXPORT
void Device_Timer(uint16_t milliseconds);
@@ -488,7 +493,7 @@ int Routed_Device_Service_Approval(
* situated in the Device Object, which "knows" how to reach its child Objects.
*
* Most of these calls have a common operation:
* -# Call Device_Objects_Find_Functions( for the desired Object_Type )
* -# Call Device_Object_Functions_Find( for the desired Object_Type )
* - Gets a pointer to the object_functions for this Type of Object.
* -# Call the Object's Object_Valid_Instance( for the desired object_instance
* ) to make sure there is such an instance.
+26 -17
View File
@@ -804,8 +804,8 @@ static object_functions_t My_Object_Table[] = {
* @return Pointer to the group of object helper functions that implement this
* type of Object.
*/
static struct object_functions *
Device_Objects_Find_Functions(BACNET_OBJECT_TYPE Object_Type)
struct object_functions *
Device_Object_Functions_Find(BACNET_OBJECT_TYPE Object_Type)
{
struct object_functions *pObject = NULL;
@@ -836,7 +836,7 @@ rr_info_function Device_Objects_RR_Info(BACNET_OBJECT_TYPE object_type)
{
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
return (pObject != NULL ? pObject->Object_RR_Info : NULL);
}
@@ -868,7 +868,7 @@ void Device_Objects_Property_List(
* to populate the pointers to the individual list counters.
*/
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if ((pObject != NULL) && (pObject->Object_RPM_List != NULL)) {
pObject->Object_RPM_List(
&pPropertyList->Required.pList, &pPropertyList->Optional.pList,
@@ -1618,7 +1618,7 @@ bool Device_Valid_Object_Name(
for (i = 1; 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);
pObject = Device_Object_Functions_Find((BACNET_OBJECT_TYPE)type);
if ((pObject != NULL) && (pObject->Object_Name != NULL) &&
(pObject->Object_Name(instance, &object_name2) &&
characterstring_same(object_name1, &object_name2))) {
@@ -1648,7 +1648,7 @@ bool Device_Valid_Object_Id(
bool status = false; /* return value */
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions((BACNET_OBJECT_TYPE)object_type);
pObject = Device_Object_Functions_Find((BACNET_OBJECT_TYPE)object_type);
if ((pObject != NULL) && (pObject->Object_Valid_Instance != NULL)) {
status = pObject->Object_Valid_Instance(object_instance);
}
@@ -1670,7 +1670,7 @@ bool Device_Object_Name_Copy(
struct object_functions *pObject = NULL;
bool found = false;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if ((pObject != NULL) && (pObject->Object_Name != NULL)) {
found = pObject->Object_Name(object_instance, object_name);
}
@@ -2064,7 +2064,7 @@ int Device_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
/* initialize the default return values */
rpdata->error_class = ERROR_CLASS_OBJECT;
rpdata->error_code = ERROR_CODE_UNKNOWN_OBJECT;
pObject = Device_Objects_Find_Functions(rpdata->object_type);
pObject = Device_Object_Functions_Find(rpdata->object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(rpdata->object_instance)) {
@@ -2419,7 +2419,7 @@ bool Device_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
/* initialize the default return values */
wp_data->error_class = ERROR_CLASS_OBJECT;
wp_data->error_code = ERROR_CODE_UNKNOWN_OBJECT;
pObject = Device_Objects_Find_Functions(wp_data->object_type);
pObject = Device_Object_Functions_Find(wp_data->object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(wp_data->object_instance)) {
@@ -2477,7 +2477,7 @@ int Device_Add_List_Element(BACNET_LIST_ELEMENT_DATA *list_element)
int status = BACNET_STATUS_ERROR;
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(list_element->object_type);
pObject = Device_Object_Functions_Find(list_element->object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(list_element->object_instance)) {
@@ -2511,7 +2511,7 @@ int Device_Remove_List_Element(BACNET_LIST_ELEMENT_DATA *list_element)
int status = BACNET_STATUS_ERROR;
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(list_element->object_type);
pObject = Device_Object_Functions_Find(list_element->object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(list_element->object_instance)) {
@@ -2550,7 +2550,7 @@ bool Device_Encode_Value_List(
bool status = false; /* Ever the pessimist! */
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(object_instance)) {
@@ -2575,7 +2575,7 @@ bool Device_COV(BACNET_OBJECT_TYPE object_type, uint32_t object_instance)
bool status = false; /* Ever the pessamist! */
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(object_instance)) {
@@ -2597,7 +2597,7 @@ void Device_COV_Clear(BACNET_OBJECT_TYPE object_type, uint32_t object_instance)
{
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if (pObject != NULL) {
if (pObject->Object_Valid_Instance &&
pObject->Object_Valid_Instance(object_instance)) {
@@ -2620,7 +2620,7 @@ bool Device_Create_Object(BACNET_CREATE_OBJECT_DATA *data)
struct object_functions *pObject = NULL;
uint32_t object_instance;
pObject = Device_Objects_Find_Functions(data->object_type);
pObject = Device_Object_Functions_Find(data->object_type);
if (pObject != NULL) {
if (!pObject->Object_Create) {
/* The device supports the object type and may have
@@ -2679,7 +2679,7 @@ bool Device_Delete_Object(BACNET_DELETE_OBJECT_DATA *data)
bool status = false;
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(data->object_type);
pObject = Device_Object_Functions_Find(data->object_type);
if (pObject != NULL) {
if (!pObject->Object_Delete) {
/* The device supports the object type
@@ -2723,7 +2723,7 @@ bool Device_Value_List_Supported(BACNET_OBJECT_TYPE object_type)
bool status = false; /* Ever the pessamist! */
struct object_functions *pObject = NULL;
pObject = Device_Objects_Find_Functions(object_type);
pObject = Device_Object_Functions_Find(object_type);
if (pObject != NULL) {
if (pObject->Object_Value_List) {
status = true;
@@ -2733,6 +2733,15 @@ bool Device_Value_List_Supported(BACNET_OBJECT_TYPE object_type)
return (status);
}
/**
* @brief Get the Device object functions table
* @return the Device object function table
*/
struct object_functions *Device_Object_Functions(void)
{
return Object_Table;
}
/** Initialize the Device Object.
Initialize the group of object helper functions for any supported Object.
Initialize each of the Device Object child Object instances.