Changed API: encode_tagged is now encode_application since we are encoding an application tag.
This commit is contained in:
@@ -624,42 +624,42 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
|
||||
|
||||
switch (property) {
|
||||
case PROP_OBJECT_IDENTIFIER:
|
||||
apdu_len = encode_tagged_object_id(&apdu[0], OBJECT_DEVICE,
|
||||
apdu_len = encode_application_object_id(&apdu[0], OBJECT_DEVICE,
|
||||
Object_Instance_Number);
|
||||
break;
|
||||
case PROP_OBJECT_NAME:
|
||||
characterstring_init_ansi(&char_string, Object_Name);
|
||||
apdu_len = encode_tagged_character_string(&apdu[0], &char_string);
|
||||
apdu_len = encode_application_character_string(&apdu[0], &char_string);
|
||||
break;
|
||||
case PROP_OBJECT_TYPE:
|
||||
apdu_len = encode_tagged_enumerated(&apdu[0], OBJECT_DEVICE);
|
||||
apdu_len = encode_application_enumerated(&apdu[0], OBJECT_DEVICE);
|
||||
break;
|
||||
case PROP_DESCRIPTION:
|
||||
characterstring_init_ansi(&char_string, Description);
|
||||
apdu_len = encode_tagged_character_string(&apdu[0], &char_string);
|
||||
apdu_len = encode_application_character_string(&apdu[0], &char_string);
|
||||
break;
|
||||
case PROP_SYSTEM_STATUS:
|
||||
apdu_len = encode_tagged_enumerated(&apdu[0], System_Status);
|
||||
apdu_len = encode_application_enumerated(&apdu[0], System_Status);
|
||||
break;
|
||||
case PROP_VENDOR_NAME:
|
||||
characterstring_init_ansi(&char_string, Vendor_Name);
|
||||
apdu_len = encode_tagged_character_string(&apdu[0], &char_string);
|
||||
apdu_len = encode_application_character_string(&apdu[0], &char_string);
|
||||
break;
|
||||
case PROP_VENDOR_IDENTIFIER:
|
||||
apdu_len = encode_tagged_unsigned(&apdu[0], Vendor_Identifier);
|
||||
apdu_len = encode_application_unsigned(&apdu[0], Vendor_Identifier);
|
||||
break;
|
||||
case PROP_MODEL_NAME:
|
||||
characterstring_init_ansi(&char_string, Model_Name);
|
||||
apdu_len = encode_tagged_character_string(&apdu[0], &char_string);
|
||||
apdu_len = encode_application_character_string(&apdu[0], &char_string);
|
||||
break;
|
||||
case PROP_FIRMWARE_REVISION:
|
||||
characterstring_init_ansi(&char_string, BACnet_Version);
|
||||
apdu_len = encode_tagged_character_string(&apdu[0], &char_string);
|
||||
apdu_len = encode_application_character_string(&apdu[0], &char_string);
|
||||
break;
|
||||
case PROP_APPLICATION_SOFTWARE_VERSION:
|
||||
characterstring_init_ansi(&char_string,
|
||||
Application_Software_Version);
|
||||
apdu_len = encode_tagged_character_string(&apdu[0], &char_string);
|
||||
apdu_len = encode_application_character_string(&apdu[0], &char_string);
|
||||
break;
|
||||
/* FIXME: if you support time */
|
||||
case PROP_LOCAL_TIME:
|
||||
@@ -668,12 +668,12 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
|
||||
Local_Time.min = 0;
|
||||
Local_Time.sec = 3;
|
||||
Local_Time.hundredths = 1;
|
||||
apdu_len = encode_tagged_time(&apdu[0], &Local_Time);
|
||||
apdu_len = encode_application_time(&apdu[0], &Local_Time);
|
||||
break;
|
||||
/* FIXME: if you support time */
|
||||
case PROP_UTC_OFFSET:
|
||||
/* NOTE: if your UTC offset is -5, then BACnet UTC offset is 5 */
|
||||
apdu_len = encode_tagged_signed(&apdu[0], UTC_Offset);
|
||||
apdu_len = encode_application_signed(&apdu[0], UTC_Offset);
|
||||
break;
|
||||
/* FIXME: if you support date */
|
||||
case PROP_LOCAL_DATE:
|
||||
@@ -682,23 +682,23 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
|
||||
Local_Date.month = 4; /* 1=Jan */
|
||||
Local_Date.day = 1; /* 1..31 */
|
||||
Local_Date.wday = 6; /* 1=Monday */
|
||||
apdu_len = encode_tagged_date(&apdu[0], &Local_Date);
|
||||
apdu_len = encode_application_date(&apdu[0], &Local_Date);
|
||||
break;
|
||||
case PROP_DAYLIGHT_SAVINGS_STATUS:
|
||||
apdu_len =
|
||||
encode_tagged_boolean(&apdu[0], Daylight_Savings_Status);
|
||||
encode_application_boolean(&apdu[0], Daylight_Savings_Status);
|
||||
break;
|
||||
case PROP_PROTOCOL_VERSION:
|
||||
apdu_len =
|
||||
encode_tagged_unsigned(&apdu[0], Device_Protocol_Version());
|
||||
encode_application_unsigned(&apdu[0], Device_Protocol_Version());
|
||||
break;
|
||||
case PROP_PROTOCOL_REVISION:
|
||||
apdu_len =
|
||||
encode_tagged_unsigned(&apdu[0], Device_Protocol_Revision());
|
||||
encode_application_unsigned(&apdu[0], Device_Protocol_Revision());
|
||||
break;
|
||||
/* BACnet Legacy Support */
|
||||
case PROP_PROTOCOL_CONFORMANCE_CLASS:
|
||||
apdu_len = encode_tagged_unsigned(&apdu[0], 1);
|
||||
apdu_len = encode_application_unsigned(&apdu[0], 1);
|
||||
break;
|
||||
case PROP_PROTOCOL_SERVICES_SUPPORTED:
|
||||
/* Note: list of services that are executed, not initiated. */
|
||||
@@ -708,7 +708,7 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
|
||||
bitstring_set_bit(&bit_string, (uint8_t) i,
|
||||
apdu_service_supported((BACNET_SERVICES_SUPPORTED)i));
|
||||
}
|
||||
apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string);
|
||||
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
|
||||
break;
|
||||
case PROP_PROTOCOL_OBJECT_TYPES_SUPPORTED:
|
||||
/* Note: this is the list of objects that can be in this device,
|
||||
@@ -743,13 +743,13 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
|
||||
if (bacfile_count())
|
||||
bitstring_set_bit(&bit_string, OBJECT_FILE, true);
|
||||
#endif
|
||||
apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string);
|
||||
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
|
||||
break;
|
||||
case PROP_OBJECT_LIST:
|
||||
count = Device_Object_List_Count();
|
||||
/* Array element zero is the number of objects in the list */
|
||||
if (array_index == 0)
|
||||
apdu_len = encode_tagged_unsigned(&apdu[0], count);
|
||||
apdu_len = encode_application_unsigned(&apdu[0], count);
|
||||
/* if no index was specified, then try to encode the entire list */
|
||||
/* into one packet. Note that more than likely you will have */
|
||||
/* to return an error if the number of encoded objects exceeds */
|
||||
@@ -759,7 +759,7 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
|
||||
if (Device_Object_List_Identifier(i, &object_type,
|
||||
&instance)) {
|
||||
len =
|
||||
encode_tagged_object_id(&apdu[apdu_len],
|
||||
encode_application_object_id(&apdu[apdu_len],
|
||||
object_type, instance);
|
||||
apdu_len += len;
|
||||
/* assume next one is the same size as this one */
|
||||
@@ -781,7 +781,7 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
|
||||
if (Device_Object_List_Identifier(array_index, &object_type,
|
||||
&instance))
|
||||
apdu_len =
|
||||
encode_tagged_object_id(&apdu[0], object_type,
|
||||
encode_application_object_id(&apdu[0], object_type,
|
||||
instance);
|
||||
else {
|
||||
*error_class = ERROR_CLASS_PROPERTY;
|
||||
@@ -791,33 +791,33 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
|
||||
}
|
||||
break;
|
||||
case PROP_MAX_APDU_LENGTH_ACCEPTED:
|
||||
apdu_len = encode_tagged_unsigned(&apdu[0],
|
||||
apdu_len = encode_application_unsigned(&apdu[0],
|
||||
Device_Max_APDU_Length_Accepted());
|
||||
break;
|
||||
case PROP_SEGMENTATION_SUPPORTED:
|
||||
apdu_len = encode_tagged_enumerated(&apdu[0],
|
||||
apdu_len = encode_application_enumerated(&apdu[0],
|
||||
Device_Segmentation_Supported());
|
||||
break;
|
||||
case PROP_APDU_TIMEOUT:
|
||||
apdu_len = encode_tagged_unsigned(&apdu[0], APDU_Timeout);
|
||||
apdu_len = encode_application_unsigned(&apdu[0], APDU_Timeout);
|
||||
break;
|
||||
case PROP_NUMBER_OF_APDU_RETRIES:
|
||||
apdu_len =
|
||||
encode_tagged_unsigned(&apdu[0], Number_Of_APDU_Retries);
|
||||
encode_application_unsigned(&apdu[0], Number_Of_APDU_Retries);
|
||||
break;
|
||||
case PROP_DEVICE_ADDRESS_BINDING:
|
||||
/* FIXME: encode the list here, if it exists */
|
||||
break;
|
||||
case PROP_DATABASE_REVISION:
|
||||
apdu_len = encode_tagged_unsigned(&apdu[0], Database_Revision);
|
||||
apdu_len = encode_application_unsigned(&apdu[0], Database_Revision);
|
||||
break;
|
||||
#if defined(BACDL_MSTP)
|
||||
case PROP_MAX_INFO_FRAMES:
|
||||
apdu_len =
|
||||
encode_tagged_unsigned(&apdu[0], dlmstp_max_info_frames());
|
||||
encode_application_unsigned(&apdu[0], dlmstp_max_info_frames());
|
||||
break;
|
||||
case PROP_MAX_MASTER:
|
||||
apdu_len = encode_tagged_unsigned(&apdu[0], dlmstp_max_master());
|
||||
apdu_len = encode_application_unsigned(&apdu[0], dlmstp_max_master());
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user