Fixed BACnetGroupChannelValue encoding and decoding of BACnetChannelValue which was deemed errata by BACnet standard committee. (#980)

This commit is contained in:
Steve Karg
2025-05-05 21:49:19 -05:00
committed by GitHub
parent 0f3cbe3ec5
commit f2c00f9766
3 changed files with 33 additions and 5 deletions
+2
View File
@@ -28,6 +28,8 @@ The git repositories are hosted at the following sites:
### Fixed ### Fixed
* Fixed BACnetGroupChannelValue encoding and decoding of BACnetChannelValue
which was deemed errata by BACnet standard committee. (#980)
* Fixed some INTRINSIC_REPORTING #ifs in AV and BV basic objects. (#977) * Fixed some INTRINSIC_REPORTING #ifs in AV and BV basic objects. (#977)
### Removed ### Removed
+30 -4
View File
@@ -282,7 +282,7 @@ int bacnet_write_group_service_request_decode(
* change-list [2] SEQUENCE OF BACnetGroupChannelValue ::= SEQUENCE { * change-list [2] SEQUENCE OF BACnetGroupChannelValue ::= SEQUENCE {
* channel [0] Unsigned16, * channel [0] Unsigned16,
* overriding-priority [1] Unsigned (1..16) OPTIONAL, * overriding-priority [1] Unsigned (1..16) OPTIONAL,
* value BACnetChannelValue * value [2] BACnetChannelValue
* } * }
* inhibit-delay [3] BOOLEAN OPTIONAL * inhibit-delay [3] BOOLEAN OPTIONAL
* } * }
@@ -408,6 +408,9 @@ bool bacnet_write_group_same(
/** /**
* @brief Compare two BACnetGroupChannelValue value lists * @brief Compare two BACnetGroupChannelValue value lists
* @param head1 Pointer to the first value list to compare
* @param head2 Pointer to the second value list to compare
* @return true if the values are the same, else false
*/ */
bool bacnet_group_change_list_same( bool bacnet_group_change_list_same(
const BACNET_GROUP_CHANNEL_VALUE *head1, const BACNET_GROUP_CHANNEL_VALUE *head1,
@@ -464,7 +467,7 @@ bool bacnet_group_channel_value_same(
* BACnetGroupChannelValue ::= SEQUENCE { * BACnetGroupChannelValue ::= SEQUENCE {
* channel [0] Unsigned16, * channel [0] Unsigned16,
* overriding-priority [1] Unsigned (1..16) OPTIONAL, * overriding-priority [1] Unsigned (1..16) OPTIONAL,
* value BACnetChannelValue * value [2] BACnetChannelValue
* } * }
* *
* @param apdu Pointer to the buffer for encoded values * @param apdu Pointer to the buffer for encoded values
@@ -495,12 +498,23 @@ int bacnet_group_channel_value_encode(
apdu += len; apdu += len;
} }
} }
/* value BACnetChannelValue */ /* value [2] BACnetChannelValue */
len = encode_opening_tag(apdu, 2);
apdu_len += len;
if (apdu) {
apdu += len;
}
/* BACnetChannelValue */
len = bacnet_channel_value_type_encode(apdu, &value->value); len = bacnet_channel_value_type_encode(apdu, &value->value);
apdu_len += len; apdu_len += len;
if (apdu) { if (apdu) {
apdu += len; apdu += len;
} }
len = encode_closing_tag(apdu, 2);
apdu_len += len;
if (apdu) {
apdu += len;
}
/* is there another one to encode? */ /* is there another one to encode? */
value = value->next; value = value->next;
} }
@@ -514,7 +528,7 @@ int bacnet_group_channel_value_encode(
* BACnetGroupChannelValue ::= SEQUENCE { * BACnetGroupChannelValue ::= SEQUENCE {
* channel [0] Unsigned16, * channel [0] Unsigned16,
* overriding-priority [1] Unsigned (1..16) OPTIONAL, * overriding-priority [1] Unsigned (1..16) OPTIONAL,
* value BACnetChannelValue * value [2] BACnetChannelValue
* } * }
* *
* @param apdu Pointer to the buffer for encoded values * @param apdu Pointer to the buffer for encoded values
@@ -566,6 +580,12 @@ int bacnet_group_channel_value_decode(
} }
} }
/* value BACnetChannelValue */ /* value BACnetChannelValue */
if (bacnet_is_opening_tag_number(
&apdu[apdu_len], apdu_size - apdu_len, 2, &len)) {
apdu_len += len;
} else {
return BACNET_STATUS_ERROR;
}
len = bacnet_channel_value_decode( len = bacnet_channel_value_decode(
&apdu[apdu_len], apdu_size - apdu_len, &channel_value); &apdu[apdu_len], apdu_size - apdu_len, &channel_value);
if (len > 0) { if (len > 0) {
@@ -576,6 +596,12 @@ int bacnet_group_channel_value_decode(
} else { } else {
return BACNET_STATUS_ERROR; return BACNET_STATUS_ERROR;
} }
if (bacnet_is_closing_tag_number(
&apdu[apdu_len], apdu_size - apdu_len, 2, &len)) {
apdu_len += len;
} else {
return BACNET_STATUS_ERROR;
}
return apdu_len; return apdu_len;
} }
+1 -1
View File
@@ -21,7 +21,7 @@
* BACnetGroupChannelValue ::= SEQUENCE { * BACnetGroupChannelValue ::= SEQUENCE {
* channel [0] Unsigned16, * channel [0] Unsigned16,
* overriding-priority [1] Unsigned (1..16) OPTIONAL, * overriding-priority [1] Unsigned (1..16) OPTIONAL,
* value BACnetChannelValue * value [2] BACnetChannelValue
* } * }
*/ */
struct BACnet_Group_Channel_Value; struct BACnet_Group_Channel_Value;