Fixed #15 bactext engineering units for new reserved range (#77)

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
Steve Karg
2020-04-23 14:42:38 -05:00
committed by GitHub
parent 62bfeba2c5
commit 1fe6b7e670
2 changed files with 25 additions and 8 deletions
+12 -6
View File
@@ -585,6 +585,7 @@ typedef enum {
} BACNET_DEVICE_STATUS;
typedef enum {
/* Enumerated values 0-255 are reserved for definition by ASHRAE. */
/* Acceleration */
UNITS_METERS_PER_SECOND_PER_SECOND = 166,
/* Area */
@@ -863,7 +864,13 @@ typedef enum {
UNITS_MOLE_PERCENT = 252,
UNITS_PASCAL_SECONDS = 253,
UNITS_MILLION_STANDARD_CUBIC_FEET_PER_MINUTE = 254,
/* 255 - NOT USED */
UNITS_RESERVED_RANGE_MAX = 255,
/* Enumerated values 256-47807 may be used by others
subject to the procedures and constraints described in Clause 23. */
UNITS_PROPRIETARY_RANGE_MIN = 256,
UNITS_PROPRIETARY_RANGE_MAX = 47807,
/* Enumerated values 47808-49999 are reserved for definition by ASHRAE. */
UNITS_RESERVED_RANGE_MIN2 = 47808,
UNITS_STANDARD_CUBIC_FEET_PER_DAY = 47808,
UNITS_MILLION_STANDARD_CUBIC_FEET_PER_DAY = 47809,
UNITS_THOUSAND_CUBIC_FEET_PER_DAY = 47810,
@@ -872,15 +879,14 @@ typedef enum {
/* 47813 - NOT USED */
UNITS_MILLIREMS = 47814,
UNITS_MILLIREMS_PER_HOUR = 47815,
/* Enumerated values 0-255 and 47808-49999 are reserved for
definition by ASHRAE. */
/* Enumerated values 256-47807 and 50000-65535 may be used by others
UNITS_RESERVED_RANGE_MAX2 = 49999,
UNITS_PROPRIETARY_RANGE_MIN2 = 50000,
/* Enumerated values 50000-65535 may be used by others
subject to the procedures and constraints described in Clause 23. */
/* do the proprietary range inside of enum so that
compilers will allocate adequate sized datatype for enum
which is used to store decoding */
UNITS_PROPRIETARY_RANGE_MIN = 256,
UNITS_PROPRIETARY_RANGE_MAX = 65535
UNITS_PROPRIETARY_RANGE_MAX2 = 65535
} BACNET_ENGINEERING_UNITS;
typedef enum {
+13 -2
View File
@@ -933,8 +933,19 @@ INDTEXT_DATA bacnet_engineering_unit_names[] = {
const char *bactext_engineering_unit_name(unsigned index)
{
return indtext_by_index_split_default(bacnet_engineering_unit_names, index,
256, ASHRAE_Reserved_String, Vendor_Proprietary_String);
if (index <= UNITS_RESERVED_RANGE_MAX) {
return indtext_by_index_default(bacnet_engineering_unit_names,
index, ASHRAE_Reserved_String);
} else if (index <= UNITS_PROPRIETARY_RANGE_MAX) {
return Vendor_Proprietary_String;
} else if (index <= UNITS_RESERVED_RANGE_MAX2) {
return indtext_by_index_default(bacnet_engineering_unit_names,
index, ASHRAE_Reserved_String);
} else if (index <= UNITS_PROPRIETARY_RANGE_MAX2) {
return Vendor_Proprietary_String;
}
return ASHRAE_Reserved_String;
}
bool bactext_engineering_unit_index(