Bugfix/bactext enumeration updates 2024 (#1020)

* Extended some BACnet enumerations from 135-2024 protocol-revision 25-30.  

* Changed usage of _FIRST and _LAST to _MIN and _MAX in some enumerations to be consistent.

* Added object type and services supported BACnetBitString sizes for protocol revision 25-30

*Added new BACnetPropertyIdentifier, BACnetEngineeringUnits, BACnetEventState, BACnetRestartReason, BACnetLifeSafetyMode, BACnetLifeSafetyOperation, BACnetLifeSafetyState, BACnet_Services_Supported, BACnetLightingOperation, BACnetBinaryLightingPV, BACnetNetworkPortCommand, BACnetAuthenticationDecision, BACnetAuthorizationPosture, BACnetFaultType, BACnetPriorityFilter, BACnetResultFlags, and BACnetSuccessFilter enumerations.

* Added BACnet text for BACnetLifeSafetyMode, BACnetLifeSafetyOperation, BACnetRestartReason, BACnetNetworkType, BACnetNetworkNumberQuality, BACnetNetworkPortCommand, BACnetAuthenticationDecision, BACnetAuthorizationPosture, BACnetFaultType, BACnetPriorityFilter, BACnetSuccessFilter, and BACnetResultFlags.
This commit is contained in:
Steve Karg
2025-06-17 14:36:57 -05:00
committed by GitHub
parent c2c987f11a
commit b0a97c6f75
14 changed files with 720 additions and 109 deletions
+103 -3
View File
@@ -936,6 +936,88 @@ Lighting_Command_Stop(struct object_data *pObject, unsigned priority)
}
}
#if (BACNET_PROTOCOL_REVISION >= 28)
/**
* @brief Set the lighting command if the priority is active
* @param object [in] BACnet object instance
* @param priority [in] BACnet priority array value 1..16
*/
static void
Lighting_Command_Restore_On(struct object_data *pObject, unsigned priority)
{
unsigned current_priority;
if (!pObject) {
return;
}
current_priority = Present_Value_Priority(pObject);
if (priority <= current_priority) {
/* we have priority - configure the Lighting Command */
lighting_command_restore_on(&pObject->Lighting_Command);
}
}
/**
* @brief Set the lighting command if the priority is active
* @param object [in] BACnet object instance
* @param priority [in] BACnet priority array value 1..16
*/
static void
Lighting_Command_Restore_Off(struct object_data *pObject, unsigned priority)
{
unsigned current_priority;
if (!pObject) {
return;
}
current_priority = Present_Value_Priority(pObject);
if (priority <= current_priority) {
/* we have priority - configure the Lighting Command */
lighting_command_restore_off(&pObject->Lighting_Command);
}
}
/**
* @brief Set the lighting command if the priority is active
* @param object [in] BACnet object instance
* @param priority [in] BACnet priority array value 1..16
*/
static void
Lighting_Command_Toggle_Restore(struct object_data *pObject, unsigned priority)
{
unsigned current_priority;
if (!pObject) {
return;
}
current_priority = Present_Value_Priority(pObject);
if (priority <= current_priority) {
/* we have priority - configure the Lighting Command */
lighting_command_toggle_restore(&pObject->Lighting_Command);
}
}
/**
* @brief Set the lighting command if the priority is active
* @param object [in] BACnet object instance
* @param priority [in] BACnet priority array value 1..16
*/
static void
Lighting_Command_Toggle_Default(struct object_data *pObject, unsigned priority)
{
unsigned current_priority;
if (!pObject) {
return;
}
current_priority = Present_Value_Priority(pObject);
if (priority <= current_priority) {
/* we have priority - configure the Lighting Command */
lighting_command_toggle_default(&pObject->Lighting_Command);
}
}
#endif
/**
* For a given object instance-number, writes the present-value
*
@@ -975,7 +1057,7 @@ static bool Lighting_Output_Lighting_Command_Write(
*error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
return status;
}
if (value->operation >= MAX_BACNET_LIGHTING_OPERATION) {
if (value->operation >= BACNET_LIGHTS_RESERVED_MIN) {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
return status;
@@ -1043,6 +1125,24 @@ static bool Lighting_Output_Lighting_Command_Write(
Lighting_Command_Stop(pObject, priority);
status = true;
break;
#if (BACNET_PROTOCOL_REVISION >= 28)
case BACNET_LIGHTS_RESTORE_ON:
Lighting_Command_Restore_On(pObject, priority);
status = true;
break;
case BACNET_LIGHTS_RESTORE_OFF:
Lighting_Command_Restore_Off(pObject, priority);
status = true;
break;
case BACNET_LIGHTS_TOGGLE_RESTORE:
Lighting_Command_Toggle_Restore(pObject, priority);
status = true;
break;
case BACNET_LIGHTS_TOGGLE_DEFAULT:
Lighting_Command_Toggle_Default(pObject, priority);
status = true;
break;
#endif
default:
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
@@ -1908,7 +2008,7 @@ bool Lighting_Output_Transition_Set(
pObject = Keylist_Data(Object_List, object_instance);
if (pObject) {
if (value <= BACNET_LIGHTING_TRANSITION_PROPRIETARY_LAST) {
if (value <= BACNET_LIGHTING_TRANSITION_PROPRIETARY_MAX) {
pObject->Transition = value;
status = true;
}
@@ -1941,7 +2041,7 @@ static bool Lighting_Output_Transition_Write(
pObject = Keylist_Data(Object_List, object_instance);
if (pObject) {
(void)priority;
if (value < BACNET_LIGHTING_TRANSITION_PROPRIETARY_LAST) {
if (value < BACNET_LIGHTING_TRANSITION_PROPRIETARY_MAX) {
pObject->Transition = value;
status = true;
} else {
+2 -3
View File
@@ -535,8 +535,7 @@ int Life_Safety_Point_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
apdu_len = encode_application_enumerated(&apdu[0], mode);
break;
case PROP_ACCEPTED_MODES:
for (mode = MIN_LIFE_SAFETY_MODE; mode < MAX_LIFE_SAFETY_MODE;
mode++) {
for (mode = 0; mode <= LIFE_SAFETY_MODE_RESERVED_MIN; mode++) {
len = encode_application_enumerated(&apdu[apdu_len], mode);
apdu_len += len;
}
@@ -583,7 +582,7 @@ bool Life_Safety_Point_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
status = write_property_type_valid(
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
if (status) {
if (value.type.Enumerated <= MAX_LIFE_SAFETY_MODE) {
if (value.type.Enumerated <= LIFE_SAFETY_MODE_PROPRIETARY_MAX) {
Life_Safety_Point_Mode_Set(
wp_data->object_instance,
(BACNET_LIFE_SAFETY_MODE)value.type.Enumerated);
+2 -3
View File
@@ -705,8 +705,7 @@ int Life_Safety_Zone_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
apdu_len = encode_application_enumerated(&apdu[0], mode);
break;
case PROP_ACCEPTED_MODES:
for (mode = MIN_LIFE_SAFETY_MODE; mode < MAX_LIFE_SAFETY_MODE;
mode++) {
for (mode = 0; mode < LIFE_SAFETY_MODE_RESERVED_MIN; mode++) {
len = encode_application_enumerated(&apdu[apdu_len], mode);
apdu_len += len;
}
@@ -760,7 +759,7 @@ bool Life_Safety_Zone_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
status = write_property_type_valid(
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
if (status) {
if (value.type.Enumerated <= MAX_LIFE_SAFETY_MODE) {
if (value.type.Enumerated <= LIFE_SAFETY_MODE_PROPRIETARY_MAX) {
Life_Safety_Zone_Mode_Set(
wp_data->object_instance,
(BACNET_LIFE_SAFETY_MODE)value.type.Enumerated);