Corrected read-property handler example for encoding ack without an extra buffer.

This commit is contained in:
skarg
2008-01-07 21:40:33 +00:00
parent f8adfe1f41
commit 9f1dc8223f
2 changed files with 13 additions and 9 deletions
+9 -5
View File
@@ -133,19 +133,23 @@ int rp_ack_encode_apdu_init(
apdu[2] = SERVICE_CONFIRMED_READ_PROPERTY; /* service choice */
apdu_len = 3;
/* service ack follows */
apdu_len +=
encode_context_object_id(&apdu[apdu_len], 0,
len =
encode_context_object_id(&apdu[apdu_len], 0,
rpdata->object_type, rpdata->object_instance);
apdu_len +=
apdu_len += len;
len =
encode_context_enumerated(&apdu[apdu_len], 1,
rpdata->object_property);
apdu_len += len;
/* context 2 array index is optional */
if (rpdata->array_index != BACNET_ARRAY_ALL) {
apdu_len +=
len =
encode_context_unsigned(&apdu[apdu_len], 2,
rpdata->array_index);
apdu_len += len;
}
apdu_len += encode_opening_tag(&apdu[apdu_len], 3);
len = encode_opening_tag(&apdu[apdu_len], 3);
apdu_len += len;
}
return apdu_len;