Changed BACnet enumerations API to use uint32_t rather than int.

This commit is contained in:
skarg
2009-01-25 22:56:47 +00:00
parent 9c8d94206a
commit 1f3bce1b56
13 changed files with 38 additions and 37 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ static int rpm_ack_decode_service_request(
BACNET_READ_ACCESS_DATA * read_access_data)
{
int decoded_len = 0; /* return value */
int error_value = 0; /* decoded error value */
uint32_t error_value = 0; /* decoded error value */
int len = 0; /* number of bytes returned from decoding */
uint8_t tag_number = 0; /* decoded tag number */
uint32_t len_value = 0; /* decoded length value */
+1 -1
View File
@@ -73,7 +73,7 @@ typedef struct BACnet_Application_Data_Value {
BACNET_BIT_STRING Bit_String;
#endif
#if defined (BACAPP_ENUMERATED)
int Enumerated;
uint32_t Enumerated;
#endif
#if defined (BACAPP_DATE)
BACNET_DATE Date;
+5 -5
View File
@@ -288,21 +288,21 @@ extern "C" {
int decode_enumerated(
uint8_t * apdu,
uint32_t len_value,
int *value);
uint32_t *value);
int decode_context_enumerated(
uint8_t * apdu,
uint8_t tag_value,
int *value);
uint32_t *value);
int encode_bacnet_enumerated(
uint8_t * apdu,
int value);
uint32_t value);
int encode_application_enumerated(
uint8_t * apdu,
int value);
uint32_t value);
int encode_context_enumerated(
uint8_t * apdu,
int tag_number,
int value);
uint32_t value);
/* from clause 20.2.13 Encoding of a Time Value */
/* and 20.2.1 General Rules for Encoding BACnet Tags */
+2 -2
View File
@@ -323,8 +323,8 @@ void apdu_handler(
uint16_t len = 0; /* counts where we are in PDU */
uint8_t tag_number = 0;
uint32_t len_value = 0;
int error_code = 0;
int error_class = 0;
uint32_t error_code = 0;
uint32_t error_class = 0;
uint8_t reason = 0;
bool server = false;
+9 -9
View File
@@ -1149,7 +1149,7 @@ int encode_application_unsigned(
int decode_enumerated(
uint8_t * apdu,
uint32_t len_value,
int *value)
uint32_t *value)
{
uint32_t unsigned_value = 0;
int len;
@@ -1165,7 +1165,7 @@ int decode_enumerated(
int decode_context_enumerated(
uint8_t * apdu,
uint8_t tag_value,
int *value)
uint32_t *value)
{
int len = 0;
uint8_t tag_number;
@@ -1186,7 +1186,7 @@ int decode_context_enumerated(
/* returns the number of apdu bytes consumed */
int encode_bacnet_enumerated(
uint8_t * apdu,
int value)
uint32_t value)
{
return encode_bacnet_unsigned(apdu, value);
}
@@ -1196,7 +1196,7 @@ int encode_bacnet_enumerated(
/* returns the number of apdu bytes consumed */
int encode_application_enumerated(
uint8_t * apdu,
int value)
uint32_t value)
{
int len = 0; /* return value */
@@ -1213,7 +1213,7 @@ int encode_application_enumerated(
int encode_context_enumerated(
uint8_t * apdu,
int tag_number,
int value)
uint32_t value)
{
int len = 0; /* return value */
@@ -1782,8 +1782,8 @@ void testBACDCodeEnumerated(
{
uint8_t array[5] = { 0 };
uint8_t encoded_array[5] = { 0 };
int value = 1;
int decoded_value = 0;
uint32_t value = 1;
uint32_t decoded_value = 0;
int i = 0, apdu_len = 0;
int len = 0;
uint8_t apdu[MAX_APDU] = { 0 };
@@ -2380,8 +2380,8 @@ void testEnumeratedContextDecodes(
int outLen2;
/* 32 bit number */
int32_t in = 0xdeadbeef;
int32_t out;
uint32_t in = 0xdeadbeef;
uint32_t out;
outLen2 = decode_context_enumerated(apdu, 9, &out);
+1 -1
View File
@@ -70,7 +70,7 @@ int bacerror_decode_error_class_and_code(
int len = 0;
uint8_t tag_number = 0;
uint32_t len_value_type = 0;
int decoded_value = 0;
uint32_t decoded_value = 0;
if (apdu_len) {
/* error class */
+2 -2
View File
@@ -175,7 +175,7 @@ int cov_notify_decode_service_request(
uint32_t len_value = 0;
uint32_t decoded_value = 0; /* for decoding */
uint16_t decoded_type = 0; /* for decoding */
int property = 0; /* for decoding */
uint32_t property = 0; /* for decoding */
BACNET_PROPERTY_VALUE *value = NULL; /* value in list */
if (apdu_len && data) {
@@ -520,7 +520,7 @@ int cov_subscribe_property_decode_service_request(
uint32_t len_value = 0;
uint32_t decoded_value = 0; /* for decoding */
uint16_t decoded_type = 0; /* for decoding */
int property = 0; /* for decoding */
uint32_t property = 0; /* for decoding */
if (apdu_len && data) {
/* tag 0 - subscriberProcessIdentifier */
+2 -3
View File
@@ -171,7 +171,6 @@ int dcc_decode_service_request(
unsigned len = 0;
uint8_t tag_number = 0;
uint32_t len_value_type = 0;
int value = 0;
uint32_t value32 = 0;
/* check for value pointers */
@@ -192,9 +191,9 @@ int dcc_decode_service_request(
len +=
decode_tag_number_and_value(&apdu[len], &tag_number,
&len_value_type);
len += decode_enumerated(&apdu[len], len_value_type, &value);
len += decode_enumerated(&apdu[len], len_value_type, &value32);
if (enable_disable)
*enable_disable = (BACNET_COMMUNICATION_ENABLE_DISABLE) value;
*enable_disable = (BACNET_COMMUNICATION_ENABLE_DISABLE) value32;
/* Tag 2: password --optional-- */
if (len < apdu_len) {
if (!decode_is_context_tag(&apdu[len], 2))
+3 -4
View File
@@ -85,7 +85,6 @@ int iam_decode_service_request(
uint8_t tag_number = 0;
uint32_t len_value = 0;
uint32_t decoded_value = 0;
int decoded_integer = 0;
/* OBJECT ID - object id */
len =
@@ -115,12 +114,12 @@ int iam_decode_service_request(
apdu_len += len;
if (tag_number != BACNET_APPLICATION_TAG_ENUMERATED)
return -1;
len = decode_enumerated(&apdu[apdu_len], len_value, &decoded_integer);
len = decode_enumerated(&apdu[apdu_len], len_value, &decoded_value);
apdu_len += len;
if (decoded_integer >= MAX_BACNET_SEGMENTATION)
if (decoded_value >= MAX_BACNET_SEGMENTATION)
return -1;
if (pSegmentation)
*pSegmentation = decoded_integer;
*pSegmentation = decoded_value;
/* Vendor ID - unsigned16 */
len =
decode_tag_number_and_value(&apdu[apdu_len], &tag_number, &len_value);
+1 -1
View File
@@ -77,7 +77,7 @@ int rd_decode_service_request(
unsigned len = 0;
uint8_t tag_number = 0;
uint32_t len_value_type = 0;
int value = 0;
uint32_t value = 0;
/* check for value pointers */
if (apdu_len) {
+8 -5
View File
@@ -82,7 +82,7 @@ int rp_decode_service_request(
uint8_t tag_number = 0;
uint32_t len_value_type = 0;
uint16_t type = 0; /* for decoding */
int property = 0; /* for decoding */
uint32_t property = 0; /* for decoding */
uint32_t array_value = 0; /* for decoding */
/* check for value pointers */
@@ -215,7 +215,7 @@ int rp_ack_decode_service_request(
int tag_len = 0; /* length of tag decode */
int len = 0; /* total length of decodes */
uint16_t object = 0; /* object type */
int property = 0; /* for decoding */
uint32_t property = 0; /* for decoding */
uint32_t array_value = 0; /* for decoding */
/* FIXME: check apdu_len against the len during decode */
@@ -247,9 +247,12 @@ int rp_ack_decode_service_request(
len++;
/* don't decode the application tag number or its data here */
rpdata->application_data = &apdu[len];
rpdata->application_data_len = apdu_len - len - 1 /*closing tag */ ;
} else
rpdata->application_data_len = apdu_len - len - 1 /*closing tag */;
/* len includes the data and the closing tag */
len = apdu_len;
} else {
return -1;
}
return len;
}
@@ -328,7 +331,7 @@ void testReadPropertyAck(
BACNET_READ_PROPERTY_DATA test_data;
BACNET_OBJECT_TYPE object_type = OBJECT_DEVICE;
uint32_t object_instance = 0;
int object = 0;
uint32_t object = 0;
rpdata.object_type = OBJECT_DEVICE;
rpdata.object_instance = 1;
+2 -2
View File
@@ -237,7 +237,7 @@ int rpm_decode_object_property(
unsigned option_len = 0;
uint8_t tag_number = 0;
uint32_t len_value_type = 0;
int property = 0; /* for decoding */
uint32_t property = 0; /* for decoding */
uint32_t array_value = 0; /* for decoding */
/* check for valid pointers */
@@ -430,7 +430,7 @@ int rpm_ack_decode_object_property(
unsigned tag_len = 0;
uint8_t tag_number = 0;
uint32_t len_value_type = 0;
int property = 0; /* for decoding */
uint32_t property = 0; /* for decoding */
uint32_t array_value = 0; /* for decoding */
/* check for valid pointers */
+1 -1
View File
@@ -100,7 +100,7 @@ int wp_decode_service_request(
uint8_t tag_number = 0;
uint32_t len_value_type = 0;
uint16_t type = 0; /* for decoding */
int property = 0; /* for decoding */
uint32_t property = 0; /* for decoding */
uint32_t unsigned_value = 0;
int i = 0; /* loop counter */