Added encoding function for context tagged character strings.
This commit is contained in:
+17
-1
@@ -1084,6 +1084,22 @@ int encode_tagged_character_string(uint8_t * apdu,
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int encode_context_character_string(uint8_t * apdu, int tag_number,
|
||||||
|
BACNET_CHARACTER_STRING *char_string)
|
||||||
|
{
|
||||||
|
int len = 0;
|
||||||
|
int string_len = 0;
|
||||||
|
|
||||||
|
string_len = characterstring_length(char_string) + 1 /* for encoding */;
|
||||||
|
len += encode_tag(&apdu[0], (uint8_t)tag_number, true, string_len);
|
||||||
|
if ((len + string_len) < MAX_APDU)
|
||||||
|
len += encode_bacnet_character_string(&apdu[len], char_string);
|
||||||
|
else
|
||||||
|
len = 0;
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
// from clause 20.2.9 Encoding of a Character String Value
|
// from clause 20.2.9 Encoding of a Character String Value
|
||||||
// and 20.2.1 General Rules for Encoding BACnet Tags
|
// and 20.2.1 General Rules for Encoding BACnet Tags
|
||||||
// returns the number of apdu bytes consumed
|
// returns the number of apdu bytes consumed
|
||||||
@@ -1861,7 +1877,7 @@ void testBACDCodeObject(Test * pTest)
|
|||||||
};
|
};
|
||||||
BACNET_OBJECT_TYPE type = OBJECT_BINARY_INPUT;
|
BACNET_OBJECT_TYPE type = OBJECT_BINARY_INPUT;
|
||||||
BACNET_OBJECT_TYPE decoded_type = OBJECT_ANALOG_OUTPUT;
|
BACNET_OBJECT_TYPE decoded_type = OBJECT_ANALOG_OUTPUT;
|
||||||
int instance = 123;
|
uint32_t instance = 123;
|
||||||
uint32_t decoded_instance = 0;
|
uint32_t decoded_instance = 0;
|
||||||
|
|
||||||
encode_bacnet_object_id(&encoded_array[0], type, instance);
|
encode_bacnet_object_id(&encoded_array[0], type, instance);
|
||||||
|
|||||||
@@ -115,6 +115,8 @@ int encode_bacnet_character_string(uint8_t * apdu,
|
|||||||
BACNET_CHARACTER_STRING *char_string);
|
BACNET_CHARACTER_STRING *char_string);
|
||||||
int encode_tagged_character_string(uint8_t * apdu,
|
int encode_tagged_character_string(uint8_t * apdu,
|
||||||
BACNET_CHARACTER_STRING *char_string);
|
BACNET_CHARACTER_STRING *char_string);
|
||||||
|
int encode_context_character_string(uint8_t * apdu, int tag_number,
|
||||||
|
BACNET_CHARACTER_STRING *char_string);
|
||||||
int decode_character_string(uint8_t * apdu, uint32_t len_value,
|
int decode_character_string(uint8_t * apdu, uint32_t len_value,
|
||||||
BACNET_CHARACTER_STRING *char_string);
|
BACNET_CHARACTER_STRING *char_string);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user