diff --git a/bacnet-stack/rpm.c b/bacnet-stack/rpm.c index 99709c40..01e332c3 100644 --- a/bacnet-stack/rpm.c +++ b/bacnet-stack/rpm.c @@ -270,7 +270,6 @@ int rpm_ack_encode_apdu_object_property( int32_t array_index) { int apdu_len = 0; /* total length of the apdu, return value */ - unsigned len = 0; if (apdu) { @@ -465,11 +464,6 @@ int rpm_ack_decode_object_property_value( unsigned *application_data_len) { unsigned len = 0; - unsigned tag_len = 0; - uint8_t tag_number = 0; - uint32_t len_value_type = 0; - int property = 0; /* for decoding */ - unsigned array_value = 0; /* for decoding */ /* check for valid pointers */ if (apdu && apdu_len && object_property && array_index) @@ -669,8 +663,8 @@ void testReadPropertyMultipleAck(Test * pTest) uint32_t object_instance = 0; BACNET_PROPERTY_ID object_property = PROP_OBJECT_IDENTIFIER; int32_t array_index = 0; - uint8_t application_data[4][480] = {0}; - int application_data_len[4] = 0; + uint8_t application_data[4][480] = {{0}}; + int application_data_len[4] = {0}; /* build the RPM - try to make it easy for the Application Layer development */ /* IDEA: similar construction, but pass apdu, apdu_len pointer, size of apdu to @@ -685,9 +679,10 @@ void testReadPropertyMultipleAck(Test * pTest) OBJECT_DEVICE, 123); /* then copy values into it as APDU length will allow */ apdu_len += rpm_ack_encode_apdu_object_property(&apdu[apdu_len], - PROP_OBJECT_IDENTIFIER, BACNET_ARRAY_ALL) - application_data_len[0] = encode_bacnet_object_id(&application_data[0][0], - OBJECT_DEVICE, 123); + PROP_OBJECT_IDENTIFIER, BACNET_ARRAY_ALL); + application_data_len[0] = + encode_bacnet_object_id( + &application_data[0][0],OBJECT_DEVICE, 123); apdu_len += rpm_ack_encode_apdu_object_property_value(&apdu[apdu_len], application_data[0],application_data_len[0]); diff --git a/bacnet-stack/rpm.h b/bacnet-stack/rpm.h index 8aa71607..5649661f 100644 --- a/bacnet-stack/rpm.h +++ b/bacnet-stack/rpm.h @@ -36,6 +36,7 @@ #include #include +#include "bacdef.h" #ifdef __cplusplus extern "C" { @@ -46,35 +47,44 @@ extern "C" { then add its properties, and then end the object. Continue to add objects and properties as needed until the APDU is full.*/ + +/* RPM */ int rpm_encode_apdu_init( uint8_t *apdu, uint8_t invoke_id); + int rpm_encode_apdu_object_begin( uint8_t *apdu, BACNET_OBJECT_TYPE object_type, uint32_t object_instance); + int rpm_encode_apdu_object_property( uint8_t *apdu, BACNET_PROPERTY_ID object_property, int32_t array_index); + int rpm_encode_apdu_object_end( uint8_t *apdu); + int rpm_decode_apdu( uint8_t *apdu, unsigned apdu_len, uint8_t *invoke_id, uint8_t **service_request, unsigned *service_request_len); + /* decode the object portion of the service request only */ int rpm_decode_object_id( uint8_t *apdu, unsigned apdu_len, BACNET_OBJECT_TYPE *object_type, uint32_t *object_instance); + /* is this the end of this object property list? */ int rpm_decode_object_end( uint8_t *apdu, unsigned apdu_len); + /* decode the object property portion of the service request only */ int rpm_decode_object_property( uint8_t *apdu, @@ -82,36 +92,25 @@ int rpm_decode_object_property( BACNET_PROPERTY_ID *object_property, int32_t *array_index); +/* RPM Ack */ int rpm_ack_encode_apdu_object_begin( uint8_t *apdu, BACNET_OBJECT_TYPE object_type, uint32_t object_instance); + int rpm_ack_encode_apdu_object_property_value( uint8_t *apdu, - BACNET_PROPERTY_ID object_property, - int32_t array_index, uint8_t *application_data, unsigned application_data_len); + int rpm_ack_encode_apdu_object_property_error( uint8_t *apdu, - BACNET_PROPERTY_ID object_property, - int32_t array_index, BACNET_ERROR_CLASS error_class, BACNET_ERROR_CODE error_code); + int rpm_ack_encode_apdu_object_end( uint8_t *apdu); -int rpm_ack_decode_apdu( - uint8_t *apdu, - int apdu_len, /* total length of the apdu */ - uint8_t *invoke_id, - uint8_t **service_request, - unsigned *service_request_len); -/* FIXME: seems to me that we could use these decodes to make - calls repeatedly to a single function that returns - the ReadProperty data structure and amount of APDU used. */ - -/* decode the object portion of the service request only */ int rpm_ack_decode_object_id( uint8_t *apdu, unsigned apdu_len, @@ -121,14 +120,29 @@ int rpm_ack_decode_object_id( int rpm_ack_decode_object_end( uint8_t *apdu, unsigned apdu_len); +int rpm_ack_decode_object_property( + uint8_t *apdu, + unsigned apdu_len, + BACNET_PROPERTY_ID *object_property, + int32_t *array_index); +int rpm_ack_decode_is_object_property_value( + uint8_t *apdu, + unsigned apdu_len); +int rpm_ack_decode_is_object_property_error( + uint8_t *apdu, + unsigned apdu_len); /* decode the object property value portion of the service request only */ int rpm_ack_decode_object_property_value( uint8_t *apdu, unsigned apdu_len, - BACNET_PROPERTY_ID *object_property, - int32_t *array_index, uint8_t **application_data, unsigned *application_data_len); +int rpm_ack_decode_apdu( + uint8_t *apdu, + int apdu_len, /* total length of the apdu */ + uint8_t *invoke_id, + uint8_t **service_request, + unsigned *service_request_len); #ifdef TEST #include "ctest.h"