cleaning up compiler errors.

This commit is contained in:
skarg
2005-12-10 19:01:33 +00:00
parent caf018f072
commit 31c0374df9
2 changed files with 37 additions and 28 deletions
+6 -11
View File
@@ -270,7 +270,6 @@ int rpm_ack_encode_apdu_object_property(
int32_t array_index) int32_t array_index)
{ {
int apdu_len = 0; /* total length of the apdu, return value */ int apdu_len = 0; /* total length of the apdu, return value */
unsigned len = 0;
if (apdu) if (apdu)
{ {
@@ -465,11 +464,6 @@ int rpm_ack_decode_object_property_value(
unsigned *application_data_len) unsigned *application_data_len)
{ {
unsigned len = 0; 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 */ /* check for valid pointers */
if (apdu && apdu_len && object_property && array_index) if (apdu && apdu_len && object_property && array_index)
@@ -669,8 +663,8 @@ void testReadPropertyMultipleAck(Test * pTest)
uint32_t object_instance = 0; uint32_t object_instance = 0;
BACNET_PROPERTY_ID object_property = PROP_OBJECT_IDENTIFIER; BACNET_PROPERTY_ID object_property = PROP_OBJECT_IDENTIFIER;
int32_t array_index = 0; int32_t array_index = 0;
uint8_t application_data[4][480] = {0}; uint8_t application_data[4][480] = {{0}};
int application_data_len[4] = 0; int application_data_len[4] = {0};
/* build the RPM - try to make it easy for the Application Layer development */ /* 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 /* IDEA: similar construction, but pass apdu, apdu_len pointer, size of apdu to
@@ -685,9 +679,10 @@ void testReadPropertyMultipleAck(Test * pTest)
OBJECT_DEVICE, 123); OBJECT_DEVICE, 123);
/* then copy values into it as APDU length will allow */ /* then copy values into it as APDU length will allow */
apdu_len += rpm_ack_encode_apdu_object_property(&apdu[apdu_len], apdu_len += rpm_ack_encode_apdu_object_property(&apdu[apdu_len],
PROP_OBJECT_IDENTIFIER, BACNET_ARRAY_ALL) PROP_OBJECT_IDENTIFIER, BACNET_ARRAY_ALL);
application_data_len[0] = encode_bacnet_object_id(&application_data[0][0], application_data_len[0] =
OBJECT_DEVICE, 123); encode_bacnet_object_id(
&application_data[0][0],OBJECT_DEVICE, 123);
apdu_len += rpm_ack_encode_apdu_object_property_value(&apdu[apdu_len], apdu_len += rpm_ack_encode_apdu_object_property_value(&apdu[apdu_len],
application_data[0],application_data_len[0]); application_data[0],application_data_len[0]);
+31 -17
View File
@@ -36,6 +36,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "bacdef.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@@ -46,35 +47,44 @@ extern "C" {
then add its properties, and then end the object. then add its properties, and then end the object.
Continue to add objects and properties as needed Continue to add objects and properties as needed
until the APDU is full.*/ until the APDU is full.*/
/* RPM */
int rpm_encode_apdu_init( int rpm_encode_apdu_init(
uint8_t *apdu, uint8_t *apdu,
uint8_t invoke_id); uint8_t invoke_id);
int rpm_encode_apdu_object_begin( int rpm_encode_apdu_object_begin(
uint8_t *apdu, uint8_t *apdu,
BACNET_OBJECT_TYPE object_type, BACNET_OBJECT_TYPE object_type,
uint32_t object_instance); uint32_t object_instance);
int rpm_encode_apdu_object_property( int rpm_encode_apdu_object_property(
uint8_t *apdu, uint8_t *apdu,
BACNET_PROPERTY_ID object_property, BACNET_PROPERTY_ID object_property,
int32_t array_index); int32_t array_index);
int rpm_encode_apdu_object_end( int rpm_encode_apdu_object_end(
uint8_t *apdu); uint8_t *apdu);
int rpm_decode_apdu( int rpm_decode_apdu(
uint8_t *apdu, uint8_t *apdu,
unsigned apdu_len, unsigned apdu_len,
uint8_t *invoke_id, uint8_t *invoke_id,
uint8_t **service_request, uint8_t **service_request,
unsigned *service_request_len); unsigned *service_request_len);
/* decode the object portion of the service request only */ /* decode the object portion of the service request only */
int rpm_decode_object_id( int rpm_decode_object_id(
uint8_t *apdu, uint8_t *apdu,
unsigned apdu_len, unsigned apdu_len,
BACNET_OBJECT_TYPE *object_type, BACNET_OBJECT_TYPE *object_type,
uint32_t *object_instance); uint32_t *object_instance);
/* is this the end of this object property list? */ /* is this the end of this object property list? */
int rpm_decode_object_end( int rpm_decode_object_end(
uint8_t *apdu, uint8_t *apdu,
unsigned apdu_len); unsigned apdu_len);
/* decode the object property portion of the service request only */ /* decode the object property portion of the service request only */
int rpm_decode_object_property( int rpm_decode_object_property(
uint8_t *apdu, uint8_t *apdu,
@@ -82,36 +92,25 @@ int rpm_decode_object_property(
BACNET_PROPERTY_ID *object_property, BACNET_PROPERTY_ID *object_property,
int32_t *array_index); int32_t *array_index);
/* RPM Ack */
int rpm_ack_encode_apdu_object_begin( int rpm_ack_encode_apdu_object_begin(
uint8_t *apdu, uint8_t *apdu,
BACNET_OBJECT_TYPE object_type, BACNET_OBJECT_TYPE object_type,
uint32_t object_instance); uint32_t object_instance);
int rpm_ack_encode_apdu_object_property_value( int rpm_ack_encode_apdu_object_property_value(
uint8_t *apdu, uint8_t *apdu,
BACNET_PROPERTY_ID object_property,
int32_t array_index,
uint8_t *application_data, uint8_t *application_data,
unsigned application_data_len); unsigned application_data_len);
int rpm_ack_encode_apdu_object_property_error( int rpm_ack_encode_apdu_object_property_error(
uint8_t *apdu, uint8_t *apdu,
BACNET_PROPERTY_ID object_property,
int32_t array_index,
BACNET_ERROR_CLASS error_class, BACNET_ERROR_CLASS error_class,
BACNET_ERROR_CODE error_code); BACNET_ERROR_CODE error_code);
int rpm_ack_encode_apdu_object_end( int rpm_ack_encode_apdu_object_end(
uint8_t *apdu); 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( int rpm_ack_decode_object_id(
uint8_t *apdu, uint8_t *apdu,
unsigned apdu_len, unsigned apdu_len,
@@ -121,14 +120,29 @@ int rpm_ack_decode_object_id(
int rpm_ack_decode_object_end( int rpm_ack_decode_object_end(
uint8_t *apdu, uint8_t *apdu,
unsigned apdu_len); 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 */ /* decode the object property value portion of the service request only */
int rpm_ack_decode_object_property_value( int rpm_ack_decode_object_property_value(
uint8_t *apdu, uint8_t *apdu,
unsigned apdu_len, unsigned apdu_len,
BACNET_PROPERTY_ID *object_property,
int32_t *array_index,
uint8_t **application_data, uint8_t **application_data,
unsigned *application_data_len); 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 #ifdef TEST
#include "ctest.h" #include "ctest.h"