Changed device object functions list to terminate with normal unsigned value so that embedded compilers that convert enums to unsigned will work correctly.
This commit is contained in:
@@ -187,7 +187,7 @@ static struct object_functions {
|
|||||||
BACfile_Property_Lists},
|
BACfile_Property_Lists},
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{-1, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
|
{MAX_BACNET_OBJECT_TYPE, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Encodes the property APDU and returns the length,
|
/* Encodes the property APDU and returns the length,
|
||||||
@@ -204,7 +204,7 @@ int Device_Objects_Read_Property(
|
|||||||
rpdata->error_class = ERROR_CLASS_OBJECT;
|
rpdata->error_class = ERROR_CLASS_OBJECT;
|
||||||
rpdata->error_code = ERROR_CODE_UNKNOWN_OBJECT;
|
rpdata->error_code = ERROR_CODE_UNKNOWN_OBJECT;
|
||||||
pObject = &Object_Table[0];
|
pObject = &Object_Table[0];
|
||||||
while (pObject->Object_Type != -1) {
|
while (pObject->Object_Type < MAX_BACNET_OBJECT_TYPE) {
|
||||||
/* handle each object type */
|
/* handle each object type */
|
||||||
if (pObject->Object_Type == rpdata->object_type) {
|
if (pObject->Object_Type == rpdata->object_type) {
|
||||||
found = true;
|
found = true;
|
||||||
@@ -242,7 +242,7 @@ bool Device_Objects_Write_Property(
|
|||||||
wp_data->error_class = ERROR_CLASS_OBJECT;
|
wp_data->error_class = ERROR_CLASS_OBJECT;
|
||||||
wp_data->error_code = ERROR_CODE_UNKNOWN_OBJECT;
|
wp_data->error_code = ERROR_CODE_UNKNOWN_OBJECT;
|
||||||
pObject = &Object_Table[0];
|
pObject = &Object_Table[0];
|
||||||
while (pObject->Object_Type != -1) {
|
while (pObject->Object_Type < MAX_BACNET_OBJECT_TYPE) {
|
||||||
/* handle each object type */
|
/* handle each object type */
|
||||||
if (pObject->Object_Type == wp_data->object_type) {
|
if (pObject->Object_Type == wp_data->object_type) {
|
||||||
found = true;
|
found = true;
|
||||||
@@ -300,7 +300,7 @@ static void Device_Objects_Property_List(
|
|||||||
pPropertyList->Optional.pList = NULL;
|
pPropertyList->Optional.pList = NULL;
|
||||||
pPropertyList->Proprietary.pList = NULL;
|
pPropertyList->Proprietary.pList = NULL;
|
||||||
pObject = &Object_Table[0];
|
pObject = &Object_Table[0];
|
||||||
while (pObject->Object_Type != -1) {
|
while (pObject->Object_Type < MAX_BACNET_OBJECT_TYPE) {
|
||||||
/* handle each object type */
|
/* handle each object type */
|
||||||
if (pObject->Object_Type == object_type) {
|
if (pObject->Object_Type == object_type) {
|
||||||
found = true;
|
found = true;
|
||||||
@@ -766,7 +766,7 @@ unsigned Device_Object_List_Count(
|
|||||||
|
|
||||||
/* initialize the default return values */
|
/* initialize the default return values */
|
||||||
pObject = &Object_Table[0];
|
pObject = &Object_Table[0];
|
||||||
while (pObject->Object_Type != -1) {
|
while (pObject->Object_Type < MAX_BACNET_OBJECT_TYPE) {
|
||||||
if (pObject->Object_Count) {
|
if (pObject->Object_Count) {
|
||||||
count += pObject->Object_Count();
|
count += pObject->Object_Count();
|
||||||
}
|
}
|
||||||
@@ -795,7 +795,7 @@ bool Device_Object_List_Identifier(
|
|||||||
object_index = array_index - 1;
|
object_index = array_index - 1;
|
||||||
/* initialize the default return values */
|
/* initialize the default return values */
|
||||||
pObject = &Object_Table[0];
|
pObject = &Object_Table[0];
|
||||||
while (pObject->Object_Type != -1) {
|
while (pObject->Object_Type < MAX_BACNET_OBJECT_TYPE) {
|
||||||
if (pObject->Object_Count &&
|
if (pObject->Object_Count &&
|
||||||
pObject->Object_Index_To_Instance) {
|
pObject->Object_Index_To_Instance) {
|
||||||
object_index -= count;
|
object_index -= count;
|
||||||
@@ -857,7 +857,7 @@ char *Device_Valid_Object_Id(
|
|||||||
struct object_functions *pObject = NULL;
|
struct object_functions *pObject = NULL;
|
||||||
|
|
||||||
pObject = &Object_Table[0];
|
pObject = &Object_Table[0];
|
||||||
while (pObject->Object_Type != -1) {
|
while (pObject->Object_Type < MAX_BACNET_OBJECT_TYPE) {
|
||||||
if ((pObject->Object_Type == object_type) &&
|
if ((pObject->Object_Type == object_type) &&
|
||||||
(pObject->Object_Name)) {
|
(pObject->Object_Name)) {
|
||||||
name = pObject->Object_Name(object_instance);
|
name = pObject->Object_Name(object_instance);
|
||||||
@@ -1062,7 +1062,7 @@ int Device_Read_Property(
|
|||||||
/* set the object types with objects to supported */
|
/* set the object types with objects to supported */
|
||||||
i = 0;
|
i = 0;
|
||||||
pObject = &Object_Table[i];
|
pObject = &Object_Table[i];
|
||||||
while (pObject->Object_Type != -1) {
|
while (pObject->Object_Type < MAX_BACNET_OBJECT_TYPE) {
|
||||||
if ((pObject->Object_Count) &&
|
if ((pObject->Object_Count) &&
|
||||||
(pObject->Object_Count() > 0)) {
|
(pObject->Object_Count() > 0)) {
|
||||||
bitstring_set_bit(&bit_string, pObject->Object_Type, true);
|
bitstring_set_bit(&bit_string, pObject->Object_Type, true);
|
||||||
@@ -1356,7 +1356,7 @@ void Device_Init(
|
|||||||
handler_write_property_function_set(Device_Objects_Write_Property);
|
handler_write_property_function_set(Device_Objects_Write_Property);
|
||||||
|
|
||||||
pObject = &Object_Table[0];
|
pObject = &Object_Table[0];
|
||||||
while (pObject->Object_Type != -1) {
|
while (pObject->Object_Type < MAX_BACNET_OBJECT_TYPE) {
|
||||||
if (pObject->Object_Init) {
|
if (pObject->Object_Init) {
|
||||||
pObject->Object_Init();
|
pObject->Object_Init();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -898,14 +898,14 @@ typedef enum {
|
|||||||
OBJECT_ACCESS_USER = 35,
|
OBJECT_ACCESS_USER = 35,
|
||||||
OBJECT_ACCESS_ZONE = 36,
|
OBJECT_ACCESS_ZONE = 36,
|
||||||
OBJECT_AUTHENTICATION_FACTOR_INPUT = 37,
|
OBJECT_AUTHENTICATION_FACTOR_INPUT = 37,
|
||||||
MAX_ASHRAE_OBJECT_TYPE = 38
|
MAX_ASHRAE_OBJECT_TYPE = 38,
|
||||||
|
/* used for bit string loop */
|
||||||
|
PROPRIETARY_BACNET_OBJECT_TYPE = 128,
|
||||||
|
MAX_BACNET_OBJECT_TYPE = 1024
|
||||||
/* Enumerated values 0-127 are reserved for definition by ASHRAE. */
|
/* Enumerated values 0-127 are reserved for definition by ASHRAE. */
|
||||||
/* Enumerated values 128-1023 may be used by others subject to */
|
/* Enumerated values 128-1023 may be used by others subject to */
|
||||||
/* the procedures and constraints described in Clause 23. */
|
/* the procedures and constraints described in Clause 23. */
|
||||||
} BACNET_OBJECT_TYPE;
|
} BACNET_OBJECT_TYPE;
|
||||||
/* used for bit string loop */
|
|
||||||
#define PROPRIETARY_BACNET_OBJECT_TYPE 128
|
|
||||||
#define MAX_BACNET_OBJECT_TYPE 1023
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SEGMENTATION_BOTH = 0,
|
SEGMENTATION_BOTH = 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user