Changed API: encode_tagged is now encode_application since we are encoding an application tag.

This commit is contained in:
skarg
2007-10-13 12:26:16 +00:00
parent fe2c7cd00a
commit 3d6158443c
36 changed files with 466 additions and 464 deletions
+11 -11
View File
@@ -132,20 +132,20 @@ int Analog_Input_Encode_Property_APDU(uint8_t * apdu,
(void) array_index;
switch (property) {
case PROP_OBJECT_IDENTIFIER:
apdu_len = encode_tagged_object_id(&apdu[0], OBJECT_ANALOG_INPUT,
apdu_len = encode_application_object_id(&apdu[0], OBJECT_ANALOG_INPUT,
object_instance);
break;
case PROP_OBJECT_NAME:
case PROP_DESCRIPTION:
characterstring_init_ansi(&char_string,
Analog_Input_Name(object_instance));
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_ANALOG_INPUT);
apdu_len = encode_application_enumerated(&apdu[0], OBJECT_ANALOG_INPUT);
break;
case PROP_PRESENT_VALUE:
apdu_len = encode_tagged_real(&apdu[0], value);
apdu_len = encode_application_real(&apdu[0], value);
break;
case PROP_STATUS_FLAGS:
bitstring_init(&bit_string);
@@ -153,26 +153,26 @@ int Analog_Input_Encode_Property_APDU(uint8_t * apdu,
bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false);
apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string);
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break;
case PROP_EVENT_STATE:
apdu_len = encode_tagged_enumerated(&apdu[0], EVENT_STATE_NORMAL);
apdu_len = encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL);
break;
case PROP_OUT_OF_SERVICE:
apdu_len = encode_tagged_boolean(&apdu[0], false);
apdu_len = encode_application_boolean(&apdu[0], false);
break;
case PROP_UNITS:
apdu_len = encode_tagged_enumerated(&apdu[0], UNITS_PERCENT);
apdu_len = encode_application_enumerated(&apdu[0], UNITS_PERCENT);
break;
case 9997:
apdu_len = encode_tagged_real(&apdu[0], (float) 90.510);
apdu_len = encode_application_real(&apdu[0], (float) 90.510);
break;
case 9998:
apdu_len = encode_tagged_unsigned(&apdu[0], 90);
apdu_len = encode_application_unsigned(&apdu[0], 90);
break;
/* test case for signed encoding-decoding negative value correctly */
case 9999:
apdu_len = encode_tagged_signed(&apdu[0], -200);
apdu_len = encode_application_signed(&apdu[0], -200);
break;
default:
*error_class = ERROR_CLASS_PROPERTY;
+14 -14
View File
@@ -280,22 +280,22 @@ int Analog_Output_Encode_Property_APDU(uint8_t * apdu,
Analog_Output_Init();
switch (property) {
case PROP_OBJECT_IDENTIFIER:
apdu_len = encode_tagged_object_id(&apdu[0], OBJECT_ANALOG_OUTPUT,
apdu_len = encode_application_object_id(&apdu[0], OBJECT_ANALOG_OUTPUT,
object_instance);
break;
case PROP_OBJECT_NAME:
case PROP_DESCRIPTION:
characterstring_init_ansi(&char_string,
Analog_Output_Name(object_instance));
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_ANALOG_OUTPUT);
encode_application_enumerated(&apdu[0], OBJECT_ANALOG_OUTPUT);
break;
case PROP_PRESENT_VALUE:
real_value = Analog_Output_Present_Value(object_instance);
apdu_len = encode_tagged_real(&apdu[0], real_value);
apdu_len = encode_application_real(&apdu[0], real_value);
break;
case PROP_STATUS_FLAGS:
bitstring_init(&bit_string);
@@ -303,24 +303,24 @@ int Analog_Output_Encode_Property_APDU(uint8_t * apdu,
bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false);
apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string);
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break;
case PROP_EVENT_STATE:
apdu_len = encode_tagged_enumerated(&apdu[0], EVENT_STATE_NORMAL);
apdu_len = encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL);
break;
case PROP_OUT_OF_SERVICE:
object_index = Analog_Output_Instance_To_Index(object_instance);
state = Analog_Output_Out_Of_Service[object_index];
apdu_len = encode_tagged_boolean(&apdu[0], state);
apdu_len = encode_application_boolean(&apdu[0], state);
break;
case PROP_UNITS:
apdu_len = encode_tagged_enumerated(&apdu[0], UNITS_PERCENT);
apdu_len = encode_application_enumerated(&apdu[0], UNITS_PERCENT);
break;
case PROP_PRIORITY_ARRAY:
/* Array element zero is the number of elements in the array */
if (array_index == 0)
apdu_len =
encode_tagged_unsigned(&apdu[0], BACNET_MAX_PRIORITY);
encode_application_unsigned(&apdu[0], BACNET_MAX_PRIORITY);
/* if no index was specified, then try to encode the entire list */
/* into one packet. */
else if (array_index == BACNET_ARRAY_ALL) {
@@ -329,10 +329,10 @@ int Analog_Output_Encode_Property_APDU(uint8_t * apdu,
for (i = 0; i < BACNET_MAX_PRIORITY; i++) {
/* FIXME: check if we have room before adding it to APDU */
if (Analog_Output_Level[object_index][i] == AO_LEVEL_NULL)
len = encode_tagged_null(&apdu[apdu_len]);
len = encode_application_null(&apdu[apdu_len]);
else {
real_value = Analog_Output_Level[object_index][i];
len = encode_tagged_real(&apdu[apdu_len], real_value);
len = encode_application_real(&apdu[apdu_len], real_value);
}
/* add it if we have room */
if ((apdu_len + len) < MAX_APDU)
@@ -350,11 +350,11 @@ int Analog_Output_Encode_Property_APDU(uint8_t * apdu,
if (array_index <= BACNET_MAX_PRIORITY) {
if (Analog_Output_Level[object_index][array_index - 1] ==
AO_LEVEL_NULL)
apdu_len = encode_tagged_null(&apdu[0]);
apdu_len = encode_application_null(&apdu[0]);
else {
real_value =
Analog_Output_Level[object_index][array_index - 1];
apdu_len = encode_tagged_real(&apdu[0], real_value);
apdu_len = encode_application_real(&apdu[0], real_value);
}
} else {
*error_class = ERROR_CLASS_PROPERTY;
@@ -365,7 +365,7 @@ int Analog_Output_Encode_Property_APDU(uint8_t * apdu,
break;
case PROP_RELINQUISH_DEFAULT:
real_value = AO_RELINQUISH_DEFAULT;
apdu_len = encode_tagged_real(&apdu[0], real_value);
apdu_len = encode_application_real(&apdu[0], real_value);
break;
default:
*error_class = ERROR_CLASS_PROPERTY;
+14 -14
View File
@@ -210,21 +210,21 @@ int Analog_Value_Encode_Property_APDU(uint8_t * apdu,
Analog_Value_Init();
switch (property) {
case PROP_OBJECT_IDENTIFIER:
apdu_len = encode_tagged_object_id(&apdu[0], OBJECT_ANALOG_VALUE,
apdu_len = encode_application_object_id(&apdu[0], OBJECT_ANALOG_VALUE,
object_instance);
break;
case PROP_OBJECT_NAME:
case PROP_DESCRIPTION:
characterstring_init_ansi(&char_string,
Analog_Value_Name(object_instance));
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_ANALOG_VALUE);
apdu_len = encode_application_enumerated(&apdu[0], OBJECT_ANALOG_VALUE);
break;
case PROP_PRESENT_VALUE:
real_value = Analog_Value_Present_Value(object_instance);
apdu_len = encode_tagged_real(&apdu[0], real_value);
apdu_len = encode_application_real(&apdu[0], real_value);
break;
case PROP_STATUS_FLAGS:
bitstring_init(&bit_string);
@@ -232,24 +232,24 @@ int Analog_Value_Encode_Property_APDU(uint8_t * apdu,
bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false);
apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string);
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break;
case PROP_EVENT_STATE:
apdu_len = encode_tagged_enumerated(&apdu[0], EVENT_STATE_NORMAL);
apdu_len = encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL);
break;
case PROP_OUT_OF_SERVICE:
object_index = Analog_Value_Instance_To_Index(object_instance);
state = Analog_Value_Out_Of_Service[object_index];
apdu_len = encode_tagged_boolean(&apdu[0], state);
apdu_len = encode_application_boolean(&apdu[0], state);
break;
case PROP_UNITS:
apdu_len = encode_tagged_enumerated(&apdu[0], UNITS_PERCENT);
apdu_len = encode_application_enumerated(&apdu[0], UNITS_PERCENT);
break;
case PROP_PRIORITY_ARRAY:
/* Array element zero is the number of elements in the array */
if (array_index == 0)
apdu_len =
encode_tagged_unsigned(&apdu[0], BACNET_MAX_PRIORITY);
encode_application_unsigned(&apdu[0], BACNET_MAX_PRIORITY);
/* if no index was specified, then try to encode the entire list */
/* into one packet. */
else if (array_index == BACNET_ARRAY_ALL) {
@@ -258,10 +258,10 @@ int Analog_Value_Encode_Property_APDU(uint8_t * apdu,
/* FIXME: check if we have room before adding it to APDU */
if (Analog_Value_Level[object_index][i] ==
ANALOG_LEVEL_NULL)
len = encode_tagged_null(&apdu[apdu_len]);
len = encode_application_null(&apdu[apdu_len]);
else {
real_value = Analog_Value_Level[object_index][i];
len = encode_tagged_real(&apdu[apdu_len], real_value);
len = encode_application_real(&apdu[apdu_len], real_value);
}
/* add it if we have room */
if ((apdu_len + len) < MAX_APDU)
@@ -278,11 +278,11 @@ int Analog_Value_Encode_Property_APDU(uint8_t * apdu,
if (array_index <= BACNET_MAX_PRIORITY) {
if (Analog_Value_Level[object_index][array_index - 1] ==
ANALOG_LEVEL_NULL)
apdu_len = encode_tagged_null(&apdu[0]);
apdu_len = encode_application_null(&apdu[0]);
else {
real_value =
Analog_Value_Level[object_index][array_index - 1];
apdu_len = encode_tagged_real(&apdu[0], real_value);
apdu_len = encode_application_real(&apdu[0], real_value);
}
} else {
*error_class = ERROR_CLASS_PROPERTY;
@@ -294,7 +294,7 @@ int Analog_Value_Encode_Property_APDU(uint8_t * apdu,
break;
case PROP_RELINQUISH_DEFAULT:
real_value = ANALOG_RELINQUISH_DEFAULT;
apdu_len = encode_tagged_real(&apdu[0], real_value);
apdu_len = encode_application_real(&apdu[0], real_value);
break;
default:
*error_class = ERROR_CLASS_PROPERTY;
+11 -11
View File
@@ -193,28 +193,28 @@ int bacfile_encode_property_apdu(uint8_t * apdu,
(void) array_index;
switch (property) {
case PROP_OBJECT_IDENTIFIER:
apdu_len = encode_tagged_object_id(&apdu[0],
apdu_len = encode_application_object_id(&apdu[0],
OBJECT_FILE, object_instance);
break;
case PROP_OBJECT_NAME:
sprintf(text_string, "FILE %d", object_instance);
characterstring_init_ansi(&char_string, text_string);
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_FILE);
apdu_len = encode_application_enumerated(&apdu[0], OBJECT_FILE);
break;
case PROP_DESCRIPTION:
characterstring_init_ansi(&char_string,
bacfile_name(object_instance));
apdu_len = encode_tagged_character_string(&apdu[0], &char_string);
apdu_len = encode_application_character_string(&apdu[0], &char_string);
break;
case PROP_FILE_TYPE:
characterstring_init_ansi(&char_string, "TEXT");
apdu_len = encode_tagged_character_string(&apdu[0], &char_string);
apdu_len = encode_application_character_string(&apdu[0], &char_string);
break;
case PROP_FILE_SIZE:
apdu_len = encode_tagged_unsigned(&apdu[0],
apdu_len = encode_application_unsigned(&apdu[0],
bacfile_file_size(object_instance));
break;
case PROP_MODIFICATION_DATE:
@@ -223,13 +223,13 @@ int bacfile_encode_property_apdu(uint8_t * apdu,
bdate.month = 4; /* 1=Jan */
bdate.day = 1; /* 1..31 */
bdate.wday = 6; /* 1=Monday */
apdu_len = encode_tagged_date(&apdu[0], &bdate);
apdu_len = encode_application_date(&apdu[0], &bdate);
/* FIXME: get the actual value */
btime.hour = 7;
btime.min = 0;
btime.sec = 3;
btime.hundredths = 1;
apdu_len += encode_tagged_time(&apdu[apdu_len], &btime);
apdu_len += encode_application_time(&apdu[apdu_len], &btime);
break;
case PROP_ARCHIVE:
/* 12.13.8 Archive
@@ -240,14 +240,14 @@ int bacfile_encode_property_apdu(uint8_t * apdu,
Access Services since the last time the object was archived.
*/
/* FIXME: get the actual value: note it may be inverse... */
apdu_len = encode_tagged_boolean(&apdu[0], true);
apdu_len = encode_application_boolean(&apdu[0], true);
break;
case PROP_READ_ONLY:
/* FIXME: get the actual value */
apdu_len = encode_tagged_boolean(&apdu[0], true);
apdu_len = encode_application_boolean(&apdu[0], true);
break;
case PROP_FILE_ACCESS_METHOD:
apdu_len = encode_tagged_enumerated(&apdu[0], FILE_STREAM_ACCESS);
apdu_len = encode_application_enumerated(&apdu[0], FILE_STREAM_ACCESS);
break;
default:
*error_class = ERROR_CLASS_PROPERTY;
+8 -8
View File
@@ -179,7 +179,7 @@ int Binary_Input_Encode_Property_APDU(uint8_t * apdu,
Binary_Input_Init();
switch (property) {
case PROP_OBJECT_IDENTIFIER:
apdu_len = encode_tagged_object_id(&apdu[0], OBJECT_BINARY_INPUT,
apdu_len = encode_application_object_id(&apdu[0], OBJECT_BINARY_INPUT,
object_instance);
break;
case PROP_OBJECT_NAME:
@@ -187,15 +187,15 @@ int Binary_Input_Encode_Property_APDU(uint8_t * apdu,
/* note: object name must be unique in our device */
characterstring_init_ansi(&char_string,
Binary_Input_Name(object_instance));
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_BINARY_INPUT);
apdu_len = encode_application_enumerated(&apdu[0], OBJECT_BINARY_INPUT);
break;
case PROP_PRESENT_VALUE:
/* note: you need to look up the actual value */
apdu_len =
encode_tagged_enumerated(&apdu[0],
encode_application_enumerated(&apdu[0],
Binary_Input_Present_Value(object_instance));
break;
case PROP_STATUS_FLAGS:
@@ -205,17 +205,17 @@ int Binary_Input_Encode_Property_APDU(uint8_t * apdu,
bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false);
apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string);
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break;
case PROP_EVENT_STATE:
/* note: see the details in the standard on how to use this */
apdu_len = encode_tagged_enumerated(&apdu[0], EVENT_STATE_NORMAL);
apdu_len = encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL);
break;
case PROP_OUT_OF_SERVICE:
apdu_len = encode_tagged_boolean(&apdu[0], false);
apdu_len = encode_application_boolean(&apdu[0], false);
break;
case PROP_POLARITY:
apdu_len = encode_tagged_enumerated(&apdu[0], polarity);
apdu_len = encode_application_enumerated(&apdu[0], polarity);
break;
default:
*error_class = ERROR_CLASS_PROPERTY;
+14 -14
View File
@@ -201,7 +201,7 @@ int Binary_Output_Encode_Property_APDU(uint8_t * apdu,
Binary_Output_Init();
switch (property) {
case PROP_OBJECT_IDENTIFIER:
apdu_len = encode_tagged_object_id(&apdu[0], OBJECT_BINARY_OUTPUT,
apdu_len = encode_application_object_id(&apdu[0], OBJECT_BINARY_OUTPUT,
object_instance);
break;
/* note: Name and Description don't have to be the same.
@@ -210,15 +210,15 @@ int Binary_Output_Encode_Property_APDU(uint8_t * apdu,
case PROP_DESCRIPTION:
characterstring_init_ansi(&char_string,
Binary_Output_Name(object_instance));
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_BINARY_OUTPUT);
encode_application_enumerated(&apdu[0], OBJECT_BINARY_OUTPUT);
break;
case PROP_PRESENT_VALUE:
present_value = Binary_Output_Present_Value(object_instance);
apdu_len = encode_tagged_enumerated(&apdu[0], present_value);
apdu_len = encode_application_enumerated(&apdu[0], present_value);
break;
case PROP_STATUS_FLAGS:
/* note: see the details in the standard on how to use these */
@@ -227,25 +227,25 @@ int Binary_Output_Encode_Property_APDU(uint8_t * apdu,
bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false);
apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string);
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break;
case PROP_EVENT_STATE:
/* note: see the details in the standard on how to use this */
apdu_len = encode_tagged_enumerated(&apdu[0], EVENT_STATE_NORMAL);
apdu_len = encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL);
break;
case PROP_OUT_OF_SERVICE:
object_index = Binary_Output_Instance_To_Index(object_instance);
state = Binary_Output_Out_Of_Service[object_index];
apdu_len = encode_tagged_boolean(&apdu[0], state);
apdu_len = encode_application_boolean(&apdu[0], state);
break;
case PROP_POLARITY:
apdu_len = encode_tagged_enumerated(&apdu[0], polarity);
apdu_len = encode_application_enumerated(&apdu[0], polarity);
break;
case PROP_PRIORITY_ARRAY:
/* Array element zero is the number of elements in the array */
if (array_index == 0)
apdu_len =
encode_tagged_unsigned(&apdu[0], BACNET_MAX_PRIORITY);
encode_application_unsigned(&apdu[0], BACNET_MAX_PRIORITY);
/* if no index was specified, then try to encode the entire list */
/* into one packet. */
else if (array_index == BACNET_ARRAY_ALL) {
@@ -254,11 +254,11 @@ int Binary_Output_Encode_Property_APDU(uint8_t * apdu,
for (i = 0; i < BACNET_MAX_PRIORITY; i++) {
/* FIXME: check if we have room before adding it to APDU */
if (Binary_Output_Level[object_index][i] == BINARY_NULL)
len = encode_tagged_null(&apdu[apdu_len]);
len = encode_application_null(&apdu[apdu_len]);
else {
present_value = Binary_Output_Level[object_index][i];
len =
encode_tagged_enumerated(&apdu[apdu_len],
encode_application_enumerated(&apdu[apdu_len],
present_value);
}
/* add it if we have room */
@@ -277,12 +277,12 @@ int Binary_Output_Encode_Property_APDU(uint8_t * apdu,
if (array_index <= BACNET_MAX_PRIORITY) {
if (Binary_Output_Level[object_index][array_index] ==
BINARY_NULL)
len = encode_tagged_null(&apdu[apdu_len]);
len = encode_application_null(&apdu[apdu_len]);
else {
present_value =
Binary_Output_Level[object_index][array_index];
len =
encode_tagged_enumerated(&apdu[apdu_len],
encode_application_enumerated(&apdu[apdu_len],
present_value);
}
} else {
@@ -295,7 +295,7 @@ int Binary_Output_Encode_Property_APDU(uint8_t * apdu,
break;
case PROP_RELINQUISH_DEFAULT:
present_value = RELINQUISH_DEFAULT;
apdu_len = encode_tagged_enumerated(&apdu[0], present_value);
apdu_len = encode_application_enumerated(&apdu[0], present_value);
break;
default:
*error_class = ERROR_CLASS_PROPERTY;
+13 -13
View File
@@ -199,7 +199,7 @@ int Binary_Value_Encode_Property_APDU(uint8_t * apdu,
Binary_Value_Init();
switch (property) {
case PROP_OBJECT_IDENTIFIER:
apdu_len = encode_tagged_object_id(&apdu[0], OBJECT_BINARY_VALUE,
apdu_len = encode_application_object_id(&apdu[0], OBJECT_BINARY_VALUE,
object_instance);
break;
/* note: Name and Description don't have to be the same.
@@ -208,14 +208,14 @@ int Binary_Value_Encode_Property_APDU(uint8_t * apdu,
case PROP_DESCRIPTION:
characterstring_init_ansi(&char_string,
Binary_Value_Name(object_instance));
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_BINARY_VALUE);
apdu_len = encode_application_enumerated(&apdu[0], OBJECT_BINARY_VALUE);
break;
case PROP_PRESENT_VALUE:
present_value = Binary_Value_Present_Value(object_instance);
apdu_len = encode_tagged_enumerated(&apdu[0], present_value);
apdu_len = encode_application_enumerated(&apdu[0], present_value);
break;
case PROP_STATUS_FLAGS:
/* note: see the details in the standard on how to use these */
@@ -224,22 +224,22 @@ int Binary_Value_Encode_Property_APDU(uint8_t * apdu,
bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false);
apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string);
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break;
case PROP_EVENT_STATE:
/* note: see the details in the standard on how to use this */
apdu_len = encode_tagged_enumerated(&apdu[0], EVENT_STATE_NORMAL);
apdu_len = encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL);
break;
case PROP_OUT_OF_SERVICE:
object_index = Binary_Value_Instance_To_Index(object_instance);
state = Binary_Value_Out_Of_Service[object_index];
apdu_len = encode_tagged_boolean(&apdu[0], state);
apdu_len = encode_application_boolean(&apdu[0], state);
break;
case PROP_PRIORITY_ARRAY:
/* Array element zero is the number of elements in the array */
if (array_index == 0)
apdu_len =
encode_tagged_unsigned(&apdu[0], BACNET_MAX_PRIORITY);
encode_application_unsigned(&apdu[0], BACNET_MAX_PRIORITY);
/* if no index was specified, then try to encode the entire list */
/* into one packet. */
else if (array_index == BACNET_ARRAY_ALL) {
@@ -247,11 +247,11 @@ int Binary_Value_Encode_Property_APDU(uint8_t * apdu,
for (i = 0; i < BACNET_MAX_PRIORITY; i++) {
/* FIXME: check if we have room before adding it to APDU */
if (Binary_Value_Level[object_index][i] == BINARY_NULL)
len = encode_tagged_null(&apdu[apdu_len]);
len = encode_application_null(&apdu[apdu_len]);
else {
present_value = Binary_Value_Level[object_index][i];
len =
encode_tagged_enumerated(&apdu[apdu_len],
encode_application_enumerated(&apdu[apdu_len],
present_value);
}
/* add it if we have room */
@@ -269,12 +269,12 @@ int Binary_Value_Encode_Property_APDU(uint8_t * apdu,
if (array_index <= BACNET_MAX_PRIORITY) {
if (Binary_Value_Level[object_index][array_index] ==
BINARY_NULL)
len = encode_tagged_null(&apdu[apdu_len]);
len = encode_application_null(&apdu[apdu_len]);
else {
present_value =
Binary_Value_Level[object_index][array_index];
len =
encode_tagged_enumerated(&apdu[apdu_len],
encode_application_enumerated(&apdu[apdu_len],
present_value);
}
} else {
@@ -287,7 +287,7 @@ int Binary_Value_Encode_Property_APDU(uint8_t * apdu,
break;
case PROP_RELINQUISH_DEFAULT:
present_value = RELINQUISH_DEFAULT;
apdu_len = encode_tagged_enumerated(&apdu[0], present_value);
apdu_len = encode_application_enumerated(&apdu[0], present_value);
break;
default:
*error_class = ERROR_CLASS_PROPERTY;
+29 -29
View File
@@ -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:
+19 -19
View File
@@ -699,26 +699,26 @@ int Load_Control_Encode_Property_APDU(uint8_t * apdu,
object_index = Load_Control_Instance_To_Index(object_instance);
switch (property) {
case PROP_OBJECT_IDENTIFIER:
apdu_len = encode_tagged_object_id(&apdu[0], OBJECT_LOAD_CONTROL,
apdu_len = encode_application_object_id(&apdu[0], OBJECT_LOAD_CONTROL,
object_instance);
break;
case PROP_OBJECT_NAME:
characterstring_init_ansi(&char_string,
Load_Control_Name(object_instance));
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_LOAD_CONTROL);
apdu_len = encode_application_enumerated(&apdu[0], OBJECT_LOAD_CONTROL);
break;
/* optional property
case PROP_DESCRIPTION:
characterstring_init_ansi(&char_string,"optional description");
apdu_len = encode_tagged_character_string(&apdu[0], &char_string);
apdu_len = encode_application_character_string(&apdu[0], &char_string);
break;
*/
case PROP_PRESENT_VALUE:
enumeration = Load_Control_Present_Value(object_instance);
apdu_len = encode_tagged_enumerated(&apdu[0], enumeration);
apdu_len = encode_application_enumerated(&apdu[0], enumeration);
break;
case PROP_STATUS_FLAGS:
bitstring_init(&bit_string);
@@ -735,10 +735,10 @@ int Load_Control_Encode_Property_APDU(uint8_t * apdu,
bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false);
/* OUT_OF_SERVICE - This bit shall always be Logical FALSE (0). */
bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false);
apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string);
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break;
case PROP_EVENT_STATE:
apdu_len = encode_tagged_enumerated(&apdu[0], EVENT_STATE_NORMAL);
apdu_len = encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL);
break;
case PROP_REQUESTED_SHED_LEVEL:
switch (Requested_Shed_Level[object_index].type) {
@@ -758,26 +758,26 @@ int Load_Control_Encode_Property_APDU(uint8_t * apdu,
}
break;
case PROP_START_TIME:
len = encode_tagged_date(&apdu[0], &Start_Time[object_index].date);
len = encode_application_date(&apdu[0], &Start_Time[object_index].date);
apdu_len = len;
len = encode_tagged_time(&apdu[apdu_len],
len = encode_application_time(&apdu[apdu_len],
&Start_Time[object_index].time);
apdu_len += len;
break;
case PROP_SHED_DURATION:
apdu_len = encode_tagged_unsigned(&apdu[0],
apdu_len = encode_application_unsigned(&apdu[0],
Shed_Duration[object_index]);
break;
case PROP_DUTY_WINDOW:
apdu_len = encode_tagged_unsigned(&apdu[0],
apdu_len = encode_application_unsigned(&apdu[0],
Duty_Window[object_index]);
break;
case PROP_ENABLE:
state = Load_Control_Enable[object_index];
apdu_len = encode_tagged_boolean(&apdu[0], state);
apdu_len = encode_application_boolean(&apdu[0], state);
break;
case PROP_FULL_DUTY_BASELINE: /* optional */
apdu_len = encode_tagged_real(&apdu[0],
apdu_len = encode_application_real(&apdu[0],
Full_Duty_Baseline[object_index]);
break;
case PROP_EXPECTED_SHED_LEVEL:
@@ -817,7 +817,7 @@ int Load_Control_Encode_Property_APDU(uint8_t * apdu,
case PROP_SHED_LEVELS:
/* Array element zero is the number of elements in the array */
if (array_index == 0)
apdu_len = encode_tagged_unsigned(&apdu[0], MAX_SHED_LEVELS);
apdu_len = encode_application_unsigned(&apdu[0], MAX_SHED_LEVELS);
/* if no index was specified, then try to encode the entire list */
/* into one packet. */
else if (array_index == BACNET_ARRAY_ALL) {
@@ -825,7 +825,7 @@ int Load_Control_Encode_Property_APDU(uint8_t * apdu,
for (i = 0; i < MAX_SHED_LEVELS; i++) {
/* FIXME: check if we have room before adding it to APDU */
len =
encode_tagged_unsigned(&apdu[apdu_len],
encode_application_unsigned(&apdu[apdu_len],
Shed_Levels[object_index][i]);
/* add it if we have room */
if ((apdu_len + len) < MAX_APDU)
@@ -839,7 +839,7 @@ int Load_Control_Encode_Property_APDU(uint8_t * apdu,
}
} else {
if (array_index <= MAX_SHED_LEVELS) {
apdu_len = encode_tagged_unsigned(&apdu[0],
apdu_len = encode_application_unsigned(&apdu[0],
Shed_Levels[object_index][array_index - 1]);
} else {
*error_class = ERROR_CLASS_PROPERTY;
@@ -851,7 +851,7 @@ int Load_Control_Encode_Property_APDU(uint8_t * apdu,
case PROP_SHED_LEVEL_DESCRIPTIONS:
/* Array element zero is the number of elements in the array */
if (array_index == 0)
apdu_len = encode_tagged_unsigned(&apdu[0], MAX_SHED_LEVELS);
apdu_len = encode_application_unsigned(&apdu[0], MAX_SHED_LEVELS);
/* if no index was specified, then try to encode the entire list */
/* into one packet. */
else if (array_index == BACNET_ARRAY_ALL) {
@@ -860,7 +860,7 @@ int Load_Control_Encode_Property_APDU(uint8_t * apdu,
/* FIXME: check if we have room before adding it to APDU */
characterstring_init_ansi(&char_string,
Shed_Level_Descriptions[i]);
len = encode_tagged_character_string(&apdu[apdu_len],
len = encode_application_character_string(&apdu[apdu_len],
&char_string);
/* add it if we have room */
if ((apdu_len + len) < MAX_APDU)
@@ -876,7 +876,7 @@ int Load_Control_Encode_Property_APDU(uint8_t * apdu,
if (array_index <= MAX_SHED_LEVELS) {
characterstring_init_ansi(&char_string,
Shed_Level_Descriptions[array_index - 1]);
apdu_len = encode_tagged_character_string(&apdu[0],
apdu_len = encode_application_character_string(&apdu[0],
&char_string);
} else {
*error_class = ERROR_CLASS_PROPERTY;
+15 -15
View File
@@ -372,7 +372,7 @@ int Lighting_Output_Encode_Property_APDU(uint8_t * apdu,
Lighting_Output_Init();
switch (property) {
case PROP_OBJECT_IDENTIFIER:
apdu_len = encode_tagged_object_id(&apdu[0], OBJECT_LIGHTING_OUTPUT,
apdu_len = encode_application_object_id(&apdu[0], OBJECT_LIGHTING_OUTPUT,
object_instance);
break;
case PROP_OBJECT_NAME:
@@ -381,19 +381,19 @@ int Lighting_Output_Encode_Property_APDU(uint8_t * apdu,
/* FIXME: description could be writable and different than object name */
characterstring_init_ansi(&char_string,
Lighting_Output_Name(object_instance));
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_LIGHTING_OUTPUT);
encode_application_enumerated(&apdu[0], OBJECT_LIGHTING_OUTPUT);
break;
case PROP_PRESENT_VALUE:
real_value = Lighting_Output_Present_Value(object_instance);
apdu_len = encode_tagged_real(&apdu[0], real_value);
apdu_len = encode_application_real(&apdu[0], real_value);
break;
case PROP_PROGRESS_VALUE:
real_value = Lighting_Output_Progress_Value(object_instance);
apdu_len = encode_tagged_real(&apdu[0], real_value);
apdu_len = encode_application_real(&apdu[0], real_value);
break;
case PROP_LIGHTING_COMMAND:
apdu_len = Lighting_Output_Encode_Lighting_Command(&apdu[0],
@@ -405,24 +405,24 @@ int Lighting_Output_Encode_Property_APDU(uint8_t * apdu,
bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false);
apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string);
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break;
case PROP_EVENT_STATE:
apdu_len = encode_tagged_enumerated(&apdu[0], EVENT_STATE_NORMAL);
apdu_len = encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL);
break;
case PROP_OUT_OF_SERVICE:
object_index = Lighting_Output_Instance_To_Index(object_instance);
state = Lighting_Output_Out_Of_Service[object_index];
apdu_len = encode_tagged_boolean(&apdu[0], state);
apdu_len = encode_application_boolean(&apdu[0], state);
break;
case PROP_UNITS:
apdu_len = encode_tagged_enumerated(&apdu[0], UNITS_PERCENT);
apdu_len = encode_application_enumerated(&apdu[0], UNITS_PERCENT);
break;
case PROP_PRIORITY_ARRAY:
/* Array element zero is the number of elements in the array */
if (array_index == 0)
apdu_len =
encode_tagged_unsigned(&apdu[0], BACNET_MAX_PRIORITY);
encode_application_unsigned(&apdu[0], BACNET_MAX_PRIORITY);
/* if no index was specified, then try to encode the entire list */
/* into one packet. */
else if (array_index == BACNET_ARRAY_ALL) {
@@ -431,10 +431,10 @@ int Lighting_Output_Encode_Property_APDU(uint8_t * apdu,
for (i = 0; i < BACNET_MAX_PRIORITY; i++) {
/* FIXME: check if we have room before adding it to APDU */
if (Lighting_Output_Level[object_index][i] == LIGHTING_LEVEL_NULL)
len = encode_tagged_null(&apdu[apdu_len]);
len = encode_application_null(&apdu[apdu_len]);
else {
real_value = Lighting_Output_Level[object_index][i];
len = encode_tagged_real(&apdu[apdu_len], real_value);
len = encode_application_real(&apdu[apdu_len], real_value);
}
/* add it if we have room */
if ((apdu_len + len) < MAX_APDU)
@@ -452,11 +452,11 @@ int Lighting_Output_Encode_Property_APDU(uint8_t * apdu,
if (array_index <= BACNET_MAX_PRIORITY) {
if (Lighting_Output_Level[object_index][array_index - 1] ==
LIGHTING_LEVEL_NULL)
apdu_len = encode_tagged_null(&apdu[0]);
apdu_len = encode_application_null(&apdu[0]);
else {
real_value =
Lighting_Output_Level[object_index][array_index - 1];
apdu_len = encode_tagged_real(&apdu[0], real_value);
apdu_len = encode_application_real(&apdu[0], real_value);
}
} else {
*error_class = ERROR_CLASS_PROPERTY;
@@ -468,7 +468,7 @@ int Lighting_Output_Encode_Property_APDU(uint8_t * apdu,
break;
case PROP_RELINQUISH_DEFAULT:
real_value = LIGHTING_RELINQUISH_DEFAULT;
apdu_len = encode_tagged_real(&apdu[0], real_value);
apdu_len = encode_application_real(&apdu[0], real_value);
break;
default:
*error_class = ERROR_CLASS_PROPERTY;
+12 -12
View File
@@ -209,22 +209,22 @@ int Life_Safety_Point_Encode_Property_APDU(uint8_t * apdu,
switch (property) {
case PROP_OBJECT_IDENTIFIER:
apdu_len =
encode_tagged_object_id(&apdu[0], OBJECT_LIFE_SAFETY_POINT,
encode_application_object_id(&apdu[0], OBJECT_LIFE_SAFETY_POINT,
object_instance);
break;
case PROP_OBJECT_NAME:
case PROP_DESCRIPTION:
characterstring_init_ansi(&char_string,
Life_Safety_Point_Name(object_instance));
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_LIFE_SAFETY_POINT);
encode_application_enumerated(&apdu[0], OBJECT_LIFE_SAFETY_POINT);
break;
case PROP_PRESENT_VALUE:
present_value = Life_Safety_Point_Present_Value(object_instance);
apdu_len = encode_tagged_enumerated(&apdu[0], present_value);
apdu_len = encode_application_enumerated(&apdu[0], present_value);
break;
case PROP_STATUS_FLAGS:
bitstring_init(&bit_string);
@@ -232,32 +232,32 @@ int Life_Safety_Point_Encode_Property_APDU(uint8_t * apdu,
bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false);
apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string);
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break;
case PROP_EVENT_STATE:
apdu_len = encode_tagged_enumerated(&apdu[0], EVENT_STATE_NORMAL);
apdu_len = encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL);
break;
case PROP_OUT_OF_SERVICE:
object_index =
Life_Safety_Point_Instance_To_Index(object_instance);
state = Life_Safety_Point_Out_Of_Service[object_index];
apdu_len = encode_tagged_boolean(&apdu[0], state);
apdu_len = encode_application_boolean(&apdu[0], state);
break;
case PROP_RELIABILITY:
/* see standard for details about this property */
reliability = RELIABILITY_NO_FAULT_DETECTED;
apdu_len = encode_tagged_enumerated(&apdu[0], reliability);
apdu_len = encode_application_enumerated(&apdu[0], reliability);
break;
case PROP_MODE:
object_index =
Life_Safety_Point_Instance_To_Index(object_instance);
mode = Life_Safety_Point_Mode[object_index];
apdu_len = encode_tagged_enumerated(&apdu[0], mode);
apdu_len = encode_application_enumerated(&apdu[0], mode);
break;
case PROP_ACCEPTED_MODES:
for (mode = MIN_LIFE_SAFETY_MODE; mode < MAX_LIFE_SAFETY_MODE;
mode++) {
len = encode_tagged_enumerated(&apdu[apdu_len], mode);
len = encode_application_enumerated(&apdu[apdu_len], mode);
apdu_len += len;
}
break;
@@ -265,13 +265,13 @@ int Life_Safety_Point_Encode_Property_APDU(uint8_t * apdu,
object_index =
Life_Safety_Point_Instance_To_Index(object_instance);
silenced_state = Life_Safety_Point_Silenced_State[object_index];
apdu_len = encode_tagged_enumerated(&apdu[0], silenced_state);
apdu_len = encode_application_enumerated(&apdu[0], silenced_state);
break;
case PROP_OPERATION_EXPECTED:
object_index =
Life_Safety_Point_Instance_To_Index(object_instance);
operation = Life_Safety_Point_Operation[object_index];
apdu_len = encode_tagged_enumerated(&apdu[0], operation);
apdu_len = encode_application_enumerated(&apdu[0], operation);
break;
default:
*error_class = ERROR_CLASS_PROPERTY;
+14 -14
View File
@@ -205,7 +205,7 @@ int Multistate_Output_Encode_Property_APDU(uint8_t * apdu,
switch (property) {
case PROP_OBJECT_IDENTIFIER:
apdu_len =
encode_tagged_object_id(&apdu[0], OBJECT_MULTI_STATE_OUTPUT,
encode_application_object_id(&apdu[0], OBJECT_MULTI_STATE_OUTPUT,
object_instance);
break;
/* note: Name and Description don't have to be the same.
@@ -214,15 +214,15 @@ int Multistate_Output_Encode_Property_APDU(uint8_t * apdu,
case PROP_DESCRIPTION:
characterstring_init_ansi(&char_string,
Multistate_Output_Name(object_instance));
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_MULTI_STATE_OUTPUT);
encode_application_enumerated(&apdu[0], OBJECT_MULTI_STATE_OUTPUT);
break;
case PROP_PRESENT_VALUE:
present_value = Multistate_Output_Present_Value(object_instance);
apdu_len = encode_tagged_unsigned(&apdu[0], present_value);
apdu_len = encode_application_unsigned(&apdu[0], present_value);
break;
case PROP_STATUS_FLAGS:
/* note: see the details in the standard on how to use these */
@@ -231,23 +231,23 @@ int Multistate_Output_Encode_Property_APDU(uint8_t * apdu,
bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false);
apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string);
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break;
case PROP_EVENT_STATE:
/* note: see the details in the standard on how to use this */
apdu_len = encode_tagged_enumerated(&apdu[0], EVENT_STATE_NORMAL);
apdu_len = encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL);
break;
case PROP_OUT_OF_SERVICE:
object_index =
Multistate_Output_Instance_To_Index(object_instance);
state = Multistate_Output_Out_Of_Service[object_index];
apdu_len = encode_tagged_boolean(&apdu[0], state);
apdu_len = encode_application_boolean(&apdu[0], state);
break;
case PROP_PRIORITY_ARRAY:
/* Array element zero is the number of elements in the array */
if (array_index == 0)
apdu_len =
encode_tagged_unsigned(&apdu[0], BACNET_MAX_PRIORITY);
encode_application_unsigned(&apdu[0], BACNET_MAX_PRIORITY);
/* if no index was specified, then try to encode the entire list */
/* into one packet. */
else if (array_index == BACNET_ARRAY_ALL) {
@@ -257,12 +257,12 @@ int Multistate_Output_Encode_Property_APDU(uint8_t * apdu,
/* FIXME: check if we have room before adding it to APDU */
if (Multistate_Output_Level[object_index][i] ==
MULTISTATE_NULL)
len = encode_tagged_null(&apdu[apdu_len]);
len = encode_application_null(&apdu[apdu_len]);
else {
present_value =
Multistate_Output_Level[object_index][i];
len =
encode_tagged_unsigned(&apdu[apdu_len],
encode_application_unsigned(&apdu[apdu_len],
present_value);
}
/* add it if we have room */
@@ -281,13 +281,13 @@ int Multistate_Output_Encode_Property_APDU(uint8_t * apdu,
if (array_index <= BACNET_MAX_PRIORITY) {
if (Multistate_Output_Level[object_index][array_index -
1] == MULTISTATE_NULL)
apdu_len = encode_tagged_null(&apdu[0]);
apdu_len = encode_application_null(&apdu[0]);
else {
present_value =
Multistate_Output_Level[object_index][array_index -
1];
apdu_len =
encode_tagged_unsigned(&apdu[0], present_value);
encode_application_unsigned(&apdu[0], present_value);
}
} else {
*error_class = ERROR_CLASS_PROPERTY;
@@ -299,10 +299,10 @@ int Multistate_Output_Encode_Property_APDU(uint8_t * apdu,
break;
case PROP_RELINQUISH_DEFAULT:
present_value = MULTISTATE_RELINQUISH_DEFAULT;
apdu_len = encode_tagged_enumerated(&apdu[0], present_value);
apdu_len = encode_application_enumerated(&apdu[0], present_value);
break;
case PROP_NUMBER_OF_STATES:
apdu_len = encode_tagged_unsigned(&apdu[apdu_len],
apdu_len = encode_application_unsigned(&apdu[apdu_len],
MULTISTATE_NUMBER_OF_STATES);
break;
+12 -12
View File
@@ -71,11 +71,11 @@ extern "C" {
bool decode_is_closing_tag(uint8_t * apdu);
/* from clause 20.2.2 Encoding of a Null Value */
int encode_tagged_null(uint8_t * apdu);
int encode_application_null(uint8_t * apdu);
int encode_context_null(uint8_t * apdu, int tag_number);
/* from clause 20.2.3 Encoding of a Boolean Value */
int encode_tagged_boolean(uint8_t * apdu, bool boolean_value);
int encode_application_boolean(uint8_t * apdu, bool boolean_value);
bool decode_boolean(uint32_t len_value);
int encode_context_boolean(uint8_t * apdu, int tag_number,
bool boolean_value);
@@ -87,7 +87,7 @@ extern "C" {
BACNET_BIT_STRING * bit_string);
/* returns the number of apdu bytes consumed */
int encode_bitstring(uint8_t * apdu, BACNET_BIT_STRING * bit_string);
int encode_tagged_bitstring(uint8_t * apdu,
int encode_application_bitstring(uint8_t * apdu,
BACNET_BIT_STRING * bit_string);
int encode_context_bitstring(uint8_t * apdu, int tag_number,
BACNET_BIT_STRING * bit_string);
@@ -97,7 +97,7 @@ extern "C" {
/* returns the number of apdu bytes consumed */
int decode_real(uint8_t * apdu, float *real_value);
int encode_bacnet_real(float value, uint8_t * apdu);
int encode_tagged_real(uint8_t * apdu, float value);
int encode_application_real(uint8_t * apdu, float value);
int encode_context_real(uint8_t * apdu, int tag_number, float value);
/* from clause 20.2.14 Encoding of an Object Identifier Value */
@@ -109,7 +109,7 @@ extern "C" {
uint32_t instance);
int encode_context_object_id(uint8_t * apdu, int tag_number,
int object_type, uint32_t instance);
int encode_tagged_object_id(uint8_t * apdu, int object_type,
int encode_application_object_id(uint8_t * apdu, int object_type,
uint32_t instance);
/* from clause 20.2.8 Encoding of an Octet String Value */
@@ -117,7 +117,7 @@ extern "C" {
/* returns the number of apdu bytes consumed */
int encode_octet_string(uint8_t * apdu,
BACNET_OCTET_STRING * octet_string);
int encode_tagged_octet_string(uint8_t * apdu,
int encode_application_octet_string(uint8_t * apdu,
BACNET_OCTET_STRING * octet_string);
int encode_context_octet_string(uint8_t * apdu,
int tag_number, BACNET_OCTET_STRING * octet_string);
@@ -130,7 +130,7 @@ extern "C" {
/* returns the number of apdu bytes consumed */
int encode_bacnet_character_string(uint8_t * apdu,
BACNET_CHARACTER_STRING * char_string);
int encode_tagged_character_string(uint8_t * apdu,
int encode_application_character_string(uint8_t * apdu,
BACNET_CHARACTER_STRING * char_string);
int encode_context_character_string(uint8_t * apdu, int tag_number,
BACNET_CHARACTER_STRING * char_string);
@@ -143,7 +143,7 @@ extern "C" {
int encode_bacnet_unsigned(uint8_t * apdu, uint32_t value);
int encode_context_unsigned(uint8_t * apdu, int tag_number,
uint32_t value);
int encode_tagged_unsigned(uint8_t * apdu, uint32_t value);
int encode_application_unsigned(uint8_t * apdu, uint32_t value);
int decode_unsigned(uint8_t * apdu, uint32_t len_value,
uint32_t * value);
@@ -151,7 +151,7 @@ extern "C" {
/* and 20.2.1 General Rules for Encoding BACnet Tags */
/* returns the number of apdu bytes consumed */
int encode_bacnet_signed(uint8_t * apdu, int32_t value);
int encode_tagged_signed(uint8_t * apdu, int32_t value);
int encode_application_signed(uint8_t * apdu, int32_t value);
int encode_context_signed(uint8_t * apdu, int tag_number,
int32_t value);
int decode_signed(uint8_t * apdu, uint32_t len_value, int32_t * value);
@@ -161,7 +161,7 @@ extern "C" {
/* returns the number of apdu bytes consumed */
int decode_enumerated(uint8_t * apdu, uint32_t len_value, int *value);
int encode_bacnet_enumerated(uint8_t * apdu, int value);
int encode_tagged_enumerated(uint8_t * apdu, int value);
int encode_application_enumerated(uint8_t * apdu, int value);
int encode_context_enumerated(uint8_t * apdu, int tag_number,
int value);
@@ -169,7 +169,7 @@ extern "C" {
/* and 20.2.1 General Rules for Encoding BACnet Tags */
/* returns the number of apdu bytes consumed */
int encode_bacnet_time(uint8_t * apdu, BACNET_TIME * btime);
int encode_tagged_time(uint8_t * apdu, BACNET_TIME * btime);
int encode_application_time(uint8_t * apdu, BACNET_TIME * btime);
int decode_bacnet_time(uint8_t * apdu, BACNET_TIME * btime);
int encode_context_time(uint8_t * apdu, int tag_number,
BACNET_TIME * btime);
@@ -184,7 +184,7 @@ extern "C" {
/* and 20.2.1 General Rules for Encoding BACnet Tags */
/* returns the number of apdu bytes consumed */
int encode_bacnet_date(uint8_t * apdu, BACNET_DATE * bdate);
int encode_tagged_date(uint8_t * apdu, BACNET_DATE * bdate);
int encode_application_date(uint8_t * apdu, BACNET_DATE * bdate);
int encode_context_date(uint8_t * apdu, int tag_number,
BACNET_DATE * bdate);
int decode_date(uint8_t * apdu, BACNET_DATE * bdate);
+8 -8
View File
@@ -101,7 +101,7 @@ int Analog_Input_Encode_Property_APDU(uint8_t * apdu,
(void) array_index;
switch (property) {
case PROP_OBJECT_IDENTIFIER:
apdu_len = encode_tagged_object_id(&apdu[0], OBJECT_ANALOG_INPUT,
apdu_len = encode_application_object_id(&apdu[0], OBJECT_ANALOG_INPUT,
object_instance);
break;
/* note: Name and Description don't have to be the same.
@@ -110,14 +110,14 @@ int Analog_Input_Encode_Property_APDU(uint8_t * apdu,
case PROP_DESCRIPTION:
characterstring_init_ansi(&char_string,
Analog_Input_Name(object_instance));
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],
apdu_len = encode_application_enumerated(&apdu[0],
OBJECT_ANALOG_INPUT);
break;
case PROP_PRESENT_VALUE:
apdu_len = encode_tagged_real(&apdu[0],
apdu_len = encode_application_real(&apdu[0],
Analog_Input_Present_Value(object_instance));
break;
case PROP_STATUS_FLAGS:
@@ -126,16 +126,16 @@ int Analog_Input_Encode_Property_APDU(uint8_t * apdu,
bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false);
apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string);
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break;
case PROP_EVENT_STATE:
apdu_len = encode_tagged_enumerated(&apdu[0], EVENT_STATE_NORMAL);
apdu_len = encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL);
break;
case PROP_OUT_OF_SERVICE:
apdu_len = encode_tagged_boolean(&apdu[0], false);
apdu_len = encode_application_boolean(&apdu[0], false);
break;
case PROP_UNITS:
apdu_len = encode_tagged_enumerated(&apdu[0], UNITS_PERCENT);
apdu_len = encode_application_enumerated(&apdu[0], UNITS_PERCENT);
break;
default:
*error_class = ERROR_CLASS_PROPERTY;
+14 -14
View File
@@ -161,21 +161,21 @@ int Analog_Value_Encode_Property_APDU(uint8_t * apdu,
Analog_Value_Init();
switch (property) {
case PROP_OBJECT_IDENTIFIER:
apdu_len = encode_tagged_object_id(&apdu[0], OBJECT_ANALOG_VALUE,
apdu_len = encode_application_object_id(&apdu[0], OBJECT_ANALOG_VALUE,
object_instance);
break;
case PROP_OBJECT_NAME:
case PROP_DESCRIPTION:
characterstring_init_ansi(&char_string,
Analog_Value_Name(object_instance));
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_ANALOG_VALUE);
apdu_len = encode_application_enumerated(&apdu[0], OBJECT_ANALOG_VALUE);
break;
case PROP_PRESENT_VALUE:
real_value = Analog_Value_Present_Value(object_instance);
apdu_len = encode_tagged_real(&apdu[0], real_value);
apdu_len = encode_application_real(&apdu[0], real_value);
break;
case PROP_STATUS_FLAGS:
bitstring_init(&bit_string);
@@ -183,27 +183,27 @@ int Analog_Value_Encode_Property_APDU(uint8_t * apdu,
bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false);
apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string);
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break;
case PROP_EVENT_STATE:
apdu_len = encode_tagged_enumerated(&apdu[0], EVENT_STATE_NORMAL);
apdu_len = encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL);
break;
case PROP_OUT_OF_SERVICE:
#if 0
object_index = Analog_Value_Instance_To_Index(object_instance);
state = Analog_Value_Out_Of_Service[object_index];
#endif
apdu_len = encode_tagged_boolean(&apdu[0], false);
apdu_len = encode_application_boolean(&apdu[0], false);
break;
case PROP_UNITS:
apdu_len = encode_tagged_enumerated(&apdu[0], UNITS_PERCENT);
apdu_len = encode_application_enumerated(&apdu[0], UNITS_PERCENT);
break;
#if 0
case PROP_PRIORITY_ARRAY:
/* Array element zero is the number of elements in the array */
if (array_index == 0)
apdu_len =
encode_tagged_unsigned(&apdu[0], BACNET_MAX_PRIORITY);
encode_application_unsigned(&apdu[0], BACNET_MAX_PRIORITY);
/* if no index was specified, then try to encode the entire list */
/* into one packet. */
else if (array_index == BACNET_ARRAY_ALL) {
@@ -212,10 +212,10 @@ int Analog_Value_Encode_Property_APDU(uint8_t * apdu,
/* FIXME: check if we have room before adding it to APDU */
if (Present_Value[object_index][i] ==
ANALOG_LEVEL_NULL)
len = encode_tagged_null(&apdu[apdu_len]);
len = encode_application_null(&apdu[apdu_len]);
else {
real_value = Present_Value[object_index][i];
len = encode_tagged_real(&apdu[apdu_len], real_value);
len = encode_application_real(&apdu[apdu_len], real_value);
}
/* add it if we have room */
if ((apdu_len + len) < MAX_APDU)
@@ -232,11 +232,11 @@ int Analog_Value_Encode_Property_APDU(uint8_t * apdu,
if (array_index <= BACNET_MAX_PRIORITY) {
if (Present_Value[object_index][array_index - 1] ==
ANALOG_LEVEL_NULL)
apdu_len = encode_tagged_null(&apdu[0]);
apdu_len = encode_application_null(&apdu[0]);
else {
real_value =
Present_Value[object_index][array_index - 1];
apdu_len = encode_tagged_real(&apdu[0], real_value);
apdu_len = encode_application_real(&apdu[0], real_value);
}
} else {
*error_class = ERROR_CLASS_PROPERTY;
@@ -248,7 +248,7 @@ int Analog_Value_Encode_Property_APDU(uint8_t * apdu,
break;
case PROP_RELINQUISH_DEFAULT:
real_value = ANALOG_RELINQUISH_DEFAULT;
apdu_len = encode_tagged_real(&apdu[0], real_value);
apdu_len = encode_application_real(&apdu[0], real_value);
break;
#endif
default:
+8 -8
View File
@@ -133,7 +133,7 @@ int Binary_Input_Encode_Property_APDU(uint8_t * apdu,
Binary_Input_Initialize();
switch (property) {
case PROP_OBJECT_IDENTIFIER:
apdu_len = encode_tagged_object_id(&apdu[0], OBJECT_BINARY_INPUT,
apdu_len = encode_application_object_id(&apdu[0], OBJECT_BINARY_INPUT,
object_instance);
break;
case PROP_OBJECT_NAME:
@@ -141,14 +141,14 @@ int Binary_Input_Encode_Property_APDU(uint8_t * apdu,
/* note: object name must be unique in our device */
characterstring_init_ansi(&char_string,
Binary_Input_Name(object_instance));
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_BINARY_INPUT);
apdu_len = encode_application_enumerated(&apdu[0], OBJECT_BINARY_INPUT);
break;
case PROP_PRESENT_VALUE:
value = Binary_Input_Present_Value(object_instance);
apdu_len = encode_tagged_enumerated(&apdu[0],value);
apdu_len = encode_application_enumerated(&apdu[0],value);
break;
case PROP_STATUS_FLAGS:
/* note: see the details in the standard on how to use these */
@@ -157,17 +157,17 @@ int Binary_Input_Encode_Property_APDU(uint8_t * apdu,
bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false);
apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string);
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break;
case PROP_EVENT_STATE:
/* note: see the details in the standard on how to use this */
apdu_len = encode_tagged_enumerated(&apdu[0], EVENT_STATE_NORMAL);
apdu_len = encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL);
break;
case PROP_OUT_OF_SERVICE:
apdu_len = encode_tagged_boolean(&apdu[0], false);
apdu_len = encode_application_boolean(&apdu[0], false);
break;
case PROP_POLARITY:
apdu_len = encode_tagged_enumerated(&apdu[0], polarity);
apdu_len = encode_application_enumerated(&apdu[0], polarity);
break;
default:
*error_class = ERROR_CLASS_PROPERTY;
+8 -8
View File
@@ -128,7 +128,7 @@ int Binary_Value_Encode_Property_APDU(uint8_t * apdu,
Binary_Value_Initialize();
switch (property) {
case PROP_OBJECT_IDENTIFIER:
apdu_len = encode_tagged_object_id(&apdu[0], OBJECT_BINARY_VALUE,
apdu_len = encode_application_object_id(&apdu[0], OBJECT_BINARY_VALUE,
object_instance);
break;
/* note: Name and Description don't have to be the same.
@@ -137,14 +137,14 @@ int Binary_Value_Encode_Property_APDU(uint8_t * apdu,
case PROP_DESCRIPTION:
characterstring_init_ansi(&char_string,
Binary_Value_Name(object_instance));
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_BINARY_VALUE);
apdu_len = encode_application_enumerated(&apdu[0], OBJECT_BINARY_VALUE);
break;
case PROP_PRESENT_VALUE:
present_value = Binary_Value_Present_Value(object_instance);
apdu_len = encode_tagged_enumerated(&apdu[0], present_value);
apdu_len = encode_application_enumerated(&apdu[0], present_value);
break;
case PROP_STATUS_FLAGS:
/* note: see the details in the standard on how to use these */
@@ -153,18 +153,18 @@ int Binary_Value_Encode_Property_APDU(uint8_t * apdu,
bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false);
apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string);
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break;
case PROP_EVENT_STATE:
/* note: see the details in the standard on how to use this */
apdu_len = encode_tagged_enumerated(&apdu[0], EVENT_STATE_NORMAL);
apdu_len = encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL);
break;
case PROP_OUT_OF_SERVICE:
apdu_len = encode_tagged_boolean(&apdu[0], false);
apdu_len = encode_application_boolean(&apdu[0], false);
break;
case PROP_POLARITY:
/* FIXME: figure out the polarity */
apdu_len = encode_tagged_enumerated(&apdu[0], polarity);
apdu_len = encode_application_enumerated(&apdu[0], polarity);
break;
default:
*error_class = ERROR_CLASS_PROPERTY;
+31 -31
View File
@@ -257,59 +257,59 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
/* FIXME: change the hardcoded names to suit your application */
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, "BACnet Demo");
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], Device_System_Status());
encode_application_enumerated(&apdu[0], Device_System_Status());
break;
case PROP_VENDOR_NAME:
characterstring_init_ansi(&char_string, BACNET_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], Device_Vendor_Identifier());
encode_application_unsigned(&apdu[0], Device_Vendor_Identifier());
break;
case PROP_MODEL_NAME:
characterstring_init_ansi(&char_string, "GNU Demo");
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, "1.0");
apdu_len = encode_tagged_character_string(&apdu[0], &char_string);
apdu_len = encode_application_character_string(&apdu[0], &char_string);
break;
case PROP_LOCATION:
characterstring_init_ansi(&char_string, "USA");
apdu_len = encode_tagged_character_string(&apdu[0], &char_string);
apdu_len = encode_application_character_string(&apdu[0], &char_string);
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. */
@@ -319,7 +319,7 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
bitstring_set_bit(&bit_string, (uint8_t) i,
apdu_service_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,
@@ -336,13 +336,13 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
bitstring_set_bit(&bit_string, OBJECT_BINARY_VALUE, true);
bitstring_set_bit(&bit_string, OBJECT_ANALOG_INPUT, true);
bitstring_set_bit(&bit_string, OBJECT_BINARY_INPUT, true);
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 */
@@ -352,7 +352,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 */
@@ -375,7 +375,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;
@@ -385,19 +385,19 @@ 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], Device_APDU_Timeout());
apdu_len = encode_application_unsigned(&apdu[0], Device_APDU_Timeout());
break;
case PROP_NUMBER_OF_APDU_RETRIES:
apdu_len =
encode_tagged_unsigned(&apdu[0],
encode_application_unsigned(&apdu[0],
Device_Number_Of_APDU_Retries());
break;
case PROP_DEVICE_ADDRESS_BINDING:
@@ -405,14 +405,14 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
break;
case PROP_DATABASE_REVISION:
apdu_len =
encode_tagged_unsigned(&apdu[0], Device_Database_Revision());
encode_application_unsigned(&apdu[0], Device_Database_Revision());
break;
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;
case PROP_LOCAL_TIME:
/* FIXME: if you support time */
@@ -420,11 +420,11 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
local_time.min = 0;
local_time.sec = 0;
local_time.hundredths = 0;
apdu_len = encode_tagged_time(&apdu[0], &local_time);
apdu_len = encode_application_time(&apdu[0], &local_time);
break;
case PROP_UTC_OFFSET:
/* Note: BACnet Time Zone is inverse of everybody else */
apdu_len = encode_tagged_signed(&apdu[0], 5 /* EST */ );
apdu_len = encode_application_signed(&apdu[0], 5 /* EST */ );
break;
case PROP_LOCAL_DATE:
/* FIXME: if you support date */
@@ -432,14 +432,14 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
local_date.month = 4; /* Jan=1..Dec=12 */
local_date.day = 11; /* 1..31 */
local_date.wday = 0; /* 1=Mon..7=Sun */
apdu_len = encode_tagged_date(&apdu[0], &local_date);
apdu_len = encode_application_date(&apdu[0], &local_date);
break;
case PROP_DAYLIGHT_SAVINGS_STATUS:
/* FIXME: if you support time/date */
apdu_len = encode_tagged_boolean(&apdu[0], false);
apdu_len = encode_application_boolean(&apdu[0], false);
break;
case 9600:
apdu_len = encode_tagged_unsigned(&apdu[0], RS485_Get_Baud_Rate());
apdu_len = encode_application_unsigned(&apdu[0], RS485_Get_Baud_Rate());
break;
default:
*error_class = ERROR_CLASS_PROPERTY;
+7 -7
View File
@@ -20,10 +20,10 @@ BACNET_FLAGS += -DCRC_USE_TABLE
#BACNET_FLAGS += -DDLMSTP_TEST
BACNET_CORE = ../../src
BACNET_DEMO = ../../demo
BACNET_INCLUDE = ../../include
INCLUDES = -I.
INCLUDES += -I$(BACNET_CORE)
INCLUDES += -I$(BACNET_CORE)/demo/handler
INCLUDES += -I$(BACNET_CORE)/demo/object
INCLUDES += -I$(BACNET_INCLUDE)
#OPTIMIZATION = -O0
OPTIMIZATION = -Os
CFLAGS = -fno-common $(INCLUDES) $(BACNET_FLAGS) -Wall -g
@@ -54,10 +54,10 @@ DEMOSRC = ai.c \
h_rp.c \
h_wp.c \
device.c \
$(BACNET_CORE)/demo/handler/txbuf.c \
$(BACNET_CORE)/demo/handler/h_whois.c \
$(BACNET_CORE)/demo/handler/h_rd.c \
$(BACNET_CORE)/demo/handler/h_dcc.c
$(BACNET_DEMO)/handler/txbuf.c \
$(BACNET_DEMO)/handler/h_whois.c \
$(BACNET_DEMO)/handler/h_rd.c \
$(BACNET_DEMO)/handler/h_dcc.c
CORESRC = $(BACNET_CORE)/npdu.c \
$(BACNET_CORE)/bacint.c \
+7 -5
View File
@@ -15,6 +15,8 @@ SIZE = avr-size
# Source locations
BACNET_CORE = ../../src
BACNET_INCLUDE = ../../include
BACNET_DEMO = ../../demo
CSRC = main.c \
timer.c \
@@ -26,10 +28,10 @@ DEMOSRC = h_rp.c \
h_wp.c \
device.c \
ai.c \
$(BACNET_CORE)/demo/handler/txbuf.c \
$(BACNET_CORE)/demo/handler/h_whois.c \
$(BACNET_CORE)/demo/handler/h_rd.c \
$(BACNET_CORE)/demo/handler/h_dcc.c
$(BACNET_DEMO)/handler/txbuf.c \
$(BACNET_DEMO)/handler/h_whois.c \
$(BACNET_DEMO)/handler/h_rd.c \
$(BACNET_DEMO)/handler/h_dcc.c
CORESRC = \
$(BACNET_CORE)/apdu.c \
@@ -68,7 +70,7 @@ CORESRC = \
$(BACNET_CORE)/version.c
## Include Directories
INCLUDES = -I. -I../.. -I../../demo/object -I../../demo/handler
INCLUDES = -I. -I$(BACNET_INCLUDE)
# Source to Object conversion
COBJ = $(CSRC:.c=.o)
+8 -8
View File
@@ -101,7 +101,7 @@ int Analog_Input_Encode_Property_APDU(uint8_t * apdu,
(void) array_index;
switch (property) {
case PROP_OBJECT_IDENTIFIER:
apdu_len = encode_tagged_object_id(&apdu[0], OBJECT_ANALOG_INPUT,
apdu_len = encode_application_object_id(&apdu[0], OBJECT_ANALOG_INPUT,
object_instance);
break;
/* note: Name and Description don't have to be the same.
@@ -110,14 +110,14 @@ int Analog_Input_Encode_Property_APDU(uint8_t * apdu,
case PROP_DESCRIPTION:
characterstring_init_ansi(&char_string,
Analog_Input_Name(object_instance));
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],
apdu_len = encode_application_enumerated(&apdu[0],
OBJECT_ANALOG_INPUT);
break;
case PROP_PRESENT_VALUE:
apdu_len = encode_tagged_real(&apdu[0],
apdu_len = encode_application_real(&apdu[0],
Analog_Input_Present_Value(object_instance));
break;
case PROP_STATUS_FLAGS:
@@ -126,16 +126,16 @@ int Analog_Input_Encode_Property_APDU(uint8_t * apdu,
bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false);
apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string);
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break;
case PROP_EVENT_STATE:
apdu_len = encode_tagged_enumerated(&apdu[0], EVENT_STATE_NORMAL);
apdu_len = encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL);
break;
case PROP_OUT_OF_SERVICE:
apdu_len = encode_tagged_boolean(&apdu[0], false);
apdu_len = encode_application_boolean(&apdu[0], false);
break;
case PROP_UNITS:
apdu_len = encode_tagged_enumerated(&apdu[0], UNITS_PERCENT);
apdu_len = encode_application_enumerated(&apdu[0], UNITS_PERCENT);
break;
default:
*error_class = ERROR_CLASS_PROPERTY;
+31 -31
View File
@@ -264,59 +264,59 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
/* FIXME: change the hardcoded names to suit your application */
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, "BACnet Demo");
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], Device_System_Status());
encode_application_enumerated(&apdu[0], Device_System_Status());
break;
case PROP_VENDOR_NAME:
characterstring_init_ansi(&char_string, BACNET_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], Device_Vendor_Identifier());
encode_application_unsigned(&apdu[0], Device_Vendor_Identifier());
break;
case PROP_MODEL_NAME:
characterstring_init_ansi(&char_string, "GNU Demo");
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, "1.0");
apdu_len = encode_tagged_character_string(&apdu[0], &char_string);
apdu_len = encode_application_character_string(&apdu[0], &char_string);
break;
case PROP_LOCATION:
characterstring_init_ansi(&char_string, "USA");
apdu_len = encode_tagged_character_string(&apdu[0], &char_string);
apdu_len = encode_application_character_string(&apdu[0], &char_string);
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. */
@@ -326,7 +326,7 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
bitstring_set_bit(&bit_string, (uint8_t) i,
apdu_service_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,
@@ -345,13 +345,13 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
bitstring_set_bit(&bit_string, OBJECT_BINARY_VALUE, true);
bitstring_set_bit(&bit_string, OBJECT_BINARY_INPUT, 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 */
@@ -361,7 +361,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 */
@@ -384,7 +384,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;
@@ -394,19 +394,19 @@ 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], Device_APDU_Timeout());
apdu_len = encode_application_unsigned(&apdu[0], Device_APDU_Timeout());
break;
case PROP_NUMBER_OF_APDU_RETRIES:
apdu_len =
encode_tagged_unsigned(&apdu[0],
encode_application_unsigned(&apdu[0],
Device_Number_Of_APDU_Retries());
break;
case PROP_DEVICE_ADDRESS_BINDING:
@@ -414,14 +414,14 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
break;
case PROP_DATABASE_REVISION:
apdu_len =
encode_tagged_unsigned(&apdu[0], Device_Database_Revision());
encode_application_unsigned(&apdu[0], Device_Database_Revision());
break;
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;
case PROP_LOCAL_TIME:
/* FIXME: if you support time */
@@ -429,11 +429,11 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
local_time.min = 0;
local_time.sec = 0;
local_time.hundredths = 0;
apdu_len = encode_tagged_time(&apdu[0], &local_time);
apdu_len = encode_application_time(&apdu[0], &local_time);
break;
case PROP_UTC_OFFSET:
/* Note: BACnet Time Zone is inverse of everybody else */
apdu_len = encode_tagged_signed(&apdu[0], 5 /* EST */ );
apdu_len = encode_application_signed(&apdu[0], 5 /* EST */ );
break;
case PROP_LOCAL_DATE:
/* FIXME: if you support date */
@@ -441,14 +441,14 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
local_date.month = 4; /* Jan=1..Dec=12 */
local_date.day = 11; /* 1..31 */
local_date.wday = 0; /* 1=Mon..7=Sun */
apdu_len = encode_tagged_date(&apdu[0], &local_date);
apdu_len = encode_application_date(&apdu[0], &local_date);
break;
case PROP_DAYLIGHT_SAVINGS_STATUS:
/* FIXME: if you support time/date */
apdu_len = encode_tagged_boolean(&apdu[0], false);
apdu_len = encode_application_boolean(&apdu[0], false);
break;
case 9600:
apdu_len = encode_tagged_unsigned(&apdu[0], RS485_Get_Baud_Rate());
apdu_len = encode_application_unsigned(&apdu[0], RS485_Get_Baud_Rate());
break;
default:
*error_class = ERROR_CLASS_PROPERTY;
+8 -8
View File
@@ -98,7 +98,7 @@ int Analog_Input_Encode_Property_APDU(uint8_t * apdu,
(void) array_index;
switch (property) {
case PROP_OBJECT_IDENTIFIER:
apdu_len = encode_tagged_object_id(&apdu[0], OBJECT_ANALOG_INPUT,
apdu_len = encode_application_object_id(&apdu[0], OBJECT_ANALOG_INPUT,
object_instance);
break;
/* note: Name and Description don't have to be the same.
@@ -107,14 +107,14 @@ int Analog_Input_Encode_Property_APDU(uint8_t * apdu,
case PROP_DESCRIPTION:
characterstring_init_ansi(&char_string,
Analog_Input_Name(object_instance));
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],
apdu_len = encode_application_enumerated(&apdu[0],
OBJECT_ANALOG_INPUT);
break;
case PROP_PRESENT_VALUE:
apdu_len = encode_tagged_real(&apdu[0],
apdu_len = encode_application_real(&apdu[0],
Analog_Input_Present_Value(object_instance));
break;
case PROP_STATUS_FLAGS:
@@ -123,16 +123,16 @@ int Analog_Input_Encode_Property_APDU(uint8_t * apdu,
bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false);
apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string);
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break;
case PROP_EVENT_STATE:
apdu_len = encode_tagged_enumerated(&apdu[0], EVENT_STATE_NORMAL);
apdu_len = encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL);
break;
case PROP_OUT_OF_SERVICE:
apdu_len = encode_tagged_boolean(&apdu[0], false);
apdu_len = encode_application_boolean(&apdu[0], false);
break;
case PROP_UNITS:
apdu_len = encode_tagged_enumerated(&apdu[0], UNITS_PERCENT);
apdu_len = encode_application_enumerated(&apdu[0], UNITS_PERCENT);
break;
default:
*error_class = ERROR_CLASS_PROPERTY;
+14 -14
View File
@@ -158,21 +158,21 @@ int Analog_Value_Encode_Property_APDU(uint8_t * apdu,
Analog_Value_Init();
switch (property) {
case PROP_OBJECT_IDENTIFIER:
apdu_len = encode_tagged_object_id(&apdu[0], OBJECT_ANALOG_VALUE,
apdu_len = encode_application_object_id(&apdu[0], OBJECT_ANALOG_VALUE,
object_instance);
break;
case PROP_OBJECT_NAME:
case PROP_DESCRIPTION:
characterstring_init_ansi(&char_string,
Analog_Value_Name(object_instance));
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_ANALOG_VALUE);
apdu_len = encode_application_enumerated(&apdu[0], OBJECT_ANALOG_VALUE);
break;
case PROP_PRESENT_VALUE:
real_value = Analog_Value_Present_Value(object_instance);
apdu_len = encode_tagged_real(&apdu[0], real_value);
apdu_len = encode_application_real(&apdu[0], real_value);
break;
case PROP_STATUS_FLAGS:
bitstring_init(&bit_string);
@@ -180,27 +180,27 @@ int Analog_Value_Encode_Property_APDU(uint8_t * apdu,
bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false);
apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string);
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break;
case PROP_EVENT_STATE:
apdu_len = encode_tagged_enumerated(&apdu[0], EVENT_STATE_NORMAL);
apdu_len = encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL);
break;
case PROP_OUT_OF_SERVICE:
#if 0
object_index = Analog_Value_Instance_To_Index(object_instance);
state = Analog_Value_Out_Of_Service[object_index];
#endif
apdu_len = encode_tagged_boolean(&apdu[0], false);
apdu_len = encode_application_boolean(&apdu[0], false);
break;
case PROP_UNITS:
apdu_len = encode_tagged_enumerated(&apdu[0], UNITS_PERCENT);
apdu_len = encode_application_enumerated(&apdu[0], UNITS_PERCENT);
break;
#if 0
case PROP_PRIORITY_ARRAY:
/* Array element zero is the number of elements in the array */
if (array_index == 0)
apdu_len =
encode_tagged_unsigned(&apdu[0], BACNET_MAX_PRIORITY);
encode_application_unsigned(&apdu[0], BACNET_MAX_PRIORITY);
/* if no index was specified, then try to encode the entire list */
/* into one packet. */
else if (array_index == BACNET_ARRAY_ALL) {
@@ -209,10 +209,10 @@ int Analog_Value_Encode_Property_APDU(uint8_t * apdu,
/* FIXME: check if we have room before adding it to APDU */
if (Present_Value[object_index][i] ==
ANALOG_LEVEL_NULL)
len = encode_tagged_null(&apdu[apdu_len]);
len = encode_application_null(&apdu[apdu_len]);
else {
real_value = Present_Value[object_index][i];
len = encode_tagged_real(&apdu[apdu_len], real_value);
len = encode_application_real(&apdu[apdu_len], real_value);
}
/* add it if we have room */
if ((apdu_len + len) < MAX_APDU)
@@ -229,11 +229,11 @@ int Analog_Value_Encode_Property_APDU(uint8_t * apdu,
if (array_index <= BACNET_MAX_PRIORITY) {
if (Present_Value[object_index][array_index - 1] ==
ANALOG_LEVEL_NULL)
apdu_len = encode_tagged_null(&apdu[0]);
apdu_len = encode_application_null(&apdu[0]);
else {
real_value =
Present_Value[object_index][array_index - 1];
apdu_len = encode_tagged_real(&apdu[0], real_value);
apdu_len = encode_application_real(&apdu[0], real_value);
}
} else {
*error_class = ERROR_CLASS_PROPERTY;
@@ -245,7 +245,7 @@ int Analog_Value_Encode_Property_APDU(uint8_t * apdu,
break;
case PROP_RELINQUISH_DEFAULT:
real_value = ANALOG_RELINQUISH_DEFAULT;
apdu_len = encode_tagged_real(&apdu[0], real_value);
apdu_len = encode_application_real(&apdu[0], real_value);
break;
#endif
default:
+8 -8
View File
@@ -130,7 +130,7 @@ int Binary_Input_Encode_Property_APDU(uint8_t * apdu,
Binary_Input_Initialize();
switch (property) {
case PROP_OBJECT_IDENTIFIER:
apdu_len = encode_tagged_object_id(&apdu[0], OBJECT_BINARY_INPUT,
apdu_len = encode_application_object_id(&apdu[0], OBJECT_BINARY_INPUT,
object_instance);
break;
case PROP_OBJECT_NAME:
@@ -138,14 +138,14 @@ int Binary_Input_Encode_Property_APDU(uint8_t * apdu,
/* note: object name must be unique in our device */
characterstring_init_ansi(&char_string,
Binary_Input_Name(object_instance));
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_BINARY_INPUT);
apdu_len = encode_application_enumerated(&apdu[0], OBJECT_BINARY_INPUT);
break;
case PROP_PRESENT_VALUE:
value = Binary_Input_Present_Value(object_instance);
apdu_len = encode_tagged_enumerated(&apdu[0],value);
apdu_len = encode_application_enumerated(&apdu[0],value);
break;
case PROP_STATUS_FLAGS:
/* note: see the details in the standard on how to use these */
@@ -154,17 +154,17 @@ int Binary_Input_Encode_Property_APDU(uint8_t * apdu,
bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false);
apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string);
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break;
case PROP_EVENT_STATE:
/* note: see the details in the standard on how to use this */
apdu_len = encode_tagged_enumerated(&apdu[0], EVENT_STATE_NORMAL);
apdu_len = encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL);
break;
case PROP_OUT_OF_SERVICE:
apdu_len = encode_tagged_boolean(&apdu[0], false);
apdu_len = encode_application_boolean(&apdu[0], false);
break;
case PROP_POLARITY:
apdu_len = encode_tagged_enumerated(&apdu[0], polarity);
apdu_len = encode_application_enumerated(&apdu[0], polarity);
break;
default:
*error_class = ERROR_CLASS_PROPERTY;
+8 -8
View File
@@ -129,7 +129,7 @@ int Binary_Value_Encode_Property_APDU(uint8_t * apdu,
Binary_Value_Initialize();
switch (property) {
case PROP_OBJECT_IDENTIFIER:
apdu_len = encode_tagged_object_id(&apdu[0], OBJECT_BINARY_VALUE,
apdu_len = encode_application_object_id(&apdu[0], OBJECT_BINARY_VALUE,
object_instance);
break;
/* note: Name and Description don't have to be the same.
@@ -138,14 +138,14 @@ int Binary_Value_Encode_Property_APDU(uint8_t * apdu,
case PROP_DESCRIPTION:
characterstring_init_ansi(&char_string,
Binary_Value_Name(object_instance));
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_BINARY_VALUE);
apdu_len = encode_application_enumerated(&apdu[0], OBJECT_BINARY_VALUE);
break;
case PROP_PRESENT_VALUE:
present_value = Binary_Value_Present_Value(object_instance);
apdu_len = encode_tagged_enumerated(&apdu[0], present_value);
apdu_len = encode_application_enumerated(&apdu[0], present_value);
break;
case PROP_STATUS_FLAGS:
/* note: see the details in the standard on how to use these */
@@ -154,18 +154,18 @@ int Binary_Value_Encode_Property_APDU(uint8_t * apdu,
bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false);
apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string);
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break;
case PROP_EVENT_STATE:
/* note: see the details in the standard on how to use this */
apdu_len = encode_tagged_enumerated(&apdu[0], EVENT_STATE_NORMAL);
apdu_len = encode_application_enumerated(&apdu[0], EVENT_STATE_NORMAL);
break;
case PROP_OUT_OF_SERVICE:
apdu_len = encode_tagged_boolean(&apdu[0], false);
apdu_len = encode_application_boolean(&apdu[0], false);
break;
case PROP_POLARITY:
/* FIXME: figure out the polarity */
apdu_len = encode_tagged_enumerated(&apdu[0], polarity);
apdu_len = encode_application_enumerated(&apdu[0], polarity);
break;
default:
*error_class = ERROR_CLASS_PROPERTY;
+31 -31
View File
@@ -264,65 +264,65 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
/* FIXME: change the hardcoded names to suit your application */
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:
(void) strcpypgm2ram(&string_buffer[0], "PIC18F6720 Device");
characterstring_init_ansi(&char_string, string_buffer);
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:
(void) strcpypgm2ram(&string_buffer[0], "BACnet Demo");
characterstring_init_ansi(&char_string, string_buffer);
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], Device_System_Status());
encode_application_enumerated(&apdu[0], Device_System_Status());
break;
case PROP_VENDOR_NAME:
(void) strcpypgm2ram(&string_buffer[0], BACNET_VENDOR_NAME);
characterstring_init_ansi(&char_string, string_buffer);
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], Device_Vendor_Identifier());
encode_application_unsigned(&apdu[0], Device_Vendor_Identifier());
break;
case PROP_MODEL_NAME:
(void) strcpypgm2ram(&string_buffer[0], "GNU Demo");
characterstring_init_ansi(&char_string, string_buffer);
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:
(void) strcpypgm2ram(&string_buffer[0], "1.0");
characterstring_init_ansi(&char_string, string_buffer);
apdu_len = encode_tagged_character_string(&apdu[0], &char_string);
apdu_len = encode_application_character_string(&apdu[0], &char_string);
break;
case PROP_LOCATION:
(void) strcpypgm2ram(&string_buffer[0], "USA");
characterstring_init_ansi(&char_string, string_buffer);
apdu_len = encode_tagged_character_string(&apdu[0], &char_string);
apdu_len = encode_application_character_string(&apdu[0], &char_string);
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. */
@@ -332,7 +332,7 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
bitstring_set_bit(&bit_string, (uint8_t) i,
apdu_service_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,
@@ -348,13 +348,13 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
bitstring_set_bit(&bit_string, OBJECT_BINARY_VALUE, true);
bitstring_set_bit(&bit_string, OBJECT_ANALOG_INPUT, true);
bitstring_set_bit(&bit_string, OBJECT_BINARY_INPUT, true);
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 */
@@ -364,7 +364,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 */
@@ -387,7 +387,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;
@@ -397,19 +397,19 @@ 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], Device_APDU_Timeout());
apdu_len = encode_application_unsigned(&apdu[0], Device_APDU_Timeout());
break;
case PROP_NUMBER_OF_APDU_RETRIES:
apdu_len =
encode_tagged_unsigned(&apdu[0],
encode_application_unsigned(&apdu[0],
Device_Number_Of_APDU_Retries());
break;
case PROP_DEVICE_ADDRESS_BINDING:
@@ -417,14 +417,14 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
break;
case PROP_DATABASE_REVISION:
apdu_len =
encode_tagged_unsigned(&apdu[0], Device_Database_Revision());
encode_application_unsigned(&apdu[0], Device_Database_Revision());
break;
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;
case PROP_LOCAL_TIME:
/* FIXME: if you support time */
@@ -432,11 +432,11 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
local_time.min = 0;
local_time.sec = 0;
local_time.hundredths = 0;
apdu_len = encode_tagged_time(&apdu[0], &local_time);
apdu_len = encode_application_time(&apdu[0], &local_time);
break;
case PROP_UTC_OFFSET:
/* Note: BACnet Time Zone is inverse of everybody else */
apdu_len = encode_tagged_signed(&apdu[0], 5 /* EST */ );
apdu_len = encode_application_signed(&apdu[0], 5 /* EST */ );
break;
case PROP_LOCAL_DATE:
/* FIXME: if you support date */
@@ -444,14 +444,14 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
local_date.month = 4; /* Jan=1..Dec=12 */
local_date.day = 11; /* 1..31 */
local_date.wday = 0; /* 1=Mon..7=Sun */
apdu_len = encode_tagged_date(&apdu[0], &local_date);
apdu_len = encode_application_date(&apdu[0], &local_date);
break;
case PROP_DAYLIGHT_SAVINGS_STATUS:
/* FIXME: if you support time/date */
apdu_len = encode_tagged_boolean(&apdu[0], false);
apdu_len = encode_application_boolean(&apdu[0], false);
break;
case 9600:
apdu_len = encode_tagged_unsigned(&apdu[0], RS485_Get_Baud_Rate());
apdu_len = encode_application_unsigned(&apdu[0], RS485_Get_Baud_Rate());
break;
default:
*error_class = ERROR_CLASS_PROPERTY;
+11 -11
View File
@@ -53,22 +53,22 @@ int arf_encode_apdu(uint8_t * apdu,
apdu[2] = invoke_id;
apdu[3] = SERVICE_CONFIRMED_ATOMIC_READ_FILE; /* service choice */
apdu_len = 4;
apdu_len += encode_tagged_object_id(&apdu[apdu_len],
apdu_len += encode_application_object_id(&apdu[apdu_len],
data->object_type, data->object_instance);
switch (data->access) {
case FILE_STREAM_ACCESS:
apdu_len += encode_opening_tag(&apdu[apdu_len], 0);
apdu_len += encode_tagged_signed(&apdu[apdu_len],
apdu_len += encode_application_signed(&apdu[apdu_len],
data->type.stream.fileStartPosition);
apdu_len += encode_tagged_unsigned(&apdu[apdu_len],
apdu_len += encode_application_unsigned(&apdu[apdu_len],
data->type.stream.requestedOctetCount);
apdu_len += encode_closing_tag(&apdu[apdu_len], 0);
break;
case FILE_RECORD_ACCESS:
apdu_len += encode_opening_tag(&apdu[apdu_len], 1);
apdu_len += encode_tagged_signed(&apdu[apdu_len],
apdu_len += encode_application_signed(&apdu[apdu_len],
data->type.record.fileStartRecord);
apdu_len += encode_tagged_unsigned(&apdu[apdu_len],
apdu_len += encode_application_unsigned(&apdu[apdu_len],
data->type.record.RecordCount);
apdu_len += encode_closing_tag(&apdu[apdu_len], 1);
break;
@@ -193,23 +193,23 @@ int arf_ack_encode_apdu(uint8_t * apdu,
apdu_len = 3;
/* endOfFile */
apdu_len +=
encode_tagged_boolean(&apdu[apdu_len], data->endOfFile);
encode_application_boolean(&apdu[apdu_len], data->endOfFile);
switch (data->access) {
case FILE_STREAM_ACCESS:
apdu_len += encode_opening_tag(&apdu[apdu_len], 0);
apdu_len += encode_tagged_signed(&apdu[apdu_len],
apdu_len += encode_application_signed(&apdu[apdu_len],
data->type.stream.fileStartPosition);
apdu_len += encode_tagged_octet_string(&apdu[apdu_len],
apdu_len += encode_application_octet_string(&apdu[apdu_len],
&data->fileData);
apdu_len += encode_closing_tag(&apdu[apdu_len], 0);
break;
case FILE_RECORD_ACCESS:
apdu_len += encode_opening_tag(&apdu[apdu_len], 1);
apdu_len += encode_tagged_signed(&apdu[apdu_len],
apdu_len += encode_application_signed(&apdu[apdu_len],
data->type.record.fileStartRecord);
apdu_len += encode_tagged_unsigned(&apdu[apdu_len],
apdu_len += encode_application_unsigned(&apdu[apdu_len],
data->type.record.RecordCount);
apdu_len += encode_tagged_octet_string(&apdu[apdu_len],
apdu_len += encode_application_octet_string(&apdu[apdu_len],
&data->fileData);
apdu_len += encode_closing_tag(&apdu[apdu_len], 1);
break;
+6 -6
View File
@@ -53,24 +53,24 @@ int awf_encode_apdu(uint8_t * apdu,
apdu[2] = invoke_id;
apdu[3] = SERVICE_CONFIRMED_ATOMIC_WRITE_FILE; /* service choice */
apdu_len = 4;
apdu_len += encode_tagged_object_id(&apdu[apdu_len],
apdu_len += encode_application_object_id(&apdu[apdu_len],
data->object_type, data->object_instance);
switch (data->access) {
case FILE_STREAM_ACCESS:
apdu_len += encode_opening_tag(&apdu[apdu_len], 0);
apdu_len += encode_tagged_signed(&apdu[apdu_len],
apdu_len += encode_application_signed(&apdu[apdu_len],
data->type.stream.fileStartPosition);
apdu_len += encode_tagged_octet_string(&apdu[apdu_len],
apdu_len += encode_application_octet_string(&apdu[apdu_len],
&data->fileData);
apdu_len += encode_closing_tag(&apdu[apdu_len], 0);
break;
case FILE_RECORD_ACCESS:
apdu_len += encode_opening_tag(&apdu[apdu_len], 1);
apdu_len += encode_tagged_signed(&apdu[apdu_len],
apdu_len += encode_application_signed(&apdu[apdu_len],
data->type.record.fileStartRecord);
apdu_len += encode_tagged_unsigned(&apdu[apdu_len],
apdu_len += encode_application_unsigned(&apdu[apdu_len],
data->type.record.returnedRecordCount);
apdu_len += encode_tagged_octet_string(&apdu[apdu_len],
apdu_len += encode_application_octet_string(&apdu[apdu_len],
&data->fileData);
apdu_len += encode_closing_tag(&apdu[apdu_len], 1);
break;
+31 -31
View File
@@ -56,50 +56,50 @@ int bacapp_encode_application_data(uint8_t * apdu,
apdu_len++;
break;
case BACNET_APPLICATION_TAG_BOOLEAN:
apdu_len = encode_tagged_boolean(&apdu[0],
apdu_len = encode_application_boolean(&apdu[0],
value->type.Boolean);
break;
case BACNET_APPLICATION_TAG_UNSIGNED_INT:
apdu_len = encode_tagged_unsigned(&apdu[0],
apdu_len = encode_application_unsigned(&apdu[0],
value->type.Unsigned_Int);
break;
case BACNET_APPLICATION_TAG_SIGNED_INT:
apdu_len = encode_tagged_signed(&apdu[0],
apdu_len = encode_application_signed(&apdu[0],
value->type.Signed_Int);
break;
case BACNET_APPLICATION_TAG_REAL:
apdu_len = encode_tagged_real(&apdu[0], value->type.Real);
apdu_len = encode_application_real(&apdu[0], value->type.Real);
break;
case BACNET_APPLICATION_TAG_ENUMERATED:
apdu_len = encode_tagged_enumerated(&apdu[0],
apdu_len = encode_application_enumerated(&apdu[0],
value->type.Enumerated);
break;
case BACNET_APPLICATION_TAG_DATE:
apdu_len = encode_tagged_date(&apdu[0], &value->type.Date);
apdu_len = encode_application_date(&apdu[0], &value->type.Date);
break;
case BACNET_APPLICATION_TAG_TIME:
apdu_len = encode_tagged_time(&apdu[0], &value->type.Time);
apdu_len = encode_application_time(&apdu[0], &value->type.Time);
break;
case BACNET_APPLICATION_TAG_OBJECT_ID:
apdu_len = encode_tagged_object_id(&apdu[0],
apdu_len = encode_application_object_id(&apdu[0],
value->type.Object_Id.type,
value->type.Object_Id.instance);
break;
case BACNET_APPLICATION_TAG_OCTET_STRING:
apdu_len = encode_tagged_octet_string(&apdu[0],
apdu_len = encode_application_octet_string(&apdu[0],
&value->type.Octet_String);
break;
case BACNET_APPLICATION_TAG_CHARACTER_STRING:
apdu_len = encode_tagged_character_string(&apdu[0],
apdu_len = encode_application_character_string(&apdu[0],
&value->type.Character_String);
break;
case BACNET_APPLICATION_TAG_BIT_STRING:
apdu_len = encode_tagged_bitstring(&apdu[0],
apdu_len = encode_application_bitstring(&apdu[0],
&value->type.Bit_String);
break;
case BACNET_APPLICATION_TAG_DOUBLE:
/* FIXME: double is not implemented yet.
apdu_len = encode_tagged_double(&apdu[0],
apdu_len = encode_application_double(&apdu[0],
value->type.Double);
*/
default:
@@ -797,7 +797,7 @@ void testBACnetApplicationDataLength(Test * pTest)
apdu_len = 0;
len = encode_opening_tag(&apdu[apdu_len], 3);
apdu_len += len;
len = encode_tagged_unsigned(&apdu[apdu_len], 4194303);
len = encode_application_unsigned(&apdu[apdu_len], 4194303);
test_len += len;
apdu_len += len;
len = encode_closing_tag(&apdu[apdu_len], 3);
@@ -811,52 +811,52 @@ void testBACnetApplicationDataLength(Test * pTest)
apdu_len = 0;
len = encode_opening_tag(&apdu[apdu_len], 3);
apdu_len += len;
len = encode_tagged_null(&apdu[apdu_len]);
len = encode_application_null(&apdu[apdu_len]);
test_len += len;
apdu_len += len;
len = encode_tagged_null(&apdu[apdu_len]);
len = encode_application_null(&apdu[apdu_len]);
test_len += len;
apdu_len += len;
len = encode_tagged_unsigned(&apdu[apdu_len], 1);
len = encode_application_unsigned(&apdu[apdu_len], 1);
test_len += len;
apdu_len += len;
len = encode_tagged_unsigned(&apdu[apdu_len], 42);
len = encode_application_unsigned(&apdu[apdu_len], 42);
test_len += len;
apdu_len += len;
len = encode_tagged_unsigned(&apdu[apdu_len], 91);
len = encode_application_unsigned(&apdu[apdu_len], 91);
test_len += len;
apdu_len += len;
len = encode_tagged_null(&apdu[apdu_len]);
len = encode_application_null(&apdu[apdu_len]);
test_len += len;
apdu_len += len;
len = encode_tagged_null(&apdu[apdu_len]);
len = encode_application_null(&apdu[apdu_len]);
test_len += len;
apdu_len += len;
len = encode_tagged_null(&apdu[apdu_len]);
len = encode_application_null(&apdu[apdu_len]);
test_len += len;
apdu_len += len;
len = encode_tagged_null(&apdu[apdu_len]);
len = encode_application_null(&apdu[apdu_len]);
test_len += len;
apdu_len += len;
len = encode_tagged_null(&apdu[apdu_len]);
len = encode_application_null(&apdu[apdu_len]);
test_len += len;
apdu_len += len;
len = encode_tagged_null(&apdu[apdu_len]);
len = encode_application_null(&apdu[apdu_len]);
test_len += len;
apdu_len += len;
len = encode_tagged_null(&apdu[apdu_len]);
len = encode_application_null(&apdu[apdu_len]);
test_len += len;
apdu_len += len;
len = encode_tagged_null(&apdu[apdu_len]);
len = encode_application_null(&apdu[apdu_len]);
test_len += len;
apdu_len += len;
len = encode_tagged_null(&apdu[apdu_len]);
len = encode_application_null(&apdu[apdu_len]);
test_len += len;
apdu_len += len;
len = encode_tagged_null(&apdu[apdu_len]);
len = encode_application_null(&apdu[apdu_len]);
test_len += len;
apdu_len += len;
len = encode_tagged_null(&apdu[apdu_len]);
len = encode_application_null(&apdu[apdu_len]);
test_len += len;
apdu_len += len;
len = encode_closing_tag(&apdu[apdu_len], 3);
@@ -877,14 +877,14 @@ void testBACnetApplicationDataLength(Test * pTest)
local_date.month = 4; /* 1=Jan */
local_date.day = 1; /* 1..31 */
local_date.wday = 6; /* 1=Monday */
len = encode_tagged_date(&apdu[apdu_len], &local_date);
len = encode_application_date(&apdu[apdu_len], &local_date);
test_len += len;
apdu_len += len;
local_time.hour = 7;
local_time.min = 0;
local_time.sec = 3;
local_time.hundredths = 1;
len = encode_tagged_time(&apdu[apdu_len], &local_time);
len = encode_application_time(&apdu[apdu_len], &local_time);
test_len += len;
apdu_len += len;
len = encode_closing_tag(&apdu[apdu_len], 3);
+28 -28
View File
@@ -412,7 +412,7 @@ bool decode_is_closing_tag_number(uint8_t * apdu, uint8_t tag_number)
/* from clause 20.2.3 Encoding of a Boolean Value */
/* and 20.2.1 General Rules for Encoding BACnet Tags */
/* returns the number of apdu bytes consumed */
int encode_tagged_boolean(uint8_t * apdu, bool boolean_value)
int encode_application_boolean(uint8_t * apdu, bool boolean_value)
{
int len = 0;
uint32_t len_value = 0;
@@ -465,7 +465,7 @@ bool decode_boolean(uint32_t len_value)
/* from clause 20.2.2 Encoding of a Null Value */
/* and 20.2.1 General Rules for Encoding BACnet Tags */
/* returns the number of apdu bytes consumed */
int encode_tagged_null(uint8_t * apdu)
int encode_application_null(uint8_t * apdu)
{
return encode_tag(&apdu[0], BACNET_APPLICATION_TAG_NULL, false, 0);
}
@@ -556,7 +556,7 @@ int encode_bitstring(uint8_t * apdu, BACNET_BIT_STRING * bit_string)
return len;
}
int encode_tagged_bitstring(uint8_t * apdu, BACNET_BIT_STRING * bit_string)
int encode_application_bitstring(uint8_t * apdu, BACNET_BIT_STRING * bit_string)
{
int len = 0;
int bit_string_encoded_length = 1; /* 1 for the bits remaining octet */
@@ -641,7 +641,7 @@ int encode_bacnet_real(float value, uint8_t * apdu)
/* from clause 20.2.6 Encoding of a Real Number Value */
/* and 20.2.1 General Rules for Encoding BACnet Tags */
/* returns the number of apdu bytes consumed */
int encode_tagged_real(uint8_t * apdu, float value)
int encode_application_real(uint8_t * apdu, float value)
{
int len = 0;
@@ -720,7 +720,7 @@ int encode_context_object_id(uint8_t * apdu,
/* 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 encode_application_object_id(uint8_t * apdu,
int object_type, uint32_t instance)
{
int len = 0;
@@ -757,7 +757,7 @@ int encode_octet_string(uint8_t * apdu, BACNET_OCTET_STRING * octet_string)
/* from clause 20.2.8 Encoding of an Octet String Value */
/* and 20.2.1 General Rules for Encoding BACnet Tags */
/* returns the number of apdu bytes consumed */
int encode_tagged_octet_string(uint8_t * apdu,
int encode_application_octet_string(uint8_t * apdu,
BACNET_OCTET_STRING * octet_string)
{
int apdu_len = 0;
@@ -834,7 +834,7 @@ int encode_bacnet_character_string(uint8_t * apdu,
/* from clause 20.2.9 Encoding of a Character String Value */
/* and 20.2.1 General Rules for Encoding BACnet Tags */
/* returns the number of apdu bytes consumed */
int encode_tagged_character_string(uint8_t * apdu,
int encode_application_character_string(uint8_t * apdu,
BACNET_CHARACTER_STRING * char_string)
{
int len = 0;
@@ -959,7 +959,7 @@ int encode_context_unsigned(uint8_t * apdu, int tag_number, uint32_t value)
/* from clause 20.2.4 Encoding of an Unsigned Integer Value */
/* and 20.2.1 General Rules for Encoding BACnet Tags */
/* returns the number of apdu bytes consumed */
int encode_tagged_unsigned(uint8_t * apdu, uint32_t value)
int encode_application_unsigned(uint8_t * apdu, uint32_t value)
{
int len = 0;
@@ -996,7 +996,7 @@ int encode_bacnet_enumerated(uint8_t * apdu, int value)
/* from clause 20.2.11 Encoding of an Enumerated Value */
/* and 20.2.1 General Rules for Encoding BACnet Tags */
/* returns the number of apdu bytes consumed */
int encode_tagged_enumerated(uint8_t * apdu, int value)
int encode_application_enumerated(uint8_t * apdu, int value)
{
int len = 0; /* return value */
@@ -1082,7 +1082,7 @@ int encode_bacnet_signed(uint8_t * apdu, int32_t value)
/* from clause 20.2.5 Encoding of a Signed Integer Value */
/* and 20.2.1 General Rules for Encoding BACnet Tags */
/* returns the number of apdu bytes consumed */
int encode_tagged_signed(uint8_t * apdu, int32_t value)
int encode_application_signed(uint8_t * apdu, int32_t value)
{
int len = 0; /* return value */
@@ -1128,7 +1128,7 @@ int encode_bacnet_time(uint8_t * apdu, BACNET_TIME * btime)
/* from clause 20.2.13 Encoding of a Time Value */
/* and 20.2.1 General Rules for Encoding BACnet Tags */
/* returns the number of apdu bytes consumed */
int encode_tagged_time(uint8_t * apdu, BACNET_TIME * btime)
int encode_application_time(uint8_t * apdu, BACNET_TIME * btime)
{
int len = 0;
@@ -1197,7 +1197,7 @@ int encode_bacnet_date(uint8_t * apdu, BACNET_DATE * bdate)
/* from clause 20.2.12 Encoding of a Date Value */
/* and 20.2.1 General Rules for Encoding BACnet Tags */
/* returns the number of apdu bytes consumed */
int encode_tagged_date(uint8_t * apdu, BACNET_DATE * bdate)
int encode_application_date(uint8_t * apdu, BACNET_DATE * bdate)
{
int len = 0;
@@ -1393,7 +1393,7 @@ void testBACDCodeReal(Test * pTest)
sizeof(real_array)) == 0);
/* a real will take up 4 octects plus a one octet tag */
apdu_len = encode_tagged_real(&apdu[0], value);
apdu_len = encode_application_real(&apdu[0], value);
ct_test(pTest, apdu_len == 5);
/* len tells us how many octets were used for encoding the value */
len = decode_tag_number_and_value(&apdu[0], &tag_number, &long_value);
@@ -1420,7 +1420,7 @@ void testBACDCodeEnumerated(Test * pTest)
uint32_t len_value = 0;
for (i = 0; i < 31; i++) {
apdu_len = encode_tagged_enumerated(&array[0], value);
apdu_len = encode_application_enumerated(&array[0], value);
len =
decode_tag_number_and_value(&array[0], &tag_number,
&len_value);
@@ -1429,12 +1429,12 @@ void testBACDCodeEnumerated(Test * pTest)
ct_test(pTest, tag_number == BACNET_APPLICATION_TAG_ENUMERATED);
ct_test(pTest, len == apdu_len);
/* encode back the value */
encode_tagged_enumerated(&encoded_array[0], decoded_value);
encode_application_enumerated(&encoded_array[0], decoded_value);
ct_test(pTest, memcmp(&array[0], &encoded_array[0],
sizeof(array)) == 0);
/* an enumerated will take up to 4 octects */
/* plus a one octet for the tag */
apdu_len = encode_tagged_enumerated(&apdu[0], value);
apdu_len = encode_application_enumerated(&apdu[0], value);
len = decode_tag_number_and_value(&apdu[0], &tag_number, NULL);
ct_test(pTest, len == 1);
ct_test(pTest, tag_number == BACNET_APPLICATION_TAG_ENUMERATED);
@@ -1462,7 +1462,7 @@ void testBACDCodeUnsignedValue(Test * pTest, uint32_t value)
uint8_t tag_number = 0;
uint32_t len_value = 0;
len_value = encode_tagged_unsigned(&array[0], value);
len_value = encode_application_unsigned(&array[0], value);
len = decode_tag_number_and_value(&array[0], &tag_number, &len_value);
len = decode_unsigned(&array[len], len_value, &decoded_value);
ct_test(pTest, decoded_value == value);
@@ -1470,12 +1470,12 @@ void testBACDCodeUnsignedValue(Test * pTest, uint32_t value)
printf("value=%u decoded_value=%u\n", value, decoded_value);
print_apdu(&array[0], sizeof(array));
}
encode_tagged_unsigned(&encoded_array[0], decoded_value);
encode_application_unsigned(&encoded_array[0], decoded_value);
ct_test(pTest, memcmp(&array[0], &encoded_array[0],
sizeof(array)) == 0);
/* an unsigned will take up to 4 octects */
/* plus a one octet for the tag */
apdu_len = encode_tagged_unsigned(&apdu[0], value);
apdu_len = encode_application_unsigned(&apdu[0], value);
/* apdu_len varies... */
/*ct_test(pTest, apdu_len == 5); */
len = decode_tag_number_and_value(&apdu[0], &tag_number, NULL);
@@ -1526,7 +1526,7 @@ void testBACDCodeSignedValue(Test * pTest, int32_t value)
uint32_t len_value = 0;
int diff = 0;
len = encode_tagged_signed(&array[0], value);
len = encode_application_signed(&array[0], value);
len = decode_tag_number_and_value(&array[0], &tag_number, &len_value);
len = decode_signed(&array[len], len_value, &decoded_value);
ct_test(pTest, tag_number == BACNET_APPLICATION_TAG_SIGNED_INT);
@@ -1535,7 +1535,7 @@ void testBACDCodeSignedValue(Test * pTest, int32_t value)
printf("value=%d decoded_value=%d\n", value, decoded_value);
print_apdu(&array[0], sizeof(array));
}
encode_tagged_signed(&encoded_array[0], decoded_value);
encode_application_signed(&encoded_array[0], decoded_value);
diff = memcmp(&array[0], &encoded_array[0], sizeof(array));
ct_test(pTest, diff == 0);
if (diff) {
@@ -1545,7 +1545,7 @@ void testBACDCodeSignedValue(Test * pTest, int32_t value)
}
/* a signed int will take up to 4 octects */
/* plus a one octet for the tag */
apdu_len = encode_tagged_signed(&apdu[0], value);
apdu_len = encode_application_signed(&apdu[0], value);
len = decode_tag_number_and_value(&apdu[0], &tag_number, NULL);
ct_test(pTest, tag_number == BACNET_APPLICATION_TAG_SIGNED_INT);
ct_test(pTest, decode_is_context_specific(&apdu[0]) == false);
@@ -1614,7 +1614,7 @@ void testBACDCodeOctetString(Test * pTest)
status = octetstring_init(&octet_string, NULL, 0);
ct_test(pTest, status == true);
apdu_len = encode_tagged_octet_string(&array[0], &octet_string);
apdu_len = encode_application_octet_string(&array[0], &octet_string);
len = decode_tag_number_and_value(&array[0], &tag_number, &len_value);
ct_test(pTest, tag_number == BACNET_APPLICATION_TAG_OCTET_STRING);
len += decode_octet_string(&array[len], len_value, &test_octet_string);
@@ -1628,7 +1628,7 @@ void testBACDCodeOctetString(Test * pTest)
status = octetstring_init(&octet_string, test_value, i);
ct_test(pTest, status == true);
apdu_len =
encode_tagged_octet_string(&encoded_array[0], &octet_string);
encode_application_octet_string(&encoded_array[0], &octet_string);
len =
decode_tag_number_and_value(&encoded_array[0], &tag_number,
&len_value);
@@ -1668,7 +1668,7 @@ void testBACDCodeCharacterString(Test * pTest)
status = characterstring_init(&char_string,
CHARACTER_ANSI_X34, NULL, 0);
ct_test(pTest, status == true);
apdu_len = encode_tagged_character_string(&array[0], &char_string);
apdu_len = encode_application_character_string(&array[0], &char_string);
len = decode_tag_number_and_value(&array[0], &tag_number, &len_value);
ct_test(pTest, tag_number == BACNET_APPLICATION_TAG_CHARACTER_STRING);
len +=
@@ -1683,7 +1683,7 @@ void testBACDCodeCharacterString(Test * pTest)
status = characterstring_init_ansi(&char_string, test_value);
ct_test(pTest, status == true);
apdu_len =
encode_tagged_character_string(&encoded_array[0],
encode_application_character_string(&encoded_array[0],
&char_string);
len =
decode_tag_number_and_value(&encoded_array[0], &tag_number,
@@ -1787,7 +1787,7 @@ void testBACDCodeBitString(Test * pTest)
ct_test(pTest, bitstring_bits_used(&bit_string) == (bit + 1));
ct_test(pTest, bitstring_bit(&bit_string, bit) == true);
/* encode */
len = encode_tagged_bitstring(&apdu[0], &bit_string);
len = encode_application_bitstring(&apdu[0], &bit_string);
/* decode */
len =
decode_tag_number_and_value(&apdu[0], &tag_number, &len_value);
@@ -1805,7 +1805,7 @@ void testBACDCodeBitString(Test * pTest)
ct_test(pTest, bitstring_bits_used(&bit_string) == (bit + 1));
ct_test(pTest, bitstring_bit(&bit_string, bit) == false);
/* encode */
len = encode_tagged_bitstring(&apdu[0], &bit_string);
len = encode_application_bitstring(&apdu[0], &bit_string);
/* decode */
len =
decode_tag_number_and_value(&apdu[0], &tag_number, &len_value);
+2 -2
View File
@@ -50,8 +50,8 @@ int bacerror_encode_apdu(uint8_t * apdu,
apdu[2] = service;
apdu_len = 3;
/* service parameters */
apdu_len += encode_tagged_enumerated(&apdu[apdu_len], error_class);
apdu_len += encode_tagged_enumerated(&apdu[apdu_len], error_code);
apdu_len += encode_application_enumerated(&apdu[apdu_len], error_class);
apdu_len += encode_application_enumerated(&apdu[apdu_len], error_code);
}
return apdu_len;
+4 -4
View File
@@ -53,14 +53,14 @@ int iam_encode_apdu(uint8_t * apdu,
apdu[0] = PDU_TYPE_UNCONFIRMED_SERVICE_REQUEST;
apdu[1] = SERVICE_UNCONFIRMED_I_AM; /* service choice */
apdu_len = 2;
len = encode_tagged_object_id(&apdu[apdu_len],
len = encode_application_object_id(&apdu[apdu_len],
OBJECT_DEVICE, device_id);
apdu_len += len;
len = encode_tagged_unsigned(&apdu[apdu_len], max_apdu);
len = encode_application_unsigned(&apdu[apdu_len], max_apdu);
apdu_len += len;
len = encode_tagged_enumerated(&apdu[apdu_len], segmentation);
len = encode_application_enumerated(&apdu[apdu_len], segmentation);
apdu_len += len;
len = encode_tagged_unsigned(&apdu[apdu_len], vendor_id);
len = encode_application_unsigned(&apdu[apdu_len], vendor_id);
apdu_len += len;
}
+3 -3
View File
@@ -47,15 +47,15 @@ int ihave_encode_apdu(uint8_t * apdu, BACNET_I_HAVE_DATA * data)
apdu[1] = SERVICE_UNCONFIRMED_I_HAVE;
apdu_len = 2;
/* deviceIdentifier */
len = encode_tagged_object_id(&apdu[apdu_len],
len = encode_application_object_id(&apdu[apdu_len],
data->device_id.type, data->device_id.instance);
apdu_len += len;
/* objectIdentifier */
len = encode_tagged_object_id(&apdu[apdu_len],
len = encode_application_object_id(&apdu[apdu_len],
data->object_id.type, data->object_id.instance);
apdu_len += len;
/* objectName */
len = encode_tagged_character_string(&apdu[apdu_len],
len = encode_application_character_string(&apdu[apdu_len],
&data->object_name);
apdu_len += len;
}
+2 -2
View File
@@ -259,8 +259,8 @@ int rpm_ack_encode_apdu_object_property_error(uint8_t * apdu,
if (apdu) {
/* Tag 5: propertyAccessError */
apdu_len += encode_opening_tag(&apdu[apdu_len], 5);
apdu_len += encode_tagged_enumerated(&apdu[apdu_len], error_class);
apdu_len += encode_tagged_enumerated(&apdu[apdu_len], error_code);
apdu_len += encode_application_enumerated(&apdu[apdu_len], error_class);
apdu_len += encode_application_enumerated(&apdu[apdu_len], error_code);
apdu_len += encode_closing_tag(&apdu[apdu_len], 5);
}
+2 -2
View File
@@ -50,9 +50,9 @@ int timesync_encode_apdu_service(uint8_t * apdu,
apdu[0] = PDU_TYPE_UNCONFIRMED_SERVICE_REQUEST;
apdu[1] = service;
apdu_len = 2;
len = encode_tagged_date(&apdu[apdu_len], my_date);
len = encode_application_date(&apdu[apdu_len], my_date);
apdu_len += len;
len = encode_tagged_time(&apdu[apdu_len], my_time);
len = encode_application_time(&apdu[apdu_len], my_time);
apdu_len += len;
}