From dd5e94641dc18f5efaefff216a4ef88ffb0fc145 Mon Sep 17 00:00:00 2001 From: skarg Date: Thu, 31 Mar 2005 19:47:25 +0000 Subject: [PATCH] added a type conversion for object type --- bacnet-stack/bacdcode.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/bacnet-stack/bacdcode.c b/bacnet-stack/bacdcode.c index 20aaf1a8..fb05868c 100644 --- a/bacnet-stack/bacdcode.c +++ b/bacnet-stack/bacdcode.c @@ -564,7 +564,10 @@ int encode_tagged_real(uint8_t * apdu, float value) // from clause 20.2.14 Encoding of an Object Identifier Value // returns the number of apdu bytes consumed -int decode_object_id(uint8_t *apdu, int *object_type, uint32_t *instance) +int decode_object_id( + uint8_t *apdu, + int *object_type, + uint32_t *instance) { uint32_t value = 0; int len = 0; @@ -578,12 +581,17 @@ int decode_object_id(uint8_t *apdu, int *object_type, uint32_t *instance) // from clause 20.2.14 Encoding of an Object Identifier Value // returns the number of apdu bytes consumed -int encode_bacnet_object_id(uint8_t * apdu, int object_type, uint32_t instance) +int encode_bacnet_object_id( + uint8_t * apdu, + int object_type, + uint32_t instance) { uint32_t value = 0; + uint32_t type = 0; int len = 0; - value = ((object_type & 0x3FF) << 22) | (instance & 0x3FFFFF); + type = object_type; + value = ((type & 0x3FF) << 22) | (instance & 0x3FFFFF); len = encode_unsigned32(apdu,value); return len; @@ -592,8 +600,11 @@ int encode_bacnet_object_id(uint8_t * apdu, int object_type, uint32_t instance) // from clause 20.2.14 Encoding of an Object Identifier Value // and 20.2.1 General Rules for Encoding BACnet Tags // returns the number of apdu bytes consumed -int encode_context_object_id(uint8_t * apdu, int tag_number, - int object_type, uint32_t instance) +int encode_context_object_id( + uint8_t * apdu, + int tag_number, + int object_type, + uint32_t instance) { int len = 0; @@ -607,7 +618,10 @@ int encode_context_object_id(uint8_t * apdu, int tag_number, // from clause 20.2.14 Encoding of an Object Identifier Value // and 20.2.1 General Rules for Encoding BACnet Tags // returns the number of apdu bytes consumed -int encode_tagged_object_id(uint8_t * apdu, int object_type, uint32_t instance) +int encode_tagged_object_id( + uint8_t * apdu, + int object_type, + uint32_t instance) { int len = 0;