make pretty
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
# Ignore formatting change commits when determining blame
|
||||||
|
# git config --global blame.ignoreRevsFile .git-blame-ignore-revs
|
||||||
|
# Mark any lines that have had a commit skipped using --ignore-rev with a `?`
|
||||||
|
# git config --global blame.markIgnoredLines true
|
||||||
|
# Mark any lines that were added in a skipped commit and can not be attributed with a `*`
|
||||||
|
# git config --global blame.markUnblamableLines true
|
||||||
|
|
||||||
|
# make pretty - apps/ and src/
|
||||||
|
|
||||||
+8
-14
@@ -153,8 +153,7 @@ static void Init_Service_Handlers(void)
|
|||||||
apdu_set_confirmed_simple_ack_handler(
|
apdu_set_confirmed_simple_ack_handler(
|
||||||
SERVICE_CONFIRMED_ACKNOWLEDGE_ALARM, MyWritePropertySimpleAckHandler);
|
SERVICE_CONFIRMED_ACKNOWLEDGE_ALARM, MyWritePropertySimpleAckHandler);
|
||||||
/* handle any errors coming back */
|
/* handle any errors coming back */
|
||||||
apdu_set_error_handler(
|
apdu_set_error_handler(SERVICE_CONFIRMED_ACKNOWLEDGE_ALARM, MyErrorHandler);
|
||||||
SERVICE_CONFIRMED_ACKNOWLEDGE_ALARM, MyErrorHandler);
|
|
||||||
apdu_set_abort_handler(MyAbortHandler);
|
apdu_set_abort_handler(MyAbortHandler);
|
||||||
apdu_set_reject_handler(MyRejectHandler);
|
apdu_set_reject_handler(MyRejectHandler);
|
||||||
}
|
}
|
||||||
@@ -294,8 +293,8 @@ int main(int argc, char *argv[])
|
|||||||
data.eventObjectIdentifier.type = object_type;
|
data.eventObjectIdentifier.type = object_type;
|
||||||
target_args++;
|
target_args++;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "event-object-type=%s invalid\n",
|
fprintf(
|
||||||
argv[argi]);
|
stderr, "event-object-type=%s invalid\n", argv[argi]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else if (target_args == 3) {
|
} else if (target_args == 3) {
|
||||||
@@ -305,13 +304,11 @@ int main(int argc, char *argv[])
|
|||||||
target_args++;
|
target_args++;
|
||||||
} else if (target_args == 4) {
|
} else if (target_args == 4) {
|
||||||
/* event-state-acked */
|
/* event-state-acked */
|
||||||
if (bactext_event_state_strtol(argv[argi],
|
if (bactext_event_state_strtol(argv[argi], &object_type)) {
|
||||||
&object_type)) {
|
|
||||||
data.eventStateAcked = object_type;
|
data.eventStateAcked = object_type;
|
||||||
target_args++;
|
target_args++;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "event-state=%s invalid\n",
|
fprintf(stderr, "event-state=%s invalid\n", argv[argi]);
|
||||||
argv[argi]);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else if (target_args == 5) {
|
} else if (target_args == 5) {
|
||||||
@@ -405,12 +402,9 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
if (found) {
|
if (found) {
|
||||||
if (Request_Invoke_ID == 0) {
|
if (Request_Invoke_ID == 0) {
|
||||||
Request_Invoke_ID =
|
Request_Invoke_ID = Send_Alarm_Acknowledgement_Address(
|
||||||
Send_Alarm_Acknowledgement_Address(
|
Handler_Transmit_Buffer, sizeof(Handler_Transmit_Buffer),
|
||||||
Handler_Transmit_Buffer,
|
&data, &Target_Address);
|
||||||
sizeof(Handler_Transmit_Buffer),
|
|
||||||
&data,
|
|
||||||
&Target_Address);
|
|
||||||
} else if (tsm_invoke_id_free(Request_Invoke_ID)) {
|
} else if (tsm_invoke_id_free(Request_Invoke_ID)) {
|
||||||
break;
|
break;
|
||||||
} else if (tsm_invoke_id_failed(Request_Invoke_ID)) {
|
} else if (tsm_invoke_id_failed(Request_Invoke_ID)) {
|
||||||
|
|||||||
+15
-12
@@ -481,7 +481,8 @@ int main(int argc, char *argv[])
|
|||||||
/* FIXME: add event type parameters */
|
/* FIXME: add event type parameters */
|
||||||
} else if (event_data.eventType == EVENT_OUT_OF_RANGE) {
|
} else if (event_data.eventType == EVENT_OUT_OF_RANGE) {
|
||||||
/* FIXME: add event type parameters */
|
/* FIXME: add event type parameters */
|
||||||
} else if (event_data.eventType == EVENT_CHANGE_OF_LIFE_SAFETY) {
|
} else if (event_data.eventType ==
|
||||||
|
EVENT_CHANGE_OF_LIFE_SAFETY) {
|
||||||
/* FIXME: add event type parameters */
|
/* FIXME: add event type parameters */
|
||||||
} else if (event_data.eventType == EVENT_EXTENDED) {
|
} else if (event_data.eventType == EVENT_EXTENDED) {
|
||||||
/* FIXME: add event type parameters */
|
/* FIXME: add event type parameters */
|
||||||
@@ -495,17 +496,22 @@ int main(int argc, char *argv[])
|
|||||||
/* FIXME: add event type parameters */
|
/* FIXME: add event type parameters */
|
||||||
} else if (event_data.eventType == EVENT_SIGNED_OUT_OF_RANGE) {
|
} else if (event_data.eventType == EVENT_SIGNED_OUT_OF_RANGE) {
|
||||||
/* FIXME: add event type parameters */
|
/* FIXME: add event type parameters */
|
||||||
} else if (event_data.eventType == EVENT_UNSIGNED_OUT_OF_RANGE) {
|
} else if (event_data.eventType ==
|
||||||
|
EVENT_UNSIGNED_OUT_OF_RANGE) {
|
||||||
/* FIXME: add event type parameters */
|
/* FIXME: add event type parameters */
|
||||||
} else if (event_data.eventType == EVENT_CHANGE_OF_CHARACTERSTRING) {
|
} else if (event_data.eventType ==
|
||||||
|
EVENT_CHANGE_OF_CHARACTERSTRING) {
|
||||||
/* FIXME: add event type parameters */
|
/* FIXME: add event type parameters */
|
||||||
} else if (event_data.eventType == EVENT_CHANGE_OF_STATUS_FLAGS) {
|
} else if (event_data.eventType ==
|
||||||
|
EVENT_CHANGE_OF_STATUS_FLAGS) {
|
||||||
/* FIXME: add event type parameters */
|
/* FIXME: add event type parameters */
|
||||||
} else if (event_data.eventType == EVENT_CHANGE_OF_RELIABILITY) {
|
} else if (event_data.eventType ==
|
||||||
|
EVENT_CHANGE_OF_RELIABILITY) {
|
||||||
/* FIXME: add event type parameters */
|
/* FIXME: add event type parameters */
|
||||||
} else if (event_data.eventType == EVENT_NONE) {
|
} else if (event_data.eventType == EVENT_NONE) {
|
||||||
/* FIXME: add event type parameters */
|
/* FIXME: add event type parameters */
|
||||||
} else if (event_data.eventType == EVENT_CHANGE_OF_DISCRETE_VALUE) {
|
} else if (event_data.eventType ==
|
||||||
|
EVENT_CHANGE_OF_DISCRETE_VALUE) {
|
||||||
/* FIXME: add event type parameters */
|
/* FIXME: add event type parameters */
|
||||||
} else if (event_data.eventType == EVENT_CHANGE_OF_TIMER) {
|
} else if (event_data.eventType == EVENT_CHANGE_OF_TIMER) {
|
||||||
/* FIXME: add event type parameters */
|
/* FIXME: add event type parameters */
|
||||||
@@ -595,12 +601,9 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
if (found) {
|
if (found) {
|
||||||
if (Request_Invoke_ID == 0) {
|
if (Request_Invoke_ID == 0) {
|
||||||
Request_Invoke_ID =
|
Request_Invoke_ID = Send_CEvent_Notify_Address(
|
||||||
Send_CEvent_Notify_Address(
|
Handler_Transmit_Buffer, sizeof(Handler_Transmit_Buffer),
|
||||||
Handler_Transmit_Buffer,
|
&event_data, &Target_Address);
|
||||||
sizeof(Handler_Transmit_Buffer),
|
|
||||||
&event_data,
|
|
||||||
&Target_Address);
|
|
||||||
} else if (tsm_invoke_id_free(Request_Invoke_ID)) {
|
} else if (tsm_invoke_id_free(Request_Invoke_ID)) {
|
||||||
break;
|
break;
|
||||||
} else if (tsm_invoke_id_failed(Request_Invoke_ID)) {
|
} else if (tsm_invoke_id_failed(Request_Invoke_ID)) {
|
||||||
|
|||||||
+3
-3
@@ -538,9 +538,9 @@ static void filename_create(char *filename)
|
|||||||
|
|
||||||
if (filename) {
|
if (filename) {
|
||||||
datetime_local(&bdate, &btime, NULL, NULL);
|
datetime_local(&bdate, &btime, NULL, NULL);
|
||||||
sprintf(filename, "mstp_%04d%02d%02d%02d%02d%02d.cap",
|
sprintf(filename, "mstp_%04d%02d%02d%02d%02d%02d.cap", (int)bdate.year,
|
||||||
(int)bdate.year, (int)bdate.month, (int)bdate.day,
|
(int)bdate.month, (int)bdate.day, (int)btime.hour, (int)btime.min,
|
||||||
(int)btime.hour, (int)btime.min, (int)btime.sec);
|
(int)btime.sec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -119,8 +119,8 @@ static void My_Router_Handler(BACNET_ADDRESS *src,
|
|||||||
that are sent with a local unicast address. */
|
that are sent with a local unicast address. */
|
||||||
if (npdu_len >= 2) {
|
if (npdu_len >= 2) {
|
||||||
len += decode_unsigned16(npdu, &dnet);
|
len += decode_unsigned16(npdu, &dnet);
|
||||||
printf(": network number = %u. SNET=%u\n",
|
printf(": network number = %u. SNET=%u\n", (unsigned)dnet,
|
||||||
(unsigned)dnet, (unsigned)src->net);
|
(unsigned)src->net);
|
||||||
} else {
|
} else {
|
||||||
printf(": network number = missing! SNET=%u\n", src->net);
|
printf(": network number = missing! SNET=%u\n", src->net);
|
||||||
}
|
}
|
||||||
@@ -251,7 +251,8 @@ int main(int argc, char *argv[])
|
|||||||
time_t timeout_seconds = 0;
|
time_t timeout_seconds = 0;
|
||||||
|
|
||||||
if (argc < 3) {
|
if (argc < 3) {
|
||||||
printf("Usage: %s DNET status [MAC]\r\n", filename_remove_path(argv[0]));
|
printf(
|
||||||
|
"Usage: %s DNET status [MAC]\r\n", filename_remove_path(argv[0]));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ((argc > 1) && (strcmp(argv[1], "--help") == 0)) {
|
if ((argc > 1) && (strcmp(argv[1], "--help") == 0)) {
|
||||||
@@ -307,8 +308,7 @@ int main(int argc, char *argv[])
|
|||||||
last_seconds = time(NULL);
|
last_seconds = time(NULL);
|
||||||
timeout_seconds = apdu_timeout() / 1000;
|
timeout_seconds = apdu_timeout() / 1000;
|
||||||
/* send the request */
|
/* send the request */
|
||||||
Send_Network_Number_Is(
|
Send_Network_Number_Is(&Target_Router_Address, Target_Network_Number,
|
||||||
&Target_Router_Address, Target_Network_Number,
|
|
||||||
Target_Network_Number_Status);
|
Target_Network_Number_Status);
|
||||||
/* loop forever */
|
/* loop forever */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|||||||
+26
-24
@@ -984,9 +984,11 @@ int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata)
|
|||||||
/* Array element zero is the number of objects in the list */
|
/* Array element zero is the number of objects in the list */
|
||||||
if (rpdata->array_index == 0) {
|
if (rpdata->array_index == 0) {
|
||||||
apdu_len = encode_application_unsigned(&apdu[0], count);
|
apdu_len = encode_application_unsigned(&apdu[0], count);
|
||||||
/* if no index was specified, then try to encode the entire list */
|
/* if no index was specified, then try to encode the entire list
|
||||||
|
*/
|
||||||
/* into one packet. Note that more than likely you will have */
|
/* into one packet. Note that more than likely you will have */
|
||||||
/* to return an error if the number of encoded objects exceeds */
|
/* to return an error if the number of encoded objects exceeds
|
||||||
|
*/
|
||||||
/* your maximum APDU size. */
|
/* your maximum APDU size. */
|
||||||
} else if (rpdata->array_index == BACNET_ARRAY_ALL) {
|
} else if (rpdata->array_index == BACNET_ARRAY_ALL) {
|
||||||
for (i = 1; i <= count; i++) {
|
for (i = 1; i <= count; i++) {
|
||||||
@@ -1135,8 +1137,8 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
/* FIXME: len < application_data_len: more data? */
|
/* FIXME: len < application_data_len: more data? */
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_OBJECT_IDENTIFIER:
|
case PROP_OBJECT_IDENTIFIER:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_OBJECT_ID);
|
wp_data, &value, BACNET_APPLICATION_TAG_OBJECT_ID);
|
||||||
if (status) {
|
if (status) {
|
||||||
if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
|
if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
|
||||||
(Device_Set_Object_Instance_Number(
|
(Device_Set_Object_Instance_Number(
|
||||||
@@ -1151,32 +1153,32 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_NUMBER_OF_APDU_RETRIES:
|
case PROP_NUMBER_OF_APDU_RETRIES:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
/* FIXME: bounds check? */
|
/* FIXME: bounds check? */
|
||||||
apdu_retries_set((uint8_t)value.type.Unsigned_Int);
|
apdu_retries_set((uint8_t)value.type.Unsigned_Int);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_APDU_TIMEOUT:
|
case PROP_APDU_TIMEOUT:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
/* FIXME: bounds check? */
|
/* FIXME: bounds check? */
|
||||||
apdu_timeout_set((uint16_t)value.type.Unsigned_Int);
|
apdu_timeout_set((uint16_t)value.type.Unsigned_Int);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_VENDOR_IDENTIFIER:
|
case PROP_VENDOR_IDENTIFIER:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
/* FIXME: bounds check? */
|
/* FIXME: bounds check? */
|
||||||
Device_Set_Vendor_Identifier((uint16_t)value.type.Unsigned_Int);
|
Device_Set_Vendor_Identifier((uint16_t)value.type.Unsigned_Int);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_SYSTEM_STATUS:
|
case PROP_SYSTEM_STATUS:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_ENUMERATED);
|
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
|
||||||
if (status) {
|
if (status) {
|
||||||
temp = Device_Set_System_Status(
|
temp = Device_Set_System_Status(
|
||||||
(BACNET_DEVICE_STATUS)value.type.Enumerated, false);
|
(BACNET_DEVICE_STATUS)value.type.Enumerated, false);
|
||||||
@@ -1193,8 +1195,8 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_OBJECT_NAME:
|
case PROP_OBJECT_NAME:
|
||||||
status = write_property_string_valid(wp_data, &value,
|
status = write_property_string_valid(
|
||||||
characterstring_capacity(&My_Object_Name));
|
wp_data, &value, characterstring_capacity(&My_Object_Name));
|
||||||
if (status) {
|
if (status) {
|
||||||
/* All the object names in a device must be unique */
|
/* All the object names in a device must be unique */
|
||||||
if (Device_Valid_Object_Name(&value.type.Character_String,
|
if (Device_Valid_Object_Name(&value.type.Character_String,
|
||||||
@@ -1214,8 +1216,8 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_LOCATION:
|
case PROP_LOCATION:
|
||||||
status = write_property_empty_string_valid(wp_data, &value,
|
status = write_property_empty_string_valid(
|
||||||
MAX_DEV_LOC_LEN);
|
wp_data, &value, MAX_DEV_LOC_LEN);
|
||||||
if (status) {
|
if (status) {
|
||||||
Device_Set_Location(
|
Device_Set_Location(
|
||||||
characterstring_value(&value.type.Character_String),
|
characterstring_value(&value.type.Character_String),
|
||||||
@@ -1224,8 +1226,8 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_DESCRIPTION:
|
case PROP_DESCRIPTION:
|
||||||
status = write_property_empty_string_valid(wp_data, &value,
|
status = write_property_empty_string_valid(
|
||||||
MAX_DEV_DESC_LEN);
|
wp_data, &value, MAX_DEV_DESC_LEN);
|
||||||
if (status) {
|
if (status) {
|
||||||
Device_Set_Description(
|
Device_Set_Description(
|
||||||
characterstring_value(&value.type.Character_String),
|
characterstring_value(&value.type.Character_String),
|
||||||
@@ -1233,8 +1235,8 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_MODEL_NAME:
|
case PROP_MODEL_NAME:
|
||||||
status = write_property_empty_string_valid(wp_data, &value,
|
status = write_property_empty_string_valid(
|
||||||
MAX_DEV_MOD_LEN);
|
wp_data, &value, MAX_DEV_MOD_LEN);
|
||||||
if (status) {
|
if (status) {
|
||||||
Device_Set_Model_Name(
|
Device_Set_Model_Name(
|
||||||
characterstring_value(&value.type.Character_String),
|
characterstring_value(&value.type.Character_String),
|
||||||
@@ -1244,8 +1246,8 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
|
|
||||||
case PROP_MAX_INFO_FRAMES:
|
case PROP_MAX_INFO_FRAMES:
|
||||||
#if defined(BACDL_MSTP)
|
#if defined(BACDL_MSTP)
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
if (value.type.Unsigned_Int <= 255) {
|
if (value.type.Unsigned_Int <= 255) {
|
||||||
dlmstp_set_max_info_frames(
|
dlmstp_set_max_info_frames(
|
||||||
@@ -1260,8 +1262,8 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
#endif
|
#endif
|
||||||
case PROP_MAX_MASTER:
|
case PROP_MAX_MASTER:
|
||||||
#if defined(BACDL_MSTP)
|
#if defined(BACDL_MSTP)
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
if ((value.type.Unsigned_Int > 0) &&
|
if ((value.type.Unsigned_Int > 0) &&
|
||||||
(value.type.Unsigned_Int <= 127)) {
|
(value.type.Unsigned_Int <= 127)) {
|
||||||
|
|||||||
@@ -100,8 +100,7 @@ static void MyErrorHandler(BACNET_ADDRESS *src,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* complex error reply function */
|
/* complex error reply function */
|
||||||
static void MyPrivateTransferErrorHandler(
|
static void MyPrivateTransferErrorHandler(BACNET_ADDRESS *src,
|
||||||
BACNET_ADDRESS * src,
|
|
||||||
uint8_t invoke_id,
|
uint8_t invoke_id,
|
||||||
uint8_t service_choice,
|
uint8_t service_choice,
|
||||||
uint8_t *service_request,
|
uint8_t *service_request,
|
||||||
@@ -163,8 +162,8 @@ static void Init_Service_Handlers(void)
|
|||||||
|
|
||||||
/* handle any errors coming back */
|
/* handle any errors coming back */
|
||||||
apdu_set_error_handler(SERVICE_CONFIRMED_READ_PROPERTY, MyErrorHandler);
|
apdu_set_error_handler(SERVICE_CONFIRMED_READ_PROPERTY, MyErrorHandler);
|
||||||
apdu_set_complex_error_handler(SERVICE_CONFIRMED_PRIVATE_TRANSFER,
|
apdu_set_complex_error_handler(
|
||||||
MyPrivateTransferErrorHandler);
|
SERVICE_CONFIRMED_PRIVATE_TRANSFER, MyPrivateTransferErrorHandler);
|
||||||
apdu_set_abort_handler(MyAbortHandler);
|
apdu_set_abort_handler(MyAbortHandler);
|
||||||
apdu_set_reject_handler(MyRejectHandler);
|
apdu_set_reject_handler(MyRejectHandler);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,8 +134,8 @@ static void AtomicReadFileAckHandler(uint8_t *service_request,
|
|||||||
data.endOfFile = true;
|
data.endOfFile = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result = fseek(pFile, data.type.stream.fileStartPosition,
|
result = fseek(
|
||||||
SEEK_SET);
|
pFile, data.type.stream.fileStartPosition, SEEK_SET);
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
/* unit to write in bytes -
|
/* unit to write in bytes -
|
||||||
in our case, an octet is one byte */
|
in our case, an octet is one byte */
|
||||||
@@ -150,8 +150,8 @@ static void AtomicReadFileAckHandler(uint8_t *service_request,
|
|||||||
Target_File_Start_Position =
|
Target_File_Start_Position =
|
||||||
data.type.stream.fileStartPosition +
|
data.type.stream.fileStartPosition +
|
||||||
octets_written;
|
octets_written;
|
||||||
printf("\r%d bytes",
|
printf(
|
||||||
(int)Target_File_Start_Position);
|
"\r%d bytes", (int)Target_File_Start_Position);
|
||||||
}
|
}
|
||||||
fflush(pFile);
|
fflush(pFile);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -297,8 +297,8 @@ int main(int argc, char *argv[])
|
|||||||
Target_Device_Object_Instance = strtol(argv[argi], NULL, 0);
|
Target_Device_Object_Instance = strtol(argv[argi], NULL, 0);
|
||||||
target_args++;
|
target_args++;
|
||||||
} else if (target_args == 1) {
|
} else if (target_args == 1) {
|
||||||
if (bactext_object_type_strtol(
|
if (bactext_object_type_strtol(argv[argi], &object_type) ==
|
||||||
argv[argi], &object_type) == false) {
|
false) {
|
||||||
fprintf(stderr, "object-type=%s invalid\n", argv[argi]);
|
fprintf(stderr, "object-type=%s invalid\n", argv[argi]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -308,8 +308,8 @@ int main(int argc, char *argv[])
|
|||||||
Target_Object_Instance = strtol(argv[argi], NULL, 0);
|
Target_Object_Instance = strtol(argv[argi], NULL, 0);
|
||||||
target_args++;
|
target_args++;
|
||||||
} else if (target_args == 3) {
|
} else if (target_args == 3) {
|
||||||
if (bactext_property_strtol(
|
if (bactext_property_strtol(argv[argi], &object_property) ==
|
||||||
argv[argi], &object_property) == false) {
|
false) {
|
||||||
fprintf(stderr, "property=%s invalid\n", argv[argi]);
|
fprintf(stderr, "property=%s invalid\n", argv[argi]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-15
@@ -143,7 +143,6 @@ static void My_Read_Property_Multiple_Ack_Handler(uint8_t *service_request,
|
|||||||
while (rpm_data) {
|
while (rpm_data) {
|
||||||
rpm_ack_print_data(rpm_data);
|
rpm_ack_print_data(rpm_data);
|
||||||
rpm_data = rpm_data_free(rpm_data);
|
rpm_data = rpm_data_free(rpm_data);
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "RPM Ack Malformed! Freeing memory...\n");
|
fprintf(stderr, "RPM Ack Malformed! Freeing memory...\n");
|
||||||
@@ -214,9 +213,7 @@ static void cleanup(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void target_address_add(
|
static void target_address_add(
|
||||||
long dnet,
|
long dnet, BACNET_MAC_ADDRESS *mac, BACNET_MAC_ADDRESS *adr)
|
||||||
BACNET_MAC_ADDRESS *mac,
|
|
||||||
BACNET_MAC_ADDRESS *adr)
|
|
||||||
{
|
{
|
||||||
BACNET_ADDRESS dest = { 0 };
|
BACNET_ADDRESS dest = { 0 };
|
||||||
|
|
||||||
@@ -416,17 +413,17 @@ int main(int argc, char *argv[])
|
|||||||
} else if (target_args >= 1) {
|
} else if (target_args >= 1) {
|
||||||
if (tag_value_arg == 0) {
|
if (tag_value_arg == 0) {
|
||||||
if (rpm_object) {
|
if (rpm_object) {
|
||||||
rpm_object->next = calloc(1,
|
rpm_object->next =
|
||||||
sizeof(BACNET_READ_ACCESS_DATA));
|
calloc(1, sizeof(BACNET_READ_ACCESS_DATA));
|
||||||
rpm_object = rpm_object->next;
|
rpm_object = rpm_object->next;
|
||||||
} else {
|
} else {
|
||||||
Read_Access_Data = calloc(1,
|
Read_Access_Data =
|
||||||
sizeof(BACNET_READ_ACCESS_DATA));
|
calloc(1, sizeof(BACNET_READ_ACCESS_DATA));
|
||||||
rpm_object = Read_Access_Data;
|
rpm_object = Read_Access_Data;
|
||||||
atexit(cleanup);
|
atexit(cleanup);
|
||||||
}
|
}
|
||||||
status = bactext_object_type_strtol(
|
status =
|
||||||
argv[argi], &object_type);
|
bactext_object_type_strtol(argv[argi], &object_type);
|
||||||
if (status == false) {
|
if (status == false) {
|
||||||
fprintf(stderr, "Error: object-type=%s invalid\n",
|
fprintf(stderr, "Error: object-type=%s invalid\n",
|
||||||
argv[argi]);
|
argv[argi]);
|
||||||
@@ -445,7 +442,8 @@ int main(int argc, char *argv[])
|
|||||||
if (rpm_object->object_instance > BACNET_MAX_INSTANCE) {
|
if (rpm_object->object_instance > BACNET_MAX_INSTANCE) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"object-instance=%u - it must be less than %u\n",
|
"object-instance=%u - it must be less than %u\n",
|
||||||
rpm_object->object_instance, BACNET_MAX_INSTANCE + 1);
|
rpm_object->object_instance,
|
||||||
|
BACNET_MAX_INSTANCE + 1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
tag_value_arg++;
|
tag_value_arg++;
|
||||||
@@ -455,9 +453,8 @@ int main(int argc, char *argv[])
|
|||||||
property_token = strtok(argv[argi], ",");
|
property_token = strtok(argv[argi], ",");
|
||||||
/* add all the properties and optional index to our list */
|
/* add all the properties and optional index to our list */
|
||||||
while (rpm_property) {
|
while (rpm_property) {
|
||||||
scan_count = sscanf(
|
scan_count = sscanf(property_token, "%u[%u]",
|
||||||
property_token, "%u[%u]", &property_id,
|
&property_id, &property_array_index);
|
||||||
&property_array_index);
|
|
||||||
if (scan_count > 0) {
|
if (scan_count > 0) {
|
||||||
rpm_property->propertyIdentifier = property_id;
|
rpm_property->propertyIdentifier = property_id;
|
||||||
if (rpm_property->propertyIdentifier >
|
if (rpm_property->propertyIdentifier >
|
||||||
@@ -489,7 +486,6 @@ int main(int argc, char *argv[])
|
|||||||
/* start over with the next arg set */
|
/* start over with the next arg set */
|
||||||
tag_value_arg = 0;
|
tag_value_arg = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1149,16 +1149,16 @@ int main(int argc, char *argv[])
|
|||||||
/* input */
|
/* input */
|
||||||
current_seconds = time(NULL);
|
current_seconds = time(NULL);
|
||||||
/* returns 0 bytes on timeout */
|
/* returns 0 bytes on timeout */
|
||||||
pdu_len = bip_receive(&src, &BIP_Rx_Buffer[0],
|
pdu_len =
|
||||||
sizeof(BIP_Rx_Buffer), 5);
|
bip_receive(&src, &BIP_Rx_Buffer[0], sizeof(BIP_Rx_Buffer), 5);
|
||||||
/* process */
|
/* process */
|
||||||
if (pdu_len) {
|
if (pdu_len) {
|
||||||
debug_printf("BACnet/IP Received packet\n");
|
debug_printf("BACnet/IP Received packet\n");
|
||||||
my_routing_npdu_handler(BIP_Net, &src, &BIP_Rx_Buffer[0], pdu_len);
|
my_routing_npdu_handler(BIP_Net, &src, &BIP_Rx_Buffer[0], pdu_len);
|
||||||
}
|
}
|
||||||
/* returns 0 bytes on timeout */
|
/* returns 0 bytes on timeout */
|
||||||
pdu_len = bip6_receive(&src, &BIP6_Rx_Buffer[0],
|
pdu_len =
|
||||||
sizeof(BIP6_Rx_Buffer), 5);
|
bip6_receive(&src, &BIP6_Rx_Buffer[0], sizeof(BIP6_Rx_Buffer), 5);
|
||||||
/* process */
|
/* process */
|
||||||
if (pdu_len) {
|
if (pdu_len) {
|
||||||
debug_printf("BACnet/IPv6 Received packet\n");
|
debug_printf("BACnet/IPv6 Received packet\n");
|
||||||
|
|||||||
@@ -1160,16 +1160,16 @@ int main(int argc, char *argv[])
|
|||||||
/* input */
|
/* input */
|
||||||
current_seconds = time(NULL);
|
current_seconds = time(NULL);
|
||||||
/* returns 0 bytes on timeout */
|
/* returns 0 bytes on timeout */
|
||||||
pdu_len = bip_receive(&src, &BIP_Rx_Buffer[0],
|
pdu_len =
|
||||||
sizeof(BIP_Rx_Buffer), 5);
|
bip_receive(&src, &BIP_Rx_Buffer[0], sizeof(BIP_Rx_Buffer), 5);
|
||||||
/* process */
|
/* process */
|
||||||
if (pdu_len) {
|
if (pdu_len) {
|
||||||
debug_printf("BACnet/IP Received packet\n");
|
debug_printf("BACnet/IP Received packet\n");
|
||||||
my_routing_npdu_handler(BIP_Net, &src, &BIP_Rx_Buffer[0], pdu_len);
|
my_routing_npdu_handler(BIP_Net, &src, &BIP_Rx_Buffer[0], pdu_len);
|
||||||
}
|
}
|
||||||
/* returns 0 bytes on timeout */
|
/* returns 0 bytes on timeout */
|
||||||
pdu_len = dlmstp_receive(&src, &MSTP_Rx_Buffer[0],
|
pdu_len =
|
||||||
sizeof(MSTP_Rx_Buffer), 5);
|
dlmstp_receive(&src, &MSTP_Rx_Buffer[0], sizeof(MSTP_Rx_Buffer), 5);
|
||||||
/* process */
|
/* process */
|
||||||
if (pdu_len) {
|
if (pdu_len) {
|
||||||
debug_printf("BACnet MS/TP Received packet\n");
|
debug_printf("BACnet MS/TP Received packet\n");
|
||||||
|
|||||||
@@ -189,7 +189,8 @@ bool dl_ip_init(ROUTER_PORT *port, IP_DATA *ip_data)
|
|||||||
|
|
||||||
/* bind the socket to the local port number */
|
/* bind the socket to the local port number */
|
||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
/* sin.sin_addr.s_addr, ip_data->local_addr.s_addr;// = htonl(INADDR_ANY); */
|
/* sin.sin_addr.s_addr, ip_data->local_addr.s_addr;// =
|
||||||
|
* htonl(INADDR_ANY); */
|
||||||
sin.sin_addr.s_addr = htonl(INADDR_ANY);
|
sin.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||||
sin.sin_port = ip_data->port;
|
sin.sin_port = ip_data->port;
|
||||||
|
|
||||||
|
|||||||
@@ -62,8 +62,7 @@ BACMSG *recv_from_msgbox(MSGBOX_ID src, BACMSG *msg, int flags)
|
|||||||
{
|
{
|
||||||
int recv_bytes;
|
int recv_bytes;
|
||||||
|
|
||||||
recv_bytes =
|
recv_bytes = msgrcv(src, msg, sizeof(BACMSG) - sizeof(MSGTYPE), 0, flags);
|
||||||
msgrcv(src, msg, sizeof(BACMSG) - sizeof(MSGTYPE), 0, flags);
|
|
||||||
if (recv_bytes > 0) {
|
if (recv_bytes > 0) {
|
||||||
return msg;
|
return msg;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+1
-2
@@ -183,8 +183,7 @@ int main(int argc, char *argv[])
|
|||||||
cov_data.timeRemaining = strtol(argv[5], NULL, 0);
|
cov_data.timeRemaining = strtol(argv[5], NULL, 0);
|
||||||
cov_data.listOfValues = &value_list;
|
cov_data.listOfValues = &value_list;
|
||||||
value_list.next = NULL;
|
value_list.next = NULL;
|
||||||
if (bactext_property_strtol(argv[6], &object_property) ==
|
if (bactext_property_strtol(argv[6], &object_property) == false) {
|
||||||
false) {
|
|
||||||
fprintf(stderr, "property=%s invalid\n", argv[6]);
|
fprintf(stderr, "property=%s invalid\n", argv[6]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,8 +104,8 @@ static void My_Router_Handler(BACNET_ADDRESS *src,
|
|||||||
that are sent with a local unicast address. */
|
that are sent with a local unicast address. */
|
||||||
if (npdu_len >= 2) {
|
if (npdu_len >= 2) {
|
||||||
len += decode_unsigned16(npdu, &dnet);
|
len += decode_unsigned16(npdu, &dnet);
|
||||||
printf(": network number = %u. SNET=%u\n",
|
printf(": network number = %u. SNET=%u\n", (unsigned)dnet,
|
||||||
(unsigned)dnet, (unsigned)src->net);
|
(unsigned)src->net);
|
||||||
} else {
|
} else {
|
||||||
printf(": network number = missing! SNET=%u\n", src->net);
|
printf(": network number = missing! SNET=%u\n", src->net);
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -497,8 +497,8 @@ int main(int argc, char *argv[])
|
|||||||
/* loop forever */
|
/* loop forever */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
/* returns 0 bytes on timeout */
|
/* returns 0 bytes on timeout */
|
||||||
pdu_len = datalink_receive(&src, &Rx_Buf[0], MAX_MPDU,
|
pdu_len =
|
||||||
delay_milliseconds);
|
datalink_receive(&src, &Rx_Buf[0], MAX_MPDU, delay_milliseconds);
|
||||||
/* process */
|
/* process */
|
||||||
if (pdu_len) {
|
if (pdu_len) {
|
||||||
npdu_handler(&src, &Rx_Buf[0], pdu_len);
|
npdu_handler(&src, &Rx_Buf[0], pdu_len);
|
||||||
@@ -507,13 +507,13 @@ int main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (mstimer_expired(&datalink_timer)) {
|
if (mstimer_expired(&datalink_timer)) {
|
||||||
datalink_maintenance_timer(mstimer_interval(&datalink_timer)/1000);
|
datalink_maintenance_timer(
|
||||||
|
mstimer_interval(&datalink_timer) / 1000);
|
||||||
mstimer_reset(&datalink_timer);
|
mstimer_reset(&datalink_timer);
|
||||||
}
|
}
|
||||||
if (mstimer_expired(&apdu_timer)) {
|
if (mstimer_expired(&apdu_timer)) {
|
||||||
if (repeat_forever || retry_count) {
|
if (repeat_forever || retry_count) {
|
||||||
Send_WhoIs_To_Network(
|
Send_WhoIs_To_Network(&dest, Target_Object_Instance_Min,
|
||||||
&dest, Target_Object_Instance_Min,
|
|
||||||
Target_Object_Instance_Max);
|
Target_Object_Instance_Max);
|
||||||
retry_count--;
|
retry_count--;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -123,7 +123,6 @@ int main(int argc, char *argv[])
|
|||||||
int c = 0;
|
int c = 0;
|
||||||
uint16_t result_code = 0;
|
uint16_t result_code = 0;
|
||||||
|
|
||||||
|
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
printf("Usage: %s IP port <IP:port[:mask]> [<IP:port[:mask]>]\r\n",
|
printf("Usage: %s IP port <IP:port[:mask]> [<IP:port[:mask]>]\r\n",
|
||||||
filename_remove_path(argv[0]));
|
filename_remove_path(argv[0]));
|
||||||
@@ -148,8 +147,8 @@ int main(int argc, char *argv[])
|
|||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
argi = 1;
|
argi = 1;
|
||||||
if (!bip_get_addr_by_name(argv[argi], &Target_BBMD_Address)) {
|
if (!bip_get_addr_by_name(argv[argi], &Target_BBMD_Address)) {
|
||||||
fprintf(stderr, "IP=%s - failed to convert address.\r\n",
|
fprintf(
|
||||||
argv[argi]);
|
stderr, "IP=%s - failed to convert address.\r\n", argv[argi]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -172,8 +171,8 @@ int main(int argc, char *argv[])
|
|||||||
argi = 3;
|
argi = 3;
|
||||||
while (argc > argi) {
|
while (argc > argi) {
|
||||||
bdt_entry = &BBMD_Table_Entry[bdti];
|
bdt_entry = &BBMD_Table_Entry[bdti];
|
||||||
c = sscanf(argv[argi], "%3u.%3u.%3u.%3u:%5u:%3u.%3u.%3u.%3u",
|
c = sscanf(argv[argi], "%3u.%3u.%3u.%3u:%5u:%3u.%3u.%3u.%3u", &a[0],
|
||||||
&a[0], &a[1], &a[2], &a[3], &p, &m[0], &m[1], &m[2], &m[3]);
|
&a[1], &a[2], &a[3], &p, &m[0], &m[1], &m[2], &m[3]);
|
||||||
if ((c == 4) || (c == 5) || (c == 9)) {
|
if ((c == 4) || (c == 5) || (c == 9)) {
|
||||||
bvlc_address_set(&bdt_entry->dest_address, a[0], a[1], a[2], a[3]);
|
bvlc_address_set(&bdt_entry->dest_address, a[0], a[1], a[2], a[3]);
|
||||||
if ((c == 5) || (c == 9)) {
|
if ((c == 5) || (c == 9)) {
|
||||||
@@ -216,8 +215,7 @@ int main(int argc, char *argv[])
|
|||||||
if (bvlc_get_function_code() != BVLC_INVALID) {
|
if (bvlc_get_function_code() != BVLC_INVALID) {
|
||||||
if (bvlc_get_function_code() == BVLC_RESULT) {
|
if (bvlc_get_function_code() == BVLC_RESULT) {
|
||||||
result_code = bvlc_get_last_result();
|
result_code = bvlc_get_last_result();
|
||||||
printf("BVLC Result: %s\n",
|
printf("BVLC Result: %s\n", bvlc_result_code_name(result_code));
|
||||||
bvlc_result_code_name(result_code));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
bvlc_set_function_code(BVLC_INVALID);
|
bvlc_set_function_code(BVLC_INVALID);
|
||||||
|
|||||||
@@ -338,7 +338,8 @@ int main(int argc, char *argv[])
|
|||||||
tag_value_arg++;
|
tag_value_arg++;
|
||||||
args_remaining--;
|
args_remaining--;
|
||||||
if (property_tag < 0) {
|
if (property_tag < 0) {
|
||||||
property_tag = bacapp_known_property_tag(Target_Object_Type, Target_Object_Property);
|
property_tag = bacapp_known_property_tag(
|
||||||
|
Target_Object_Type, Target_Object_Property);
|
||||||
} else if (property_tag >= MAX_BACNET_APPLICATION_TAG) {
|
} else if (property_tag >= MAX_BACNET_APPLICATION_TAG) {
|
||||||
fprintf(stderr, "Error: tag=%u - it must be less than %u\n",
|
fprintf(stderr, "Error: tag=%u - it must be less than %u\n",
|
||||||
property_tag, MAX_BACNET_APPLICATION_TAG);
|
property_tag, MAX_BACNET_APPLICATION_TAG);
|
||||||
@@ -354,8 +355,10 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* FIXME: show the expected entry format for the tag */
|
/* FIXME: show the expected entry format for the tag */
|
||||||
fprintf(stderr, "Error: unable to parse the known property"
|
fprintf(stderr,
|
||||||
" \"%s\"\r\n", value_string);
|
"Error: unable to parse the known property"
|
||||||
|
" \"%s\"\r\n",
|
||||||
|
value_string);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-7
@@ -70,8 +70,7 @@ static bool Error_Detected = false;
|
|||||||
/* Used for verbose */
|
/* Used for verbose */
|
||||||
static bool Verbose = false;
|
static bool Verbose = false;
|
||||||
|
|
||||||
static void MyWritePropertyMultipleErrorHandler(
|
static void MyWritePropertyMultipleErrorHandler(BACNET_ADDRESS *src,
|
||||||
BACNET_ADDRESS * src,
|
|
||||||
uint8_t invoke_id,
|
uint8_t invoke_id,
|
||||||
uint8_t service_choice,
|
uint8_t service_choice,
|
||||||
uint8_t *service_request,
|
uint8_t *service_request,
|
||||||
@@ -121,7 +120,6 @@ static void MyRejectHandler(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void MyWritePropertyMultipleSimpleAckHandler(
|
static void MyWritePropertyMultipleSimpleAckHandler(
|
||||||
BACNET_ADDRESS *src, uint8_t invoke_id)
|
BACNET_ADDRESS *src, uint8_t invoke_id)
|
||||||
{
|
{
|
||||||
@@ -428,7 +426,9 @@ int main(int argc, char *argv[])
|
|||||||
printf("tag=%u value=%s\n", property_tag, value_string);
|
printf("tag=%u value=%s\n", property_tag, value_string);
|
||||||
}
|
}
|
||||||
if (property_tag < 0) {
|
if (property_tag < 0) {
|
||||||
property_tag = bacapp_known_property_tag(wpm_object->object_type, wpm_property->propertyIdentifier);
|
property_tag =
|
||||||
|
bacapp_known_property_tag(wpm_object->object_type,
|
||||||
|
wpm_property->propertyIdentifier);
|
||||||
} else if (property_tag >= MAX_BACNET_APPLICATION_TAG) {
|
} else if (property_tag >= MAX_BACNET_APPLICATION_TAG) {
|
||||||
fprintf(stderr, "Error: tag=%u - it must be less than %u\n",
|
fprintf(stderr, "Error: tag=%u - it must be less than %u\n",
|
||||||
property_tag, MAX_BACNET_APPLICATION_TAG);
|
property_tag, MAX_BACNET_APPLICATION_TAG);
|
||||||
@@ -439,13 +439,16 @@ int main(int argc, char *argv[])
|
|||||||
property_tag, value_string, &wpm_property->value);
|
property_tag, value_string, &wpm_property->value);
|
||||||
if (!status) {
|
if (!status) {
|
||||||
/* FIXME: show the expected entry format for the tag */
|
/* FIXME: show the expected entry format for the tag */
|
||||||
fprintf(stderr, "Error: unable to parse the tag value\n");
|
fprintf(
|
||||||
|
stderr, "Error: unable to parse the tag value\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* FIXME: show the expected entry format for the tag */
|
/* FIXME: show the expected entry format for the tag */
|
||||||
fprintf(stderr, "Error: unable to parse the known property"
|
fprintf(stderr,
|
||||||
" \"%s\"\r\n", value_string);
|
"Error: unable to parse the known property"
|
||||||
|
" \"%s\"\r\n",
|
||||||
|
value_string);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
wpm_property->value.next = NULL;
|
wpm_property->value.next = NULL;
|
||||||
|
|||||||
+123
-133
@@ -87,8 +87,8 @@ int bacapp_encode_application_data(
|
|||||||
#endif
|
#endif
|
||||||
#if defined(BACAPP_UNSIGNED)
|
#if defined(BACAPP_UNSIGNED)
|
||||||
case BACNET_APPLICATION_TAG_UNSIGNED_INT:
|
case BACNET_APPLICATION_TAG_UNSIGNED_INT:
|
||||||
apdu_len = encode_application_unsigned(
|
apdu_len =
|
||||||
apdu, value->type.Unsigned_Int);
|
encode_application_unsigned(apdu, value->type.Unsigned_Int);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(BACAPP_SIGNED)
|
#if defined(BACAPP_SIGNED)
|
||||||
@@ -104,8 +104,7 @@ int bacapp_encode_application_data(
|
|||||||
#endif
|
#endif
|
||||||
#if defined(BACAPP_DOUBLE)
|
#if defined(BACAPP_DOUBLE)
|
||||||
case BACNET_APPLICATION_TAG_DOUBLE:
|
case BACNET_APPLICATION_TAG_DOUBLE:
|
||||||
apdu_len =
|
apdu_len = encode_application_double(apdu, value->type.Double);
|
||||||
encode_application_double(apdu, value->type.Double);
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(BACAPP_OCTET_STRING)
|
#if defined(BACAPP_OCTET_STRING)
|
||||||
@@ -122,14 +121,14 @@ int bacapp_encode_application_data(
|
|||||||
#endif
|
#endif
|
||||||
#if defined(BACAPP_BIT_STRING)
|
#if defined(BACAPP_BIT_STRING)
|
||||||
case BACNET_APPLICATION_TAG_BIT_STRING:
|
case BACNET_APPLICATION_TAG_BIT_STRING:
|
||||||
apdu_len = encode_application_bitstring(
|
apdu_len =
|
||||||
apdu, &value->type.Bit_String);
|
encode_application_bitstring(apdu, &value->type.Bit_String);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(BACAPP_ENUMERATED)
|
#if defined(BACAPP_ENUMERATED)
|
||||||
case BACNET_APPLICATION_TAG_ENUMERATED:
|
case BACNET_APPLICATION_TAG_ENUMERATED:
|
||||||
apdu_len = encode_application_enumerated(
|
apdu_len =
|
||||||
apdu, value->type.Enumerated);
|
encode_application_enumerated(apdu, value->type.Enumerated);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(BACAPP_DATE)
|
#if defined(BACAPP_DATE)
|
||||||
@@ -156,8 +155,7 @@ int bacapp_encode_application_data(
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_DATETIME:
|
case BACNET_APPLICATION_TAG_DATETIME:
|
||||||
apdu_len = bacapp_encode_datetime(apdu,
|
apdu_len = bacapp_encode_datetime(apdu, &value->type.Date_Time);
|
||||||
&value->type.Date_Time);
|
|
||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_LIGHTING_COMMAND:
|
case BACNET_APPLICATION_TAG_LIGHTING_COMMAND:
|
||||||
/* BACnetLightingCommand */
|
/* BACnetLightingCommand */
|
||||||
@@ -166,13 +164,12 @@ int bacapp_encode_application_data(
|
|||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_XY_COLOR:
|
case BACNET_APPLICATION_TAG_XY_COLOR:
|
||||||
/* BACnetxyColor */
|
/* BACnetxyColor */
|
||||||
apdu_len = xy_color_encode(
|
apdu_len = xy_color_encode(apdu, &value->type.XY_Color);
|
||||||
apdu, &value->type.XY_Color);
|
|
||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_COLOR_COMMAND:
|
case BACNET_APPLICATION_TAG_COLOR_COMMAND:
|
||||||
/* BACnetColorCommand */
|
/* BACnetColorCommand */
|
||||||
apdu_len = color_command_encode(
|
apdu_len =
|
||||||
apdu, &value->type.Color_Command);
|
color_command_encode(apdu, &value->type.Color_Command);
|
||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_WEEKLY_SCHEDULE:
|
case BACNET_APPLICATION_TAG_WEEKLY_SCHEDULE:
|
||||||
/* BACnetWeeklySchedule */
|
/* BACnetWeeklySchedule */
|
||||||
@@ -181,8 +178,7 @@ int bacapp_encode_application_data(
|
|||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_HOST_N_PORT:
|
case BACNET_APPLICATION_TAG_HOST_N_PORT:
|
||||||
/* BACnetHostNPort */
|
/* BACnetHostNPort */
|
||||||
apdu_len = host_n_port_encode(apdu,
|
apdu_len = host_n_port_encode(apdu, &value->type.Host_Address);
|
||||||
&value->type.Host_Address);
|
|
||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_DEVICE_OBJECT_PROPERTY_REFERENCE:
|
case BACNET_APPLICATION_TAG_DEVICE_OBJECT_PROPERTY_REFERENCE:
|
||||||
/* BACnetDeviceObjectPropertyReference */
|
/* BACnetDeviceObjectPropertyReference */
|
||||||
@@ -251,8 +247,8 @@ int bacapp_decode_data(uint8_t *apdu,
|
|||||||
#endif
|
#endif
|
||||||
#if defined(BACAPP_REAL)
|
#if defined(BACAPP_REAL)
|
||||||
case BACNET_APPLICATION_TAG_REAL:
|
case BACNET_APPLICATION_TAG_REAL:
|
||||||
len = decode_real_safe(
|
len =
|
||||||
apdu, len_value_type, &(value->type.Real));
|
decode_real_safe(apdu, len_value_type, &(value->type.Real));
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(BACAPP_DOUBLE)
|
#if defined(BACAPP_DOUBLE)
|
||||||
@@ -287,8 +283,7 @@ int bacapp_decode_data(uint8_t *apdu,
|
|||||||
#endif
|
#endif
|
||||||
#if defined(BACAPP_DATE)
|
#if defined(BACAPP_DATE)
|
||||||
case BACNET_APPLICATION_TAG_DATE:
|
case BACNET_APPLICATION_TAG_DATE:
|
||||||
len = decode_date_safe(
|
len = decode_date_safe(apdu, len_value_type, &value->type.Date);
|
||||||
apdu, len_value_type, &value->type.Date);
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(BACAPP_TIME)
|
#if defined(BACAPP_TIME)
|
||||||
@@ -309,8 +304,7 @@ int bacapp_decode_data(uint8_t *apdu,
|
|||||||
#endif
|
#endif
|
||||||
#if defined(BACAPP_TYPES_EXTRA)
|
#if defined(BACAPP_TYPES_EXTRA)
|
||||||
case BACNET_APPLICATION_TAG_DATETIME:
|
case BACNET_APPLICATION_TAG_DATETIME:
|
||||||
len = bacapp_decode_datetime(apdu,
|
len = bacapp_decode_datetime(apdu, &value->type.Date_Time);
|
||||||
&value->type.Date_Time);
|
|
||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_LIGHTING_COMMAND:
|
case BACNET_APPLICATION_TAG_LIGHTING_COMMAND:
|
||||||
len = lighting_command_decode(
|
len = lighting_command_decode(
|
||||||
@@ -332,8 +326,7 @@ int bacapp_decode_data(uint8_t *apdu,
|
|||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_HOST_N_PORT:
|
case BACNET_APPLICATION_TAG_HOST_N_PORT:
|
||||||
len = host_n_port_decode(
|
len = host_n_port_decode(
|
||||||
apdu, len_value_type, NULL,
|
apdu, len_value_type, NULL, &value->type.Host_Address);
|
||||||
&value->type.Host_Address);
|
|
||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_DEVICE_OBJECT_PROPERTY_REFERENCE:
|
case BACNET_APPLICATION_TAG_DEVICE_OBJECT_PROPERTY_REFERENCE:
|
||||||
/* BACnetDeviceObjectPropertyReference */
|
/* BACnetDeviceObjectPropertyReference */
|
||||||
@@ -347,8 +340,7 @@ int bacapp_decode_data(uint8_t *apdu,
|
|||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_OBJECT_PROPERTY_REFERENCE:
|
case BACNET_APPLICATION_TAG_OBJECT_PROPERTY_REFERENCE:
|
||||||
/* BACnetObjectPropertyReference */
|
/* BACnetObjectPropertyReference */
|
||||||
len = bacapp_decode_obj_property_ref(
|
len = bacapp_decode_obj_property_ref(apdu, len_value_type,
|
||||||
apdu, len_value_type,
|
|
||||||
&value->type.Object_Property_Reference);
|
&value->type.Object_Property_Reference);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@@ -601,8 +593,8 @@ int bacapp_encode_context_data_value(uint8_t *apdu,
|
|||||||
#endif
|
#endif
|
||||||
#if defined(BACAPP_CHARACTER_STRING)
|
#if defined(BACAPP_CHARACTER_STRING)
|
||||||
case BACNET_APPLICATION_TAG_CHARACTER_STRING:
|
case BACNET_APPLICATION_TAG_CHARACTER_STRING:
|
||||||
apdu_len = encode_context_character_string(apdu,
|
apdu_len = encode_context_character_string(
|
||||||
context_tag_number, &value->type.Character_String);
|
apdu, context_tag_number, &value->type.Character_String);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(BACAPP_BIT_STRING)
|
#if defined(BACAPP_BIT_STRING)
|
||||||
@@ -631,19 +623,18 @@ int bacapp_encode_context_data_value(uint8_t *apdu,
|
|||||||
#endif
|
#endif
|
||||||
#if defined(BACAPP_OBJECT_ID)
|
#if defined(BACAPP_OBJECT_ID)
|
||||||
case BACNET_APPLICATION_TAG_OBJECT_ID:
|
case BACNET_APPLICATION_TAG_OBJECT_ID:
|
||||||
apdu_len = encode_context_object_id(apdu,
|
apdu_len = encode_context_object_id(apdu, context_tag_number,
|
||||||
context_tag_number, value->type.Object_Id.type,
|
value->type.Object_Id.type, value->type.Object_Id.instance);
|
||||||
value->type.Object_Id.instance);
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(BACAPP_TYPES_EXTRA)
|
#if defined(BACAPP_TYPES_EXTRA)
|
||||||
case BACNET_APPLICATION_TAG_DATETIME:
|
case BACNET_APPLICATION_TAG_DATETIME:
|
||||||
apdu_len = bacapp_encode_context_datetime(apdu,
|
apdu_len = bacapp_encode_context_datetime(
|
||||||
context_tag_number, &value->type.Date_Time);
|
apdu, context_tag_number, &value->type.Date_Time);
|
||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_LIGHTING_COMMAND:
|
case BACNET_APPLICATION_TAG_LIGHTING_COMMAND:
|
||||||
apdu_len = lighting_command_encode_context(apdu,
|
apdu_len = lighting_command_encode_context(
|
||||||
context_tag_number, &value->type.Lighting_Command);
|
apdu, context_tag_number, &value->type.Lighting_Command);
|
||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_XY_COLOR:
|
case BACNET_APPLICATION_TAG_XY_COLOR:
|
||||||
/* BACnetxyColor */
|
/* BACnetxyColor */
|
||||||
@@ -661,26 +652,24 @@ int bacapp_encode_context_data_value(uint8_t *apdu,
|
|||||||
apdu, context_tag_number, &value->type.Color_Command);
|
apdu, context_tag_number, &value->type.Color_Command);
|
||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_HOST_N_PORT:
|
case BACNET_APPLICATION_TAG_HOST_N_PORT:
|
||||||
apdu_len = host_n_port_context_encode(apdu,
|
apdu_len = host_n_port_context_encode(
|
||||||
context_tag_number, &value->type.Host_Address);
|
apdu, context_tag_number, &value->type.Host_Address);
|
||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_DEVICE_OBJECT_PROPERTY_REFERENCE:
|
case BACNET_APPLICATION_TAG_DEVICE_OBJECT_PROPERTY_REFERENCE:
|
||||||
/* BACnetDeviceObjectPropertyReference */
|
/* BACnetDeviceObjectPropertyReference */
|
||||||
apdu_len = bacapp_encode_context_device_obj_property_ref(
|
apdu_len = bacapp_encode_context_device_obj_property_ref(apdu,
|
||||||
apdu, context_tag_number,
|
context_tag_number,
|
||||||
&value->type.Device_Object_Property_Reference);
|
&value->type.Device_Object_Property_Reference);
|
||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_DEVICE_OBJECT_REFERENCE:
|
case BACNET_APPLICATION_TAG_DEVICE_OBJECT_REFERENCE:
|
||||||
/* BACnetDeviceObjectReference */
|
/* BACnetDeviceObjectReference */
|
||||||
apdu_len = bacapp_encode_context_device_obj_ref(
|
apdu_len = bacapp_encode_context_device_obj_ref(apdu,
|
||||||
apdu, context_tag_number,
|
context_tag_number, &value->type.Device_Object_Reference);
|
||||||
&value->type.Device_Object_Reference);
|
|
||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_OBJECT_PROPERTY_REFERENCE:
|
case BACNET_APPLICATION_TAG_OBJECT_PROPERTY_REFERENCE:
|
||||||
/* BACnetObjectPropertyReference */
|
/* BACnetObjectPropertyReference */
|
||||||
apdu_len = bacapp_encode_context_obj_property_ref(
|
apdu_len = bacapp_encode_context_obj_property_ref(apdu,
|
||||||
apdu, context_tag_number,
|
context_tag_number, &value->type.Object_Property_Reference);
|
||||||
&value->type.Object_Property_Reference);
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
@@ -972,8 +961,7 @@ int bacapp_decode_context_data(uint8_t *apdu,
|
|||||||
* @param property - context property identifier
|
* @param property - context property identifier
|
||||||
* @return number of bytes decoded, or ERROR if errors occur
|
* @return number of bytes decoded, or ERROR if errors occur
|
||||||
*/
|
*/
|
||||||
int bacapp_decode_generic_property(
|
int bacapp_decode_generic_property(uint8_t *apdu,
|
||||||
uint8_t * apdu,
|
|
||||||
int max_apdu_len,
|
int max_apdu_len,
|
||||||
BACNET_APPLICATION_DATA_VALUE *value,
|
BACNET_APPLICATION_DATA_VALUE *value,
|
||||||
BACNET_PROPERTY_ID prop)
|
BACNET_PROPERTY_ID prop)
|
||||||
@@ -1029,8 +1017,7 @@ static int decode_priority_value(uint8_t *apdu,
|
|||||||
|
|
||||||
#if defined(BACAPP_TYPES_EXTRA)
|
#if defined(BACAPP_TYPES_EXTRA)
|
||||||
int bacapp_known_property_tag(
|
int bacapp_known_property_tag(
|
||||||
BACNET_OBJECT_TYPE object_type,
|
BACNET_OBJECT_TYPE object_type, BACNET_PROPERTY_ID property)
|
||||||
BACNET_PROPERTY_ID property)
|
|
||||||
{
|
{
|
||||||
switch (property) {
|
switch (property) {
|
||||||
case PROP_MEMBER_OF:
|
case PROP_MEMBER_OF:
|
||||||
@@ -1238,8 +1225,8 @@ int bacapp_decode_known_property(uint8_t *apdu,
|
|||||||
case PROP_LOG_DEVICE_OBJECT_PROPERTY:
|
case PROP_LOG_DEVICE_OBJECT_PROPERTY:
|
||||||
case PROP_LIST_OF_OBJECT_PROPERTY_REFERENCES:
|
case PROP_LIST_OF_OBJECT_PROPERTY_REFERENCES:
|
||||||
/* Properties using BACnetDeviceObjectPropertyReference */
|
/* Properties using BACnetDeviceObjectPropertyReference */
|
||||||
len = bacapp_decode_device_obj_property_ref(apdu,
|
len = bacapp_decode_device_obj_property_ref(
|
||||||
&value->type.Device_Object_Property_Reference);
|
apdu, &value->type.Device_Object_Property_Reference);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_MANIPULATED_VARIABLE_REFERENCE:
|
case PROP_MANIPULATED_VARIABLE_REFERENCE:
|
||||||
@@ -1247,8 +1234,7 @@ int bacapp_decode_known_property(uint8_t *apdu,
|
|||||||
case PROP_INPUT_REFERENCE:
|
case PROP_INPUT_REFERENCE:
|
||||||
/* Properties using BACnetObjectPropertyReference */
|
/* Properties using BACnetObjectPropertyReference */
|
||||||
len = bacapp_decode_obj_property_ref(
|
len = bacapp_decode_obj_property_ref(
|
||||||
apdu, max_apdu_len,
|
apdu, max_apdu_len, &value->type.Object_Property_Reference);
|
||||||
&value->type.Object_Property_Reference);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_EVENT_TIME_STAMPS:
|
case PROP_EVENT_TIME_STAMPS:
|
||||||
@@ -1261,33 +1247,32 @@ int bacapp_decode_known_property(uint8_t *apdu,
|
|||||||
|
|
||||||
case PROP_DEFAULT_COLOR:
|
case PROP_DEFAULT_COLOR:
|
||||||
/* Properties using BACnetxyColor */
|
/* Properties using BACnetxyColor */
|
||||||
len = xy_color_decode(apdu, max_apdu_len,
|
len = xy_color_decode(apdu, max_apdu_len, &value->type.XY_Color);
|
||||||
&value->type.XY_Color);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_TRACKING_VALUE:
|
case PROP_TRACKING_VALUE:
|
||||||
case PROP_PRESENT_VALUE:
|
case PROP_PRESENT_VALUE:
|
||||||
if (object_type == OBJECT_COLOR) {
|
if (object_type == OBJECT_COLOR) {
|
||||||
/* Properties using BACnetxyColor */
|
/* Properties using BACnetxyColor */
|
||||||
len = xy_color_decode(apdu, max_apdu_len,
|
len =
|
||||||
&value->type.XY_Color);
|
xy_color_decode(apdu, max_apdu_len, &value->type.XY_Color);
|
||||||
} else {
|
} else {
|
||||||
/* Decode a "classic" simple property */
|
/* Decode a "classic" simple property */
|
||||||
len = bacapp_decode_generic_property(apdu, max_apdu_len, value,
|
len = bacapp_decode_generic_property(
|
||||||
property);
|
apdu, max_apdu_len, value, property);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_COLOR_COMMAND:
|
case PROP_COLOR_COMMAND:
|
||||||
/* Properties using BACnetColorCommand */
|
/* Properties using BACnetColorCommand */
|
||||||
len = color_command_decode(apdu, max_apdu_len, NULL,
|
len = color_command_decode(
|
||||||
&value->type.Color_Command);
|
apdu, max_apdu_len, NULL, &value->type.Color_Command);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_LIGHTING_COMMAND:
|
case PROP_LIGHTING_COMMAND:
|
||||||
/* Properties using BACnetLightingCommand */
|
/* Properties using BACnetLightingCommand */
|
||||||
len = lighting_command_decode(apdu, max_apdu_len,
|
len = lighting_command_decode(
|
||||||
&value->type.Lighting_Command);
|
apdu, max_apdu_len, &value->type.Lighting_Command);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_PRIORITY_ARRAY:
|
case PROP_PRIORITY_ARRAY:
|
||||||
@@ -1301,7 +1286,8 @@ int bacapp_decode_known_property(uint8_t *apdu,
|
|||||||
apdu, max_apdu_len, &value->type.Weekly_Schedule);
|
apdu, max_apdu_len, &value->type.Weekly_Schedule);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* properties without a specific decoder - fall through to default */
|
/* properties without a specific decoder - fall through to default
|
||||||
|
*/
|
||||||
|
|
||||||
case PROP_LIST_OF_GROUP_MEMBERS:
|
case PROP_LIST_OF_GROUP_MEMBERS:
|
||||||
/* Properties using ReadAccessSpecification */
|
/* Properties using ReadAccessSpecification */
|
||||||
@@ -1326,8 +1312,8 @@ int bacapp_decode_known_property(uint8_t *apdu,
|
|||||||
case PROP_ACTION:
|
case PROP_ACTION:
|
||||||
default:
|
default:
|
||||||
/* Decode a "classic" simple property */
|
/* Decode a "classic" simple property */
|
||||||
len = bacapp_decode_generic_property(apdu, max_apdu_len, value,
|
len = bacapp_decode_generic_property(
|
||||||
property);
|
apdu, max_apdu_len, value, property);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1477,8 +1463,7 @@ bool bacapp_copy(BACNET_APPLICATION_DATA_VALUE *dest_value,
|
|||||||
&src_value->type.Lighting_Command);
|
&src_value->type.Lighting_Command);
|
||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_HOST_N_PORT:
|
case BACNET_APPLICATION_TAG_HOST_N_PORT:
|
||||||
status =
|
status = host_n_port_copy(&dest_value->type.Host_Address,
|
||||||
host_n_port_copy(&dest_value->type.Host_Address,
|
|
||||||
&src_value->type.Host_Address);
|
&src_value->type.Host_Address);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@@ -1586,8 +1571,8 @@ static int bacapp_snprintf_date(char *str, size_t str_len, BACNET_DATE *bdate)
|
|||||||
/* false positive cppcheck - snprintf allows null pointers */
|
/* false positive cppcheck - snprintf allows null pointers */
|
||||||
/* cppcheck-suppress nullPointer */
|
/* cppcheck-suppress nullPointer */
|
||||||
/* cppcheck-suppress ctunullpointer */
|
/* cppcheck-suppress ctunullpointer */
|
||||||
slen = snprintf(str, str_len, "%s, %s",
|
slen =
|
||||||
bactext_day_of_week_name(bdate->wday),
|
snprintf(str, str_len, "%s, %s", bactext_day_of_week_name(bdate->wday),
|
||||||
bactext_month_name(bdate->month));
|
bactext_month_name(bdate->month));
|
||||||
if (str) {
|
if (str) {
|
||||||
str += slen;
|
str += slen;
|
||||||
@@ -1601,8 +1586,7 @@ static int bacapp_snprintf_date(char *str, size_t str_len, BACNET_DATE *bdate)
|
|||||||
if (bdate->day == 255) {
|
if (bdate->day == 255) {
|
||||||
slen = snprintf(str, str_len, " (unspecified), ");
|
slen = snprintf(str, str_len, " (unspecified), ");
|
||||||
} else {
|
} else {
|
||||||
slen = snprintf(str, str_len, " %u, ",
|
slen = snprintf(str, str_len, " %u, ", (unsigned)bdate->day);
|
||||||
(unsigned)bdate->day);
|
|
||||||
}
|
}
|
||||||
if (str) {
|
if (str) {
|
||||||
str += slen;
|
str += slen;
|
||||||
@@ -1616,8 +1600,7 @@ static int bacapp_snprintf_date(char *str, size_t str_len, BACNET_DATE *bdate)
|
|||||||
if (bdate->year == 2155) {
|
if (bdate->year == 2155) {
|
||||||
slen = snprintf(str, str_len, "(unspecified)");
|
slen = snprintf(str, str_len, "(unspecified)");
|
||||||
} else {
|
} else {
|
||||||
slen = snprintf(str, str_len, "%u",
|
slen = snprintf(str, str_len, "%u", (unsigned)bdate->year);
|
||||||
(unsigned)bdate->year);
|
|
||||||
}
|
}
|
||||||
ret_val += slen;
|
ret_val += slen;
|
||||||
|
|
||||||
@@ -1641,8 +1624,7 @@ static int bacapp_snprintf_time(char *str, size_t str_len, BACNET_TIME *btime)
|
|||||||
} else {
|
} else {
|
||||||
/* false positive cppcheck - snprintf allows null pointers */
|
/* false positive cppcheck - snprintf allows null pointers */
|
||||||
/* cppcheck-suppress nullPointer */
|
/* cppcheck-suppress nullPointer */
|
||||||
slen = snprintf(str, str_len, "%02u:",
|
slen = snprintf(str, str_len, "%02u:", (unsigned)btime->hour);
|
||||||
(unsigned)btime->hour);
|
|
||||||
}
|
}
|
||||||
if (str) {
|
if (str) {
|
||||||
str += slen;
|
str += slen;
|
||||||
@@ -1656,8 +1638,7 @@ static int bacapp_snprintf_time(char *str, size_t str_len, BACNET_TIME *btime)
|
|||||||
if (btime->min == 255) {
|
if (btime->min == 255) {
|
||||||
slen = snprintf(str, str_len, "**:");
|
slen = snprintf(str, str_len, "**:");
|
||||||
} else {
|
} else {
|
||||||
slen = snprintf(str, str_len, "%02u:",
|
slen = snprintf(str, str_len, "%02u:", (unsigned)btime->min);
|
||||||
(unsigned)btime->min);
|
|
||||||
}
|
}
|
||||||
if (str) {
|
if (str) {
|
||||||
str += slen;
|
str += slen;
|
||||||
@@ -1671,8 +1652,7 @@ static int bacapp_snprintf_time(char *str, size_t str_len, BACNET_TIME *btime)
|
|||||||
if (btime->sec == 255) {
|
if (btime->sec == 255) {
|
||||||
slen = snprintf(str, str_len, "**.");
|
slen = snprintf(str, str_len, "**.");
|
||||||
} else {
|
} else {
|
||||||
slen = snprintf(str, str_len, "%02u.",
|
slen = snprintf(str, str_len, "%02u.", (unsigned)btime->sec);
|
||||||
(unsigned)btime->sec);
|
|
||||||
}
|
}
|
||||||
if (str) {
|
if (str) {
|
||||||
str += slen;
|
str += slen;
|
||||||
@@ -1686,8 +1666,7 @@ static int bacapp_snprintf_time(char *str, size_t str_len, BACNET_TIME *btime)
|
|||||||
if (btime->hundredths == 255) {
|
if (btime->hundredths == 255) {
|
||||||
slen = snprintf(str, str_len, "**");
|
slen = snprintf(str, str_len, "**");
|
||||||
} else {
|
} else {
|
||||||
slen = snprintf(str, str_len, "%02u",
|
slen = snprintf(str, str_len, "%02u", (unsigned)btime->hundredths);
|
||||||
(unsigned)btime->hundredths);
|
|
||||||
}
|
}
|
||||||
ret_val += slen;
|
ret_val += slen;
|
||||||
|
|
||||||
@@ -1696,8 +1675,7 @@ static int bacapp_snprintf_time(char *str, size_t str_len, BACNET_TIME *btime)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(BACAPP_TYPES_EXTRA)
|
#if defined(BACAPP_TYPES_EXTRA)
|
||||||
static int bacapp_snprintf_weeklyschedule(
|
static int bacapp_snprintf_weeklyschedule(char *str,
|
||||||
char *str,
|
|
||||||
size_t str_len,
|
size_t str_len,
|
||||||
BACNET_WEEKLY_SCHEDULE *ws,
|
BACNET_WEEKLY_SCHEDULE *ws,
|
||||||
BACNET_ARRAY_INDEX arrayIndex)
|
BACNET_ARRAY_INDEX arrayIndex)
|
||||||
@@ -1708,9 +1686,8 @@ static int bacapp_snprintf_weeklyschedule(
|
|||||||
BACNET_OBJECT_PROPERTY_VALUE dummyPropValue;
|
BACNET_OBJECT_PROPERTY_VALUE dummyPropValue;
|
||||||
BACNET_APPLICATION_DATA_VALUE dummyDataValue;
|
BACNET_APPLICATION_DATA_VALUE dummyDataValue;
|
||||||
|
|
||||||
const char *weekdaynames[7] = {
|
const char *weekdaynames[7] = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
|
||||||
"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"
|
"Sun" };
|
||||||
};
|
|
||||||
const int loopend = ((arrayIndex == BACNET_ARRAY_ALL) ? 7 : 1);
|
const int loopend = ((arrayIndex == BACNET_ARRAY_ALL) ? 7 : 1);
|
||||||
|
|
||||||
// Find what inner type it uses
|
// Find what inner type it uses
|
||||||
@@ -1732,7 +1709,8 @@ static int bacapp_snprintf_weeklyschedule(
|
|||||||
} else if (inner_tag == -2) {
|
} else if (inner_tag == -2) {
|
||||||
slen = snprintf(str, str_len, "(MIXED_TYPES; ");
|
slen = snprintf(str, str_len, "(MIXED_TYPES; ");
|
||||||
} else {
|
} else {
|
||||||
slen = snprintf(str, str_len, "(%s; ", bactext_application_tag_name(inner_tag));
|
slen = snprintf(
|
||||||
|
str, str_len, "(%s; ", bactext_application_tag_name(inner_tag));
|
||||||
}
|
}
|
||||||
ret_val += slen;
|
ret_val += slen;
|
||||||
if (str) {
|
if (str) {
|
||||||
@@ -1749,10 +1727,10 @@ static int bacapp_snprintf_weeklyschedule(
|
|||||||
if (arrayIndex == BACNET_ARRAY_ALL) {
|
if (arrayIndex == BACNET_ARRAY_ALL) {
|
||||||
slen = snprintf(str, str_len, "%s: [", weekdaynames[wi]);
|
slen = snprintf(str, str_len, "%s: [", weekdaynames[wi]);
|
||||||
} else {
|
} else {
|
||||||
slen = snprintf(
|
slen = snprintf(str, str_len, "%s: [",
|
||||||
str, str_len, "%s: [",
|
(arrayIndex >= 1 && arrayIndex <= 7)
|
||||||
(arrayIndex >= 1 && arrayIndex <= 7) ? weekdaynames[arrayIndex - 1] : "???"
|
? weekdaynames[arrayIndex - 1]
|
||||||
);
|
: "???");
|
||||||
}
|
}
|
||||||
ret_val += slen;
|
ret_val += slen;
|
||||||
if (str) {
|
if (str) {
|
||||||
@@ -1765,7 +1743,8 @@ static int bacapp_snprintf_weeklyschedule(
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (ti = 0; ti < ds->TV_Count; ti++) {
|
for (ti = 0; ti < ds->TV_Count; ti++) {
|
||||||
slen = bacapp_snprintf_time(str, str_len, &ds->Time_Values[ti].Time);
|
slen =
|
||||||
|
bacapp_snprintf_time(str, str_len, &ds->Time_Values[ti].Time);
|
||||||
ret_val += slen;
|
ret_val += slen;
|
||||||
if (str) {
|
if (str) {
|
||||||
str += slen;
|
str += slen;
|
||||||
@@ -1837,7 +1816,6 @@ static int bacapp_snprintf_weeklyschedule(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Extract the value into a text string
|
* @brief Extract the value into a text string
|
||||||
* @param str - the buffer to store the extracted value, or NULL for length
|
* @param str - the buffer to store the extracted value, or NULL for length
|
||||||
@@ -2125,14 +2103,12 @@ int bacapp_snprintf_value(
|
|||||||
#endif
|
#endif
|
||||||
#if defined(BACAPP_DATE)
|
#if defined(BACAPP_DATE)
|
||||||
case BACNET_APPLICATION_TAG_DATE:
|
case BACNET_APPLICATION_TAG_DATE:
|
||||||
ret_val = bacapp_snprintf_date(str, str_len,
|
ret_val = bacapp_snprintf_date(str, str_len, &value->type.Date);
|
||||||
&value->type.Date);
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(BACAPP_TIME)
|
#if defined(BACAPP_TIME)
|
||||||
case BACNET_APPLICATION_TAG_TIME:
|
case BACNET_APPLICATION_TAG_TIME:
|
||||||
ret_val = bacapp_snprintf_time(str, str_len,
|
ret_val = bacapp_snprintf_time(str, str_len, &value->type.Time);
|
||||||
&value->type.Time);
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(BACAPP_OBJECT_ID)
|
#if defined(BACAPP_OBJECT_ID)
|
||||||
@@ -2174,8 +2150,7 @@ int bacapp_snprintf_value(
|
|||||||
#endif
|
#endif
|
||||||
#if defined(BACAPP_TYPES_EXTRA)
|
#if defined(BACAPP_TYPES_EXTRA)
|
||||||
case BACNET_APPLICATION_TAG_DATETIME:
|
case BACNET_APPLICATION_TAG_DATETIME:
|
||||||
slen = bacapp_snprintf_date(str, str_len,
|
slen = bacapp_snprintf_date(str, str_len, &value->type.Date);
|
||||||
&value->type.Date);
|
|
||||||
ret_val += slen;
|
ret_val += slen;
|
||||||
if (str) {
|
if (str) {
|
||||||
str += slen;
|
str += slen;
|
||||||
@@ -2185,8 +2160,7 @@ int bacapp_snprintf_value(
|
|||||||
str_len = 0;
|
str_len = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
slen = bacapp_snprintf_time(str, str_len,
|
slen = bacapp_snprintf_time(str, str_len, &value->type.Time);
|
||||||
&value->type.Time);
|
|
||||||
ret_val += slen;
|
ret_val += slen;
|
||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_LIGHTING_COMMAND:
|
case BACNET_APPLICATION_TAG_LIGHTING_COMMAND:
|
||||||
@@ -2252,18 +2226,16 @@ int bacapp_snprintf_value(
|
|||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_WEEKLY_SCHEDULE:
|
case BACNET_APPLICATION_TAG_WEEKLY_SCHEDULE:
|
||||||
/* BACnetWeeklySchedule */
|
/* BACnetWeeklySchedule */
|
||||||
ret_val = bacapp_snprintf_weeklyschedule(
|
ret_val = bacapp_snprintf_weeklyschedule(str, str_len,
|
||||||
str, str_len, &value->type.Weekly_Schedule, object_value->array_index);
|
&value->type.Weekly_Schedule, object_value->array_index);
|
||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_HOST_N_PORT:
|
case BACNET_APPLICATION_TAG_HOST_N_PORT:
|
||||||
if (value->type.Host_Address.host_ip_address) {
|
if (value->type.Host_Address.host_ip_address) {
|
||||||
octet_str = octetstring_value(
|
octet_str = octetstring_value(
|
||||||
&value->type.Host_Address.host.ip_address);
|
&value->type.Host_Address.host.ip_address);
|
||||||
slen = snprintf(str, str_len, "%u.%u.%u.%u:%u",
|
slen = snprintf(str, str_len, "%u.%u.%u.%u:%u",
|
||||||
(unsigned)octet_str[0],
|
(unsigned)octet_str[0], (unsigned)octet_str[1],
|
||||||
(unsigned)octet_str[1],
|
(unsigned)octet_str[2], (unsigned)octet_str[3],
|
||||||
(unsigned)octet_str[2],
|
|
||||||
(unsigned)octet_str[3],
|
|
||||||
(unsigned)value->type.Host_Address.port);
|
(unsigned)value->type.Host_Address.port);
|
||||||
ret_val += slen;
|
ret_val += slen;
|
||||||
} else if (value->type.Host_Address.host_name) {
|
} else if (value->type.Host_Address.host_name) {
|
||||||
@@ -2304,7 +2276,8 @@ int bacapp_snprintf_value(
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
ret_val = snprintf(str, str_len, "UnknownType(tag=%d)", value->tag);
|
ret_val =
|
||||||
|
snprintf(str, str_len, "UnknownType(tag=%d)", value->tag);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2357,7 +2330,8 @@ bool bacapp_print_value(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BACAPP_PRINT_ENABLED
|
#ifdef BACAPP_PRINT_ENABLED
|
||||||
static char* ltrim(char *str, const char *trimmedchars) {
|
static char *ltrim(char *str, const char *trimmedchars)
|
||||||
|
{
|
||||||
if (str[0] == 0) {
|
if (str[0] == 0) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
@@ -2367,25 +2341,29 @@ static char* ltrim(char *str, const char *trimmedchars) {
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char* rtrim(char *str, const char *trimmedchars) {
|
static char *rtrim(char *str, const char *trimmedchars)
|
||||||
|
{
|
||||||
if (str[0] == 0) {
|
if (str[0] == 0) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
char *end = str + strlen(str) - 1;
|
char *end = str + strlen(str) - 1;
|
||||||
while (strchr(trimmedchars, *end)) {
|
while (strchr(trimmedchars, *end)) {
|
||||||
*end = 0;
|
*end = 0;
|
||||||
if (end == str) break;
|
if (end == str)
|
||||||
|
break;
|
||||||
end--;
|
end--;
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char* trim(char *str, const char *trimmedchars) {
|
static char *trim(char *str, const char *trimmedchars)
|
||||||
|
{
|
||||||
return ltrim(rtrim(str, trimmedchars), trimmedchars);
|
return ltrim(rtrim(str, trimmedchars), trimmedchars);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(BACAPP_TYPES_EXTRA)
|
#if defined(BACAPP_TYPES_EXTRA)
|
||||||
static bool parse_weeklyschedule(char *str, BACNET_APPLICATION_DATA_VALUE *value)
|
static bool parse_weeklyschedule(
|
||||||
|
char *str, BACNET_APPLICATION_DATA_VALUE *value)
|
||||||
{
|
{
|
||||||
char *chunk, *comma, *space, *t, *v;
|
char *chunk, *comma, *space, *t, *v;
|
||||||
int daynum = 0, tvnum = 0;
|
int daynum = 0, tvnum = 0;
|
||||||
@@ -2396,12 +2374,14 @@ static bool parse_weeklyschedule(char *str, BACNET_APPLICATION_DATA_VALUE *value
|
|||||||
/*
|
/*
|
||||||
Format:
|
Format:
|
||||||
|
|
||||||
(1; Mon: [02:00:00.00 FALSE, 07:35:00.00 active, 07:40:00.00 inactive]; Tue: [02:00:00.00 inactive]; ...)
|
(1; Mon: [02:00:00.00 FALSE, 07:35:00.00 active, 07:40:00.00 inactive];
|
||||||
|
Tue: [02:00:00.00 inactive]; ...)
|
||||||
|
|
||||||
- the first number is the inner tag (e.g. 1 = boolean, 4 = real, 9 = enum)
|
- the first number is the inner tag (e.g. 1 = boolean, 4 = real, 9 = enum)
|
||||||
- Day name prefix is optional and ignored.
|
- Day name prefix is optional and ignored.
|
||||||
- Entries are separated by semicolons.
|
- Entries are separated by semicolons.
|
||||||
- There can be a full week, or only one entry - when using array index to modify a single day
|
- There can be a full week, or only one entry - when using array index to
|
||||||
|
modify a single day
|
||||||
- time-value array can be empty: []
|
- time-value array can be empty: []
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -2410,7 +2390,9 @@ static bool parse_weeklyschedule(char *str, BACNET_APPLICATION_DATA_VALUE *value
|
|||||||
// Parse the inner tag
|
// Parse the inner tag
|
||||||
chunk = strtok(str, ";");
|
chunk = strtok(str, ";");
|
||||||
chunk = ltrim(chunk, "(");
|
chunk = ltrim(chunk, "(");
|
||||||
if (false == bacapp_parse_application_data(BACNET_APPLICATION_TAG_UNSIGNED_INT, chunk, &dummy_value)) {
|
if (false ==
|
||||||
|
bacapp_parse_application_data(
|
||||||
|
BACNET_APPLICATION_TAG_UNSIGNED_INT, chunk, &dummy_value)) {
|
||||||
// Try searching it by name
|
// Try searching it by name
|
||||||
if (false == bactext_application_tag_index(chunk, &inner_tag)) {
|
if (false == bactext_application_tag_index(chunk, &inner_tag)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -2455,18 +2437,22 @@ static bool parse_weeklyschedule(char *str, BACNET_APPLICATION_DATA_VALUE *value
|
|||||||
|
|
||||||
// Extract time and value
|
// Extract time and value
|
||||||
t = chunk;
|
t = chunk;
|
||||||
// value starts one byte after the space, and there can be multiple spaces
|
// value starts one byte after the space, and there can be
|
||||||
|
// multiple spaces
|
||||||
chunk = ltrim(space + 1, " ");
|
chunk = ltrim(space + 1, " ");
|
||||||
v = chunk;
|
v = chunk;
|
||||||
|
|
||||||
// Parse time
|
// Parse time
|
||||||
if (false == bacapp_parse_application_data(BACNET_APPLICATION_TAG_TIME, t, &dummy_value)) {
|
if (false ==
|
||||||
|
bacapp_parse_application_data(
|
||||||
|
BACNET_APPLICATION_TAG_TIME, t, &dummy_value)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
dsch->Time_Values[tvnum].Time = dummy_value.type.Time;
|
dsch->Time_Values[tvnum].Time = dummy_value.type.Time;
|
||||||
|
|
||||||
// Parse value
|
// Parse value
|
||||||
if (false == bacapp_parse_application_data(inner_tag, v, &dummy_value)) {
|
if (false ==
|
||||||
|
bacapp_parse_application_data(inner_tag, v, &dummy_value)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (BACNET_STATUS_OK !=
|
if (BACNET_STATUS_OK !=
|
||||||
@@ -2579,9 +2565,11 @@ bool bacapp_parse_application_data(BACNET_APPLICATION_TAG tag_number,
|
|||||||
switch (tag_number) {
|
switch (tag_number) {
|
||||||
#if defined(BACAPP_BOOLEAN)
|
#if defined(BACAPP_BOOLEAN)
|
||||||
case BACNET_APPLICATION_TAG_BOOLEAN:
|
case BACNET_APPLICATION_TAG_BOOLEAN:
|
||||||
if (strcasecmp(argv, "true") == 0 || strcasecmp(argv, "active") == 0) {
|
if (strcasecmp(argv, "true") == 0 ||
|
||||||
|
strcasecmp(argv, "active") == 0) {
|
||||||
value->type.Boolean = true;
|
value->type.Boolean = true;
|
||||||
} else if (strcasecmp(argv, "false") == 0 || strcasecmp(argv, "inactive") == 0) {
|
} else if (strcasecmp(argv, "false") == 0 ||
|
||||||
|
strcasecmp(argv, "inactive") == 0) {
|
||||||
value->type.Boolean = false;
|
value->type.Boolean = false;
|
||||||
} else {
|
} else {
|
||||||
status = strtol_checked(argv, &long_value);
|
status = strtol_checked(argv, &long_value);
|
||||||
@@ -2611,7 +2599,8 @@ bool bacapp_parse_application_data(BACNET_APPLICATION_TAG tag_number,
|
|||||||
#if defined(BACAPP_SIGNED)
|
#if defined(BACAPP_SIGNED)
|
||||||
case BACNET_APPLICATION_TAG_SIGNED_INT:
|
case BACNET_APPLICATION_TAG_SIGNED_INT:
|
||||||
status = strtol_checked(argv, &long_value);
|
status = strtol_checked(argv, &long_value);
|
||||||
if (!status || long_value > INT32_MAX || long_value < INT32_MIN) {
|
if (!status || long_value > INT32_MAX ||
|
||||||
|
long_value < INT32_MIN) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
value->type.Signed_Int = (int32_t)long_value;
|
value->type.Signed_Int = (int32_t)long_value;
|
||||||
@@ -2719,8 +2708,7 @@ bool bacapp_parse_application_data(BACNET_APPLICATION_TAG tag_number,
|
|||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_XY_COLOR:
|
case BACNET_APPLICATION_TAG_XY_COLOR:
|
||||||
/* BACnetxyColor */
|
/* BACnetxyColor */
|
||||||
count = sscanf(
|
count = sscanf(argv, "%f,%f", &x, &y);
|
||||||
argv, "%f,%f", &x, &y);
|
|
||||||
if (count == 2) {
|
if (count == 2) {
|
||||||
value->type.XY_Color.x_coordinate = x;
|
value->type.XY_Color.x_coordinate = x;
|
||||||
value->type.XY_Color.y_coordinate = y;
|
value->type.XY_Color.y_coordinate = y;
|
||||||
@@ -2735,8 +2723,8 @@ bool bacapp_parse_application_data(BACNET_APPLICATION_TAG tag_number,
|
|||||||
status = parse_weeklyschedule(argv, value);
|
status = parse_weeklyschedule(argv, value);
|
||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_HOST_N_PORT:
|
case BACNET_APPLICATION_TAG_HOST_N_PORT:
|
||||||
count = sscanf(argv, "%3u.%3u.%3u.%3u:%5u",
|
count = sscanf(argv, "%3u.%3u.%3u.%3u:%5u", &a[0], &a[1], &a[2],
|
||||||
&a[0], &a[1], &a[2], &a[3], &p);
|
&a[3], &p);
|
||||||
if ((count == 4) || (count == 5)) {
|
if ((count == 4) || (count == 5)) {
|
||||||
uint8_t address[4];
|
uint8_t address[4];
|
||||||
value->type.Host_Address.host_ip_address = true;
|
value->type.Host_Address.host_ip_address = true;
|
||||||
@@ -2745,7 +2733,8 @@ bool bacapp_parse_application_data(BACNET_APPLICATION_TAG tag_number,
|
|||||||
address[1] = (uint8_t)a[1];
|
address[1] = (uint8_t)a[1];
|
||||||
address[2] = (uint8_t)a[2];
|
address[2] = (uint8_t)a[2];
|
||||||
address[3] = (uint8_t)a[3];
|
address[3] = (uint8_t)a[3];
|
||||||
octetstring_init(&value->type.Host_Address.host.ip_address, address, 4);
|
octetstring_init(
|
||||||
|
&value->type.Host_Address.host.ip_address, address, 4);
|
||||||
if (count == 4) {
|
if (count == 4) {
|
||||||
value->type.Host_Address.port = 0xBAC0U;
|
value->type.Host_Address.port = 0xBAC0U;
|
||||||
} else {
|
} else {
|
||||||
@@ -2941,8 +2930,8 @@ bool bacapp_same_value(BACNET_APPLICATION_DATA_VALUE *value,
|
|||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_XY_COLOR:
|
case BACNET_APPLICATION_TAG_XY_COLOR:
|
||||||
/* BACnetxyColor */
|
/* BACnetxyColor */
|
||||||
status = xy_color_same(&value->type.XY_Color,
|
status = xy_color_same(
|
||||||
&test_value->type.XY_Color);
|
&value->type.XY_Color, &test_value->type.XY_Color);
|
||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_COLOR_COMMAND:
|
case BACNET_APPLICATION_TAG_COLOR_COMMAND:
|
||||||
/* BACnetColorCommand */
|
/* BACnetColorCommand */
|
||||||
@@ -2951,12 +2940,13 @@ bool bacapp_same_value(BACNET_APPLICATION_DATA_VALUE *value,
|
|||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_WEEKLY_SCHEDULE:
|
case BACNET_APPLICATION_TAG_WEEKLY_SCHEDULE:
|
||||||
/* BACnetWeeklySchedule */
|
/* BACnetWeeklySchedule */
|
||||||
status = bacnet_weeklyschedule_same(&value->type.Weekly_Schedule,
|
status =
|
||||||
|
bacnet_weeklyschedule_same(&value->type.Weekly_Schedule,
|
||||||
&test_value->type.Weekly_Schedule);
|
&test_value->type.Weekly_Schedule);
|
||||||
break;
|
break;
|
||||||
case BACNET_APPLICATION_TAG_HOST_N_PORT:
|
case BACNET_APPLICATION_TAG_HOST_N_PORT:
|
||||||
status = host_n_port_same(&value->type.Host_Address,
|
status = host_n_port_same(
|
||||||
&value->type.Host_Address);
|
&value->type.Host_Address, &value->type.Host_Address);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
|
|||||||
+12
-17
@@ -691,8 +691,7 @@ int encode_application_boolean(uint8_t *apdu, bool boolean_value)
|
|||||||
} else {
|
} else {
|
||||||
len_value = 0;
|
len_value = 0;
|
||||||
}
|
}
|
||||||
len =
|
len = encode_tag(apdu, BACNET_APPLICATION_TAG_BOOLEAN, false, len_value);
|
||||||
encode_tag(apdu, BACNET_APPLICATION_TAG_BOOLEAN, false, len_value);
|
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
@@ -1011,8 +1010,7 @@ int encode_context_bitstring(
|
|||||||
*
|
*
|
||||||
* @return the number of apdu bytes consumed
|
* @return the number of apdu bytes consumed
|
||||||
*/
|
*/
|
||||||
int decode_object_id_safe(
|
int decode_object_id_safe(uint8_t *apdu,
|
||||||
uint8_t *apdu,
|
|
||||||
uint32_t len_value_type,
|
uint32_t len_value_type,
|
||||||
BACNET_OBJECT_TYPE *object_type,
|
BACNET_OBJECT_TYPE *object_type,
|
||||||
uint32_t *instance)
|
uint32_t *instance)
|
||||||
@@ -1025,8 +1023,8 @@ int decode_object_id_safe(
|
|||||||
if (apdu) {
|
if (apdu) {
|
||||||
/* value is meaningless if apdu was NULL */
|
/* value is meaningless if apdu was NULL */
|
||||||
if (object_type) {
|
if (object_type) {
|
||||||
*object_type = (BACNET_OBJECT_TYPE)(
|
*object_type = (BACNET_OBJECT_TYPE)((
|
||||||
((value >> BACNET_INSTANCE_BITS) & BACNET_MAX_OBJECT));
|
(value >> BACNET_INSTANCE_BITS) & BACNET_MAX_OBJECT));
|
||||||
}
|
}
|
||||||
if (instance) {
|
if (instance) {
|
||||||
*instance = (value & BACNET_MAX_INSTANCE);
|
*instance = (value & BACNET_MAX_INSTANCE);
|
||||||
@@ -1049,9 +1047,7 @@ int decode_object_id_safe(
|
|||||||
* @return the number of apdu bytes consumed
|
* @return the number of apdu bytes consumed
|
||||||
*/
|
*/
|
||||||
int decode_object_id(
|
int decode_object_id(
|
||||||
uint8_t *apdu,
|
uint8_t *apdu, BACNET_OBJECT_TYPE *object_type, uint32_t *instance)
|
||||||
BACNET_OBJECT_TYPE *object_type,
|
|
||||||
uint32_t *instance)
|
|
||||||
{
|
{
|
||||||
const uint32_t len_value = 4;
|
const uint32_t len_value = 4;
|
||||||
|
|
||||||
@@ -1079,8 +1075,8 @@ int bacnet_object_id_decode(uint8_t *apdu,
|
|||||||
|
|
||||||
len = decode_object_id_safe(NULL, len_value_type, object_type, instance);
|
len = decode_object_id_safe(NULL, len_value_type, object_type, instance);
|
||||||
if (len <= apdu_len_max) {
|
if (len <= apdu_len_max) {
|
||||||
return decode_object_id_safe(apdu, len_value_type, object_type,
|
return decode_object_id_safe(
|
||||||
instance);
|
apdu, len_value_type, object_type, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1316,8 +1312,8 @@ int encode_application_octet_string(
|
|||||||
uint8_t *apdu_offset = NULL;
|
uint8_t *apdu_offset = NULL;
|
||||||
|
|
||||||
if (octet_string) {
|
if (octet_string) {
|
||||||
len = encode_tag(apdu, BACNET_APPLICATION_TAG_OCTET_STRING,
|
len = encode_tag(apdu, BACNET_APPLICATION_TAG_OCTET_STRING, false,
|
||||||
false, octetstring_length(octet_string));
|
octetstring_length(octet_string));
|
||||||
if (apdu) {
|
if (apdu) {
|
||||||
apdu_offset = &apdu[len];
|
apdu_offset = &apdu[len];
|
||||||
}
|
}
|
||||||
@@ -1505,8 +1501,8 @@ int encode_application_character_string(
|
|||||||
uint8_t *apdu_offset = NULL;
|
uint8_t *apdu_offset = NULL;
|
||||||
|
|
||||||
len = encode_bacnet_character_string(NULL, char_string);
|
len = encode_bacnet_character_string(NULL, char_string);
|
||||||
len = encode_tag(apdu, BACNET_APPLICATION_TAG_CHARACTER_STRING,
|
len = encode_tag(
|
||||||
false, (uint32_t)len);
|
apdu, BACNET_APPLICATION_TAG_CHARACTER_STRING, false, (uint32_t)len);
|
||||||
if (apdu) {
|
if (apdu) {
|
||||||
apdu_offset = &apdu[len];
|
apdu_offset = &apdu[len];
|
||||||
}
|
}
|
||||||
@@ -2980,8 +2976,7 @@ int encode_bacnet_address(uint8_t *apdu, BACNET_ADDRESS *destination)
|
|||||||
|
|
||||||
if (destination) {
|
if (destination) {
|
||||||
/* network number */
|
/* network number */
|
||||||
apdu_len +=
|
apdu_len += encode_application_unsigned(apdu, destination->net);
|
||||||
encode_application_unsigned(apdu, destination->net);
|
|
||||||
/* encode mac address as an octet-string */
|
/* encode mac address as an octet-string */
|
||||||
if (destination->len != 0) {
|
if (destination->len != 0) {
|
||||||
octetstring_init(&mac_addr, destination->adr, destination->len);
|
octetstring_init(&mac_addr, destination->adr, destination->len);
|
||||||
|
|||||||
@@ -153,17 +153,14 @@ int bacapp_decode_device_obj_property_ref(
|
|||||||
uint32_t enumValue = 0;
|
uint32_t enumValue = 0;
|
||||||
|
|
||||||
/* object-identifier [0] BACnetObjectIdentifier */
|
/* object-identifier [0] BACnetObjectIdentifier */
|
||||||
len =
|
len = decode_context_object_id(&apdu[apdu_len], 0,
|
||||||
decode_context_object_id(&apdu[apdu_len], 0,
|
&value->objectIdentifier.type, &value->objectIdentifier.instance);
|
||||||
&value->objectIdentifier.type,
|
|
||||||
&value->objectIdentifier.instance);
|
|
||||||
if (len == BACNET_STATUS_ERROR) {
|
if (len == BACNET_STATUS_ERROR) {
|
||||||
return BACNET_STATUS_ERROR;
|
return BACNET_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
/* property-identifier [1] BACnetPropertyIdentifier */
|
/* property-identifier [1] BACnetPropertyIdentifier */
|
||||||
len =
|
len = decode_context_enumerated(&apdu[apdu_len], 1, &enumValue);
|
||||||
decode_context_enumerated(&apdu[apdu_len], 1, &enumValue);
|
|
||||||
if (len == BACNET_STATUS_ERROR) {
|
if (len == BACNET_STATUS_ERROR) {
|
||||||
return BACNET_STATUS_ERROR;
|
return BACNET_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
@@ -172,8 +169,7 @@ int bacapp_decode_device_obj_property_ref(
|
|||||||
/* property-array-index [2] Unsigned OPTIONAL */
|
/* property-array-index [2] Unsigned OPTIONAL */
|
||||||
if (decode_is_context_tag(&apdu[apdu_len], 2) &&
|
if (decode_is_context_tag(&apdu[apdu_len], 2) &&
|
||||||
!decode_is_closing_tag(&apdu[apdu_len])) {
|
!decode_is_closing_tag(&apdu[apdu_len])) {
|
||||||
len = decode_context_unsigned(
|
len = decode_context_unsigned(&apdu[apdu_len], 2, &value->arrayIndex);
|
||||||
&apdu[apdu_len], 2, &value->arrayIndex);
|
|
||||||
if (len == BACNET_STATUS_ERROR) {
|
if (len == BACNET_STATUS_ERROR) {
|
||||||
return BACNET_STATUS_ERROR;
|
return BACNET_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
@@ -210,8 +206,7 @@ int bacapp_decode_device_obj_property_ref(
|
|||||||
*
|
*
|
||||||
* @return Bytes decoded or BACNET_STATUS_ERROR on failure.
|
* @return Bytes decoded or BACNET_STATUS_ERROR on failure.
|
||||||
*/
|
*/
|
||||||
int bacapp_decode_context_device_obj_property_ref(
|
int bacapp_decode_context_device_obj_property_ref(uint8_t *apdu,
|
||||||
uint8_t *apdu,
|
|
||||||
uint8_t tag_number,
|
uint8_t tag_number,
|
||||||
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE *value)
|
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE *value)
|
||||||
{
|
{
|
||||||
@@ -255,9 +250,7 @@ int bacapp_decode_context_device_obj_property_ref(
|
|||||||
* @return Bytes encoded or 0 on failure.
|
* @return Bytes encoded or 0 on failure.
|
||||||
*/
|
*/
|
||||||
int bacapp_encode_context_device_obj_ref(
|
int bacapp_encode_context_device_obj_ref(
|
||||||
uint8_t *apdu,
|
uint8_t *apdu, uint8_t tag_number, BACNET_DEVICE_OBJECT_REFERENCE *value)
|
||||||
uint8_t tag_number,
|
|
||||||
BACNET_DEVICE_OBJECT_REFERENCE *value)
|
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
int apdu_len = 0;
|
int apdu_len = 0;
|
||||||
@@ -291,8 +284,7 @@ int bacapp_encode_context_device_obj_ref(
|
|||||||
* @return Bytes encoded or 0 on failure.
|
* @return Bytes encoded or 0 on failure.
|
||||||
*/
|
*/
|
||||||
int bacapp_encode_device_obj_ref(
|
int bacapp_encode_device_obj_ref(
|
||||||
uint8_t * apdu,
|
uint8_t *apdu, BACNET_DEVICE_OBJECT_REFERENCE *value)
|
||||||
BACNET_DEVICE_OBJECT_REFERENCE * value)
|
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
int apdu_len = 0;
|
int apdu_len = 0;
|
||||||
@@ -307,8 +299,7 @@ int bacapp_encode_device_obj_ref(
|
|||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
}
|
}
|
||||||
/* object-identifier [1] BACnetObjectIdentifier */
|
/* object-identifier [1] BACnetObjectIdentifier */
|
||||||
len =
|
len = encode_context_object_id(&apdu[apdu_len], 1,
|
||||||
encode_context_object_id(&apdu[apdu_len], 1,
|
|
||||||
value->objectIdentifier.type, value->objectIdentifier.instance);
|
value->objectIdentifier.type, value->objectIdentifier.instance);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
|
|
||||||
@@ -330,8 +321,7 @@ int bacapp_encode_device_obj_ref(
|
|||||||
* @return Bytes decoded or BACNET_STATUS_ERROR on failure.
|
* @return Bytes decoded or BACNET_STATUS_ERROR on failure.
|
||||||
*/
|
*/
|
||||||
int bacapp_decode_device_obj_ref(
|
int bacapp_decode_device_obj_ref(
|
||||||
uint8_t * apdu,
|
uint8_t *apdu, BACNET_DEVICE_OBJECT_REFERENCE *value)
|
||||||
BACNET_DEVICE_OBJECT_REFERENCE * value)
|
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
int apdu_len = 0;
|
int apdu_len = 0;
|
||||||
@@ -339,10 +329,8 @@ int bacapp_decode_device_obj_ref(
|
|||||||
/* device-identifier [0] BACnetObjectIdentifier OPTIONAL */
|
/* device-identifier [0] BACnetObjectIdentifier OPTIONAL */
|
||||||
if (decode_is_context_tag(&apdu[apdu_len], 0) &&
|
if (decode_is_context_tag(&apdu[apdu_len], 0) &&
|
||||||
!decode_is_closing_tag(&apdu[apdu_len])) {
|
!decode_is_closing_tag(&apdu[apdu_len])) {
|
||||||
len =
|
len = decode_context_object_id(&apdu[apdu_len], 0,
|
||||||
decode_context_object_id(&apdu[apdu_len], 0,
|
&value->deviceIdentifier.type, &value->deviceIdentifier.instance);
|
||||||
&value->deviceIdentifier.type,
|
|
||||||
&value->deviceIdentifier.instance);
|
|
||||||
if (len == BACNET_STATUS_ERROR) {
|
if (len == BACNET_STATUS_ERROR) {
|
||||||
return BACNET_STATUS_ERROR;
|
return BACNET_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
@@ -352,10 +340,8 @@ int bacapp_decode_device_obj_ref(
|
|||||||
value->deviceIdentifier.instance = BACNET_NO_DEV_ID;
|
value->deviceIdentifier.instance = BACNET_NO_DEV_ID;
|
||||||
}
|
}
|
||||||
/* object-identifier [1] BACnetObjectIdentifier */
|
/* object-identifier [1] BACnetObjectIdentifier */
|
||||||
len =
|
len = decode_context_object_id(&apdu[apdu_len], 1,
|
||||||
decode_context_object_id(&apdu[apdu_len], 1,
|
&value->objectIdentifier.type, &value->objectIdentifier.instance);
|
||||||
&value->objectIdentifier.type,
|
|
||||||
&value->objectIdentifier.instance);
|
|
||||||
if (len == BACNET_STATUS_ERROR) {
|
if (len == BACNET_STATUS_ERROR) {
|
||||||
return BACNET_STATUS_ERROR;
|
return BACNET_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
@@ -376,9 +362,7 @@ int bacapp_decode_device_obj_ref(
|
|||||||
* @return Bytes decoded or BACNET_STATUS_ERROR on failure.
|
* @return Bytes decoded or BACNET_STATUS_ERROR on failure.
|
||||||
*/
|
*/
|
||||||
int bacapp_decode_context_device_obj_ref(
|
int bacapp_decode_context_device_obj_ref(
|
||||||
uint8_t * apdu,
|
uint8_t *apdu, uint8_t tag_number, BACNET_DEVICE_OBJECT_REFERENCE *value)
|
||||||
uint8_t tag_number,
|
|
||||||
BACNET_DEVICE_OBJECT_REFERENCE * value)
|
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int section_length;
|
int section_length;
|
||||||
@@ -402,7 +386,6 @@ int bacapp_decode_context_device_obj_ref(
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Encode a BACnetObjectPropertyReference
|
* @brief Encode a BACnetObjectPropertyReference
|
||||||
*
|
*
|
||||||
@@ -418,8 +401,8 @@ int bacapp_decode_context_device_obj_ref(
|
|||||||
* @param reference - BACnetObjectPropertyReference
|
* @param reference - BACnetObjectPropertyReference
|
||||||
* @return length of the APDU buffer
|
* @return length of the APDU buffer
|
||||||
*/
|
*/
|
||||||
int bacapp_encode_obj_property_ref(uint8_t *apdu,
|
int bacapp_encode_obj_property_ref(
|
||||||
BACNET_OBJECT_PROPERTY_REFERENCE *reference)
|
uint8_t *apdu, BACNET_OBJECT_PROPERTY_REFERENCE *reference)
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
uint8_t *apdu_offset = NULL;
|
uint8_t *apdu_offset = NULL;
|
||||||
@@ -547,9 +530,8 @@ int bacapp_decode_obj_property_ref(uint8_t *apdu,
|
|||||||
/* property-array-index [2] Unsigned OPTIONAL */
|
/* property-array-index [2] Unsigned OPTIONAL */
|
||||||
if (apdu_len_max > apdu_len) {
|
if (apdu_len_max > apdu_len) {
|
||||||
if (decode_is_context_tag(&apdu[apdu_len], 2)) {
|
if (decode_is_context_tag(&apdu[apdu_len], 2)) {
|
||||||
len = bacnet_unsigned_context_decode(
|
len = bacnet_unsigned_context_decode(&apdu[apdu_len],
|
||||||
&apdu[apdu_len], apdu_len_max - apdu_len, 2,
|
apdu_len_max - apdu_len, 2, &unsigned_value);
|
||||||
&unsigned_value);
|
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
if (unsigned_value > UINT32_MAX) {
|
if (unsigned_value > UINT32_MAX) {
|
||||||
@@ -580,8 +562,7 @@ int bacapp_decode_obj_property_ref(uint8_t *apdu,
|
|||||||
*
|
*
|
||||||
* @return Bytes decoded or BACNET_STATUS_ERROR on failure.
|
* @return Bytes decoded or BACNET_STATUS_ERROR on failure.
|
||||||
*/
|
*/
|
||||||
int bacapp_decode_context_obj_property_ref(
|
int bacapp_decode_context_obj_property_ref(uint8_t *apdu,
|
||||||
uint8_t * apdu,
|
|
||||||
uint16_t apdu_len_max,
|
uint16_t apdu_len_max,
|
||||||
uint8_t tag_number,
|
uint8_t tag_number,
|
||||||
BACNET_OBJECT_PROPERTY_REFERENCE *value)
|
BACNET_OBJECT_PROPERTY_REFERENCE *value)
|
||||||
@@ -597,8 +578,8 @@ int bacapp_decode_context_obj_property_ref(
|
|||||||
} else {
|
} else {
|
||||||
return BACNET_STATUS_ERROR;
|
return BACNET_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
len = bacapp_decode_obj_property_ref(&apdu[apdu_len],
|
len = bacapp_decode_obj_property_ref(
|
||||||
apdu_len_max - apdu_len, value);
|
&apdu[apdu_len], apdu_len_max - apdu_len, value);
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
return BACNET_STATUS_ERROR;
|
return BACNET_STATUS_ERROR;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -74,7 +74,6 @@ int decode_real(uint8_t *apdu, float *real_value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-4
@@ -231,9 +231,7 @@ bool bitstring_set_octet(
|
|||||||
* @return true on success or false on error.
|
* @return true on success or false on error.
|
||||||
*/
|
*/
|
||||||
bool bitstring_set_bits_used(
|
bool bitstring_set_bits_used(
|
||||||
BACNET_BIT_STRING * bit_string,
|
BACNET_BIT_STRING *bit_string, uint8_t bytes_used, uint8_t unused_bits)
|
||||||
uint8_t bytes_used,
|
|
||||||
uint8_t unused_bits)
|
|
||||||
{
|
{
|
||||||
bool status = false;
|
bool status = false;
|
||||||
|
|
||||||
@@ -500,7 +498,8 @@ bool characterstring_ansi_copy(
|
|||||||
size_t i; /* counter */
|
size_t i; /* counter */
|
||||||
|
|
||||||
if (dest && src) {
|
if (dest && src) {
|
||||||
if ((src->encoding == CHARACTER_ANSI_X34) && (src->length < dest_max_len)) {
|
if ((src->encoding == CHARACTER_ANSI_X34) &&
|
||||||
|
(src->length < dest_max_len)) {
|
||||||
for (i = 0; i < dest_max_len; i++) {
|
for (i = 0; i < dest_max_len; i++) {
|
||||||
if (i < src->length) {
|
if (i < src->length) {
|
||||||
dest[i] = src->value[i];
|
dest[i] = src->value[i];
|
||||||
|
|||||||
@@ -129,8 +129,8 @@ const char *bactext_unconfirmed_service_name(unsigned index)
|
|||||||
bacnet_unconfirmed_service_names, index, ASHRAE_Reserved_String);
|
bacnet_unconfirmed_service_names, index, ASHRAE_Reserved_String);
|
||||||
}
|
}
|
||||||
|
|
||||||
INDTEXT_DATA bacnet_application_tag_names[] = {
|
INDTEXT_DATA bacnet_application_tag_names[] = { { BACNET_APPLICATION_TAG_NULL,
|
||||||
{ BACNET_APPLICATION_TAG_NULL, "Null" },
|
"Null" },
|
||||||
{ BACNET_APPLICATION_TAG_BOOLEAN, "Boolean" },
|
{ BACNET_APPLICATION_TAG_BOOLEAN, "Boolean" },
|
||||||
{ BACNET_APPLICATION_TAG_UNSIGNED_INT, "Unsigned Int" },
|
{ BACNET_APPLICATION_TAG_UNSIGNED_INT, "Unsigned Int" },
|
||||||
{ BACNET_APPLICATION_TAG_SIGNED_INT, "Signed Int" },
|
{ BACNET_APPLICATION_TAG_SIGNED_INT, "Signed Int" },
|
||||||
@@ -166,8 +166,7 @@ INDTEXT_DATA bacnet_application_tag_names[] = {
|
|||||||
{ BACNET_APPLICATION_TAG_READ_ACCESS_SPECIFICATION,
|
{ BACNET_APPLICATION_TAG_READ_ACCESS_SPECIFICATION,
|
||||||
"BACnetReadAccessSpecification" },
|
"BACnetReadAccessSpecification" },
|
||||||
{ BACNET_APPLICATION_TAG_LIGHTING_COMMAND, "BACnetLightingCommand" },
|
{ BACNET_APPLICATION_TAG_LIGHTING_COMMAND, "BACnetLightingCommand" },
|
||||||
{ BACNET_APPLICATION_TAG_HOST_N_PORT, "BACnetHostNPort" },
|
{ BACNET_APPLICATION_TAG_HOST_N_PORT, "BACnetHostNPort" }, { 0, NULL } };
|
||||||
{ 0, NULL } };
|
|
||||||
|
|
||||||
const char *bactext_application_tag_name(unsigned index)
|
const char *bactext_application_tag_name(unsigned index)
|
||||||
{
|
{
|
||||||
@@ -744,8 +743,7 @@ INDTEXT_DATA bacnet_property_names[] = {
|
|||||||
{ PROP_COLOR_COMMAND, "color-command" },
|
{ PROP_COLOR_COMMAND, "color-command" },
|
||||||
{ PROP_HIGH_END_TRIM, "high-end-trim" },
|
{ PROP_HIGH_END_TRIM, "high-end-trim" },
|
||||||
{ PROP_LOW_END_TRIM, "low-end-trim" },
|
{ PROP_LOW_END_TRIM, "low-end-trim" },
|
||||||
{ PROP_TRIM_FADE_TIME, "trim-fade-time" },
|
{ PROP_TRIM_FADE_TIME, "trim-fade-time" }, { 0, NULL }
|
||||||
{ 0, NULL }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bool bactext_property_name_proprietary(unsigned index)
|
bool bactext_property_name_proprietary(unsigned index)
|
||||||
|
|||||||
+25
-17
@@ -39,7 +39,8 @@
|
|||||||
#include "bacnet/bactimevalue.h"
|
#include "bacnet/bactimevalue.h"
|
||||||
#include "bacnet/bacapp.h"
|
#include "bacnet/bacapp.h"
|
||||||
|
|
||||||
static bool is_data_value_schedule_compatible(uint8_t tag) {
|
static bool is_data_value_schedule_compatible(uint8_t tag)
|
||||||
|
{
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
/* Every member of the union must be listed here to allow decoding */
|
/* Every member of the union must be listed here to allow decoding */
|
||||||
case BACNET_APPLICATION_TAG_NULL:
|
case BACNET_APPLICATION_TAG_NULL:
|
||||||
@@ -102,7 +103,8 @@ int bacnet_time_value_encode(uint8_t *apdu, BACNET_TIME_VALUE *value)
|
|||||||
return apdu_len;
|
return apdu_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bacapp_encode_time_value(uint8_t *apdu, BACNET_TIME_VALUE *value) {
|
int bacapp_encode_time_value(uint8_t *apdu, BACNET_TIME_VALUE *value)
|
||||||
|
{
|
||||||
return bacnet_time_value_encode(apdu, value);
|
return bacnet_time_value_encode(apdu, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +136,8 @@ int bacnet_time_value_context_encode(
|
|||||||
return apdu_len;
|
return apdu_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bacapp_encode_context_time_value(uint8_t *apdu, uint8_t tag_number, BACNET_TIME_VALUE *value)
|
int bacapp_encode_context_time_value(
|
||||||
|
uint8_t *apdu, uint8_t tag_number, BACNET_TIME_VALUE *value)
|
||||||
{
|
{
|
||||||
return bacnet_time_value_context_encode(apdu, tag_number, value);
|
return bacnet_time_value_context_encode(apdu, tag_number, value);
|
||||||
}
|
}
|
||||||
@@ -169,19 +172,22 @@ int bacnet_primitive_to_application_data_value(
|
|||||||
return BACNET_STATUS_OK; /* OK */
|
return BACNET_STATUS_OK; /* OK */
|
||||||
}
|
}
|
||||||
|
|
||||||
int bacnet_time_value_decode(uint8_t *apdu, int max_apdu_len, BACNET_TIME_VALUE *value)
|
int bacnet_time_value_decode(
|
||||||
|
uint8_t *apdu, int max_apdu_len, BACNET_TIME_VALUE *value)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
int apdu_len = 0;
|
int apdu_len = 0;
|
||||||
BACNET_APPLICATION_DATA_VALUE full_data_value = { 0 };
|
BACNET_APPLICATION_DATA_VALUE full_data_value = { 0 };
|
||||||
|
|
||||||
len = bacnet_time_application_decode(&apdu[apdu_len], max_apdu_len, &value->Time);
|
len = bacnet_time_application_decode(
|
||||||
|
&apdu[apdu_len], max_apdu_len, &value->Time);
|
||||||
if (len <= 0) {
|
if (len <= 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
|
|
||||||
len = bacapp_decode_application_data(&apdu[apdu_len], max_apdu_len - apdu_len, &full_data_value);
|
len = bacapp_decode_application_data(
|
||||||
|
&apdu[apdu_len], max_apdu_len - apdu_len, &full_data_value);
|
||||||
if (len <= 0) {
|
if (len <= 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -200,25 +206,31 @@ int bacapp_decode_time_value(uint8_t *apdu, BACNET_TIME_VALUE *value)
|
|||||||
return bacnet_time_value_decode(apdu, MAX_APDU, value);
|
return bacnet_time_value_decode(apdu, MAX_APDU, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
int bacnet_time_value_context_decode(uint8_t *apdu, int max_apdu_len, uint8_t tag_number, BACNET_TIME_VALUE *value)
|
int bacnet_time_value_context_decode(uint8_t *apdu,
|
||||||
|
int max_apdu_len,
|
||||||
|
uint8_t tag_number,
|
||||||
|
BACNET_TIME_VALUE *value)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
int apdu_len = 0;
|
int apdu_len = 0;
|
||||||
|
|
||||||
if ((max_apdu_len - apdu_len) >= 1 && decode_is_opening_tag_number(&apdu[apdu_len], tag_number)) {
|
if ((max_apdu_len - apdu_len) >= 1 &&
|
||||||
|
decode_is_opening_tag_number(&apdu[apdu_len], tag_number)) {
|
||||||
apdu_len += 1;
|
apdu_len += 1;
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = bacnet_time_value_decode(&apdu[apdu_len], max_apdu_len - apdu_len, value);
|
len = bacnet_time_value_decode(
|
||||||
|
&apdu[apdu_len], max_apdu_len - apdu_len, value);
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((max_apdu_len - apdu_len) >= 1 && decode_is_closing_tag_number(&apdu[apdu_len], tag_number)) {
|
if ((max_apdu_len - apdu_len) >= 1 &&
|
||||||
|
decode_is_closing_tag_number(&apdu[apdu_len], tag_number)) {
|
||||||
apdu_len += 1;
|
apdu_len += 1;
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
@@ -233,8 +245,7 @@ int bacapp_decode_context_time_value(
|
|||||||
return bacnet_time_value_context_decode(apdu, MAX_APDU, tag_number, value);
|
return bacnet_time_value_context_decode(apdu, MAX_APDU, tag_number, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
int bacnet_time_values_context_decode(
|
int bacnet_time_values_context_decode(uint8_t *apdu,
|
||||||
uint8_t * apdu,
|
|
||||||
const int max_apdu_len,
|
const int max_apdu_len,
|
||||||
const uint8_t tag_number,
|
const uint8_t tag_number,
|
||||||
BACNET_TIME_VALUE *time_values,
|
BACNET_TIME_VALUE *time_values,
|
||||||
@@ -287,8 +298,7 @@ int bacnet_time_values_context_decode(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Encodes a : [x] SEQUENCE OF BACnetTimeValue into a fixed-size buffer */
|
/* Encodes a : [x] SEQUENCE OF BACnetTimeValue into a fixed-size buffer */
|
||||||
int bacnet_time_values_context_encode(
|
int bacnet_time_values_context_encode(uint8_t *apdu,
|
||||||
uint8_t * apdu,
|
|
||||||
uint8_t tag_number,
|
uint8_t tag_number,
|
||||||
BACNET_TIME_VALUE *time_values,
|
BACNET_TIME_VALUE *time_values,
|
||||||
unsigned int max_time_values)
|
unsigned int max_time_values)
|
||||||
@@ -312,9 +322,7 @@ int bacnet_time_values_context_encode(
|
|||||||
if (apdu) {
|
if (apdu) {
|
||||||
apdu_offset = &apdu[apdu_len];
|
apdu_offset = &apdu[apdu_len];
|
||||||
}
|
}
|
||||||
len =
|
len = bacnet_time_value_encode(apdu_offset, &time_values[j]);
|
||||||
bacnet_time_value_encode(apdu_offset,
|
|
||||||
&time_values[j]);
|
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
return -1;
|
return -1;
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
|
|||||||
@@ -784,8 +784,7 @@ int bvlc_bbmd_disabled_handler(BACNET_IP_ADDRESS *addr,
|
|||||||
npdu = &mtu[offset];
|
npdu = &mtu[offset];
|
||||||
if (npdu_confirmed_service(npdu, npdu_len)) {
|
if (npdu_confirmed_service(npdu, npdu_len)) {
|
||||||
offset = 0;
|
offset = 0;
|
||||||
debug_print_string(
|
debug_print_string("Original-Broadcast-NPDU: "
|
||||||
"Original-Broadcast-NPDU: "
|
|
||||||
"Confirmed Service! Discard!");
|
"Confirmed Service! Discard!");
|
||||||
} else {
|
} else {
|
||||||
debug_print_npdu(
|
debug_print_npdu(
|
||||||
@@ -1105,14 +1104,13 @@ int bvlc_bbmd_enabled_handler(BACNET_IP_ADDRESS *addr,
|
|||||||
network layer. */
|
network layer. */
|
||||||
if (npdu_confirmed_service(npdu, npdu_len)) {
|
if (npdu_confirmed_service(npdu, npdu_len)) {
|
||||||
offset = 0;
|
offset = 0;
|
||||||
debug_print_string(
|
debug_print_string("Original-Broadcast-NPDU: "
|
||||||
"Original-Broadcast-NPDU: "
|
|
||||||
"Confirmed Service! Discard!");
|
"Confirmed Service! Discard!");
|
||||||
} else {
|
} else {
|
||||||
(void)bbmd_fdt_forward_npdu(addr, npdu, npdu_len, true);
|
(void)bbmd_fdt_forward_npdu(addr, npdu, npdu_len, true);
|
||||||
(void)bbmd_bdt_forward_npdu(addr, npdu, npdu_len, true);
|
(void)bbmd_bdt_forward_npdu(addr, npdu, npdu_len, true);
|
||||||
debug_print_npdu("Original-Broadcast-NPDU",
|
debug_print_npdu(
|
||||||
offset, npdu_len);
|
"Original-Broadcast-NPDU", offset, npdu_len);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
debug_print_string(
|
debug_print_string(
|
||||||
@@ -1211,8 +1209,7 @@ int bvlc_register_with_bbmd(BACNET_IP_ADDRESS *bbmd_addr, uint16_t ttl_seconds)
|
|||||||
* 0 if no registration request is sent, or
|
* 0 if no registration request is sent, or
|
||||||
* -1 if registration fails.
|
* -1 if registration fails.
|
||||||
*/
|
*/
|
||||||
void bvlc_remote_bbmd_address(
|
void bvlc_remote_bbmd_address(BACNET_IP_ADDRESS *bbmd_addr)
|
||||||
BACNET_IP_ADDRESS *bbmd_addr)
|
|
||||||
{
|
{
|
||||||
bvlc_address_copy(bbmd_addr, &Remote_BBMD);
|
bvlc_address_copy(bbmd_addr, &Remote_BBMD);
|
||||||
}
|
}
|
||||||
@@ -1222,8 +1219,7 @@ void bvlc_remote_bbmd_address(
|
|||||||
* Register Foreign Device
|
* Register Foreign Device
|
||||||
* @return Lease time in seconds to use when registering.
|
* @return Lease time in seconds to use when registering.
|
||||||
*/
|
*/
|
||||||
uint16_t bvlc_remote_bbmd_lifetime(
|
uint16_t bvlc_remote_bbmd_lifetime(void)
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
return Remote_BBMD_TTL_Seconds;
|
return Remote_BBMD_TTL_Seconds;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,6 @@
|
|||||||
#include "bacnet/basic/bbmd6/vmac.h"
|
#include "bacnet/basic/bbmd6/vmac.h"
|
||||||
#include "bacnet/basic/bbmd6/h_bbmd6.h"
|
#include "bacnet/basic/bbmd6/h_bbmd6.h"
|
||||||
|
|
||||||
|
|
||||||
static bool BVLC6_Debug;
|
static bool BVLC6_Debug;
|
||||||
#if PRINT_ENABLED
|
#if PRINT_ENABLED
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@@ -740,8 +739,7 @@ int bvlc6_bbmd_disabled_handler(BACNET_IP6_ADDRESS *addr,
|
|||||||
npdu = &mtu[offset];
|
npdu = &mtu[offset];
|
||||||
if (npdu_confirmed_service(npdu, npdu_len)) {
|
if (npdu_confirmed_service(npdu, npdu_len)) {
|
||||||
offset = 0;
|
offset = 0;
|
||||||
PRINTF(
|
PRINTF("BIP6: Original-Broadcast-NPDU: "
|
||||||
"BIP6: Original-Broadcast-NPDU: "
|
|
||||||
"Confirmed Service! Discard!");
|
"Confirmed Service! Discard!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -766,8 +764,7 @@ int bvlc6_bbmd_disabled_handler(BACNET_IP6_ADDRESS *addr,
|
|||||||
bvlc6_vmac_address_set(src, vmac_src);
|
bvlc6_vmac_address_set(src, vmac_src);
|
||||||
offset = header_len + (function_len - npdu_len);
|
offset = header_len + (function_len - npdu_len);
|
||||||
} else {
|
} else {
|
||||||
PRINTF(
|
PRINTF("BIP6: Forwarded-NPDU: Unable to decode!\n");
|
||||||
"BIP6: Forwarded-NPDU: Unable to decode!\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -908,8 +905,7 @@ int bvlc6_bbmd_enabled_handler(BACNET_IP6_ADDRESS *addr,
|
|||||||
network layer. */
|
network layer. */
|
||||||
if (npdu_confirmed_service(npdu, npdu_len)) {
|
if (npdu_confirmed_service(npdu, npdu_len)) {
|
||||||
offset = 0;
|
offset = 0;
|
||||||
PRINTF(
|
PRINTF("BIP6: Original-Broadcast-NPDU: "
|
||||||
"BIP6: Original-Broadcast-NPDU: "
|
|
||||||
"Confirmed Service! Discard!");
|
"Confirmed Service! Discard!");
|
||||||
} else {
|
} else {
|
||||||
/* Upon receipt of a BVLL Original-Broadcast-NPDU
|
/* Upon receipt of a BVLL Original-Broadcast-NPDU
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ void npdu_network_number_set(uint16_t net)
|
|||||||
* @param status - 0=learned, 1=assigned
|
* @param status - 0=learned, 1=assigned
|
||||||
* @return number of bytes sent
|
* @return number of bytes sent
|
||||||
*/
|
*/
|
||||||
int npdu_send_network_number_is(BACNET_ADDRESS *dst,
|
int npdu_send_network_number_is(
|
||||||
uint16_t net, uint8_t status)
|
BACNET_ADDRESS *dst, uint16_t net, uint8_t status)
|
||||||
{
|
{
|
||||||
uint16_t len = 0;
|
uint16_t len = 0;
|
||||||
int pdu_len = 0;
|
int pdu_len = 0;
|
||||||
@@ -84,13 +84,11 @@ int npdu_send_network_number_is(BACNET_ADDRESS *dst,
|
|||||||
transmit a local broadcast Network-Number-Is message
|
transmit a local broadcast Network-Number-Is message
|
||||||
back to the source device. */
|
back to the source device. */
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
npdu_encode_npdu_network(&npdu_data,
|
npdu_encode_npdu_network(&npdu_data, NETWORK_MESSAGE_NETWORK_NUMBER_IS,
|
||||||
NETWORK_MESSAGE_NETWORK_NUMBER_IS,
|
|
||||||
data_expecting_reply, MESSAGE_PRIORITY_NORMAL);
|
data_expecting_reply, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len = npdu_encode_pdu(&Handler_Transmit_Buffer[0], dst,
|
pdu_len = npdu_encode_pdu(
|
||||||
&my_address, &npdu_data);
|
&Handler_Transmit_Buffer[0], dst, &my_address, &npdu_data);
|
||||||
len = encode_unsigned16(
|
len = encode_unsigned16(&Handler_Transmit_Buffer[pdu_len], net);
|
||||||
&Handler_Transmit_Buffer[pdu_len], net);
|
|
||||||
pdu_len += len;
|
pdu_len += len;
|
||||||
Handler_Transmit_Buffer[pdu_len] = status;
|
Handler_Transmit_Buffer[pdu_len] = status;
|
||||||
pdu_len++;
|
pdu_len++;
|
||||||
@@ -120,17 +118,14 @@ int npdu_send_what_is_network_number(BACNET_ADDRESS *dst)
|
|||||||
datalink_get_broadcast_address(&daddr);
|
datalink_get_broadcast_address(&daddr);
|
||||||
}
|
}
|
||||||
datalink_get_my_address(&saddr);
|
datalink_get_my_address(&saddr);
|
||||||
npdu_encode_npdu_network(&npdu_data,
|
npdu_encode_npdu_network(&npdu_data, NETWORK_MESSAGE_WHAT_IS_NETWORK_NUMBER,
|
||||||
NETWORK_MESSAGE_WHAT_IS_NETWORK_NUMBER,
|
|
||||||
data_expecting_reply, MESSAGE_PRIORITY_NORMAL);
|
data_expecting_reply, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len = npdu_encode_pdu(
|
pdu_len = npdu_encode_pdu(
|
||||||
&Handler_Transmit_Buffer[0],
|
&Handler_Transmit_Buffer[0], &daddr, &saddr, &npdu_data);
|
||||||
&daddr, &saddr, &npdu_data);
|
|
||||||
|
|
||||||
/* Now send the message */
|
/* Now send the message */
|
||||||
return datalink_send_pdu(
|
return datalink_send_pdu(
|
||||||
dst, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
|
dst, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @file h_npdu.c Handles messages at the NPDU level of the BACnet stack. */
|
/** @file h_npdu.c Handles messages at the NPDU level of the BACnet stack. */
|
||||||
@@ -163,8 +158,8 @@ static void network_control_handler(BACNET_ADDRESS *src,
|
|||||||
case NETWORK_MESSAGE_WHAT_IS_NETWORK_NUMBER:
|
case NETWORK_MESSAGE_WHAT_IS_NETWORK_NUMBER:
|
||||||
if (src->net == 0) {
|
if (src->net == 0) {
|
||||||
if (Local_Network_Number) {
|
if (Local_Network_Number) {
|
||||||
npdu_send_network_number_is(src, Local_Network_Number,
|
npdu_send_network_number_is(
|
||||||
Local_Network_Number_Status);
|
src, Local_Network_Number, Local_Network_Number_Status);
|
||||||
} else {
|
} else {
|
||||||
/* Upon receipt of a What-Is-Network-Number message,
|
/* Upon receipt of a What-Is-Network-Number message,
|
||||||
a device that does not know the local network number
|
a device that does not know the local network number
|
||||||
@@ -225,9 +220,7 @@ static void network_control_handler(BACNET_ADDRESS *src,
|
|||||||
* @param pdu [in] Buffer containing the NPDU and APDU of the received packet.
|
* @param pdu [in] Buffer containing the NPDU and APDU of the received packet.
|
||||||
* @param pdu_len [in] The size of the received message in the pdu[] buffer.
|
* @param pdu_len [in] The size of the received message in the pdu[] buffer.
|
||||||
*/
|
*/
|
||||||
void npdu_handler(BACNET_ADDRESS *src,
|
void npdu_handler(BACNET_ADDRESS *src, uint8_t *pdu, uint16_t pdu_len)
|
||||||
uint8_t *pdu,
|
|
||||||
uint16_t pdu_len)
|
|
||||||
{
|
{
|
||||||
int apdu_offset = 0;
|
int apdu_offset = 0;
|
||||||
BACNET_ADDRESS dest = { 0 };
|
BACNET_ADDRESS dest = { 0 };
|
||||||
@@ -243,8 +236,8 @@ void npdu_handler(BACNET_ADDRESS *src,
|
|||||||
bacnet_npdu_decode(&pdu[0], pdu_len, &dest, src, &npdu_data);
|
bacnet_npdu_decode(&pdu[0], pdu_len, &dest, src, &npdu_data);
|
||||||
if (npdu_data.network_layer_message) {
|
if (npdu_data.network_layer_message) {
|
||||||
if ((dest.net == 0) || (dest.net == BACNET_BROADCAST_NETWORK)) {
|
if ((dest.net == 0) || (dest.net == BACNET_BROADCAST_NETWORK)) {
|
||||||
network_control_handler(src, &npdu_data,
|
network_control_handler(src, &npdu_data, &pdu[apdu_offset],
|
||||||
&pdu[apdu_offset], (uint16_t)(pdu_len - apdu_offset));
|
(uint16_t)(pdu_len - apdu_offset));
|
||||||
} else {
|
} else {
|
||||||
debug_printf("NPDU: message for router. Discarded!\n");
|
debug_printf("NPDU: message for router. Discarded!\n");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -317,6 +317,5 @@ void Send_Network_Number_Is(BACNET_ADDRESS *dst, int dnet, int status)
|
|||||||
iArgs[0] = dnet;
|
iArgs[0] = dnet;
|
||||||
iArgs[1] = status;
|
iArgs[1] = status;
|
||||||
|
|
||||||
Send_Network_Layer_Message(
|
Send_Network_Layer_Message(NETWORK_MESSAGE_NETWORK_NUMBER_IS, dst, iArgs);
|
||||||
NETWORK_MESSAGE_NETWORK_NUMBER_IS, dst, iArgs);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -342,8 +342,8 @@ bool Access_Credential_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
Access_Credential_Instance_To_Index(wp_data->object_instance);
|
Access_Credential_Instance_To_Index(wp_data->object_instance);
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_GLOBAL_IDENTIFIER:
|
case PROP_GLOBAL_IDENTIFIER:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
ac_descr[object_index].global_identifier =
|
ac_descr[object_index].global_identifier =
|
||||||
value.type.Unsigned_Int;
|
value.type.Unsigned_Int;
|
||||||
|
|||||||
@@ -462,8 +462,8 @@ bool Access_Door_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
object_index = Access_Door_Instance_To_Index(wp_data->object_instance);
|
object_index = Access_Door_Instance_To_Index(wp_data->object_instance);
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_PRESENT_VALUE:
|
case PROP_PRESENT_VALUE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_ENUMERATED);
|
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
|
||||||
if (status) {
|
if (status) {
|
||||||
/* Command priority 6 is reserved for use by Minimum On/Off
|
/* Command priority 6 is reserved for use by Minimum On/Off
|
||||||
algorithm and may not be used for other purposes in any
|
algorithm and may not be used for other purposes in any
|
||||||
@@ -482,8 +482,8 @@ bool Access_Door_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
|
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_NULL);
|
wp_data, &value, BACNET_APPLICATION_TAG_NULL);
|
||||||
if (status) {
|
if (status) {
|
||||||
status = Access_Door_Present_Value_Relinquish(
|
status = Access_Door_Present_Value_Relinquish(
|
||||||
wp_data->object_instance, wp_data->priority);
|
wp_data->object_instance, wp_data->priority);
|
||||||
@@ -495,8 +495,8 @@ bool Access_Door_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_OUT_OF_SERVICE:
|
case PROP_OUT_OF_SERVICE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BOOLEAN);
|
wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN);
|
||||||
if (status) {
|
if (status) {
|
||||||
Access_Door_Out_Of_Service_Set(
|
Access_Door_Out_Of_Service_Set(
|
||||||
wp_data->object_instance, value.type.Boolean);
|
wp_data->object_instance, value.type.Boolean);
|
||||||
@@ -504,8 +504,8 @@ bool Access_Door_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
case PROP_DOOR_STATUS:
|
case PROP_DOOR_STATUS:
|
||||||
if (Access_Door_Out_Of_Service(wp_data->object_instance)) {
|
if (Access_Door_Out_Of_Service(wp_data->object_instance)) {
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_ENUMERATED);
|
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
|
||||||
if (status) {
|
if (status) {
|
||||||
ad_descr[object_index].door_status =
|
ad_descr[object_index].door_status =
|
||||||
(BACNET_DOOR_STATUS)value.type.Enumerated;
|
(BACNET_DOOR_STATUS)value.type.Enumerated;
|
||||||
@@ -517,8 +517,8 @@ bool Access_Door_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
case PROP_LOCK_STATUS:
|
case PROP_LOCK_STATUS:
|
||||||
if (Access_Door_Out_Of_Service(wp_data->object_instance)) {
|
if (Access_Door_Out_Of_Service(wp_data->object_instance)) {
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_ENUMERATED);
|
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
|
||||||
if (status) {
|
if (status) {
|
||||||
ad_descr[object_index].lock_status =
|
ad_descr[object_index].lock_status =
|
||||||
(BACNET_LOCK_STATUS)value.type.Enumerated;
|
(BACNET_LOCK_STATUS)value.type.Enumerated;
|
||||||
@@ -530,8 +530,8 @@ bool Access_Door_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
case PROP_DOOR_ALARM_STATE:
|
case PROP_DOOR_ALARM_STATE:
|
||||||
if (Access_Door_Out_Of_Service(wp_data->object_instance)) {
|
if (Access_Door_Out_Of_Service(wp_data->object_instance)) {
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_ENUMERATED);
|
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
|
||||||
if (status) {
|
if (status) {
|
||||||
ad_descr[object_index].door_alarm_state =
|
ad_descr[object_index].door_alarm_state =
|
||||||
(BACNET_DOOR_ALARM_STATE)value.type.Enumerated;
|
(BACNET_DOOR_ALARM_STATE)value.type.Enumerated;
|
||||||
|
|||||||
@@ -308,8 +308,8 @@ bool Access_Rights_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
object_index = Access_Rights_Instance_To_Index(wp_data->object_instance);
|
object_index = Access_Rights_Instance_To_Index(wp_data->object_instance);
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_GLOBAL_IDENTIFIER:
|
case PROP_GLOBAL_IDENTIFIER:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
ar_descr[object_index].global_identifier =
|
ar_descr[object_index].global_identifier =
|
||||||
value.type.Unsigned_Int;
|
value.type.Unsigned_Int;
|
||||||
|
|||||||
@@ -250,8 +250,8 @@ bool Access_User_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
object_index = Access_User_Instance_To_Index(wp_data->object_instance);
|
object_index = Access_User_Instance_To_Index(wp_data->object_instance);
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_GLOBAL_IDENTIFIER:
|
case PROP_GLOBAL_IDENTIFIER:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
au_descr[object_index].global_identifier =
|
au_descr[object_index].global_identifier =
|
||||||
value.type.Unsigned_Int;
|
value.type.Unsigned_Int;
|
||||||
@@ -276,4 +276,3 @@ bool Access_User_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -301,8 +301,8 @@ bool Access_Zone_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
object_index = Access_Zone_Instance_To_Index(wp_data->object_instance);
|
object_index = Access_Zone_Instance_To_Index(wp_data->object_instance);
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_GLOBAL_IDENTIFIER:
|
case PROP_GLOBAL_IDENTIFIER:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
az_descr[object_index].global_identifier =
|
az_descr[object_index].global_identifier =
|
||||||
value.type.Unsigned_Int;
|
value.type.Unsigned_Int;
|
||||||
@@ -310,8 +310,8 @@ bool Access_Zone_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
case PROP_RELIABILITY:
|
case PROP_RELIABILITY:
|
||||||
if (Access_Zone_Out_Of_Service(wp_data->object_instance)) {
|
if (Access_Zone_Out_Of_Service(wp_data->object_instance)) {
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_ENUMERATED);
|
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
|
||||||
if (status) {
|
if (status) {
|
||||||
az_descr[object_index].reliability =
|
az_descr[object_index].reliability =
|
||||||
(BACNET_RELIABILITY)value.type.Enumerated;
|
(BACNET_RELIABILITY)value.type.Enumerated;
|
||||||
|
|||||||
@@ -300,8 +300,8 @@ bool Analog_Input_Encode_Value_List(
|
|||||||
}
|
}
|
||||||
out_of_service = AI_Descr[index].Out_Of_Service;
|
out_of_service = AI_Descr[index].Out_Of_Service;
|
||||||
present_value = AI_Descr[index].Present_Value;
|
present_value = AI_Descr[index].Present_Value;
|
||||||
status = cov_value_list_encode_real(value_list, present_value,
|
status = cov_value_list_encode_real(value_list, present_value, in_alarm,
|
||||||
in_alarm, fault, overridden, out_of_service);
|
fault, overridden, out_of_service);
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
@@ -430,9 +430,8 @@ int Analog_Input_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_EVENT_STATE:
|
case PROP_EVENT_STATE:
|
||||||
apdu_len =
|
apdu_len = encode_application_enumerated(
|
||||||
encode_application_enumerated(&apdu[0],
|
&apdu[0], Analog_Input_Event_State(rpdata->object_instance));
|
||||||
Analog_Input_Event_State(rpdata->object_instance));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_RELIABILITY:
|
case PROP_RELIABILITY:
|
||||||
@@ -633,8 +632,8 @@ bool Analog_Input_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
|
|
||||||
switch ((int)wp_data->object_property) {
|
switch ((int)wp_data->object_property) {
|
||||||
case PROP_PRESENT_VALUE:
|
case PROP_PRESENT_VALUE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_REAL);
|
wp_data, &value, BACNET_APPLICATION_TAG_REAL);
|
||||||
if (status) {
|
if (status) {
|
||||||
if (CurrentAI->Out_Of_Service == true) {
|
if (CurrentAI->Out_Of_Service == true) {
|
||||||
Analog_Input_Present_Value_Set(
|
Analog_Input_Present_Value_Set(
|
||||||
@@ -648,8 +647,8 @@ bool Analog_Input_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_OUT_OF_SERVICE:
|
case PROP_OUT_OF_SERVICE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BOOLEAN);
|
wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN);
|
||||||
if (status) {
|
if (status) {
|
||||||
Analog_Input_Out_Of_Service_Set(
|
Analog_Input_Out_Of_Service_Set(
|
||||||
wp_data->object_instance, value.type.Boolean);
|
wp_data->object_instance, value.type.Boolean);
|
||||||
@@ -657,16 +656,16 @@ bool Analog_Input_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_UNITS:
|
case PROP_UNITS:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_ENUMERATED);
|
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
|
||||||
if (status) {
|
if (status) {
|
||||||
CurrentAI->Units = value.type.Enumerated;
|
CurrentAI->Units = value.type.Enumerated;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_COV_INCREMENT:
|
case PROP_COV_INCREMENT:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_REAL);
|
wp_data, &value, BACNET_APPLICATION_TAG_REAL);
|
||||||
if (status) {
|
if (status) {
|
||||||
if (value.type.Real >= 0.0) {
|
if (value.type.Real >= 0.0) {
|
||||||
Analog_Input_COV_Increment_Set(
|
Analog_Input_COV_Increment_Set(
|
||||||
@@ -681,8 +680,8 @@ bool Analog_Input_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
|
|
||||||
#if defined(INTRINSIC_REPORTING)
|
#if defined(INTRINSIC_REPORTING)
|
||||||
case PROP_TIME_DELAY:
|
case PROP_TIME_DELAY:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
CurrentAI->Time_Delay = value.type.Unsigned_Int;
|
CurrentAI->Time_Delay = value.type.Unsigned_Int;
|
||||||
CurrentAI->Remaining_Time_Delay = CurrentAI->Time_Delay;
|
CurrentAI->Remaining_Time_Delay = CurrentAI->Time_Delay;
|
||||||
@@ -690,40 +689,40 @@ bool Analog_Input_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_NOTIFICATION_CLASS:
|
case PROP_NOTIFICATION_CLASS:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
CurrentAI->Notification_Class = value.type.Unsigned_Int;
|
CurrentAI->Notification_Class = value.type.Unsigned_Int;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_HIGH_LIMIT:
|
case PROP_HIGH_LIMIT:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_REAL);
|
wp_data, &value, BACNET_APPLICATION_TAG_REAL);
|
||||||
if (status) {
|
if (status) {
|
||||||
CurrentAI->High_Limit = value.type.Real;
|
CurrentAI->High_Limit = value.type.Real;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_LOW_LIMIT:
|
case PROP_LOW_LIMIT:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_REAL);
|
wp_data, &value, BACNET_APPLICATION_TAG_REAL);
|
||||||
if (status) {
|
if (status) {
|
||||||
CurrentAI->Low_Limit = value.type.Real;
|
CurrentAI->Low_Limit = value.type.Real;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_DEADBAND:
|
case PROP_DEADBAND:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_REAL);
|
wp_data, &value, BACNET_APPLICATION_TAG_REAL);
|
||||||
if (status) {
|
if (status) {
|
||||||
CurrentAI->Deadband = value.type.Real;
|
CurrentAI->Deadband = value.type.Real;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_LIMIT_ENABLE:
|
case PROP_LIMIT_ENABLE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BIT_STRING);
|
wp_data, &value, BACNET_APPLICATION_TAG_BIT_STRING);
|
||||||
if (status) {
|
if (status) {
|
||||||
if (value.type.Bit_String.bits_used == 2) {
|
if (value.type.Bit_String.bits_used == 2) {
|
||||||
CurrentAI->Limit_Enable = value.type.Bit_String.value[0];
|
CurrentAI->Limit_Enable = value.type.Bit_String.value[0];
|
||||||
@@ -736,8 +735,8 @@ bool Analog_Input_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_EVENT_ENABLE:
|
case PROP_EVENT_ENABLE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BIT_STRING);
|
wp_data, &value, BACNET_APPLICATION_TAG_BIT_STRING);
|
||||||
if (status) {
|
if (status) {
|
||||||
if (value.type.Bit_String.bits_used == 3) {
|
if (value.type.Bit_String.bits_used == 3) {
|
||||||
CurrentAI->Event_Enable = value.type.Bit_String.value[0];
|
CurrentAI->Event_Enable = value.type.Bit_String.value[0];
|
||||||
@@ -750,8 +749,8 @@ bool Analog_Input_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_NOTIFY_TYPE:
|
case PROP_NOTIFY_TYPE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_ENUMERATED);
|
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
|
||||||
if (status) {
|
if (status) {
|
||||||
switch ((BACNET_NOTIFY_TYPE)value.type.Enumerated) {
|
switch ((BACNET_NOTIFY_TYPE)value.type.Enumerated) {
|
||||||
case NOTIFY_EVENT:
|
case NOTIFY_EVENT:
|
||||||
@@ -968,8 +967,7 @@ void Analog_Input_Intrinsic_Reporting(uint32_t object_instance)
|
|||||||
break;
|
break;
|
||||||
} /* switch (ToState) */
|
} /* switch (ToState) */
|
||||||
PRINTF("Analog-Input[%d]: Event_State goes from %s to %s.\n",
|
PRINTF("Analog-Input[%d]: Event_State goes from %s to %s.\n",
|
||||||
object_instance,
|
object_instance, bactext_event_state_name(FromState),
|
||||||
bactext_event_state_name(FromState),
|
|
||||||
bactext_event_state_name(ToState));
|
bactext_event_state_name(ToState));
|
||||||
/* Notify Type */
|
/* Notify Type */
|
||||||
event_data.notifyType = CurrentAI->Notify_Type;
|
event_data.notifyType = CurrentAI->Notify_Type;
|
||||||
@@ -1014,18 +1012,15 @@ void Analog_Input_Intrinsic_Reporting(uint32_t object_instance)
|
|||||||
switch (ToState) {
|
switch (ToState) {
|
||||||
case EVENT_STATE_HIGH_LIMIT:
|
case EVENT_STATE_HIGH_LIMIT:
|
||||||
case EVENT_STATE_LOW_LIMIT:
|
case EVENT_STATE_LOW_LIMIT:
|
||||||
datetime_copy(
|
datetime_copy(&event_data.timeStamp.value.dateTime,
|
||||||
&event_data.timeStamp.value.dateTime,
|
|
||||||
&CurrentAI->Event_Time_Stamps[TRANSITION_TO_OFFNORMAL]);
|
&CurrentAI->Event_Time_Stamps[TRANSITION_TO_OFFNORMAL]);
|
||||||
break;
|
break;
|
||||||
case EVENT_STATE_FAULT:
|
case EVENT_STATE_FAULT:
|
||||||
datetime_copy(
|
datetime_copy(&event_data.timeStamp.value.dateTime,
|
||||||
&event_data.timeStamp.value.dateTime,
|
|
||||||
&CurrentAI->Event_Time_Stamps[TRANSITION_TO_FAULT]);
|
&CurrentAI->Event_Time_Stamps[TRANSITION_TO_FAULT]);
|
||||||
break;
|
break;
|
||||||
case EVENT_STATE_NORMAL:
|
case EVENT_STATE_NORMAL:
|
||||||
datetime_copy(
|
datetime_copy(&event_data.timeStamp.value.dateTime,
|
||||||
&event_data.timeStamp.value.dateTime,
|
|
||||||
&CurrentAI->Event_Time_Stamps[TRANSITION_TO_NORMAL]);
|
&CurrentAI->Event_Time_Stamps[TRANSITION_TO_NORMAL]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -425,8 +425,8 @@ bool Analog_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_PRESENT_VALUE:
|
case PROP_PRESENT_VALUE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_REAL);
|
wp_data, &value, BACNET_APPLICATION_TAG_REAL);
|
||||||
if (status) {
|
if (status) {
|
||||||
/* Command priority 6 is reserved for use by Minimum On/Off
|
/* Command priority 6 is reserved for use by Minimum On/Off
|
||||||
algorithm and may not be used for other purposes in any
|
algorithm and may not be used for other purposes in any
|
||||||
@@ -445,8 +445,8 @@ bool Analog_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
|
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_NULL);
|
wp_data, &value, BACNET_APPLICATION_TAG_NULL);
|
||||||
if (status) {
|
if (status) {
|
||||||
status = Analog_Output_Present_Value_Relinquish(
|
status = Analog_Output_Present_Value_Relinquish(
|
||||||
wp_data->object_instance, wp_data->priority);
|
wp_data->object_instance, wp_data->priority);
|
||||||
@@ -458,8 +458,8 @@ bool Analog_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_OUT_OF_SERVICE:
|
case PROP_OUT_OF_SERVICE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BOOLEAN);
|
wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN);
|
||||||
if (status) {
|
if (status) {
|
||||||
Analog_Output_Out_Of_Service_Set(
|
Analog_Output_Out_Of_Service_Set(
|
||||||
wp_data->object_instance, value.type.Boolean);
|
wp_data->object_instance, value.type.Boolean);
|
||||||
|
|||||||
@@ -382,8 +382,8 @@ bool Analog_Value_Encode_Value_List(
|
|||||||
bitstring_set_bit(&value_list->value.type.Bit_String,
|
bitstring_set_bit(&value_list->value.type.Bit_String,
|
||||||
STATUS_FLAG_IN_ALARM, false);
|
STATUS_FLAG_IN_ALARM, false);
|
||||||
} else {
|
} else {
|
||||||
bitstring_set_bit(&value_list->value.type.Bit_String,
|
bitstring_set_bit(
|
||||||
STATUS_FLAG_IN_ALARM, true);
|
&value_list->value.type.Bit_String, STATUS_FLAG_IN_ALARM, true);
|
||||||
}
|
}
|
||||||
bitstring_set_bit(
|
bitstring_set_bit(
|
||||||
&value_list->value.type.Bit_String, STATUS_FLAG_FAULT, false);
|
&value_list->value.type.Bit_String, STATUS_FLAG_FAULT, false);
|
||||||
@@ -745,8 +745,8 @@ bool Analog_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
|
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_PRESENT_VALUE:
|
case PROP_PRESENT_VALUE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_REAL);
|
wp_data, &value, BACNET_APPLICATION_TAG_REAL);
|
||||||
if (status) {
|
if (status) {
|
||||||
/* Command priority 6 is reserved for use by Minimum On/Off
|
/* Command priority 6 is reserved for use by Minimum On/Off
|
||||||
algorithm and may not be used for other purposes in any
|
algorithm and may not be used for other purposes in any
|
||||||
@@ -772,24 +772,24 @@ bool Analog_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_OUT_OF_SERVICE:
|
case PROP_OUT_OF_SERVICE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BOOLEAN);
|
wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN);
|
||||||
if (status) {
|
if (status) {
|
||||||
CurrentAV->Out_Of_Service = value.type.Boolean;
|
CurrentAV->Out_Of_Service = value.type.Boolean;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_UNITS:
|
case PROP_UNITS:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_ENUMERATED);
|
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
|
||||||
if (status) {
|
if (status) {
|
||||||
CurrentAV->Units = value.type.Enumerated;
|
CurrentAV->Units = value.type.Enumerated;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_COV_INCREMENT:
|
case PROP_COV_INCREMENT:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_REAL);
|
wp_data, &value, BACNET_APPLICATION_TAG_REAL);
|
||||||
if (status) {
|
if (status) {
|
||||||
if (value.type.Real >= 0.0) {
|
if (value.type.Real >= 0.0) {
|
||||||
Analog_Value_COV_Increment_Set(
|
Analog_Value_COV_Increment_Set(
|
||||||
@@ -804,8 +804,8 @@ bool Analog_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
|
|
||||||
#if defined(INTRINSIC_REPORTING)
|
#if defined(INTRINSIC_REPORTING)
|
||||||
case PROP_TIME_DELAY:
|
case PROP_TIME_DELAY:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
CurrentAV->Time_Delay = value.type.Unsigned_Int;
|
CurrentAV->Time_Delay = value.type.Unsigned_Int;
|
||||||
CurrentAV->Remaining_Time_Delay = CurrentAV->Time_Delay;
|
CurrentAV->Remaining_Time_Delay = CurrentAV->Time_Delay;
|
||||||
@@ -813,40 +813,40 @@ bool Analog_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_NOTIFICATION_CLASS:
|
case PROP_NOTIFICATION_CLASS:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
CurrentAV->Notification_Class = value.type.Unsigned_Int;
|
CurrentAV->Notification_Class = value.type.Unsigned_Int;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_HIGH_LIMIT:
|
case PROP_HIGH_LIMIT:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_REAL);
|
wp_data, &value, BACNET_APPLICATION_TAG_REAL);
|
||||||
if (status) {
|
if (status) {
|
||||||
CurrentAV->High_Limit = value.type.Real;
|
CurrentAV->High_Limit = value.type.Real;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_LOW_LIMIT:
|
case PROP_LOW_LIMIT:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_REAL);
|
wp_data, &value, BACNET_APPLICATION_TAG_REAL);
|
||||||
if (status) {
|
if (status) {
|
||||||
CurrentAV->Low_Limit = value.type.Real;
|
CurrentAV->Low_Limit = value.type.Real;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_DEADBAND:
|
case PROP_DEADBAND:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_REAL);
|
wp_data, &value, BACNET_APPLICATION_TAG_REAL);
|
||||||
if (status) {
|
if (status) {
|
||||||
CurrentAV->Deadband = value.type.Real;
|
CurrentAV->Deadband = value.type.Real;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_LIMIT_ENABLE:
|
case PROP_LIMIT_ENABLE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BIT_STRING);
|
wp_data, &value, BACNET_APPLICATION_TAG_BIT_STRING);
|
||||||
if (status) {
|
if (status) {
|
||||||
if (value.type.Bit_String.bits_used == 2) {
|
if (value.type.Bit_String.bits_used == 2) {
|
||||||
CurrentAV->Limit_Enable = value.type.Bit_String.value[0];
|
CurrentAV->Limit_Enable = value.type.Bit_String.value[0];
|
||||||
@@ -859,8 +859,8 @@ bool Analog_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_EVENT_ENABLE:
|
case PROP_EVENT_ENABLE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BIT_STRING);
|
wp_data, &value, BACNET_APPLICATION_TAG_BIT_STRING);
|
||||||
if (status) {
|
if (status) {
|
||||||
if (value.type.Bit_String.bits_used == 3) {
|
if (value.type.Bit_String.bits_used == 3) {
|
||||||
CurrentAV->Event_Enable = value.type.Bit_String.value[0];
|
CurrentAV->Event_Enable = value.type.Bit_String.value[0];
|
||||||
@@ -873,8 +873,8 @@ bool Analog_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_NOTIFY_TYPE:
|
case PROP_NOTIFY_TYPE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_ENUMERATED);
|
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
|
||||||
if (status) {
|
if (status) {
|
||||||
switch ((BACNET_NOTIFY_TYPE)value.type.Enumerated) {
|
switch ((BACNET_NOTIFY_TYPE)value.type.Enumerated) {
|
||||||
case NOTIFY_EVENT:
|
case NOTIFY_EVENT:
|
||||||
@@ -1097,8 +1097,7 @@ void Analog_Value_Intrinsic_Reporting(uint32_t object_instance)
|
|||||||
#if PRINT_ENABLED
|
#if PRINT_ENABLED
|
||||||
fprintf(stderr, "Event_State for (%s,%u) goes from %s to %s.\n",
|
fprintf(stderr, "Event_State for (%s,%u) goes from %s to %s.\n",
|
||||||
bactext_object_type_name(OBJECT_ANALOG_VALUE),
|
bactext_object_type_name(OBJECT_ANALOG_VALUE),
|
||||||
(unsigned)object_instance,
|
(unsigned)object_instance, bactext_event_state_name(FromState),
|
||||||
bactext_event_state_name(FromState),
|
|
||||||
bactext_event_state_name(ToState));
|
bactext_event_state_name(ToState));
|
||||||
#endif /* PRINT_ENABLED */
|
#endif /* PRINT_ENABLED */
|
||||||
|
|
||||||
|
|||||||
@@ -309,8 +309,8 @@ bool bacfile_write_property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
property shall be logical TRUE only if no changes have been
|
property shall be logical TRUE only if no changes have been
|
||||||
made to the file data by internal processes or through File
|
made to the file data by internal processes or through File
|
||||||
Access Services since the last time the object was archived. */
|
Access Services since the last time the object was archived. */
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BOOLEAN);
|
wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN);
|
||||||
if (status) {
|
if (status) {
|
||||||
if (value.type.Boolean) {
|
if (value.type.Boolean) {
|
||||||
/* FIXME: do something to wp_data->object_instance */
|
/* FIXME: do something to wp_data->object_instance */
|
||||||
@@ -323,8 +323,8 @@ bool bacfile_write_property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
/* If the file size can be changed by writing to the file,
|
/* If the file size can be changed by writing to the file,
|
||||||
and File_Access_Method is STREAM_ACCESS, then this property
|
and File_Access_Method is STREAM_ACCESS, then this property
|
||||||
shall be writable. */
|
shall be writable. */
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
/* FIXME: do something with value.type.Unsigned
|
/* FIXME: do something with value.type.Unsigned
|
||||||
to wp_data->object_instance */
|
to wp_data->object_instance */
|
||||||
|
|||||||
@@ -429,8 +429,8 @@ bool Binary_Input_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_PRESENT_VALUE:
|
case PROP_PRESENT_VALUE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_ENUMERATED);
|
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
|
||||||
if (status) {
|
if (status) {
|
||||||
if (value.type.Enumerated <= MAX_BINARY_PV) {
|
if (value.type.Enumerated <= MAX_BINARY_PV) {
|
||||||
Binary_Input_Present_Value_Set(wp_data->object_instance,
|
Binary_Input_Present_Value_Set(wp_data->object_instance,
|
||||||
@@ -443,16 +443,16 @@ bool Binary_Input_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_OUT_OF_SERVICE:
|
case PROP_OUT_OF_SERVICE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BOOLEAN);
|
wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN);
|
||||||
if (status) {
|
if (status) {
|
||||||
Binary_Input_Out_Of_Service_Set(
|
Binary_Input_Out_Of_Service_Set(
|
||||||
wp_data->object_instance, value.type.Boolean);
|
wp_data->object_instance, value.type.Boolean);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_POLARITY:
|
case PROP_POLARITY:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_ENUMERATED);
|
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
|
||||||
if (status) {
|
if (status) {
|
||||||
if (value.type.Enumerated < MAX_POLARITY) {
|
if (value.type.Enumerated < MAX_POLARITY) {
|
||||||
Binary_Input_Polarity_Set(wp_data->object_instance,
|
Binary_Input_Polarity_Set(wp_data->object_instance,
|
||||||
|
|||||||
@@ -363,8 +363,8 @@ bool Binary_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_PRESENT_VALUE:
|
case PROP_PRESENT_VALUE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_ENUMERATED);
|
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
|
||||||
if (status) {
|
if (status) {
|
||||||
priority = wp_data->priority;
|
priority = wp_data->priority;
|
||||||
/* Command priority 6 is reserved for use by Minimum On/Off
|
/* Command priority 6 is reserved for use by Minimum On/Off
|
||||||
@@ -396,8 +396,8 @@ bool Binary_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
|
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_NULL);
|
wp_data, &value, BACNET_APPLICATION_TAG_NULL);
|
||||||
if (status) {
|
if (status) {
|
||||||
level = BINARY_NULL;
|
level = BINARY_NULL;
|
||||||
object_index = Binary_Output_Instance_To_Index(
|
object_index = Binary_Output_Instance_To_Index(
|
||||||
@@ -422,8 +422,8 @@ bool Binary_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_OUT_OF_SERVICE:
|
case PROP_OUT_OF_SERVICE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BOOLEAN);
|
wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN);
|
||||||
if (status) {
|
if (status) {
|
||||||
object_index =
|
object_index =
|
||||||
Binary_Output_Instance_To_Index(wp_data->object_instance);
|
Binary_Output_Instance_To_Index(wp_data->object_instance);
|
||||||
|
|||||||
@@ -457,8 +457,8 @@ bool Binary_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
|
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_PRESENT_VALUE:
|
case PROP_PRESENT_VALUE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_ENUMERATED);
|
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
|
||||||
if (status) {
|
if (status) {
|
||||||
priority = wp_data->priority;
|
priority = wp_data->priority;
|
||||||
/* Command priority 6 is reserved for use by Minimum On/Off
|
/* Command priority 6 is reserved for use by Minimum On/Off
|
||||||
@@ -488,8 +488,8 @@ bool Binary_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
|
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_NULL);
|
wp_data, &value, BACNET_APPLICATION_TAG_NULL);
|
||||||
if (status) {
|
if (status) {
|
||||||
level = BINARY_NULL;
|
level = BINARY_NULL;
|
||||||
priority = wp_data->priority;
|
priority = wp_data->priority;
|
||||||
@@ -512,8 +512,8 @@ bool Binary_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_OUT_OF_SERVICE:
|
case PROP_OUT_OF_SERVICE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BOOLEAN);
|
wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN);
|
||||||
if (status) {
|
if (status) {
|
||||||
Binary_Value_Out_Of_Service_Set(
|
Binary_Value_Out_Of_Service_Set(
|
||||||
wp_data->object_instance, value.type.Boolean);
|
wp_data->object_instance, value.type.Boolean);
|
||||||
|
|||||||
@@ -1513,8 +1513,8 @@ bool Channel_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
status = Channel_Present_Value_Set(wp_data, &value);
|
status = Channel_Present_Value_Set(wp_data, &value);
|
||||||
break;
|
break;
|
||||||
case PROP_OUT_OF_SERVICE:
|
case PROP_OUT_OF_SERVICE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BOOLEAN);
|
wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN);
|
||||||
if (status) {
|
if (status) {
|
||||||
Channel_Out_Of_Service_Set(
|
Channel_Out_Of_Service_Set(
|
||||||
wp_data->object_instance, value.type.Boolean);
|
wp_data->object_instance, value.type.Boolean);
|
||||||
@@ -1531,16 +1531,16 @@ bool Channel_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
ERROR_CODE_OPTIONAL_FUNCTIONALITY_NOT_SUPPORTED;
|
ERROR_CODE_OPTIONAL_FUNCTIONALITY_NOT_SUPPORTED;
|
||||||
break;
|
break;
|
||||||
case PROP_CHANNEL_NUMBER:
|
case PROP_CHANNEL_NUMBER:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
Channel_Number_Set(
|
Channel_Number_Set(
|
||||||
wp_data->object_instance, value.type.Unsigned_Int);
|
wp_data->object_instance, value.type.Unsigned_Int);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_CONTROL_GROUPS:
|
case PROP_CONTROL_GROUPS:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
if (wp_data->array_index == 0) {
|
if (wp_data->array_index == 0) {
|
||||||
/* Array element zero is the number of elements in the array
|
/* Array element zero is the number of elements in the array
|
||||||
|
|||||||
@@ -833,70 +833,57 @@ int Color_Temperature_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
|||||||
encode_application_enumerated(&apdu[0], rpdata->object_type);
|
encode_application_enumerated(&apdu[0], rpdata->object_type);
|
||||||
break;
|
break;
|
||||||
case PROP_PRESENT_VALUE:
|
case PROP_PRESENT_VALUE:
|
||||||
apdu_len =
|
apdu_len = encode_application_unsigned(
|
||||||
encode_application_unsigned(apdu,
|
apdu, Color_Temperature_Present_Value(rpdata->object_instance));
|
||||||
Color_Temperature_Present_Value(
|
|
||||||
rpdata->object_instance));
|
|
||||||
break;
|
break;
|
||||||
case PROP_MIN_PRES_VALUE:
|
case PROP_MIN_PRES_VALUE:
|
||||||
apdu_len =
|
apdu_len = encode_application_unsigned(apdu,
|
||||||
encode_application_unsigned(apdu,
|
Color_Temperature_Min_Pres_Value(rpdata->object_instance));
|
||||||
Color_Temperature_Min_Pres_Value(
|
|
||||||
rpdata->object_instance));
|
|
||||||
break;
|
break;
|
||||||
case PROP_MAX_PRES_VALUE:
|
case PROP_MAX_PRES_VALUE:
|
||||||
apdu_len =
|
apdu_len = encode_application_unsigned(apdu,
|
||||||
encode_application_unsigned(apdu,
|
Color_Temperature_Max_Pres_Value(rpdata->object_instance));
|
||||||
Color_Temperature_Max_Pres_Value(
|
|
||||||
rpdata->object_instance));
|
|
||||||
break;
|
break;
|
||||||
case PROP_TRACKING_VALUE:
|
case PROP_TRACKING_VALUE:
|
||||||
apdu_len =
|
apdu_len = encode_application_unsigned(apdu,
|
||||||
encode_application_unsigned(apdu,
|
Color_Temperature_Tracking_Value(rpdata->object_instance));
|
||||||
Color_Temperature_Tracking_Value(
|
|
||||||
rpdata->object_instance));
|
|
||||||
break;
|
break;
|
||||||
case PROP_COLOR_COMMAND:
|
case PROP_COLOR_COMMAND:
|
||||||
if (Color_Temperature_Command(rpdata->object_instance, &color_command)) {
|
if (Color_Temperature_Command(
|
||||||
|
rpdata->object_instance, &color_command)) {
|
||||||
apdu_len = color_command_encode(apdu, &color_command);
|
apdu_len = color_command_encode(apdu, &color_command);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_IN_PROGRESS:
|
case PROP_IN_PROGRESS:
|
||||||
apdu_len =
|
apdu_len = encode_application_enumerated(
|
||||||
encode_application_enumerated(apdu,
|
apdu, Color_Temperature_In_Progress(rpdata->object_instance));
|
||||||
Color_Temperature_In_Progress(rpdata->object_instance));
|
|
||||||
break;
|
break;
|
||||||
case PROP_DEFAULT_COLOR_TEMPERATURE:
|
case PROP_DEFAULT_COLOR_TEMPERATURE:
|
||||||
apdu_len =
|
apdu_len = encode_application_unsigned(apdu,
|
||||||
encode_application_unsigned(apdu,
|
|
||||||
Color_Temperature_Default_Color_Temperature(
|
Color_Temperature_Default_Color_Temperature(
|
||||||
rpdata->object_instance));
|
rpdata->object_instance));
|
||||||
break;
|
break;
|
||||||
case PROP_DEFAULT_FADE_TIME:
|
case PROP_DEFAULT_FADE_TIME:
|
||||||
apdu_len =
|
apdu_len = encode_application_unsigned(apdu,
|
||||||
encode_application_unsigned(apdu,
|
|
||||||
Color_Temperature_Default_Fade_Time(rpdata->object_instance));
|
Color_Temperature_Default_Fade_Time(rpdata->object_instance));
|
||||||
break;
|
break;
|
||||||
case PROP_DEFAULT_RAMP_RATE:
|
case PROP_DEFAULT_RAMP_RATE:
|
||||||
apdu_len =
|
apdu_len = encode_application_unsigned(apdu,
|
||||||
encode_application_unsigned(apdu,
|
|
||||||
Color_Temperature_Default_Ramp_Rate(rpdata->object_instance));
|
Color_Temperature_Default_Ramp_Rate(rpdata->object_instance));
|
||||||
break;
|
break;
|
||||||
case PROP_DEFAULT_STEP_INCREMENT:
|
case PROP_DEFAULT_STEP_INCREMENT:
|
||||||
apdu_len =
|
apdu_len = encode_application_unsigned(apdu,
|
||||||
encode_application_unsigned(apdu,
|
Color_Temperature_Default_Step_Increment(
|
||||||
Color_Temperature_Default_Step_Increment(rpdata->object_instance));
|
rpdata->object_instance));
|
||||||
break;
|
break;
|
||||||
case PROP_TRANSITION:
|
case PROP_TRANSITION:
|
||||||
apdu_len =
|
apdu_len = encode_application_enumerated(
|
||||||
encode_application_enumerated(apdu,
|
apdu, Color_Temperature_Transition(rpdata->object_instance));
|
||||||
Color_Temperature_Transition(rpdata->object_instance));
|
|
||||||
break;
|
break;
|
||||||
case PROP_DESCRIPTION:
|
case PROP_DESCRIPTION:
|
||||||
characterstring_init_ansi(
|
characterstring_init_ansi(&char_string,
|
||||||
&char_string, Color_Temperature_Description(rpdata->object_instance));
|
Color_Temperature_Description(rpdata->object_instance));
|
||||||
apdu_len =
|
apdu_len = encode_application_character_string(apdu, &char_string);
|
||||||
encode_application_character_string(apdu, &char_string);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
rpdata->error_class = ERROR_CLASS_PROPERTY;
|
rpdata->error_class = ERROR_CLASS_PROPERTY;
|
||||||
|
|||||||
@@ -195,8 +195,7 @@ int cl_decode_apdu(uint8_t *apdu,
|
|||||||
if (tag_number != 2) {
|
if (tag_number != 2) {
|
||||||
return BACNET_STATUS_REJECT;
|
return BACNET_STATUS_REJECT;
|
||||||
}
|
}
|
||||||
len = decode_enumerated(
|
len = decode_enumerated(&apdu[dec_len], len_value_type, &enum_value);
|
||||||
&apdu[dec_len], len_value_type, &enum_value);
|
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
return BACNET_STATUS_REJECT;
|
return BACNET_STATUS_REJECT;
|
||||||
}
|
}
|
||||||
@@ -783,8 +782,8 @@ bool Command_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
|
|
||||||
switch ((int)wp_data->object_property) {
|
switch ((int)wp_data->object_property) {
|
||||||
case PROP_PRESENT_VALUE:
|
case PROP_PRESENT_VALUE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
if (value.type.Unsigned_Int >= MAX_COMMAND_ACTIONS) {
|
if (value.type.Unsigned_Int >= MAX_COMMAND_ACTIONS) {
|
||||||
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
||||||
|
|||||||
@@ -333,8 +333,8 @@ bool Credential_Data_Input_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
case PROP_RELIABILITY:
|
case PROP_RELIABILITY:
|
||||||
if (Credential_Data_Input_Out_Of_Service(
|
if (Credential_Data_Input_Out_Of_Service(
|
||||||
wp_data->object_instance)) {
|
wp_data->object_instance)) {
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_ENUMERATED);
|
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
|
||||||
if (status) {
|
if (status) {
|
||||||
cdi_descr[object_index].reliability =
|
cdi_descr[object_index].reliability =
|
||||||
(BACNET_RELIABILITY)value.type.Enumerated;
|
(BACNET_RELIABILITY)value.type.Enumerated;
|
||||||
|
|||||||
@@ -268,8 +268,7 @@ static void CharacterString_Value_Out_Of_Service_Set(
|
|||||||
* @param object_instance - object-instance number of the object
|
* @param object_instance - object-instance number of the object
|
||||||
* @return the COV change flag status
|
* @return the COV change flag status
|
||||||
*/
|
*/
|
||||||
bool CharacterString_Value_Change_Of_Value(
|
bool CharacterString_Value_Change_Of_Value(uint32_t object_instance)
|
||||||
uint32_t object_instance)
|
|
||||||
{
|
{
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
unsigned index = 0; /* offset from instance lookup */
|
unsigned index = 0; /* offset from instance lookup */
|
||||||
@@ -286,8 +285,7 @@ bool CharacterString_Value_Change_Of_Value(
|
|||||||
* @brief Clear the COV change flag
|
* @brief Clear the COV change flag
|
||||||
* @param object_instance - object-instance number of the object
|
* @param object_instance - object-instance number of the object
|
||||||
*/
|
*/
|
||||||
void CharacterString_Value_Change_Of_Value_Clear(
|
void CharacterString_Value_Change_Of_Value_Clear(uint32_t object_instance)
|
||||||
uint32_t object_instance)
|
|
||||||
{
|
{
|
||||||
unsigned index = 0; /* offset from instance lookup */
|
unsigned index = 0; /* offset from instance lookup */
|
||||||
|
|
||||||
@@ -298,14 +296,14 @@ void CharacterString_Value_Change_Of_Value_Clear(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief For a given object instance-number, loads the value_list with the COV data.
|
* @brief For a given object instance-number, loads the value_list with the COV
|
||||||
|
* data.
|
||||||
* @param object_instance - object-instance number of the object
|
* @param object_instance - object-instance number of the object
|
||||||
* @param value_list - list of COV data
|
* @param value_list - list of COV data
|
||||||
* @return true if the value list is encoded
|
* @return true if the value list is encoded
|
||||||
*/
|
*/
|
||||||
bool CharacterString_Value_Encode_Value_List(
|
bool CharacterString_Value_Encode_Value_List(
|
||||||
uint32_t object_instance,
|
uint32_t object_instance, BACNET_PROPERTY_VALUE *value_list)
|
||||||
BACNET_PROPERTY_VALUE * value_list)
|
|
||||||
{
|
{
|
||||||
bool status = false;
|
bool status = false;
|
||||||
const bool in_alarm = false;
|
const bool in_alarm = false;
|
||||||
@@ -589,8 +587,8 @@ bool CharacterString_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
|
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_PRESENT_VALUE:
|
case PROP_PRESENT_VALUE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_CHARACTER_STRING);
|
wp_data, &value, BACNET_APPLICATION_TAG_CHARACTER_STRING);
|
||||||
if (status) {
|
if (status) {
|
||||||
status = CharacterString_Value_Present_Value_Set(
|
status = CharacterString_Value_Present_Value_Set(
|
||||||
wp_data->object_instance, &value.type.Character_String);
|
wp_data->object_instance, &value.type.Character_String);
|
||||||
@@ -601,8 +599,8 @@ bool CharacterString_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_OUT_OF_SERVICE:
|
case PROP_OUT_OF_SERVICE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BOOLEAN);
|
wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN);
|
||||||
if (status) {
|
if (status) {
|
||||||
CharacterString_Value_Out_Of_Service_Set(
|
CharacterString_Value_Out_Of_Service_Set(
|
||||||
wp_data->object_instance, value.type.Boolean);
|
wp_data->object_instance, value.type.Boolean);
|
||||||
|
|||||||
@@ -228,12 +228,11 @@ static object_functions_t My_Object_Table[] = {
|
|||||||
NULL /* COV */, NULL /* COV Clear */, NULL /* Intrinsic Reporting */ },
|
NULL /* COV */, NULL /* COV Clear */, NULL /* Intrinsic Reporting */ },
|
||||||
#endif
|
#endif
|
||||||
#if (BACNET_PROTOCOL_REVISION >= 24)
|
#if (BACNET_PROTOCOL_REVISION >= 24)
|
||||||
{ OBJECT_COLOR, Color_Init, Color_Count,
|
{ OBJECT_COLOR, Color_Init, Color_Count, Color_Index_To_Instance,
|
||||||
Color_Index_To_Instance, Color_Valid_Instance,
|
Color_Valid_Instance, Color_Object_Name, Color_Read_Property,
|
||||||
Color_Object_Name, Color_Read_Property,
|
Color_Write_Property, Color_Property_Lists, NULL /* ReadRangeInfo */,
|
||||||
Color_Write_Property, Color_Property_Lists,
|
NULL /* Iterator */, NULL /* Value_Lists */, NULL /* COV */,
|
||||||
NULL /* ReadRangeInfo */, NULL /* Iterator */, NULL /* Value_Lists */,
|
NULL /* COV Clear */, NULL /* Intrinsic Reporting */ },
|
||||||
NULL /* COV */, NULL /* COV Clear */, NULL /* Intrinsic Reporting */ },
|
|
||||||
{ OBJECT_COLOR_TEMPERATURE, Color_Temperature_Init, Color_Temperature_Count,
|
{ OBJECT_COLOR_TEMPERATURE, Color_Temperature_Init, Color_Temperature_Count,
|
||||||
Color_Temperature_Index_To_Instance, Color_Temperature_Valid_Instance,
|
Color_Temperature_Index_To_Instance, Color_Temperature_Valid_Instance,
|
||||||
Color_Temperature_Object_Name, Color_Temperature_Read_Property,
|
Color_Temperature_Object_Name, Color_Temperature_Read_Property,
|
||||||
@@ -1353,8 +1352,7 @@ static int Read_Property_Common(
|
|||||||
}
|
}
|
||||||
apdu = rpdata->application_data;
|
apdu = rpdata->application_data;
|
||||||
if (property_list_common(rpdata->object_property)) {
|
if (property_list_common(rpdata->object_property)) {
|
||||||
apdu_len = property_list_common_encode(rpdata,
|
apdu_len = property_list_common_encode(rpdata, Object_Instance_Number);
|
||||||
Object_Instance_Number);
|
|
||||||
} else if (rpdata->object_property == PROP_OBJECT_NAME) {
|
} else if (rpdata->object_property == PROP_OBJECT_NAME) {
|
||||||
/* only array properties can have array options */
|
/* only array properties can have array options */
|
||||||
if (rpdata->array_index != BACNET_ARRAY_ALL) {
|
if (rpdata->array_index != BACNET_ARRAY_ALL) {
|
||||||
@@ -1374,9 +1372,8 @@ static int Read_Property_Common(
|
|||||||
} else if (rpdata->object_property == PROP_PROPERTY_LIST) {
|
} else if (rpdata->object_property == PROP_PROPERTY_LIST) {
|
||||||
Device_Objects_Property_List(
|
Device_Objects_Property_List(
|
||||||
rpdata->object_type, rpdata->object_instance, &property_list);
|
rpdata->object_type, rpdata->object_instance, &property_list);
|
||||||
apdu_len = property_list_encode(rpdata,
|
apdu_len = property_list_encode(rpdata, property_list.Required.pList,
|
||||||
property_list.Required.pList, property_list.Optional.pList,
|
property_list.Optional.pList, property_list.Proprietary.pList);
|
||||||
property_list.Proprietary.pList);
|
|
||||||
#endif
|
#endif
|
||||||
} else if (pObject->Object_Read_Property) {
|
} else if (pObject->Object_Read_Property) {
|
||||||
apdu_len = pObject->Object_Read_Property(rpdata);
|
apdu_len = pObject->Object_Read_Property(rpdata);
|
||||||
@@ -1451,8 +1448,8 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
/* FIXME: len < application_data_len: more data? */
|
/* FIXME: len < application_data_len: more data? */
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_OBJECT_IDENTIFIER:
|
case PROP_OBJECT_IDENTIFIER:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_OBJECT_ID);
|
wp_data, &value, BACNET_APPLICATION_TAG_OBJECT_ID);
|
||||||
if (status) {
|
if (status) {
|
||||||
if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
|
if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
|
||||||
(Device_Set_Object_Instance_Number(
|
(Device_Set_Object_Instance_Number(
|
||||||
@@ -1467,32 +1464,32 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_NUMBER_OF_APDU_RETRIES:
|
case PROP_NUMBER_OF_APDU_RETRIES:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
/* FIXME: bounds check? */
|
/* FIXME: bounds check? */
|
||||||
apdu_retries_set((uint8_t)value.type.Unsigned_Int);
|
apdu_retries_set((uint8_t)value.type.Unsigned_Int);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_APDU_TIMEOUT:
|
case PROP_APDU_TIMEOUT:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
/* FIXME: bounds check? */
|
/* FIXME: bounds check? */
|
||||||
apdu_timeout_set((uint16_t)value.type.Unsigned_Int);
|
apdu_timeout_set((uint16_t)value.type.Unsigned_Int);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_VENDOR_IDENTIFIER:
|
case PROP_VENDOR_IDENTIFIER:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
/* FIXME: bounds check? */
|
/* FIXME: bounds check? */
|
||||||
Device_Set_Vendor_Identifier((uint16_t)value.type.Unsigned_Int);
|
Device_Set_Vendor_Identifier((uint16_t)value.type.Unsigned_Int);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_SYSTEM_STATUS:
|
case PROP_SYSTEM_STATUS:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_ENUMERATED);
|
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
|
||||||
if (status) {
|
if (status) {
|
||||||
result = Device_Set_System_Status(
|
result = Device_Set_System_Status(
|
||||||
(BACNET_DEVICE_STATUS)value.type.Enumerated, false);
|
(BACNET_DEVICE_STATUS)value.type.Enumerated, false);
|
||||||
@@ -1510,8 +1507,8 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_OBJECT_NAME:
|
case PROP_OBJECT_NAME:
|
||||||
status = write_property_string_valid(wp_data, &value,
|
status = write_property_string_valid(
|
||||||
characterstring_capacity(&My_Object_Name));
|
wp_data, &value, characterstring_capacity(&My_Object_Name));
|
||||||
if (status) {
|
if (status) {
|
||||||
/* All the object names in a device must be unique */
|
/* All the object names in a device must be unique */
|
||||||
if (Device_Valid_Object_Name(&value.type.Character_String,
|
if (Device_Valid_Object_Name(&value.type.Character_String,
|
||||||
@@ -1531,8 +1528,8 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_LOCATION:
|
case PROP_LOCATION:
|
||||||
status = write_property_empty_string_valid(wp_data, &value,
|
status = write_property_empty_string_valid(
|
||||||
MAX_DEV_LOC_LEN);
|
wp_data, &value, MAX_DEV_LOC_LEN);
|
||||||
if (status) {
|
if (status) {
|
||||||
Device_Set_Location(
|
Device_Set_Location(
|
||||||
characterstring_value(&value.type.Character_String),
|
characterstring_value(&value.type.Character_String),
|
||||||
@@ -1541,8 +1538,8 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_DESCRIPTION:
|
case PROP_DESCRIPTION:
|
||||||
status = write_property_empty_string_valid(wp_data, &value,
|
status = write_property_empty_string_valid(
|
||||||
MAX_DEV_DESC_LEN);
|
wp_data, &value, MAX_DEV_DESC_LEN);
|
||||||
if (status) {
|
if (status) {
|
||||||
Device_Set_Description(
|
Device_Set_Description(
|
||||||
characterstring_value(&value.type.Character_String),
|
characterstring_value(&value.type.Character_String),
|
||||||
@@ -1550,8 +1547,8 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_MODEL_NAME:
|
case PROP_MODEL_NAME:
|
||||||
status = write_property_empty_string_valid(wp_data, &value,
|
status = write_property_empty_string_valid(
|
||||||
MAX_DEV_MOD_LEN);
|
wp_data, &value, MAX_DEV_MOD_LEN);
|
||||||
if (status) {
|
if (status) {
|
||||||
Device_Set_Model_Name(
|
Device_Set_Model_Name(
|
||||||
characterstring_value(&value.type.Character_String),
|
characterstring_value(&value.type.Character_String),
|
||||||
@@ -1560,8 +1557,8 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
#if defined(BACNET_TIME_MASTER)
|
#if defined(BACNET_TIME_MASTER)
|
||||||
case PROP_TIME_SYNCHRONIZATION_INTERVAL:
|
case PROP_TIME_SYNCHRONIZATION_INTERVAL:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
if (value.type.Unsigned_Int < 65535) {
|
if (value.type.Unsigned_Int < 65535) {
|
||||||
minutes = value.type.Unsigned_Int;
|
minutes = value.type.Unsigned_Int;
|
||||||
@@ -1574,16 +1571,16 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_ALIGN_INTERVALS:
|
case PROP_ALIGN_INTERVALS:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BOOLEAN);
|
wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN);
|
||||||
if (status) {
|
if (status) {
|
||||||
Device_Align_Intervals_Set(value.type.Boolean);
|
Device_Align_Intervals_Set(value.type.Boolean);
|
||||||
status = true;
|
status = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_INTERVAL_OFFSET:
|
case PROP_INTERVAL_OFFSET:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
if (value.type.Unsigned_Int < 65535) {
|
if (value.type.Unsigned_Int < 65535) {
|
||||||
minutes = value.type.Unsigned_Int;
|
minutes = value.type.Unsigned_Int;
|
||||||
@@ -1604,8 +1601,8 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case PROP_UTC_OFFSET:
|
case PROP_UTC_OFFSET:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_SIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_SIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
if ((value.type.Signed_Int < (12 * 60)) &&
|
if ((value.type.Signed_Int < (12 * 60)) &&
|
||||||
(value.type.Signed_Int > (-12 * 60))) {
|
(value.type.Signed_Int > (-12 * 60))) {
|
||||||
@@ -1619,8 +1616,8 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
#if defined(BACDL_MSTP)
|
#if defined(BACDL_MSTP)
|
||||||
case PROP_MAX_INFO_FRAMES:
|
case PROP_MAX_INFO_FRAMES:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
if (value.type.Unsigned_Int <= 255) {
|
if (value.type.Unsigned_Int <= 255) {
|
||||||
dlmstp_set_max_info_frames(
|
dlmstp_set_max_info_frames(
|
||||||
@@ -1633,8 +1630,8 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_MAX_MASTER:
|
case PROP_MAX_MASTER:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
if ((value.type.Unsigned_Int > 0) &&
|
if ((value.type.Unsigned_Int > 0) &&
|
||||||
(value.type.Unsigned_Int <= 127)) {
|
(value.type.Unsigned_Int <= 127)) {
|
||||||
|
|||||||
@@ -213,8 +213,7 @@ void routed_get_my_address(BACNET_ADDRESS *my_address)
|
|||||||
* meaning MAC broadcast, so it's an automatic match).
|
* meaning MAC broadcast, so it's an automatic match).
|
||||||
* Else False if no match or invalid idx is given.
|
* Else False if no match or invalid idx is given.
|
||||||
*/
|
*/
|
||||||
bool Routed_Device_Address_Lookup(
|
bool Routed_Device_Address_Lookup(int idx, uint8_t dlen, uint8_t *dadr)
|
||||||
int idx, uint8_t dlen, uint8_t *dadr)
|
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
DEVICE_OBJECT_DATA *pDev = &Devices[idx];
|
DEVICE_OBJECT_DATA *pDev = &Devices[idx];
|
||||||
@@ -371,15 +370,12 @@ uint32_t Routed_Device_Index_To_Instance(unsigned index)
|
|||||||
* @param object_instance - object-instance number of the object
|
* @param object_instance - object-instance number of the object
|
||||||
* @return index for the given instance-number, or 0 if not valid.
|
* @return index for the given instance-number, or 0 if not valid.
|
||||||
*/
|
*/
|
||||||
static uint32_t Routed_Device_Instance_To_Index(
|
static uint32_t Routed_Device_Instance_To_Index(uint32_t Instance_Number)
|
||||||
uint32_t Instance_Number)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < MAX_NUM_DEVICES; i++) {
|
for (i = 0; i < MAX_NUM_DEVICES; i++) {
|
||||||
if (Devices[i].bacObj.Object_Instance_Number == Instance_Number)
|
if (Devices[i].bacObj.Object_Instance_Number == Instance_Number) {
|
||||||
{
|
|
||||||
/* Found Instance, so return the Device Index Number */
|
/* Found Instance, so return the Device Index Number */
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@@ -388,7 +384,6 @@ static uint32_t Routed_Device_Instance_To_Index(
|
|||||||
/* We did not find instance... so simply return an Index of 0
|
/* We did not find instance... so simply return an Index of 0
|
||||||
All gateways will have at least a single root Device Object */
|
All gateways will have at least a single root Device Object */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -492,8 +487,8 @@ bool Routed_Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
/* FIXME: len < application_data_len: more data? */
|
/* FIXME: len < application_data_len: more data? */
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_OBJECT_IDENTIFIER:
|
case PROP_OBJECT_IDENTIFIER:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_OBJECT_ID);
|
wp_data, &value, BACNET_APPLICATION_TAG_OBJECT_ID);
|
||||||
if (status) {
|
if (status) {
|
||||||
if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
|
if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
|
||||||
(Routed_Device_Set_Object_Instance_Number(
|
(Routed_Device_Set_Object_Instance_Number(
|
||||||
@@ -508,8 +503,8 @@ bool Routed_Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_OBJECT_NAME:
|
case PROP_OBJECT_NAME:
|
||||||
status = write_property_string_valid(wp_data, &value,
|
status =
|
||||||
MAX_DEV_NAME_LEN);
|
write_property_string_valid(wp_data, &value, MAX_DEV_NAME_LEN);
|
||||||
if (status) {
|
if (status) {
|
||||||
Routed_Device_Set_Object_Name(
|
Routed_Device_Set_Object_Name(
|
||||||
characterstring_encoding(&value.type.Character_String),
|
characterstring_encoding(&value.type.Character_String),
|
||||||
|
|||||||
@@ -431,16 +431,16 @@ bool Integer_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_PRESENT_VALUE:
|
case PROP_PRESENT_VALUE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_SIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_SIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
Integer_Value_Present_Value_Set(wp_data->object_instance,
|
Integer_Value_Present_Value_Set(wp_data->object_instance,
|
||||||
value.type.Signed_Int, wp_data->priority);
|
value.type.Signed_Int, wp_data->priority);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_OUT_OF_SERVICE:
|
case PROP_OUT_OF_SERVICE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BOOLEAN);
|
wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN);
|
||||||
if (status) {
|
if (status) {
|
||||||
Integer_Value_Out_Of_Service_Set(
|
Integer_Value_Out_Of_Service_Set(
|
||||||
wp_data->object_instance, value.type.Boolean);
|
wp_data->object_instance, value.type.Boolean);
|
||||||
|
|||||||
@@ -909,7 +909,8 @@ bool Load_Control_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
wp_data->application_data_len, &value,
|
wp_data->application_data_len, &value,
|
||||||
PROP_REQUESTED_SHED_LEVEL);
|
PROP_REQUESTED_SHED_LEVEL);
|
||||||
if (len == BACNET_STATUS_ERROR) {
|
if (len == BACNET_STATUS_ERROR) {
|
||||||
PRINTF("Load_Control_Write_Property() failure detected point D\n");
|
PRINTF(
|
||||||
|
"Load_Control_Write_Property() failure detected point D\n");
|
||||||
/* error! */
|
/* error! */
|
||||||
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
||||||
wp_data->error_code = ERROR_CODE_INVALID_DATA_TYPE;
|
wp_data->error_code = ERROR_CODE_INVALID_DATA_TYPE;
|
||||||
@@ -935,7 +936,8 @@ bool Load_Control_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
value.type.Real;
|
value.type.Real;
|
||||||
status = true;
|
status = true;
|
||||||
} else {
|
} else {
|
||||||
PRINTF("Load_Control_Write_Property() failure detected point E\n");
|
PRINTF(
|
||||||
|
"Load_Control_Write_Property() failure detected point E\n");
|
||||||
/* error! */
|
/* error! */
|
||||||
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
||||||
wp_data->error_code = ERROR_CODE_INVALID_DATA_TYPE;
|
wp_data->error_code = ERROR_CODE_INVALID_DATA_TYPE;
|
||||||
@@ -946,10 +948,11 @@ bool Load_Control_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_START_TIME:
|
case PROP_START_TIME:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_DATE);
|
wp_data, &value, BACNET_APPLICATION_TAG_DATE);
|
||||||
if (!status) {
|
if (!status) {
|
||||||
PRINTF("Load_Control_Write_Property() failure detected point F\n");
|
PRINTF(
|
||||||
|
"Load_Control_Write_Property() failure detected point F\n");
|
||||||
/* don't continue if we don't have a valid date */
|
/* don't continue if we don't have a valid date */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -959,8 +962,8 @@ bool Load_Control_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
bacapp_decode_application_data(wp_data->application_data + len,
|
bacapp_decode_application_data(wp_data->application_data + len,
|
||||||
wp_data->application_data_len - len, &value);
|
wp_data->application_data_len - len, &value);
|
||||||
if (len) {
|
if (len) {
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_TIME);
|
wp_data, &value, BACNET_APPLICATION_TAG_TIME);
|
||||||
if (status) {
|
if (status) {
|
||||||
/* Write time and date and set written flag */
|
/* Write time and date and set written flag */
|
||||||
Start_Time[object_index].date = start_date;
|
Start_Time[object_index].date = start_date;
|
||||||
@@ -968,7 +971,8 @@ bool Load_Control_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
Start_Time_Property_Written[object_index] = true;
|
Start_Time_Property_Written[object_index] = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PRINTF("Load_Control_Write_Property() failure detected point G\n");
|
PRINTF(
|
||||||
|
"Load_Control_Write_Property() failure detected point G\n");
|
||||||
status = false;
|
status = false;
|
||||||
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
||||||
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
|
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
|
||||||
@@ -976,19 +980,20 @@ bool Load_Control_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_SHED_DURATION:
|
case PROP_SHED_DURATION:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
Shed_Duration[object_index] = value.type.Unsigned_Int;
|
Shed_Duration[object_index] = value.type.Unsigned_Int;
|
||||||
Load_Control_Request_Written[object_index] = true;
|
Load_Control_Request_Written[object_index] = true;
|
||||||
} else {
|
} else {
|
||||||
PRINTF("Load_Control_Write_Property() failure detected point H\n");
|
PRINTF(
|
||||||
|
"Load_Control_Write_Property() failure detected point H\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_DUTY_WINDOW:
|
case PROP_DUTY_WINDOW:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
Duty_Window[object_index] = value.type.Unsigned_Int;
|
Duty_Window[object_index] = value.type.Unsigned_Int;
|
||||||
Load_Control_Request_Written[object_index] = true;
|
Load_Control_Request_Written[object_index] = true;
|
||||||
@@ -996,8 +1001,8 @@ bool Load_Control_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_SHED_LEVELS:
|
case PROP_SHED_LEVELS:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
/* re-write the size of the array? */
|
/* re-write the size of the array? */
|
||||||
if (wp_data->array_index == 0) {
|
if (wp_data->array_index == 0) {
|
||||||
@@ -1020,8 +1025,8 @@ bool Load_Control_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_ENABLE:
|
case PROP_ENABLE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BOOLEAN);
|
wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN);
|
||||||
if (status) {
|
if (status) {
|
||||||
Load_Control_Enable[object_index] = value.type.Boolean;
|
Load_Control_Enable[object_index] = value.type.Boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1111,8 +1111,8 @@ bool Lighting_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_PRESENT_VALUE:
|
case PROP_PRESENT_VALUE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_REAL);
|
wp_data, &value, BACNET_APPLICATION_TAG_REAL);
|
||||||
if (status) {
|
if (status) {
|
||||||
/* Command priority 6 is reserved for use by Minimum On/Off
|
/* Command priority 6 is reserved for use by Minimum On/Off
|
||||||
algorithm and may not be used for other purposes in any
|
algorithm and may not be used for other purposes in any
|
||||||
@@ -1131,8 +1131,8 @@ bool Lighting_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
|
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_NULL);
|
wp_data, &value, BACNET_APPLICATION_TAG_NULL);
|
||||||
if (status) {
|
if (status) {
|
||||||
if (wp_data->priority == 6) {
|
if (wp_data->priority == 6) {
|
||||||
/* Command priority 6 is reserved for use by Minimum
|
/* Command priority 6 is reserved for use by Minimum
|
||||||
@@ -1154,8 +1154,8 @@ bool Lighting_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_LIGHTING_COMMAND:
|
case PROP_LIGHTING_COMMAND:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_LIGHTING_COMMAND);
|
wp_data, &value, BACNET_APPLICATION_TAG_LIGHTING_COMMAND);
|
||||||
if (status) {
|
if (status) {
|
||||||
status = Lighting_Output_Lighting_Command_Set(
|
status = Lighting_Output_Lighting_Command_Set(
|
||||||
wp_data->object_instance, &value.type.Lighting_Command);
|
wp_data->object_instance, &value.type.Lighting_Command);
|
||||||
@@ -1166,8 +1166,8 @@ bool Lighting_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_OUT_OF_SERVICE:
|
case PROP_OUT_OF_SERVICE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BOOLEAN);
|
wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN);
|
||||||
if (status) {
|
if (status) {
|
||||||
Lighting_Output_Out_Of_Service_Set(
|
Lighting_Output_Out_Of_Service_Set(
|
||||||
wp_data->object_instance, value.type.Boolean);
|
wp_data->object_instance, value.type.Boolean);
|
||||||
|
|||||||
@@ -322,8 +322,8 @@ bool Life_Safety_Point_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_MODE:
|
case PROP_MODE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_ENUMERATED);
|
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
|
||||||
if (status) {
|
if (status) {
|
||||||
if (value.type.Enumerated <= MAX_LIFE_SAFETY_MODE) {
|
if (value.type.Enumerated <= MAX_LIFE_SAFETY_MODE) {
|
||||||
object_index = Life_Safety_Point_Instance_To_Index(
|
object_index = Life_Safety_Point_Instance_To_Index(
|
||||||
@@ -338,8 +338,8 @@ bool Life_Safety_Point_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_OUT_OF_SERVICE:
|
case PROP_OUT_OF_SERVICE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BOOLEAN);
|
wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN);
|
||||||
if (status) {
|
if (status) {
|
||||||
object_index = Life_Safety_Point_Instance_To_Index(
|
object_index = Life_Safety_Point_Instance_To_Index(
|
||||||
wp_data->object_instance);
|
wp_data->object_instance);
|
||||||
|
|||||||
@@ -603,8 +603,8 @@ bool Multistate_Input_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_OBJECT_NAME:
|
case PROP_OBJECT_NAME:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_CHARACTER_STRING);
|
wp_data, &value, BACNET_APPLICATION_TAG_CHARACTER_STRING);
|
||||||
if (status) {
|
if (status) {
|
||||||
/* All the object names in a device must be unique */
|
/* All the object names in a device must be unique */
|
||||||
if (Device_Valid_Object_Name(&value.type.Character_String,
|
if (Device_Valid_Object_Name(&value.type.Character_String,
|
||||||
@@ -626,8 +626,8 @@ bool Multistate_Input_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_DESCRIPTION:
|
case PROP_DESCRIPTION:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_CHARACTER_STRING);
|
wp_data, &value, BACNET_APPLICATION_TAG_CHARACTER_STRING);
|
||||||
if (status) {
|
if (status) {
|
||||||
status = Multistate_Input_Description_Write(
|
status = Multistate_Input_Description_Write(
|
||||||
wp_data->object_instance, &value.type.Character_String,
|
wp_data->object_instance, &value.type.Character_String,
|
||||||
@@ -635,8 +635,8 @@ bool Multistate_Input_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_PRESENT_VALUE:
|
case PROP_PRESENT_VALUE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
status = Multistate_Input_Present_Value_Set(
|
status = Multistate_Input_Present_Value_Set(
|
||||||
wp_data->object_instance, value.type.Unsigned_Int);
|
wp_data->object_instance, value.type.Unsigned_Int);
|
||||||
@@ -647,8 +647,8 @@ bool Multistate_Input_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_OUT_OF_SERVICE:
|
case PROP_OUT_OF_SERVICE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BOOLEAN);
|
wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN);
|
||||||
if (status) {
|
if (status) {
|
||||||
Multistate_Input_Out_Of_Service_Set(
|
Multistate_Input_Out_Of_Service_Set(
|
||||||
wp_data->object_instance, value.type.Boolean);
|
wp_data->object_instance, value.type.Boolean);
|
||||||
@@ -675,8 +675,8 @@ bool Multistate_Input_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
if (element_len) {
|
if (element_len) {
|
||||||
status = Multistate_Input_State_Text_Write(
|
status = Multistate_Input_State_Text_Write(
|
||||||
wp_data->object_instance, array_index,
|
wp_data->object_instance, array_index,
|
||||||
&value.type.Character_String,
|
&value.type.Character_String, &wp_data->error_class,
|
||||||
&wp_data->error_class, &wp_data->error_code);
|
&wp_data->error_code);
|
||||||
}
|
}
|
||||||
max_states--;
|
max_states--;
|
||||||
array_index++;
|
array_index++;
|
||||||
@@ -686,8 +686,7 @@ bool Multistate_Input_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
wp_data->application_data_len - len, &value);
|
wp_data->application_data_len - len, &value);
|
||||||
if (element_len < 0) {
|
if (element_len < 0) {
|
||||||
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
||||||
wp_data->error_code =
|
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
|
||||||
ERROR_CODE_VALUE_OUT_OF_RANGE;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
len += element_len;
|
len += element_len;
|
||||||
|
|||||||
@@ -375,8 +375,8 @@ bool Multistate_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_PRESENT_VALUE:
|
case PROP_PRESENT_VALUE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
priority = wp_data->priority;
|
priority = wp_data->priority;
|
||||||
/* Command priority 6 is reserved for use by Minimum On/Off
|
/* Command priority 6 is reserved for use by Minimum On/Off
|
||||||
@@ -410,8 +410,8 @@ bool Multistate_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
|
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_NULL);
|
wp_data, &value, BACNET_APPLICATION_TAG_NULL);
|
||||||
if (status) {
|
if (status) {
|
||||||
level = MULTISTATE_NULL;
|
level = MULTISTATE_NULL;
|
||||||
object_index = Multistate_Output_Instance_To_Index(
|
object_index = Multistate_Output_Instance_To_Index(
|
||||||
@@ -437,8 +437,8 @@ bool Multistate_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_OUT_OF_SERVICE:
|
case PROP_OUT_OF_SERVICE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BOOLEAN);
|
wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN);
|
||||||
if (status) {
|
if (status) {
|
||||||
Multistate_Output_Out_Of_Service_Set(
|
Multistate_Output_Out_Of_Service_Set(
|
||||||
wp_data->object_instance, value.type.Boolean);
|
wp_data->object_instance, value.type.Boolean);
|
||||||
|
|||||||
@@ -538,8 +538,8 @@ bool Multistate_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_PRESENT_VALUE:
|
case PROP_PRESENT_VALUE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
status = Multistate_Value_Present_Value_Set(
|
status = Multistate_Value_Present_Value_Set(
|
||||||
wp_data->object_instance, value.type.Unsigned_Int);
|
wp_data->object_instance, value.type.Unsigned_Int);
|
||||||
@@ -550,8 +550,8 @@ bool Multistate_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_OUT_OF_SERVICE:
|
case PROP_OUT_OF_SERVICE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BOOLEAN);
|
wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN);
|
||||||
if (status) {
|
if (status) {
|
||||||
Multistate_Value_Out_Of_Service_Set(
|
Multistate_Value_Out_Of_Service_Set(
|
||||||
wp_data->object_instance, value.type.Boolean);
|
wp_data->object_instance, value.type.Boolean);
|
||||||
|
|||||||
@@ -112,8 +112,7 @@ void Notification_Class_Init(void)
|
|||||||
NC_Info[NotifyIdx].Recipient_List->ToTime.sec = 59;
|
NC_Info[NotifyIdx].Recipient_List->ToTime.sec = 59;
|
||||||
NC_Info[NotifyIdx].Recipient_List->ToTime.hundredths = 0;
|
NC_Info[NotifyIdx].Recipient_List->ToTime.hundredths = 0;
|
||||||
NC_Info[NotifyIdx].Recipient_List->Transitions =
|
NC_Info[NotifyIdx].Recipient_List->Transitions =
|
||||||
TRANSITION_TO_OFFNORMAL_MASKED |
|
TRANSITION_TO_OFFNORMAL_MASKED | TRANSITION_TO_FAULT_MASKED |
|
||||||
TRANSITION_TO_FAULT_MASKED |
|
|
||||||
TRANSITION_TO_NORMAL_MASKED;
|
TRANSITION_TO_NORMAL_MASKED;
|
||||||
NC_Info[NotifyIdx].Recipient_List->ConfirmedNotify = false;
|
NC_Info[NotifyIdx].Recipient_List->ConfirmedNotify = false;
|
||||||
NC_Info[NotifyIdx].Recipient_List->ConfirmedNotify = false;
|
NC_Info[NotifyIdx].Recipient_List->ConfirmedNotify = false;
|
||||||
@@ -418,8 +417,8 @@ bool Notification_Class_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_PRIORITY:
|
case PROP_PRIORITY:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
if (wp_data->array_index == 0) {
|
if (wp_data->array_index == 0) {
|
||||||
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
||||||
@@ -471,8 +470,8 @@ bool Notification_Class_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_ACK_REQUIRED:
|
case PROP_ACK_REQUIRED:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BIT_STRING);
|
wp_data, &value, BACNET_APPLICATION_TAG_BIT_STRING);
|
||||||
if (status) {
|
if (status) {
|
||||||
if (value.type.Bit_String.bits_used == 3) {
|
if (value.type.Bit_String.bits_used == 3) {
|
||||||
CurrentNotify->Ack_Required =
|
CurrentNotify->Ack_Required =
|
||||||
|
|||||||
@@ -613,8 +613,8 @@ bool Network_Port_MAC_Address(
|
|||||||
memcpy(
|
memcpy(
|
||||||
&ip_mac[0], &Object_List[index].Network.IPv4.IP_Address, 4);
|
&ip_mac[0], &Object_List[index].Network.IPv4.IP_Address, 4);
|
||||||
/* convert port from host-byte-order to network-byte-order */
|
/* convert port from host-byte-order to network-byte-order */
|
||||||
encode_unsigned16(&ip_mac[4],
|
encode_unsigned16(
|
||||||
Object_List[index].Network.IPv4.Port);
|
&ip_mac[4], Object_List[index].Network.IPv4.Port);
|
||||||
mac = &ip_mac[0];
|
mac = &ip_mac[0];
|
||||||
mac_len = sizeof(ip_mac);
|
mac_len = sizeof(ip_mac);
|
||||||
break;
|
break;
|
||||||
@@ -1326,9 +1326,7 @@ void *Network_Port_BBMD_BD_Table(uint32_t object_instance)
|
|||||||
* @return true if the Broadcast Distribution Table linked list head
|
* @return true if the Broadcast Distribution Table linked list head
|
||||||
* property value was set
|
* property value was set
|
||||||
*/
|
*/
|
||||||
bool Network_Port_BBMD_BD_Table_Set(
|
bool Network_Port_BBMD_BD_Table_Set(uint32_t object_instance, void *bdt_head)
|
||||||
uint32_t object_instance,
|
|
||||||
void *bdt_head)
|
|
||||||
{
|
{
|
||||||
bool status = false;
|
bool status = false;
|
||||||
unsigned index = 0;
|
unsigned index = 0;
|
||||||
@@ -1379,9 +1377,7 @@ void *Network_Port_BBMD_FD_Table(uint32_t object_instance)
|
|||||||
*
|
*
|
||||||
* @return true if the BBMD-Accept-FD-Registrations property value was set
|
* @return true if the BBMD-Accept-FD-Registrations property value was set
|
||||||
*/
|
*/
|
||||||
bool Network_Port_BBMD_FD_Table_Set(
|
bool Network_Port_BBMD_FD_Table_Set(uint32_t object_instance, void *fdt_head)
|
||||||
uint32_t object_instance,
|
|
||||||
void *fdt_head)
|
|
||||||
{
|
{
|
||||||
bool status = false;
|
bool status = false;
|
||||||
unsigned index = 0;
|
unsigned index = 0;
|
||||||
@@ -1449,8 +1445,7 @@ static bool Network_Port_Remote_BBMD_IP_Address_And_Port(
|
|||||||
* @return true if ip-address was retrieved
|
* @return true if ip-address was retrieved
|
||||||
*/
|
*/
|
||||||
bool Network_Port_Remote_BBMD_IP_Address(
|
bool Network_Port_Remote_BBMD_IP_Address(
|
||||||
uint32_t object_instance,
|
uint32_t object_instance, uint8_t *a, uint8_t *b, uint8_t *c, uint8_t *d)
|
||||||
uint8_t *a, uint8_t *b, uint8_t *c, uint8_t *d)
|
|
||||||
{
|
{
|
||||||
unsigned index = 0; /* offset from instance lookup */
|
unsigned index = 0; /* offset from instance lookup */
|
||||||
bool status = false;
|
bool status = false;
|
||||||
@@ -1539,8 +1534,8 @@ uint16_t Network_Port_Remote_BBMD_BIP_Port(uint32_t object_instance)
|
|||||||
*
|
*
|
||||||
* @return true if values are within range and property is set.
|
* @return true if values are within range and property is set.
|
||||||
*/
|
*/
|
||||||
bool Network_Port_Remote_BBMD_BIP_Port_Set(uint32_t object_instance,
|
bool Network_Port_Remote_BBMD_BIP_Port_Set(
|
||||||
uint16_t value)
|
uint32_t object_instance, uint16_t value)
|
||||||
{
|
{
|
||||||
bool status = false;
|
bool status = false;
|
||||||
unsigned index = 0;
|
unsigned index = 0;
|
||||||
@@ -1591,8 +1586,8 @@ uint16_t Network_Port_Remote_BBMD_BIP_Lifetime(uint32_t object_instance)
|
|||||||
*
|
*
|
||||||
* @return true if values are within range and property is set.
|
* @return true if values are within range and property is set.
|
||||||
*/
|
*/
|
||||||
bool Network_Port_Remote_BBMD_BIP_Lifetime_Set(uint32_t object_instance,
|
bool Network_Port_Remote_BBMD_BIP_Lifetime_Set(
|
||||||
uint16_t value)
|
uint32_t object_instance, uint16_t value)
|
||||||
{
|
{
|
||||||
bool status = false;
|
bool status = false;
|
||||||
unsigned index = 0;
|
unsigned index = 0;
|
||||||
@@ -2357,13 +2352,12 @@ int Network_Port_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
|||||||
case PROP_FD_BBMD_ADDRESS:
|
case PROP_FD_BBMD_ADDRESS:
|
||||||
Network_Port_Remote_BBMD_IP_Address_And_Port(
|
Network_Port_Remote_BBMD_IP_Address_And_Port(
|
||||||
rpdata->object_instance, &ip_address);
|
rpdata->object_instance, &ip_address);
|
||||||
apdu_len = bvlc_foreign_device_bbmd_host_address_encode(&apdu[0],
|
apdu_len = bvlc_foreign_device_bbmd_host_address_encode(
|
||||||
apdu_size, &ip_address);
|
&apdu[0], apdu_size, &ip_address);
|
||||||
break;
|
break;
|
||||||
case PROP_FD_SUBSCRIPTION_LIFETIME:
|
case PROP_FD_SUBSCRIPTION_LIFETIME:
|
||||||
apdu_len = encode_application_unsigned(
|
apdu_len = encode_application_unsigned(&apdu[0],
|
||||||
&apdu[0], Network_Port_Remote_BBMD_BIP_Lifetime(
|
Network_Port_Remote_BBMD_BIP_Lifetime(rpdata->object_instance));
|
||||||
rpdata->object_instance));
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case PROP_BACNET_IPV6_MODE:
|
case PROP_BACNET_IPV6_MODE:
|
||||||
@@ -2497,8 +2491,8 @@ bool Network_Port_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
/* FIXME: len < application_data_len: more data? */
|
/* FIXME: len < application_data_len: more data? */
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_MAX_MASTER:
|
case PROP_MAX_MASTER:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
if (value.type.Unsigned_Int <= 255) {
|
if (value.type.Unsigned_Int <= 255) {
|
||||||
status = Network_Port_MSTP_Max_Master_Set(
|
status = Network_Port_MSTP_Max_Master_Set(
|
||||||
@@ -2514,8 +2508,8 @@ bool Network_Port_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_MAX_INFO_FRAMES:
|
case PROP_MAX_INFO_FRAMES:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
if (value.type.Unsigned_Int <= 255) {
|
if (value.type.Unsigned_Int <= 255) {
|
||||||
status = Network_Port_MSTP_Max_Info_Frames_Set(
|
status = Network_Port_MSTP_Max_Info_Frames_Set(
|
||||||
|
|||||||
@@ -303,8 +303,8 @@ bool OctetString_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
|
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_PRESENT_VALUE:
|
case PROP_PRESENT_VALUE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_OCTET_STRING);
|
wp_data, &value, BACNET_APPLICATION_TAG_OCTET_STRING);
|
||||||
if (status) {
|
if (status) {
|
||||||
/* Command priority 6 is reserved for use by Minimum On/Off
|
/* Command priority 6 is reserved for use by Minimum On/Off
|
||||||
algorithm and may not be used for other purposes in any
|
algorithm and may not be used for other purposes in any
|
||||||
@@ -327,8 +327,8 @@ bool OctetString_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_OUT_OF_SERVICE:
|
case PROP_OUT_OF_SERVICE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BOOLEAN);
|
wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN);
|
||||||
if (status) {
|
if (status) {
|
||||||
CurrentAV->Out_Of_Service = value.type.Boolean;
|
CurrentAV->Out_Of_Service = value.type.Boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -309,8 +309,8 @@ bool PositiveInteger_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
|
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_PRESENT_VALUE:
|
case PROP_PRESENT_VALUE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
/* Command priority 6 is reserved for use by Minimum On/Off
|
/* Command priority 6 is reserved for use by Minimum On/Off
|
||||||
algorithm and may not be used for other purposes in any
|
algorithm and may not be used for other purposes in any
|
||||||
@@ -333,8 +333,8 @@ bool PositiveInteger_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_OUT_OF_SERVICE:
|
case PROP_OUT_OF_SERVICE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BOOLEAN);
|
wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN);
|
||||||
if (status) {
|
if (status) {
|
||||||
CurrentAV->Out_Of_Service = value.type.Boolean;
|
CurrentAV->Out_Of_Service = value.type.Boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,8 @@ void Schedule_Init(void)
|
|||||||
for (j = 0; j < 7; j++) {
|
for (j = 0; j < 7; j++) {
|
||||||
psched->Weekly_Schedule[j].TV_Count = 0;
|
psched->Weekly_Schedule[j].TV_Count = 0;
|
||||||
}
|
}
|
||||||
memcpy(&psched->Present_Value, &psched->Schedule_Default, sizeof(psched->Present_Value));
|
memcpy(&psched->Present_Value, &psched->Schedule_Default,
|
||||||
|
sizeof(psched->Present_Value));
|
||||||
psched->Schedule_Default.context_specific = false;
|
psched->Schedule_Default.context_specific = false;
|
||||||
psched->Schedule_Default.tag = BACNET_APPLICATION_TAG_REAL;
|
psched->Schedule_Default.tag = BACNET_APPLICATION_TAG_REAL;
|
||||||
psched->Schedule_Default.type.Real = 21.0f; /* 21 C, room temperature */
|
psched->Schedule_Default.type.Real = 21.0f; /* 21 C, room temperature */
|
||||||
@@ -347,8 +348,8 @@ bool Schedule_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
suitable time for
|
suitable time for
|
||||||
review by all interested parties. Say 6 months -> September
|
review by all interested parties. Say 6 months -> September
|
||||||
2016 */
|
2016 */
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BOOLEAN);
|
wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN);
|
||||||
if (status) {
|
if (status) {
|
||||||
Schedule_Out_Of_Service_Set(
|
Schedule_Out_Of_Service_Set(
|
||||||
wp_data->object_instance, value.type.Boolean);
|
wp_data->object_instance, value.type.Boolean);
|
||||||
@@ -421,6 +422,7 @@ void Schedule_Recalculate_PV(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (desc->Present_Value.tag == BACNET_APPLICATION_TAG_NULL) {
|
if (desc->Present_Value.tag == BACNET_APPLICATION_TAG_NULL) {
|
||||||
memcpy(&desc->Present_Value, &desc->Schedule_Default, sizeof(desc->Present_Value));
|
memcpy(&desc->Present_Value, &desc->Schedule_Default,
|
||||||
|
sizeof(desc->Present_Value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -458,8 +458,8 @@ bool Trend_Log_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
}
|
}
|
||||||
switch (wp_data->object_property) {
|
switch (wp_data->object_property) {
|
||||||
case PROP_ENABLE:
|
case PROP_ENABLE:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BOOLEAN);
|
wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN);
|
||||||
if (status) {
|
if (status) {
|
||||||
/* Section 12.25.5 can't enable a full log with stop when full
|
/* Section 12.25.5 can't enable a full log with stop when full
|
||||||
* set */
|
* set */
|
||||||
@@ -500,8 +500,8 @@ bool Trend_Log_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_STOP_WHEN_FULL:
|
case PROP_STOP_WHEN_FULL:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BOOLEAN);
|
wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN);
|
||||||
if (status) {
|
if (status) {
|
||||||
/* Only trigger this on a change of state */
|
/* Only trigger this on a change of state */
|
||||||
if (CurrentLog->bStopWhenFull != value.type.Boolean) {
|
if (CurrentLog->bStopWhenFull != value.type.Boolean) {
|
||||||
@@ -532,8 +532,8 @@ bool Trend_Log_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_RECORD_COUNT:
|
case PROP_RECORD_COUNT:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
if (value.type.Unsigned_Int == 0) {
|
if (value.type.Unsigned_Int == 0) {
|
||||||
/* Time to clear down the log */
|
/* Time to clear down the log */
|
||||||
@@ -549,8 +549,8 @@ bool Trend_Log_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
/* logic
|
/* logic
|
||||||
* triggered and polled options.
|
* triggered and polled options.
|
||||||
*/
|
*/
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_ENUMERATED);
|
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
|
||||||
if (status) {
|
if (status) {
|
||||||
if (value.type.Enumerated != LOGGING_TYPE_COV) {
|
if (value.type.Enumerated != LOGGING_TYPE_COV) {
|
||||||
CurrentLog->LoggingType =
|
CurrentLog->LoggingType =
|
||||||
@@ -579,8 +579,8 @@ bool Trend_Log_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
|
|
||||||
case PROP_START_TIME:
|
case PROP_START_TIME:
|
||||||
/* Copy the date part to safe place */
|
/* Copy the date part to safe place */
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_DATE);
|
wp_data, &value, BACNET_APPLICATION_TAG_DATE);
|
||||||
if (!status) {
|
if (!status) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -591,8 +591,8 @@ bool Trend_Log_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
wp_data->application_data_len - len, &value);
|
wp_data->application_data_len - len, &value);
|
||||||
|
|
||||||
if (len) {
|
if (len) {
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_TIME);
|
wp_data, &value, BACNET_APPLICATION_TAG_TIME);
|
||||||
if (!status) {
|
if (!status) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -630,8 +630,8 @@ bool Trend_Log_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
|
|
||||||
case PROP_STOP_TIME:
|
case PROP_STOP_TIME:
|
||||||
/* Copy the date part to safe place */
|
/* Copy the date part to safe place */
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_DATE);
|
wp_data, &value, BACNET_APPLICATION_TAG_DATE);
|
||||||
if (!status) {
|
if (!status) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -642,8 +642,8 @@ bool Trend_Log_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
wp_data->application_data_len - len, &value);
|
wp_data->application_data_len - len, &value);
|
||||||
|
|
||||||
if (len) {
|
if (len) {
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_TIME);
|
wp_data, &value, BACNET_APPLICATION_TAG_TIME);
|
||||||
if (!status) {
|
if (!status) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -720,8 +720,8 @@ bool Trend_Log_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
|
wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
if ((CurrentLog->LoggingType == LOGGING_TYPE_POLLED) &&
|
if ((CurrentLog->LoggingType == LOGGING_TYPE_POLLED) &&
|
||||||
(value.type.Unsigned_Int == 0)) {
|
(value.type.Unsigned_Int == 0)) {
|
||||||
@@ -745,8 +745,8 @@ bool Trend_Log_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_ALIGN_INTERVALS:
|
case PROP_ALIGN_INTERVALS:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BOOLEAN);
|
wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN);
|
||||||
if (status) {
|
if (status) {
|
||||||
CurrentLog->bAlignIntervals = value.type.Boolean;
|
CurrentLog->bAlignIntervals = value.type.Boolean;
|
||||||
}
|
}
|
||||||
@@ -755,16 +755,16 @@ bool Trend_Log_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
|||||||
case PROP_INTERVAL_OFFSET:
|
case PROP_INTERVAL_OFFSET:
|
||||||
/* We only log to 1 sec accuracy so must divide by 100 before
|
/* We only log to 1 sec accuracy so must divide by 100 before
|
||||||
* passing it on */
|
* passing it on */
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
wp_data, &value, BACNET_APPLICATION_TAG_UNSIGNED_INT);
|
||||||
if (status) {
|
if (status) {
|
||||||
CurrentLog->ulIntervalOffset = value.type.Unsigned_Int / 100;
|
CurrentLog->ulIntervalOffset = value.type.Unsigned_Int / 100;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_TRIGGER:
|
case PROP_TRIGGER:
|
||||||
status = write_property_type_valid(wp_data, &value,
|
status = write_property_type_valid(
|
||||||
BACNET_APPLICATION_TAG_BOOLEAN);
|
wp_data, &value, BACNET_APPLICATION_TAG_BOOLEAN);
|
||||||
if (status) {
|
if (status) {
|
||||||
/* We will not allow triggered operation if polling with
|
/* We will not allow triggered operation if polling with
|
||||||
* aligning to the clock as that will produce non aligned
|
* aligning to the clock as that will produce non aligned
|
||||||
|
|||||||
@@ -342,8 +342,7 @@ bool apdu_complex_error(uint8_t service_choice)
|
|||||||
* handling.
|
* handling.
|
||||||
*/
|
*/
|
||||||
void apdu_set_error_handler(
|
void apdu_set_error_handler(
|
||||||
BACNET_CONFIRMED_SERVICE service_choice,
|
BACNET_CONFIRMED_SERVICE service_choice, error_function pFunction)
|
||||||
error_function pFunction)
|
|
||||||
{
|
{
|
||||||
if ((service_choice < MAX_BACNET_CONFIRMED_SERVICE) &&
|
if ((service_choice < MAX_BACNET_CONFIRMED_SERVICE) &&
|
||||||
(!apdu_complex_error(service_choice))) {
|
(!apdu_complex_error(service_choice))) {
|
||||||
@@ -359,8 +358,7 @@ void apdu_set_error_handler(
|
|||||||
* handling.
|
* handling.
|
||||||
*/
|
*/
|
||||||
void apdu_set_complex_error_handler(
|
void apdu_set_complex_error_handler(
|
||||||
BACNET_CONFIRMED_SERVICE service_choice,
|
BACNET_CONFIRMED_SERVICE service_choice, complex_error_function pFunction)
|
||||||
complex_error_function pFunction)
|
|
||||||
{
|
{
|
||||||
if (apdu_complex_error(service_choice)) {
|
if (apdu_complex_error(service_choice)) {
|
||||||
Error_Function[service_choice].complex = pFunction;
|
Error_Function[service_choice].complex = pFunction;
|
||||||
@@ -556,9 +554,9 @@ void apdu_handler(BACNET_ADDRESS *src,
|
|||||||
/* PDU Type */
|
/* PDU Type */
|
||||||
switch (apdu[0] & 0xF0) {
|
switch (apdu[0] & 0xF0) {
|
||||||
case PDU_TYPE_CONFIRMED_SERVICE_REQUEST:
|
case PDU_TYPE_CONFIRMED_SERVICE_REQUEST:
|
||||||
len = apdu_decode_confirmed_service_request(
|
len = apdu_decode_confirmed_service_request(&apdu[0], apdu_len,
|
||||||
&apdu[0], apdu_len, &service_data, &service_choice,
|
&service_data, &service_choice, &service_request,
|
||||||
&service_request, &service_request_len);
|
&service_request_len);
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
/* service data unable to be decoded - simply drop */
|
/* service data unable to be decoded - simply drop */
|
||||||
break;
|
break;
|
||||||
@@ -672,8 +670,8 @@ void apdu_handler(BACNET_ADDRESS *src,
|
|||||||
case SERVICE_CONFIRMED_VT_DATA:
|
case SERVICE_CONFIRMED_VT_DATA:
|
||||||
/* Security Services */
|
/* Security Services */
|
||||||
case SERVICE_CONFIRMED_AUTHENTICATE:
|
case SERVICE_CONFIRMED_AUTHENTICATE:
|
||||||
if (Confirmed_ACK_Function[service_choice].complex !=
|
if (Confirmed_ACK_Function[service_choice]
|
||||||
NULL) {
|
.complex != NULL) {
|
||||||
Confirmed_ACK_Function[service_choice].complex(
|
Confirmed_ACK_Function[service_choice].complex(
|
||||||
service_request, service_request_len, src,
|
service_request, service_request_len, src,
|
||||||
&service_ack_data);
|
&service_ack_data);
|
||||||
@@ -697,16 +695,15 @@ void apdu_handler(BACNET_ADDRESS *src,
|
|||||||
if (apdu_complex_error(service_choice)) {
|
if (apdu_complex_error(service_choice)) {
|
||||||
if (Error_Function[service_choice].complex) {
|
if (Error_Function[service_choice].complex) {
|
||||||
Error_Function[service_choice].complex(src,
|
Error_Function[service_choice].complex(src,
|
||||||
invoke_id, service_choice,
|
invoke_id, service_choice, &apdu[3],
|
||||||
&apdu[3], apdu_len - 3);
|
apdu_len - 3);
|
||||||
}
|
}
|
||||||
} else if (service_choice < MAX_BACNET_CONFIRMED_SERVICE) {
|
} else if (service_choice < MAX_BACNET_CONFIRMED_SERVICE) {
|
||||||
len = bacerror_decode_error_class_and_code(&apdu[3],
|
len = bacerror_decode_error_class_and_code(
|
||||||
apdu_len - 3, &error_class, &error_code);
|
&apdu[3], apdu_len - 3, &error_class, &error_code);
|
||||||
if ((len != 0) &&
|
if ((len != 0) &&
|
||||||
(Error_Function[service_choice].error)) {
|
(Error_Function[service_choice].error)) {
|
||||||
Error_Function[service_choice].error(src,
|
Error_Function[service_choice].error(src, invoke_id,
|
||||||
invoke_id,
|
|
||||||
(BACNET_ERROR_CLASS)error_class,
|
(BACNET_ERROR_CLASS)error_class,
|
||||||
(BACNET_ERROR_CODE)error_code);
|
(BACNET_ERROR_CODE)error_code);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,8 +60,7 @@ static BACNET_COV_NOTIFICATION Confirmed_COV_Notification_Head;
|
|||||||
* @brief call the COV notification callbacks
|
* @brief call the COV notification callbacks
|
||||||
* @param cov_data - data decoded from the COV notification
|
* @param cov_data - data decoded from the COV notification
|
||||||
*/
|
*/
|
||||||
static void handler_ccov_notification_callback(
|
static void handler_ccov_notification_callback(BACNET_COV_DATA *cov_data)
|
||||||
BACNET_COV_DATA *cov_data)
|
|
||||||
{
|
{
|
||||||
BACNET_COV_NOTIFICATION *head;
|
BACNET_COV_NOTIFICATION *head;
|
||||||
|
|
||||||
@@ -78,8 +77,7 @@ static void handler_ccov_notification_callback(
|
|||||||
* @brief Add a Confirmed COV notification callback
|
* @brief Add a Confirmed COV notification callback
|
||||||
* @param cb - COV notification callback to be added
|
* @param cb - COV notification callback to be added
|
||||||
*/
|
*/
|
||||||
void handler_ccov_notification_add(
|
void handler_ccov_notification_add(BACNET_COV_NOTIFICATION *cb)
|
||||||
BACNET_COV_NOTIFICATION *cb)
|
|
||||||
{
|
{
|
||||||
BACNET_COV_NOTIFICATION *head;
|
BACNET_COV_NOTIFICATION *head;
|
||||||
|
|
||||||
@@ -161,8 +159,7 @@ void handler_ccov_notification(uint8_t *service_request,
|
|||||||
PRINTF("%s ",
|
PRINTF("%s ",
|
||||||
bactext_property_name(pProperty_value->propertyIdentifier));
|
bactext_property_name(pProperty_value->propertyIdentifier));
|
||||||
} else {
|
} else {
|
||||||
PRINTF("proprietary %u ",
|
PRINTF("proprietary %u ", pProperty_value->propertyIdentifier);
|
||||||
pProperty_value->propertyIdentifier);
|
|
||||||
}
|
}
|
||||||
if (pProperty_value->propertyArrayIndex != BACNET_ARRAY_ALL) {
|
if (pProperty_value->propertyArrayIndex != BACNET_ARRAY_ALL) {
|
||||||
PRINTF("%u ", pProperty_value->propertyArrayIndex);
|
PRINTF("%u ", pProperty_value->propertyArrayIndex);
|
||||||
|
|||||||
@@ -149,8 +149,7 @@ void handler_device_communication_control(uint8_t *service_request,
|
|||||||
#endif
|
#endif
|
||||||
} else if (len == BACNET_STATUS_REJECT) {
|
} else if (len == BACNET_STATUS_REJECT) {
|
||||||
len = reject_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
len = reject_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||||
service_data->invoke_id,
|
service_data->invoke_id, REJECT_REASON_PARAMETER_OUT_OF_RANGE);
|
||||||
REJECT_REASON_PARAMETER_OUT_OF_RANGE);
|
|
||||||
#if PRINT_ENABLED
|
#if PRINT_ENABLED
|
||||||
fprintf(stderr, "DCC: Sending Reject!\n");
|
fprintf(stderr, "DCC: Sending Reject!\n");
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -140,9 +140,9 @@ void handler_read_property(uint8_t *service_request,
|
|||||||
rpdata.object_instance = Network_Port_Index_To_Instance(0);
|
rpdata.object_instance = Network_Port_Index_To_Instance(0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
apdu_len = rp_ack_encode_apdu_init(
|
apdu_len =
|
||||||
&Handler_Transmit_Buffer[npdu_len], service_data->invoke_id,
|
rp_ack_encode_apdu_init(&Handler_Transmit_Buffer[npdu_len],
|
||||||
&rpdata);
|
service_data->invoke_id, &rpdata);
|
||||||
/* configure our storage */
|
/* configure our storage */
|
||||||
rpdata.application_data =
|
rpdata.application_data =
|
||||||
&Handler_Transmit_Buffer[npdu_len + apdu_len];
|
&Handler_Transmit_Buffer[npdu_len + apdu_len];
|
||||||
@@ -157,7 +157,8 @@ void handler_read_property(uint8_t *service_request,
|
|||||||
if (apdu_len > service_data->max_resp) {
|
if (apdu_len > service_data->max_resp) {
|
||||||
/* too big for the sender - send an abort!
|
/* too big for the sender - send an abort!
|
||||||
Setting of error code needed here as read property
|
Setting of error code needed here as read property
|
||||||
processing may have overridden the default set at start */
|
processing may have overridden the default set at start
|
||||||
|
*/
|
||||||
rpdata.error_code =
|
rpdata.error_code =
|
||||||
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
|
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
|
||||||
len = BACNET_STATUS_ABORT;
|
len = BACNET_STATUS_ABORT;
|
||||||
|
|||||||
@@ -73,9 +73,9 @@ void rp_ack_print_data(BACNET_READ_PROPERTY_DATA *data)
|
|||||||
/* FIXME: what if application_data_len is bigger than 255? */
|
/* FIXME: what if application_data_len is bigger than 255? */
|
||||||
/* value? need to loop until all of the len is gone... */
|
/* value? need to loop until all of the len is gone... */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
len = bacapp_decode_known_property(
|
len = bacapp_decode_known_property(application_data,
|
||||||
application_data, (unsigned)application_data_len, &value,
|
(unsigned)application_data_len, &value, data->object_type,
|
||||||
data->object_type, data->object_property);
|
data->object_property);
|
||||||
|
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
PRINTF_ERR("RP Ack: unable to decode! %s:%s\n",
|
PRINTF_ERR("RP Ack: unable to decode! %s:%s\n",
|
||||||
|
|||||||
@@ -287,7 +287,8 @@ void handler_read_property_multiple(uint8_t *service_request,
|
|||||||
#endif
|
#endif
|
||||||
error = len;
|
error = len;
|
||||||
berror = true;
|
berror = true;
|
||||||
break; /* The berror flag ensures that both loops will */
|
break; /* The berror flag ensures that both loops will
|
||||||
|
*/
|
||||||
/* be broken! */
|
/* be broken! */
|
||||||
}
|
}
|
||||||
decode_len += len;
|
decode_len += len;
|
||||||
@@ -379,7 +380,8 @@ void handler_read_property_multiple(uint8_t *service_request,
|
|||||||
#endif
|
#endif
|
||||||
error = len;
|
error = len;
|
||||||
berror = true;
|
berror = true;
|
||||||
break; /* The berror flag ensures that */
|
break; /* The berror flag ensures that
|
||||||
|
*/
|
||||||
/* both loops will be broken! */
|
/* both loops will be broken! */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,9 +124,8 @@ int rpm_ack_decode_service_request(
|
|||||||
value = calloc(1, sizeof(BACNET_APPLICATION_DATA_VALUE));
|
value = calloc(1, sizeof(BACNET_APPLICATION_DATA_VALUE));
|
||||||
rpm_property->value = value;
|
rpm_property->value = value;
|
||||||
while (value && (apdu_len > 0)) {
|
while (value && (apdu_len > 0)) {
|
||||||
len = bacapp_decode_known_property(
|
len = bacapp_decode_known_property(apdu, (unsigned)apdu_len,
|
||||||
apdu, (unsigned)apdu_len, value,
|
value, rpm_object->object_type,
|
||||||
rpm_object->object_type,
|
|
||||||
rpm_property->propertyIdentifier);
|
rpm_property->propertyIdentifier);
|
||||||
/* If len == 0 then it's an empty structure, which is OK. */
|
/* If len == 0 then it's an empty structure, which is OK. */
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
@@ -155,7 +154,8 @@ int rpm_ack_decode_service_request(
|
|||||||
PRINTF_ERR("RPM Ack: decoded %s:%s len=%d\n",
|
PRINTF_ERR("RPM Ack: decoded %s:%s len=%d\n",
|
||||||
bactext_object_type_name(rpm_object->object_type),
|
bactext_object_type_name(rpm_object->object_type),
|
||||||
bactext_property_name(
|
bactext_property_name(
|
||||||
rpm_property->propertyIdentifier), len);
|
rpm_property->propertyIdentifier),
|
||||||
|
len);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -225,8 +225,7 @@ void rpm_ack_print_data(BACNET_READ_ACCESS_DATA *rpm_data)
|
|||||||
bool array_value = false;
|
bool array_value = false;
|
||||||
|
|
||||||
if (rpm_data) {
|
if (rpm_data) {
|
||||||
PRINTF("%s #%lu\r\n",
|
PRINTF("%s #%lu\r\n", bactext_object_type_name(rpm_data->object_type),
|
||||||
bactext_object_type_name(rpm_data->object_type),
|
|
||||||
(unsigned long)rpm_data->object_instance);
|
(unsigned long)rpm_data->object_instance);
|
||||||
PRINTF("{\r\n");
|
PRINTF("{\r\n");
|
||||||
listOfProperties = rpm_data->listOfProperties;
|
listOfProperties = rpm_data->listOfProperties;
|
||||||
|
|||||||
@@ -173,8 +173,8 @@ void handler_read_range(uint8_t *service_request,
|
|||||||
data.application_data = &Temp_Buf[0];
|
data.application_data = &Temp_Buf[0];
|
||||||
data.application_data_len = len;
|
data.application_data_len = len;
|
||||||
/* FIXME: probably need a length limitation sent with encode */
|
/* FIXME: probably need a length limitation sent with encode */
|
||||||
len = rr_ack_encode_apdu(
|
len = rr_ack_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||||
&Handler_Transmit_Buffer[pdu_len], service_data->invoke_id, &data);
|
service_data->invoke_id, &data);
|
||||||
#if PRINT_ENABLED
|
#if PRINT_ENABLED
|
||||||
fprintf(stderr, "RR: Sending Ack!\n");
|
fprintf(stderr, "RR: Sending Ack!\n");
|
||||||
#endif
|
#endif
|
||||||
@@ -182,7 +182,8 @@ void handler_read_range(uint8_t *service_request,
|
|||||||
}
|
}
|
||||||
if (error) {
|
if (error) {
|
||||||
if (len == -2) {
|
if (len == -2) {
|
||||||
/* BACnet APDU too small to fit data, so proper response is Abort */
|
/* BACnet APDU too small to fit data, so proper response is
|
||||||
|
* Abort */
|
||||||
len = abort_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
len = abort_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||||
service_data->invoke_id,
|
service_data->invoke_id,
|
||||||
ABORT_REASON_SEGMENTATION_NOT_SUPPORTED, true);
|
ABORT_REASON_SEGMENTATION_NOT_SUPPORTED, true);
|
||||||
@@ -190,7 +191,8 @@ void handler_read_range(uint8_t *service_request,
|
|||||||
fprintf(stderr, "RR: Reply too big to fit into APDU!\n");
|
fprintf(stderr, "RR: Reply too big to fit into APDU!\n");
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
len = bacerror_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
len = bacerror_encode_apdu(
|
||||||
|
&Handler_Transmit_Buffer[pdu_len],
|
||||||
service_data->invoke_id, SERVICE_CONFIRMED_READ_RANGE,
|
service_data->invoke_id, SERVICE_CONFIRMED_READ_RANGE,
|
||||||
data.error_class, data.error_code);
|
data.error_class, data.error_code);
|
||||||
#if PRINT_ENABLED
|
#if PRINT_ENABLED
|
||||||
|
|||||||
@@ -57,8 +57,7 @@ static BACNET_COV_NOTIFICATION Unconfirmed_COV_Notification_Head;
|
|||||||
* @brief call the COV notification callbacks
|
* @brief call the COV notification callbacks
|
||||||
* @param cov_data - data decoded from the COV notification
|
* @param cov_data - data decoded from the COV notification
|
||||||
*/
|
*/
|
||||||
static void handler_ucov_notification_callback(
|
static void handler_ucov_notification_callback(BACNET_COV_DATA *cov_data)
|
||||||
BACNET_COV_DATA *cov_data)
|
|
||||||
{
|
{
|
||||||
BACNET_COV_NOTIFICATION *head;
|
BACNET_COV_NOTIFICATION *head;
|
||||||
|
|
||||||
@@ -75,8 +74,7 @@ static void handler_ucov_notification_callback(
|
|||||||
* @brief Add a Confirmed COV notification callback
|
* @brief Add a Confirmed COV notification callback
|
||||||
* @param cb - COV notification callback to be added
|
* @param cb - COV notification callback to be added
|
||||||
*/
|
*/
|
||||||
void handler_ucov_notification_add(
|
void handler_ucov_notification_add(BACNET_COV_NOTIFICATION *cb)
|
||||||
BACNET_COV_NOTIFICATION *cb)
|
|
||||||
{
|
{
|
||||||
BACNET_COV_NOTIFICATION *head;
|
BACNET_COV_NOTIFICATION *head;
|
||||||
|
|
||||||
@@ -122,8 +120,7 @@ void handler_ucov_notification(
|
|||||||
cov_data.listOfValues = &property_value[0];
|
cov_data.listOfValues = &property_value[0];
|
||||||
PRINTF("UCOV: Received Notification!\n");
|
PRINTF("UCOV: Received Notification!\n");
|
||||||
/* decode the service request only */
|
/* decode the service request only */
|
||||||
len =
|
len = cov_notify_decode_service_request(
|
||||||
cov_notify_decode_service_request(
|
|
||||||
service_request, service_len, &cov_data);
|
service_request, service_len, &cov_data);
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
handler_ucov_notification_callback(&cov_data);
|
handler_ucov_notification_callback(&cov_data);
|
||||||
@@ -141,8 +138,7 @@ void handler_ucov_notification(
|
|||||||
PRINTF("%s ",
|
PRINTF("%s ",
|
||||||
bactext_property_name(pProperty_value->propertyIdentifier));
|
bactext_property_name(pProperty_value->propertyIdentifier));
|
||||||
} else {
|
} else {
|
||||||
PRINTF("proprietary %u ",
|
PRINTF("proprietary %u ", pProperty_value->propertyIdentifier);
|
||||||
pProperty_value->propertyIdentifier);
|
|
||||||
}
|
}
|
||||||
if (pProperty_value->propertyArrayIndex != BACNET_ARRAY_ALL) {
|
if (pProperty_value->propertyArrayIndex != BACNET_ARRAY_ALL) {
|
||||||
PRINTF("%u ", pProperty_value->propertyArrayIndex);
|
PRINTF("%u ", pProperty_value->propertyArrayIndex);
|
||||||
|
|||||||
@@ -61,8 +61,8 @@
|
|||||||
* @return number of bytes decoded, or BACNET_STATUS_REJECT,
|
* @return number of bytes decoded, or BACNET_STATUS_REJECT,
|
||||||
* or BACNET_STATUS_ERROR
|
* or BACNET_STATUS_ERROR
|
||||||
*/
|
*/
|
||||||
static int write_property_multiple_decode(
|
static int write_property_multiple_decode(uint8_t *apdu,
|
||||||
uint8_t *apdu, uint16_t apdu_len,
|
uint16_t apdu_len,
|
||||||
BACNET_WRITE_PROPERTY_DATA *wp_data,
|
BACNET_WRITE_PROPERTY_DATA *wp_data,
|
||||||
write_property_function device_write_property)
|
write_property_function device_write_property)
|
||||||
{
|
{
|
||||||
@@ -83,8 +83,8 @@ static int write_property_multiple_decode(
|
|||||||
(3) an optional 'Property Array Index'
|
(3) an optional 'Property Array Index'
|
||||||
(4) a 'Property Value'
|
(4) a 'Property Value'
|
||||||
(5) an optional 'Priority' */
|
(5) an optional 'Priority' */
|
||||||
len = wpm_decode_object_property(&apdu[offset],
|
len = wpm_decode_object_property(
|
||||||
apdu_len - offset, wp_data);
|
&apdu[offset], apdu_len - offset, wp_data);
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
offset += len;
|
offset += len;
|
||||||
PRINTF("WPM: type=%lu instance=%lu property=%lu "
|
PRINTF("WPM: type=%lu instance=%lu property=%lu "
|
||||||
@@ -160,11 +160,11 @@ void handler_write_property_multiple(uint8_t *service_request,
|
|||||||
PRINTF("WPM: Segmented message. Sending Abort!\n");
|
PRINTF("WPM: Segmented message. Sending Abort!\n");
|
||||||
} else {
|
} else {
|
||||||
/* first time - detect malformed request before writing any data */
|
/* first time - detect malformed request before writing any data */
|
||||||
len = write_property_multiple_decode(service_request, service_len,
|
len = write_property_multiple_decode(
|
||||||
&wp_data, NULL);
|
service_request, service_len, &wp_data, NULL);
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
len = write_property_multiple_decode(service_request, service_len,
|
len = write_property_multiple_decode(
|
||||||
&wp_data, Device_Write_Property);
|
service_request, service_len, &wp_data, Device_Write_Property);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* encode the confirmed reply */
|
/* encode the confirmed reply */
|
||||||
|
|||||||
@@ -58,8 +58,10 @@
|
|||||||
* @return invoke id of outgoing message, or 0 if communication is disabled,
|
* @return invoke id of outgoing message, or 0 if communication is disabled,
|
||||||
* or no tsm slot is available.
|
* or no tsm slot is available.
|
||||||
*/
|
*/
|
||||||
uint8_t Send_Alarm_Acknowledgement_Address(uint8_t *pdu, uint16_t pdu_size,
|
uint8_t Send_Alarm_Acknowledgement_Address(uint8_t *pdu,
|
||||||
BACNET_ALARM_ACK_DATA *data, BACNET_ADDRESS *dest)
|
uint16_t pdu_size,
|
||||||
|
BACNET_ALARM_ACK_DATA *data,
|
||||||
|
BACNET_ADDRESS *dest)
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int pdu_len = 0;
|
int pdu_len = 0;
|
||||||
@@ -91,10 +93,9 @@ uint8_t Send_Alarm_Acknowledgement_Address(uint8_t *pdu, uint16_t pdu_size,
|
|||||||
we have a way to check for that and update the
|
we have a way to check for that and update the
|
||||||
max_apdu in the address binding table. */
|
max_apdu in the address binding table. */
|
||||||
if ((uint16_t)pdu_len < pdu_size) {
|
if ((uint16_t)pdu_len < pdu_size) {
|
||||||
tsm_set_confirmed_unsegmented_transaction(invoke_id, dest,
|
tsm_set_confirmed_unsegmented_transaction(
|
||||||
&npdu_data, pdu, (uint16_t)pdu_len);
|
invoke_id, dest, &npdu_data, pdu, (uint16_t)pdu_len);
|
||||||
bytes_sent =
|
bytes_sent = datalink_send_pdu(dest, &npdu_data, pdu, pdu_len);
|
||||||
datalink_send_pdu(dest, &npdu_data, pdu, pdu_len);
|
|
||||||
if (bytes_sent <= 0) {
|
if (bytes_sent <= 0) {
|
||||||
PRINTF("Failed to Send Alarm Ack Request (%s)!\n",
|
PRINTF("Failed to Send Alarm Ack Request (%s)!\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
@@ -133,8 +134,7 @@ uint8_t Send_Alarm_Acknowledgement(
|
|||||||
max_apdu = sizeof(Handler_Transmit_Buffer);
|
max_apdu = sizeof(Handler_Transmit_Buffer);
|
||||||
}
|
}
|
||||||
invoke_id = Send_Alarm_Acknowledgement_Address(
|
invoke_id = Send_Alarm_Acknowledgement_Address(
|
||||||
Handler_Transmit_Buffer, max_apdu,
|
Handler_Transmit_Buffer, max_apdu, data, &dest);
|
||||||
data, &dest);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return invoke_id;
|
return invoke_id;
|
||||||
|
|||||||
@@ -47,8 +47,10 @@
|
|||||||
* @return invoke id of outgoing message, or 0 if communication is disabled,
|
* @return invoke id of outgoing message, or 0 if communication is disabled,
|
||||||
* or no tsm slot is available.
|
* or no tsm slot is available.
|
||||||
*/
|
*/
|
||||||
uint8_t Send_CEvent_Notify_Address(uint8_t *pdu, uint16_t pdu_size,
|
uint8_t Send_CEvent_Notify_Address(uint8_t *pdu,
|
||||||
BACNET_EVENT_NOTIFICATION_DATA *data, BACNET_ADDRESS *dest)
|
uint16_t pdu_size,
|
||||||
|
BACNET_EVENT_NOTIFICATION_DATA *data,
|
||||||
|
BACNET_ADDRESS *dest)
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int pdu_len = 0;
|
int pdu_len = 0;
|
||||||
@@ -81,8 +83,8 @@ uint8_t Send_CEvent_Notify_Address(uint8_t *pdu, uint16_t pdu_size,
|
|||||||
we have a way to check for that and update the
|
we have a way to check for that and update the
|
||||||
max_apdu in the address binding table. */
|
max_apdu in the address binding table. */
|
||||||
if ((uint16_t)pdu_len < pdu_size) {
|
if ((uint16_t)pdu_len < pdu_size) {
|
||||||
tsm_set_confirmed_unsegmented_transaction(invoke_id, dest,
|
tsm_set_confirmed_unsegmented_transaction(
|
||||||
&npdu_data, pdu, (uint16_t)pdu_len);
|
invoke_id, dest, &npdu_data, pdu, (uint16_t)pdu_len);
|
||||||
#if PRINT_ENABLED
|
#if PRINT_ENABLED
|
||||||
bytes_sent =
|
bytes_sent =
|
||||||
#endif
|
#endif
|
||||||
@@ -131,8 +133,7 @@ uint8_t Send_CEvent_Notify(
|
|||||||
max_apdu = sizeof(Handler_Transmit_Buffer);
|
max_apdu = sizeof(Handler_Transmit_Buffer);
|
||||||
}
|
}
|
||||||
invoke_id = Send_CEvent_Notify_Address(
|
invoke_id = Send_CEvent_Notify_Address(
|
||||||
Handler_Transmit_Buffer, max_apdu,
|
Handler_Transmit_Buffer, max_apdu, data, &dest);
|
||||||
data, &dest);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return invoke_id;
|
return invoke_id;
|
||||||
|
|||||||
@@ -144,7 +144,8 @@ uint8_t Send_COV_Subscribe(
|
|||||||
/* encode the APDU portion of the packet */
|
/* encode the APDU portion of the packet */
|
||||||
if (cov_data->covSubscribeToProperty) {
|
if (cov_data->covSubscribeToProperty) {
|
||||||
/* subscribe to 1 property */
|
/* subscribe to 1 property */
|
||||||
len = cov_subscribe_property_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
len = cov_subscribe_property_encode_apdu(
|
||||||
|
&Handler_Transmit_Buffer[pdu_len],
|
||||||
sizeof(Handler_Transmit_Buffer) - pdu_len, invoke_id, cov_data);
|
sizeof(Handler_Transmit_Buffer) - pdu_len, invoke_id, cov_data);
|
||||||
} else {
|
} else {
|
||||||
/* subscribe to object */
|
/* subscribe to object */
|
||||||
|
|||||||
+103
-172
@@ -43,8 +43,12 @@ static double clamp(double d, double min, double max)
|
|||||||
* @param brightness - return brightness of the CIE xy color 0..255
|
* @param brightness - return brightness of the CIE xy color 0..255
|
||||||
* @note http://en.wikipedia.org/wiki/Srgb
|
* @note http://en.wikipedia.org/wiki/Srgb
|
||||||
*/
|
*/
|
||||||
void color_rgb_to_xy(uint8_t r, uint8_t g, uint8_t b,
|
void color_rgb_to_xy(uint8_t r,
|
||||||
float *x_coordinate, float *y_coordinate, uint8_t *brightness)
|
uint8_t g,
|
||||||
|
uint8_t b,
|
||||||
|
float *x_coordinate,
|
||||||
|
float *y_coordinate,
|
||||||
|
uint8_t *brightness)
|
||||||
{
|
{
|
||||||
/* Get the RGB values from your color object
|
/* Get the RGB values from your color object
|
||||||
and convert them to be between 0 and 1.
|
and convert them to be between 0 and 1.
|
||||||
@@ -63,15 +67,12 @@ void color_rgb_to_xy(uint8_t r, uint8_t g, uint8_t b,
|
|||||||
This gamma correction is also applied to the screen
|
This gamma correction is also applied to the screen
|
||||||
of your computer or phone, thus we need this to create
|
of your computer or phone, thus we need this to create
|
||||||
the same color on the light as on screen. */
|
the same color on the light as on screen. */
|
||||||
red = (red > 0.04045f) ?
|
red = (red > 0.04045f) ? pow((red + 0.055f) / (1.0f + 0.055f), 2.4f)
|
||||||
pow((red + 0.055f) / (1.0f + 0.055f), 2.4f) :
|
: (red / 12.92f);
|
||||||
(red / 12.92f);
|
green = (green > 0.04045f) ? pow((green + 0.055f) / (1.0f + 0.055f), 2.4f)
|
||||||
green = (green > 0.04045f) ?
|
: (green / 12.92f);
|
||||||
pow((green + 0.055f) / (1.0f + 0.055f), 2.4f) :
|
blue = (blue > 0.04045f) ? pow((blue + 0.055f) / (1.0f + 0.055f), 2.4f)
|
||||||
(green / 12.92f);
|
: (blue / 12.92f);
|
||||||
blue = (blue > 0.04045f) ?
|
|
||||||
pow((blue + 0.055f) / (1.0f + 0.055f), 2.4f) :
|
|
||||||
(blue / 12.92f);
|
|
||||||
|
|
||||||
/* Convert the RGB values to XYZ using the
|
/* Convert the RGB values to XYZ using the
|
||||||
Wide RGB D65 conversion formula */
|
Wide RGB D65 conversion formula */
|
||||||
@@ -114,8 +115,12 @@ void color_rgb_to_xy(uint8_t r, uint8_t g, uint8_t b,
|
|||||||
* @param brightness - brightness of the CIE xy color
|
* @param brightness - brightness of the CIE xy color
|
||||||
* @note http://en.wikipedia.org/wiki/Srgb
|
* @note http://en.wikipedia.org/wiki/Srgb
|
||||||
*/
|
*/
|
||||||
void color_rgb_from_xy(uint8_t *red, uint8_t *green, uint8_t *blue,
|
void color_rgb_from_xy(uint8_t *red,
|
||||||
float x_coordinate, float y_coordinate, uint8_t brightness)
|
uint8_t *green,
|
||||||
|
uint8_t *blue,
|
||||||
|
float x_coordinate,
|
||||||
|
float y_coordinate,
|
||||||
|
uint8_t brightness)
|
||||||
{
|
{
|
||||||
/* Calculate XYZ values */
|
/* Calculate XYZ values */
|
||||||
float x = x_coordinate;
|
float x = x_coordinate;
|
||||||
@@ -133,12 +138,12 @@ void color_rgb_from_xy(uint8_t *red, uint8_t *green, uint8_t *blue,
|
|||||||
float b = X * 0.0349342f - Y * 0.0968930f + Z * 1.2884099f;
|
float b = X * 0.0349342f - Y * 0.0968930f + Z * 1.2884099f;
|
||||||
|
|
||||||
/* Apply reverse gamma correction */
|
/* Apply reverse gamma correction */
|
||||||
r = r <= 0.0031308f ? 12.92f * r :
|
r = r <= 0.0031308f ? 12.92f * r
|
||||||
(1.0f + 0.055f) * pow(r, (1.0f / 2.4f)) - 0.055f;
|
: (1.0f + 0.055f) * pow(r, (1.0f / 2.4f)) - 0.055f;
|
||||||
g = g <= 0.0031308f ? 12.92f * g :
|
g = g <= 0.0031308f ? 12.92f * g
|
||||||
(1.0f + 0.055f) * pow(g, (1.0f / 2.4f)) - 0.055f;
|
: (1.0f + 0.055f) * pow(g, (1.0f / 2.4f)) - 0.055f;
|
||||||
b = b <= 0.0031308f ? 12.92f * b :
|
b = b <= 0.0031308f ? 12.92f * b
|
||||||
(1.0f + 0.055f) * pow(b, (1.0f / 2.4f)) - 0.055f;
|
: (1.0f + 0.055f) * pow(b, (1.0f / 2.4f)) - 0.055f;
|
||||||
|
|
||||||
/* Convert the RGB values to your color object
|
/* Convert the RGB values to your color object
|
||||||
The rgb values from the above formulas are
|
The rgb values from the above formulas are
|
||||||
@@ -169,154 +174,80 @@ struct css_color_rgb {
|
|||||||
uint8_t blue;
|
uint8_t blue;
|
||||||
};
|
};
|
||||||
static struct css_color_rgb CSS_Color_RGB_Table[] = {
|
static struct css_color_rgb CSS_Color_RGB_Table[] = {
|
||||||
{"aliceblue", 240, 248, 255},
|
{ "aliceblue", 240, 248, 255 }, { "antiquewhite", 250, 235, 215 },
|
||||||
{"antiquewhite", 250, 235, 215},
|
{ "aqua", 0, 255, 255 }, { "aquamarine", 127, 255, 212 },
|
||||||
{"aqua", 0, 255, 255},
|
{ "azure", 240, 255, 255 }, { "beige", 245, 245, 220 },
|
||||||
{"aquamarine", 127, 255, 212},
|
{ "bisque", 255, 228, 196 }, { "black", 0, 0, 0 },
|
||||||
{"azure", 240, 255, 255},
|
{ "blanchedalmond", 255, 235, 205 }, { "blue", 0, 0, 255 },
|
||||||
{"beige", 245, 245, 220},
|
{ "blueviolet", 138, 43, 226 }, { "brown", 165, 42, 42 },
|
||||||
{"bisque", 255, 228, 196},
|
{ "burlywood", 222, 184, 135 }, { "cadetblue", 95, 158, 160 },
|
||||||
{"black", 0, 0, 0},
|
{ "chartreuse", 127, 255, 0 }, { "chocolate", 210, 105, 30 },
|
||||||
{"blanchedalmond", 255, 235, 205},
|
{ "coral", 255, 127, 80 }, { "cornflowerblue", 100, 149, 237 },
|
||||||
{"blue", 0, 0, 255},
|
{ "cornsilk", 255, 248, 220 }, { "crimson", 220, 20, 60 },
|
||||||
{"blueviolet", 138, 43, 226},
|
{ "cyan", 0, 255, 255 }, { "darkblue", 0, 0, 139 },
|
||||||
{"brown", 165, 42, 42},
|
{ "darkcyan", 0, 139, 139 }, { "darkgoldenrod", 184, 134, 11 },
|
||||||
{"burlywood", 222, 184, 135},
|
{ "darkgray", 169, 169, 169 }, { "darkgreen", 0, 100, 0 },
|
||||||
{"cadetblue", 95, 158, 160},
|
{ "darkgrey", 169, 169, 169 }, { "darkkhaki", 189, 183, 107 },
|
||||||
{"chartreuse", 127, 255, 0},
|
{ "darkmagenta", 139, 0, 139 }, { "darkolivegreen", 85, 107, 47 },
|
||||||
{"chocolate", 210, 105, 30},
|
{ "darkorange", 255, 140, 0 }, { "darkorchid", 153, 50, 204 },
|
||||||
{"coral", 255, 127, 80},
|
{ "darkred", 139, 0, 0 }, { "darksalmon", 233, 150, 122 },
|
||||||
{"cornflowerblue", 100, 149, 237},
|
{ "darkseagreen", 143, 188, 143 }, { "darkslateblue", 72, 61, 139 },
|
||||||
{"cornsilk", 255, 248, 220},
|
{ "darkslategray", 47, 79, 79 }, { "darkslategrey", 47, 79, 79 },
|
||||||
{"crimson", 220, 20, 60},
|
{ "darkturquoise", 0, 206, 209 }, { "darkviolet", 148, 0, 211 },
|
||||||
{"cyan", 0, 255, 255},
|
{ "deeppink", 255, 20, 147 }, { "deepskyblue", 0, 191, 255 },
|
||||||
{"darkblue", 0, 0, 139},
|
{ "dimgray", 105, 105, 105 }, { "dimgrey", 105, 105, 105 },
|
||||||
{"darkcyan", 0, 139, 139},
|
{ "dodgerblue", 30, 144, 255 }, { "firebrick", 178, 34, 34 },
|
||||||
{"darkgoldenrod", 184, 134, 11},
|
{ "floralwhite", 255, 250, 240 }, { "forestgreen", 34, 139, 34 },
|
||||||
{"darkgray", 169, 169, 169},
|
{ "fuchsia", 255, 0, 255 }, { "gainsboro", 220, 220, 220 },
|
||||||
{"darkgreen", 0, 100, 0},
|
{ "ghostwhite", 248, 248, 255 }, { "gold", 255, 215, 0 },
|
||||||
{"darkgrey", 169, 169, 169},
|
{ "goldenrod", 218, 165, 32 }, { "gray", 128, 128, 128 },
|
||||||
{"darkkhaki", 189, 183, 107},
|
{ "green", 0, 128, 0 }, { "greenyellow", 173, 255, 47 },
|
||||||
{"darkmagenta", 139, 0, 139},
|
{ "grey", 128, 128, 128 }, { "honeydew", 240, 255, 240 },
|
||||||
{"darkolivegreen", 85, 107, 47},
|
{ "hotpink", 255, 105, 180 }, { "indianred", 205, 92, 92 },
|
||||||
{"darkorange", 255, 140, 0},
|
{ "indigo", 75, 0, 130 }, { "ivory", 255, 255, 240 },
|
||||||
{"darkorchid", 153, 50, 204},
|
{ "khaki", 240, 230, 140 }, { "lavender", 230, 230, 250 },
|
||||||
{"darkred", 139, 0, 0},
|
{ "lavenderblush", 255, 240, 245 }, { "lawngreen", 124, 252, 0 },
|
||||||
{"darksalmon", 233, 150, 122},
|
{ "lemonchiffon", 255, 250, 205 }, { "lightblue", 173, 216, 230 },
|
||||||
{"darkseagreen", 143, 188, 143},
|
{ "lightcoral", 240, 128, 128 }, { "lightcyan", 224, 255, 255 },
|
||||||
{"darkslateblue", 72, 61, 139},
|
{ "lightgoldenrodyellow", 250, 250, 210 }, { "lightgray", 211, 211, 211 },
|
||||||
{"darkslategray", 47, 79, 79},
|
{ "lightgreen", 144, 238, 144 }, { "lightgrey", 211, 211, 211 },
|
||||||
{"darkslategrey", 47, 79, 79},
|
{ "lightpink", 255, 182, 193 }, { "lightsalmon", 255, 160, 122 },
|
||||||
{"darkturquoise", 0, 206, 209},
|
{ "lightseagreen", 32, 178, 170 }, { "lightskyblue", 135, 206, 250 },
|
||||||
{"darkviolet", 148, 0, 211},
|
{ "lightslategray", 119, 136, 153 }, { "lightslategrey", 119, 136, 153 },
|
||||||
{"deeppink", 255, 20, 147},
|
{ "lightsteelblue", 176, 196, 222 }, { "lightyellow", 255, 255, 224 },
|
||||||
{"deepskyblue", 0, 191, 255},
|
{ "lime", 0, 255, 0 }, { "limegreen", 50, 205, 50 },
|
||||||
{"dimgray", 105, 105, 105},
|
{ "linen", 250, 240, 230 }, { "magenta", 255, 0, 255 },
|
||||||
{"dimgrey", 105, 105, 105},
|
{ "maroon", 128, 0, 0 }, { "mediumaquamarine", 102, 205, 170 },
|
||||||
{"dodgerblue", 30, 144, 255},
|
{ "mediumblue", 0, 0, 205 }, { "mediumorchid", 186, 85, 211 },
|
||||||
{"firebrick", 178, 34, 34},
|
{ "mediumpurple", 147, 112, 219 }, { "mediumseagreen", 60, 179, 113 },
|
||||||
{"floralwhite", 255, 250, 240},
|
{ "mediumslateblue", 123, 104, 238 }, { "mediumspringgreen", 0, 250, 154 },
|
||||||
{"forestgreen", 34, 139, 34},
|
{ "mediumturquoise", 72, 209, 204 }, { "mediumvioletred", 199, 21, 133 },
|
||||||
{"fuchsia", 255, 0, 255},
|
{ "midnightblue", 25, 25, 112 }, { "mintcream", 245, 255, 250 },
|
||||||
{"gainsboro", 220, 220, 220},
|
{ "mistyrose", 255, 228, 225 }, { "moccasin", 255, 228, 181 },
|
||||||
{"ghostwhite", 248, 248, 255},
|
{ "navajowhite", 255, 222, 173 }, { "navy", 0, 0, 128 },
|
||||||
{"gold", 255, 215, 0},
|
{ "navyblue", 0, 0, 128 }, { "oldlace", 253, 245, 230 },
|
||||||
{"goldenrod", 218, 165, 32},
|
{ "olive", 128, 128, 0 }, { "olivedrab", 107, 142, 35 },
|
||||||
{"gray", 128, 128, 128},
|
{ "orange", 255, 165, 0 }, { "orangered", 255, 69, 0 },
|
||||||
{"green", 0, 128, 0},
|
{ "orchid", 218, 112, 214 }, { "palegoldenrod", 238, 232, 170 },
|
||||||
{"greenyellow", 173, 255, 47},
|
{ "palegreen", 152, 251, 152 }, { "paleturquoise", 175, 238, 238 },
|
||||||
{"grey", 128, 128, 128},
|
{ "palevioletred", 219, 112, 147 }, { "papayawhip", 255, 239, 213 },
|
||||||
{"honeydew", 240, 255, 240},
|
{ "peachpuff", 255, 218, 185 }, { "peru", 205, 133, 63 },
|
||||||
{"hotpink", 255, 105, 180},
|
{ "pink", 255, 192, 203 }, { "plum", 221, 160, 221 },
|
||||||
{"indianred", 205, 92, 92},
|
{ "powderblue", 176, 224, 230 }, { "purple", 128, 0, 128 },
|
||||||
{"indigo", 75, 0, 130},
|
{ "red", 255, 0, 0 }, { "rosybrown", 188, 143, 143 },
|
||||||
{"ivory", 255, 255, 240},
|
{ "royalblue", 65, 105, 225 }, { "saddlebrown", 139, 69, 19 },
|
||||||
{"khaki", 240, 230, 140},
|
{ "salmon", 250, 128, 114 }, { "sandybrown", 244, 164, 96 },
|
||||||
{"lavender", 230, 230, 250},
|
{ "seagreen", 46, 139, 87 }, { "seashell", 255, 245, 238 },
|
||||||
{"lavenderblush", 255, 240, 245},
|
{ "sienna", 160, 82, 45 }, { "silver", 192, 192, 192 },
|
||||||
{"lawngreen", 124, 252, 0},
|
{ "skyblue", 135, 206, 235 }, { "slateblue", 106, 90, 205 },
|
||||||
{"lemonchiffon", 255, 250, 205},
|
{ "slategray", 112, 128, 144 }, { "slategrey", 112, 128, 144 },
|
||||||
{"lightblue", 173, 216, 230},
|
{ "snow", 255, 250, 250 }, { "springgreen", 0, 255, 127 },
|
||||||
{"lightcoral", 240, 128, 128},
|
{ "steelblue", 70, 130, 180 }, { "tan", 210, 180, 140 },
|
||||||
{"lightcyan", 224, 255, 255},
|
{ "teal", 0, 128, 128 }, { "thistle", 216, 191, 216 },
|
||||||
{"lightgoldenrodyellow", 250, 250, 210},
|
{ "tomato", 255, 99, 71 }, { "turquoise", 64, 224, 208 },
|
||||||
{"lightgray", 211, 211, 211},
|
{ "violet", 238, 130, 238 }, { "wheat", 245, 222, 179 },
|
||||||
{"lightgreen", 144, 238, 144},
|
{ "white", 255, 255, 255 }, { "whitesmoke", 245, 245, 245 },
|
||||||
{"lightgrey", 211, 211, 211},
|
{ "yellow", 255, 255, 0 }, { "yellowgreen", 154, 205, 50 },
|
||||||
{"lightpink", 255, 182, 193},
|
|
||||||
{"lightsalmon", 255, 160, 122},
|
|
||||||
{"lightseagreen", 32, 178, 170},
|
|
||||||
{"lightskyblue", 135, 206, 250},
|
|
||||||
{"lightslategray", 119, 136, 153},
|
|
||||||
{"lightslategrey", 119, 136, 153},
|
|
||||||
{"lightsteelblue", 176, 196, 222},
|
|
||||||
{"lightyellow", 255, 255, 224},
|
|
||||||
{"lime", 0, 255, 0},
|
|
||||||
{"limegreen", 50, 205, 50},
|
|
||||||
{"linen", 250, 240, 230},
|
|
||||||
{"magenta", 255, 0, 255},
|
|
||||||
{"maroon", 128, 0, 0},
|
|
||||||
{"mediumaquamarine", 102, 205, 170},
|
|
||||||
{"mediumblue", 0, 0, 205},
|
|
||||||
{"mediumorchid", 186, 85, 211},
|
|
||||||
{"mediumpurple", 147, 112, 219},
|
|
||||||
{"mediumseagreen", 60, 179, 113},
|
|
||||||
{"mediumslateblue", 123, 104, 238},
|
|
||||||
{"mediumspringgreen", 0, 250, 154},
|
|
||||||
{"mediumturquoise", 72, 209, 204},
|
|
||||||
{"mediumvioletred", 199, 21, 133},
|
|
||||||
{"midnightblue", 25, 25, 112},
|
|
||||||
{"mintcream", 245, 255, 250},
|
|
||||||
{"mistyrose", 255, 228, 225},
|
|
||||||
{"moccasin", 255, 228, 181},
|
|
||||||
{"navajowhite", 255, 222, 173},
|
|
||||||
{"navy", 0, 0, 128},
|
|
||||||
{"navyblue", 0, 0, 128},
|
|
||||||
{"oldlace", 253, 245, 230},
|
|
||||||
{"olive", 128, 128, 0},
|
|
||||||
{"olivedrab", 107, 142, 35},
|
|
||||||
{"orange", 255, 165, 0},
|
|
||||||
{"orangered", 255, 69, 0},
|
|
||||||
{"orchid", 218, 112, 214},
|
|
||||||
{"palegoldenrod", 238, 232, 170},
|
|
||||||
{"palegreen", 152, 251, 152},
|
|
||||||
{"paleturquoise", 175, 238, 238},
|
|
||||||
{"palevioletred", 219, 112, 147},
|
|
||||||
{"papayawhip", 255, 239, 213},
|
|
||||||
{"peachpuff", 255, 218, 185},
|
|
||||||
{"peru", 205, 133, 63},
|
|
||||||
{"pink", 255, 192, 203},
|
|
||||||
{"plum", 221, 160, 221},
|
|
||||||
{"powderblue", 176, 224, 230},
|
|
||||||
{"purple", 128, 0, 128},
|
|
||||||
{"red", 255, 0, 0},
|
|
||||||
{"rosybrown", 188, 143, 143},
|
|
||||||
{"royalblue", 65, 105, 225},
|
|
||||||
{"saddlebrown", 139, 69, 19},
|
|
||||||
{"salmon", 250, 128, 114},
|
|
||||||
{"sandybrown", 244, 164, 96},
|
|
||||||
{"seagreen", 46, 139, 87},
|
|
||||||
{"seashell", 255, 245, 238},
|
|
||||||
{"sienna", 160, 82, 45},
|
|
||||||
{"silver", 192, 192, 192},
|
|
||||||
{"skyblue", 135, 206, 235},
|
|
||||||
{"slateblue", 106, 90, 205},
|
|
||||||
{"slategray", 112, 128, 144},
|
|
||||||
{"slategrey", 112, 128, 144},
|
|
||||||
{"snow", 255, 250, 250},
|
|
||||||
{"springgreen", 0, 255, 127},
|
|
||||||
{"steelblue", 70, 130, 180},
|
|
||||||
{"tan", 210, 180, 140},
|
|
||||||
{"teal", 0, 128, 128},
|
|
||||||
{"thistle", 216, 191, 216},
|
|
||||||
{"tomato", 255, 99, 71},
|
|
||||||
{"turquoise", 64, 224, 208},
|
|
||||||
{"violet", 238, 130, 238},
|
|
||||||
{"wheat", 245, 222, 179},
|
|
||||||
{"white", 255, 255, 255},
|
|
||||||
{"whitesmoke", 245, 245, 245},
|
|
||||||
{"yellow", 255, 255, 0},
|
|
||||||
{"yellowgreen", 154, 205, 50},
|
|
||||||
{ NULL, 0, 0, 0 }
|
{ NULL, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -355,8 +286,8 @@ const char * color_rgb_to_ascii(uint8_t red, uint8_t green, uint8_t blue)
|
|||||||
* @param name - CSS color name from W3C
|
* @param name - CSS color name from W3C
|
||||||
* @return index 0..color_rgb_count(), where color_rgb_count() is not found.
|
* @return index 0..color_rgb_count(), where color_rgb_count() is not found.
|
||||||
*/
|
*/
|
||||||
unsigned color_rgb_from_ascii(uint8_t *red, uint8_t *green, uint8_t *blue,
|
unsigned color_rgb_from_ascii(
|
||||||
const char *name)
|
uint8_t *red, uint8_t *green, uint8_t *blue, const char *name)
|
||||||
{
|
{
|
||||||
unsigned index = 0;
|
unsigned index = 0;
|
||||||
|
|
||||||
@@ -386,7 +317,8 @@ unsigned color_rgb_from_ascii(uint8_t *red, uint8_t *green, uint8_t *blue,
|
|||||||
* @param blue - return B value of sRGB
|
* @param blue - return B value of sRGB
|
||||||
* @return CSS ASCII color name from W3C or NULL if invalid index
|
* @return CSS ASCII color name from W3C or NULL if invalid index
|
||||||
*/
|
*/
|
||||||
const char *color_rgb_from_index(unsigned target_index, uint8_t *red, uint8_t *green, uint8_t *blue)
|
const char *color_rgb_from_index(
|
||||||
|
unsigned target_index, uint8_t *red, uint8_t *green, uint8_t *blue)
|
||||||
{
|
{
|
||||||
unsigned index = 0;
|
unsigned index = 0;
|
||||||
|
|
||||||
@@ -431,8 +363,7 @@ unsigned color_rgb_count(void)
|
|||||||
* http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code/
|
* http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code/
|
||||||
*/
|
*/
|
||||||
void color_rgb_from_temperature(
|
void color_rgb_from_temperature(
|
||||||
uint16_t temperature_kelvin,
|
uint16_t temperature_kelvin, uint8_t *r, uint8_t *g, uint8_t *b)
|
||||||
uint8_t *r, uint8_t *g, uint8_t *b)
|
|
||||||
{
|
{
|
||||||
float red = 0, green = 0, blue = 0;
|
float red = 0, green = 0, blue = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -200,10 +200,8 @@ uint32_t days_apart(uint16_t year1,
|
|||||||
* @param day - day of month (1-31)
|
* @param day - day of month (1-31)
|
||||||
* @return number of days since epoch, or 0 if out of range
|
* @return number of days since epoch, or 0 if out of range
|
||||||
*/
|
*/
|
||||||
uint32_t days_since_epoch(uint16_t epoch_year,
|
uint32_t days_since_epoch(
|
||||||
uint16_t year,
|
uint16_t epoch_year, uint16_t year, uint8_t month, uint8_t day)
|
||||||
uint8_t month,
|
|
||||||
uint8_t day)
|
|
||||||
{
|
{
|
||||||
uint32_t days = 0; /* return value */
|
uint32_t days = 0; /* return value */
|
||||||
uint16_t yy = 0; /* year */
|
uint16_t yy = 0; /* year */
|
||||||
@@ -212,8 +210,8 @@ uint32_t days_since_epoch(uint16_t epoch_year,
|
|||||||
|
|
||||||
/* validate the date conforms to our range */
|
/* validate the date conforms to our range */
|
||||||
monthdays = days_per_month(year, month);
|
monthdays = days_per_month(year, month);
|
||||||
if ((year >= epoch_year) && (year <= 9999) &&
|
if ((year >= epoch_year) && (year <= 9999) && (monthdays > 0) &&
|
||||||
(monthdays > 0) && (day >= 1) && (day <= monthdays)) {
|
(day >= 1) && (day <= monthdays)) {
|
||||||
for (yy = epoch_year; yy < year; yy++) {
|
for (yy = epoch_year; yy < year; yy++) {
|
||||||
days += 365;
|
days += 365;
|
||||||
if (days_is_leap_year(yy)) {
|
if (days_is_leap_year(yy)) {
|
||||||
@@ -238,8 +236,7 @@ uint32_t days_since_epoch(uint16_t epoch_year,
|
|||||||
* @param pDay - day of month (1-31)
|
* @param pDay - day of month (1-31)
|
||||||
* @return nothing
|
* @return nothing
|
||||||
*/
|
*/
|
||||||
void days_since_epoch_to_date(
|
void days_since_epoch_to_date(uint16_t epoch_year,
|
||||||
uint16_t epoch_year,
|
|
||||||
uint32_t days,
|
uint32_t days,
|
||||||
uint16_t *pYear,
|
uint16_t *pYear,
|
||||||
uint8_t *pMonth,
|
uint8_t *pMonth,
|
||||||
@@ -281,9 +278,7 @@ void days_since_epoch_to_date(
|
|||||||
* @param day - day of month (1-31)
|
* @param day - day of month (1-31)
|
||||||
* @return true if the date is valid
|
* @return true if the date is valid
|
||||||
*/
|
*/
|
||||||
bool days_date_is_valid(uint16_t year,
|
bool days_date_is_valid(uint16_t year, uint8_t month, uint8_t day)
|
||||||
uint8_t month,
|
|
||||||
uint8_t day)
|
|
||||||
{
|
{
|
||||||
uint8_t month_days = 0;
|
uint8_t month_days = 0;
|
||||||
bool valid = false; /* return value */
|
bool valid = false; /* return value */
|
||||||
|
|||||||
+21
-27
@@ -774,8 +774,7 @@ void cov_data_value_list_link(
|
|||||||
*
|
*
|
||||||
* @return true if values were encoded
|
* @return true if values were encoded
|
||||||
*/
|
*/
|
||||||
bool cov_value_list_encode_real(
|
bool cov_value_list_encode_real(BACNET_PROPERTY_VALUE *value_list,
|
||||||
BACNET_PROPERTY_VALUE * value_list,
|
|
||||||
float value,
|
float value,
|
||||||
bool in_alarm,
|
bool in_alarm,
|
||||||
bool fault,
|
bool fault,
|
||||||
@@ -800,10 +799,10 @@ bool cov_value_list_encode_real(
|
|||||||
value_list->value.context_specific = false;
|
value_list->value.context_specific = false;
|
||||||
value_list->value.tag = BACNET_APPLICATION_TAG_BIT_STRING;
|
value_list->value.tag = BACNET_APPLICATION_TAG_BIT_STRING;
|
||||||
bitstring_init(&value_list->value.type.Bit_String);
|
bitstring_init(&value_list->value.type.Bit_String);
|
||||||
bitstring_set_bit(&value_list->value.type.Bit_String,
|
bitstring_set_bit(
|
||||||
STATUS_FLAG_IN_ALARM, in_alarm);
|
&value_list->value.type.Bit_String, STATUS_FLAG_IN_ALARM, in_alarm);
|
||||||
bitstring_set_bit(&value_list->value.type.Bit_String,
|
bitstring_set_bit(
|
||||||
STATUS_FLAG_FAULT, fault);
|
&value_list->value.type.Bit_String, STATUS_FLAG_FAULT, fault);
|
||||||
bitstring_set_bit(&value_list->value.type.Bit_String,
|
bitstring_set_bit(&value_list->value.type.Bit_String,
|
||||||
STATUS_FLAG_OVERRIDDEN, overridden);
|
STATUS_FLAG_OVERRIDDEN, overridden);
|
||||||
bitstring_set_bit(&value_list->value.type.Bit_String,
|
bitstring_set_bit(&value_list->value.type.Bit_String,
|
||||||
@@ -828,8 +827,7 @@ bool cov_value_list_encode_real(
|
|||||||
*
|
*
|
||||||
* @return true if values were encoded
|
* @return true if values were encoded
|
||||||
*/
|
*/
|
||||||
bool cov_value_list_encode_enumerated(
|
bool cov_value_list_encode_enumerated(BACNET_PROPERTY_VALUE *value_list,
|
||||||
BACNET_PROPERTY_VALUE * value_list,
|
|
||||||
uint32_t value,
|
uint32_t value,
|
||||||
bool in_alarm,
|
bool in_alarm,
|
||||||
bool fault,
|
bool fault,
|
||||||
@@ -854,10 +852,10 @@ bool cov_value_list_encode_enumerated(
|
|||||||
value_list->value.context_specific = false;
|
value_list->value.context_specific = false;
|
||||||
value_list->value.tag = BACNET_APPLICATION_TAG_BIT_STRING;
|
value_list->value.tag = BACNET_APPLICATION_TAG_BIT_STRING;
|
||||||
bitstring_init(&value_list->value.type.Bit_String);
|
bitstring_init(&value_list->value.type.Bit_String);
|
||||||
bitstring_set_bit(&value_list->value.type.Bit_String,
|
bitstring_set_bit(
|
||||||
STATUS_FLAG_IN_ALARM, in_alarm);
|
&value_list->value.type.Bit_String, STATUS_FLAG_IN_ALARM, in_alarm);
|
||||||
bitstring_set_bit(&value_list->value.type.Bit_String,
|
bitstring_set_bit(
|
||||||
STATUS_FLAG_FAULT, fault);
|
&value_list->value.type.Bit_String, STATUS_FLAG_FAULT, fault);
|
||||||
bitstring_set_bit(&value_list->value.type.Bit_String,
|
bitstring_set_bit(&value_list->value.type.Bit_String,
|
||||||
STATUS_FLAG_OVERRIDDEN, overridden);
|
STATUS_FLAG_OVERRIDDEN, overridden);
|
||||||
bitstring_set_bit(&value_list->value.type.Bit_String,
|
bitstring_set_bit(&value_list->value.type.Bit_String,
|
||||||
@@ -882,8 +880,7 @@ bool cov_value_list_encode_enumerated(
|
|||||||
*
|
*
|
||||||
* @return true if values were encoded
|
* @return true if values were encoded
|
||||||
*/
|
*/
|
||||||
bool cov_value_list_encode_unsigned(
|
bool cov_value_list_encode_unsigned(BACNET_PROPERTY_VALUE *value_list,
|
||||||
BACNET_PROPERTY_VALUE * value_list,
|
|
||||||
uint32_t value,
|
uint32_t value,
|
||||||
bool in_alarm,
|
bool in_alarm,
|
||||||
bool fault,
|
bool fault,
|
||||||
@@ -908,10 +905,10 @@ bool cov_value_list_encode_unsigned(
|
|||||||
value_list->value.context_specific = false;
|
value_list->value.context_specific = false;
|
||||||
value_list->value.tag = BACNET_APPLICATION_TAG_BIT_STRING;
|
value_list->value.tag = BACNET_APPLICATION_TAG_BIT_STRING;
|
||||||
bitstring_init(&value_list->value.type.Bit_String);
|
bitstring_init(&value_list->value.type.Bit_String);
|
||||||
bitstring_set_bit(&value_list->value.type.Bit_String,
|
bitstring_set_bit(
|
||||||
STATUS_FLAG_IN_ALARM, in_alarm);
|
&value_list->value.type.Bit_String, STATUS_FLAG_IN_ALARM, in_alarm);
|
||||||
bitstring_set_bit(&value_list->value.type.Bit_String,
|
bitstring_set_bit(
|
||||||
STATUS_FLAG_FAULT, fault);
|
&value_list->value.type.Bit_String, STATUS_FLAG_FAULT, fault);
|
||||||
bitstring_set_bit(&value_list->value.type.Bit_String,
|
bitstring_set_bit(&value_list->value.type.Bit_String,
|
||||||
STATUS_FLAG_OVERRIDDEN, overridden);
|
STATUS_FLAG_OVERRIDDEN, overridden);
|
||||||
bitstring_set_bit(&value_list->value.type.Bit_String,
|
bitstring_set_bit(&value_list->value.type.Bit_String,
|
||||||
@@ -938,8 +935,7 @@ bool cov_value_list_encode_unsigned(
|
|||||||
*
|
*
|
||||||
* @return true if values were encoded
|
* @return true if values were encoded
|
||||||
*/
|
*/
|
||||||
bool cov_value_list_encode_character_string(
|
bool cov_value_list_encode_character_string(BACNET_PROPERTY_VALUE *value_list,
|
||||||
BACNET_PROPERTY_VALUE * value_list,
|
|
||||||
BACNET_CHARACTER_STRING *value,
|
BACNET_CHARACTER_STRING *value,
|
||||||
bool in_alarm,
|
bool in_alarm,
|
||||||
bool fault,
|
bool fault,
|
||||||
@@ -953,9 +949,7 @@ bool cov_value_list_encode_character_string(
|
|||||||
value_list->propertyArrayIndex = BACNET_ARRAY_ALL;
|
value_list->propertyArrayIndex = BACNET_ARRAY_ALL;
|
||||||
value_list->value.context_specific = false;
|
value_list->value.context_specific = false;
|
||||||
value_list->value.tag = BACNET_APPLICATION_TAG_CHARACTER_STRING;
|
value_list->value.tag = BACNET_APPLICATION_TAG_CHARACTER_STRING;
|
||||||
characterstring_copy(
|
characterstring_copy(&value_list->value.type.Character_String, value);
|
||||||
&value_list->value.type.Character_String,
|
|
||||||
value);
|
|
||||||
value_list->value.next = NULL;
|
value_list->value.next = NULL;
|
||||||
value_list->priority = BACNET_NO_PRIORITY;
|
value_list->priority = BACNET_NO_PRIORITY;
|
||||||
value_list = value_list->next;
|
value_list = value_list->next;
|
||||||
@@ -966,10 +960,10 @@ bool cov_value_list_encode_character_string(
|
|||||||
value_list->value.context_specific = false;
|
value_list->value.context_specific = false;
|
||||||
value_list->value.tag = BACNET_APPLICATION_TAG_BIT_STRING;
|
value_list->value.tag = BACNET_APPLICATION_TAG_BIT_STRING;
|
||||||
bitstring_init(&value_list->value.type.Bit_String);
|
bitstring_init(&value_list->value.type.Bit_String);
|
||||||
bitstring_set_bit(&value_list->value.type.Bit_String,
|
bitstring_set_bit(
|
||||||
STATUS_FLAG_IN_ALARM, in_alarm);
|
&value_list->value.type.Bit_String, STATUS_FLAG_IN_ALARM, in_alarm);
|
||||||
bitstring_set_bit(&value_list->value.type.Bit_String,
|
bitstring_set_bit(
|
||||||
STATUS_FLAG_FAULT, fault);
|
&value_list->value.type.Bit_String, STATUS_FLAG_FAULT, fault);
|
||||||
bitstring_set_bit(&value_list->value.type.Bit_String,
|
bitstring_set_bit(&value_list->value.type.Bit_String,
|
||||||
STATUS_FLAG_OVERRIDDEN, overridden);
|
STATUS_FLAG_OVERRIDDEN, overridden);
|
||||||
bitstring_set_bit(&value_list->value.type.Bit_String,
|
bitstring_set_bit(&value_list->value.type.Bit_String,
|
||||||
|
|||||||
@@ -37,20 +37,16 @@ License.
|
|||||||
#include "bacnet/bactimevalue.h"
|
#include "bacnet/bactimevalue.h"
|
||||||
|
|
||||||
int bacnet_dailyschedule_decode(
|
int bacnet_dailyschedule_decode(
|
||||||
uint8_t * apdu,
|
uint8_t *apdu, int max_apdu_len, BACNET_DAILY_SCHEDULE *day)
|
||||||
int max_apdu_len,
|
|
||||||
BACNET_DAILY_SCHEDULE * day)
|
|
||||||
{
|
{
|
||||||
unsigned int tv_count = 0;
|
unsigned int tv_count = 0;
|
||||||
int retval = bacnet_time_values_context_decode(
|
int retval = bacnet_time_values_context_decode(apdu, max_apdu_len, 0,
|
||||||
apdu, max_apdu_len, 0, &day->Time_Values[0], MAX_DAY_SCHEDULE_VALUES, &tv_count);
|
&day->Time_Values[0], MAX_DAY_SCHEDULE_VALUES, &tv_count);
|
||||||
day->TV_Count = (uint16_t)tv_count;
|
day->TV_Count = (uint16_t)tv_count;
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bacnet_dailyschedule_encode(
|
int bacnet_dailyschedule_encode(uint8_t *apdu, BACNET_DAILY_SCHEDULE *day)
|
||||||
uint8_t * apdu,
|
|
||||||
BACNET_DAILY_SCHEDULE * day)
|
|
||||||
{
|
{
|
||||||
return bacnet_time_values_context_encode(
|
return bacnet_time_values_context_encode(
|
||||||
apdu, 0, &day->Time_Values[0], day->TV_Count);
|
apdu, 0, &day->Time_Values[0], day->TV_Count);
|
||||||
|
|||||||
+20
-29
@@ -563,10 +563,10 @@ int bvlc_broadcast_distribution_table_encode(uint8_t *apdu,
|
|||||||
len = encode_opening_tag(&apdu[apdu_len], 0);
|
len = encode_opening_tag(&apdu[apdu_len], 0);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
/* CHOICE - ip-address [1] OCTET STRING */
|
/* CHOICE - ip-address [1] OCTET STRING */
|
||||||
octetstring_init(&octet_string,
|
octetstring_init(&octet_string, &bdt_entry->dest_address.address[0],
|
||||||
&bdt_entry->dest_address.address[0], IP_ADDRESS_MAX);
|
IP_ADDRESS_MAX);
|
||||||
len = encode_context_octet_string(&apdu[apdu_len], 1,
|
len =
|
||||||
&octet_string);
|
encode_context_octet_string(&apdu[apdu_len], 1, &octet_string);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
/* host [0] BACnetHostAddress - closing */
|
/* host [0] BACnetHostAddress - closing */
|
||||||
len = encode_closing_tag(&apdu[apdu_len], 0);
|
len = encode_closing_tag(&apdu[apdu_len], 0);
|
||||||
@@ -581,8 +581,8 @@ int bvlc_broadcast_distribution_table_encode(uint8_t *apdu,
|
|||||||
/* broadcast-mask [1] OCTET STRING */
|
/* broadcast-mask [1] OCTET STRING */
|
||||||
octetstring_init(&octet_string,
|
octetstring_init(&octet_string,
|
||||||
&bdt_entry->broadcast_mask.address[0], IP_ADDRESS_MAX);
|
&bdt_entry->broadcast_mask.address[0], IP_ADDRESS_MAX);
|
||||||
len = encode_context_octet_string(&apdu[apdu_len], 1,
|
len =
|
||||||
&octet_string);
|
encode_context_octet_string(&apdu[apdu_len], 1, &octet_string);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
}
|
}
|
||||||
if (!entry_size) {
|
if (!entry_size) {
|
||||||
@@ -657,13 +657,12 @@ int bvlc_broadcast_distribution_table_decode(uint8_t *apdu,
|
|||||||
}
|
}
|
||||||
return BACNET_STATUS_REJECT;
|
return BACNET_STATUS_REJECT;
|
||||||
}
|
}
|
||||||
len += decode_octet_string(&apdu[len], len_value_type,
|
len += decode_octet_string(&apdu[len], len_value_type, &octet_string);
|
||||||
&octet_string);
|
|
||||||
if (len > apdu_len) {
|
if (len > apdu_len) {
|
||||||
return BACNET_STATUS_REJECT;
|
return BACNET_STATUS_REJECT;
|
||||||
}
|
}
|
||||||
(void)octetstring_copy_value(&bdt_entry->dest_address.address[0],
|
(void)octetstring_copy_value(
|
||||||
IP_ADDRESS_MAX, &octet_string);
|
&bdt_entry->dest_address.address[0], IP_ADDRESS_MAX, &octet_string);
|
||||||
/* host [0] BACnetHostAddress - closing */
|
/* host [0] BACnetHostAddress - closing */
|
||||||
if (!decode_is_closing_tag_number(&apdu[len++], 0)) {
|
if (!decode_is_closing_tag_number(&apdu[len++], 0)) {
|
||||||
if (error_code) {
|
if (error_code) {
|
||||||
@@ -717,8 +716,7 @@ int bvlc_broadcast_distribution_table_decode(uint8_t *apdu,
|
|||||||
if (len > apdu_len) {
|
if (len > apdu_len) {
|
||||||
return BACNET_STATUS_REJECT;
|
return BACNET_STATUS_REJECT;
|
||||||
}
|
}
|
||||||
len += decode_octet_string(&apdu[len], len_value_type,
|
len += decode_octet_string(&apdu[len], len_value_type, &octet_string);
|
||||||
&octet_string);
|
|
||||||
if (len > apdu_len) {
|
if (len > apdu_len) {
|
||||||
return BACNET_STATUS_REJECT;
|
return BACNET_STATUS_REJECT;
|
||||||
}
|
}
|
||||||
@@ -1148,13 +1146,11 @@ int bvlc_foreign_device_table_encode(uint8_t *apdu,
|
|||||||
while (fdt_entry) {
|
while (fdt_entry) {
|
||||||
if (fdt_entry->valid) {
|
if (fdt_entry->valid) {
|
||||||
/* bacnetip-address [0] OCTET STRING */
|
/* bacnetip-address [0] OCTET STRING */
|
||||||
len = bvlc_encode_address(
|
len = bvlc_encode_address(octetstring_value(&octet_string),
|
||||||
octetstring_value(&octet_string),
|
octetstring_capacity(&octet_string), &fdt_entry->dest_address);
|
||||||
octetstring_capacity(&octet_string),
|
|
||||||
&fdt_entry->dest_address);
|
|
||||||
octetstring_truncate(&octet_string, len);
|
octetstring_truncate(&octet_string, len);
|
||||||
len = encode_context_octet_string(
|
len =
|
||||||
&apdu[apdu_len], 0, &octet_string);
|
encode_context_octet_string(&apdu[apdu_len], 0, &octet_string);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
/* time-to-live [1] Unsigned16 */
|
/* time-to-live [1] Unsigned16 */
|
||||||
len = encode_context_unsigned(
|
len = encode_context_unsigned(
|
||||||
@@ -1179,8 +1175,6 @@ int bvlc_foreign_device_table_encode(uint8_t *apdu,
|
|||||||
return apdu_len;
|
return apdu_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief J.2.7 Read-Foreign-Device-Table: encode
|
* @brief J.2.7 Read-Foreign-Device-Table: encode
|
||||||
*
|
*
|
||||||
@@ -2629,17 +2623,16 @@ const char *bvlc_result_code_name(uint16_t result_code)
|
|||||||
* @param ip_address - IP address and port number
|
* @param ip_address - IP address and port number
|
||||||
* @return length of the APDU buffer
|
* @return length of the APDU buffer
|
||||||
*/
|
*/
|
||||||
int bvlc_foreign_device_bbmd_host_address_encode(uint8_t *apdu,
|
int bvlc_foreign_device_bbmd_host_address_encode(
|
||||||
uint16_t apdu_size,
|
uint8_t *apdu, uint16_t apdu_size, BACNET_IP_ADDRESS *ip_address)
|
||||||
BACNET_IP_ADDRESS *ip_address)
|
|
||||||
{
|
{
|
||||||
BACNET_HOST_N_PORT address = { 0 };
|
BACNET_HOST_N_PORT address = { 0 };
|
||||||
int apdu_len = 0;
|
int apdu_len = 0;
|
||||||
|
|
||||||
address.host_ip_address = true;
|
address.host_ip_address = true;
|
||||||
address.host_name = false;
|
address.host_name = false;
|
||||||
octetstring_init(&address.host.ip_address, &ip_address->address[0],
|
octetstring_init(
|
||||||
IP_ADDRESS_MAX);
|
&address.host.ip_address, &ip_address->address[0], IP_ADDRESS_MAX);
|
||||||
address.port = ip_address->port;
|
address.port = ip_address->port;
|
||||||
apdu_len = host_n_port_encode(NULL, &address);
|
apdu_len = host_n_port_encode(NULL, &address);
|
||||||
if (apdu_len <= apdu_size) {
|
if (apdu_len <= apdu_size) {
|
||||||
@@ -2668,10 +2661,8 @@ int bvlc_foreign_device_bbmd_host_address_decode(uint8_t *apdu,
|
|||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
if (address.host_ip_address) {
|
if (address.host_ip_address) {
|
||||||
ip_address->port = address.port;
|
ip_address->port = address.port;
|
||||||
(void)octetstring_copy_value(
|
(void)octetstring_copy_value(&ip_address->address[0],
|
||||||
&ip_address->address[0],
|
IP_ADDRESS_MAX, &address.host.ip_address);
|
||||||
IP_ADDRESS_MAX,
|
|
||||||
&address.host.ip_address);
|
|
||||||
} else {
|
} else {
|
||||||
len = BACNET_STATUS_REJECT;
|
len = BACNET_STATUS_REJECT;
|
||||||
if (error_code) {
|
if (error_code) {
|
||||||
|
|||||||
@@ -670,8 +670,7 @@ bool bvlc6_address_get(BACNET_IP6_ADDRESS *addr,
|
|||||||
* input, excluding the trailing null.
|
* input, excluding the trailing null.
|
||||||
* @note buf and buf_size may be null and zero to return only the size
|
* @note buf and buf_size may be null and zero to return only the size
|
||||||
*/
|
*/
|
||||||
int bvlc6_address_to_ascii(BACNET_IP6_ADDRESS *addr, char *buf,
|
int bvlc6_address_to_ascii(BACNET_IP6_ADDRESS *addr, char *buf, size_t buf_size)
|
||||||
size_t buf_size)
|
|
||||||
{
|
{
|
||||||
uint16_t a;
|
uint16_t a;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|||||||
@@ -86,8 +86,7 @@ uint32_t cobs_crc32k(uint8_t dataValue, uint32_t crc32kValue)
|
|||||||
* @return the length of the encoded data, or 0 if error
|
* @return the length of the encoded data, or 0 if error
|
||||||
* @note This function is copied mostly from the BACnet standard.
|
* @note This function is copied mostly from the BACnet standard.
|
||||||
*/
|
*/
|
||||||
size_t cobs_encode(
|
size_t cobs_encode(uint8_t *buffer,
|
||||||
uint8_t *buffer,
|
|
||||||
size_t buffer_size,
|
size_t buffer_size,
|
||||||
const uint8_t *from,
|
const uint8_t *from,
|
||||||
size_t length,
|
size_t length,
|
||||||
@@ -163,10 +162,7 @@ size_t cobs_encode(
|
|||||||
* @note This function is copied mostly from the BACnet standard.
|
* @note This function is copied mostly from the BACnet standard.
|
||||||
*/
|
*/
|
||||||
size_t cobs_frame_encode(
|
size_t cobs_frame_encode(
|
||||||
uint8_t *buffer,
|
uint8_t *buffer, size_t buffer_size, const uint8_t *from, size_t length)
|
||||||
size_t buffer_size,
|
|
||||||
const uint8_t *from,
|
|
||||||
size_t length)
|
|
||||||
{
|
{
|
||||||
size_t cobs_data_len, cobs_crc_len;
|
size_t cobs_data_len, cobs_crc_len;
|
||||||
uint32_t crc32K;
|
uint32_t crc32K;
|
||||||
@@ -176,8 +172,8 @@ size_t cobs_frame_encode(
|
|||||||
/*
|
/*
|
||||||
* Prepare the Encoded Data field for transmission.
|
* Prepare the Encoded Data field for transmission.
|
||||||
*/
|
*/
|
||||||
cobs_data_len = cobs_encode(buffer, buffer_size, from, length,
|
cobs_data_len =
|
||||||
MSTP_PREAMBLE_X55);
|
cobs_encode(buffer, buffer_size, from, length, MSTP_PREAMBLE_X55);
|
||||||
if (cobs_data_len == 0) {
|
if (cobs_data_len == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -218,8 +214,7 @@ size_t cobs_frame_encode(
|
|||||||
* @return the length of the decoded buffer, or 0 if error
|
* @return the length of the decoded buffer, or 0 if error
|
||||||
* @note This function is copied directly from the BACnet standard.
|
* @note This function is copied directly from the BACnet standard.
|
||||||
*/
|
*/
|
||||||
size_t cobs_decode(
|
size_t cobs_decode(uint8_t *buffer,
|
||||||
uint8_t *buffer,
|
|
||||||
size_t buffer_size,
|
size_t buffer_size,
|
||||||
const uint8_t *from,
|
const uint8_t *from,
|
||||||
size_t length,
|
size_t length,
|
||||||
@@ -282,10 +277,7 @@ size_t cobs_decode(
|
|||||||
* @note This function is copied directly from the BACnet standard.
|
* @note This function is copied directly from the BACnet standard.
|
||||||
*/
|
*/
|
||||||
size_t cobs_frame_decode(
|
size_t cobs_frame_decode(
|
||||||
uint8_t *buffer,
|
uint8_t *buffer, size_t buffer_size, const uint8_t *from, size_t length)
|
||||||
size_t buffer_size,
|
|
||||||
const uint8_t *from,
|
|
||||||
size_t length)
|
|
||||||
{
|
{
|
||||||
size_t data_len, crc_len;
|
size_t data_len, crc_len;
|
||||||
uint32_t crc32K;
|
uint32_t crc32K;
|
||||||
@@ -306,8 +298,8 @@ size_t cobs_frame_decode(
|
|||||||
/* See Clause G.3.1 */
|
/* See Clause G.3.1 */
|
||||||
crc32K = cobs_crc32k(from[i], crc32K);
|
crc32K = cobs_crc32k(from[i], crc32K);
|
||||||
}
|
}
|
||||||
data_len = cobs_decode(buffer, buffer_size, from, data_len,
|
data_len =
|
||||||
MSTP_PREAMBLE_X55);
|
cobs_decode(buffer, buffer_size, from, data_len, MSTP_PREAMBLE_X55);
|
||||||
if (data_len == 0) {
|
if (data_len == 0) {
|
||||||
/* error during decode */
|
/* error during decode */
|
||||||
return 0;
|
return 0;
|
||||||
@@ -315,8 +307,7 @@ size_t cobs_frame_decode(
|
|||||||
/*
|
/*
|
||||||
* Decode the Encoded CRC-32K field
|
* Decode the Encoded CRC-32K field
|
||||||
*/
|
*/
|
||||||
crc_len = cobs_decode(crc_buffer,
|
crc_len = cobs_decode(crc_buffer, sizeof(crc_buffer),
|
||||||
sizeof(crc_buffer),
|
|
||||||
(uint8_t *)(from + length - COBS_ENCODED_CRC_SIZE),
|
(uint8_t *)(from + length - COBS_ENCODED_CRC_SIZE),
|
||||||
COBS_ENCODED_CRC_SIZE, MSTP_PREAMBLE_X55);
|
COBS_ENCODED_CRC_SIZE, MSTP_PREAMBLE_X55);
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -114,24 +114,19 @@ int datalink_send_pdu(BACNET_ADDRESS *dest,
|
|||||||
bytes = pdu_len;
|
bytes = pdu_len;
|
||||||
break;
|
break;
|
||||||
case DATALINK_ARCNET:
|
case DATALINK_ARCNET:
|
||||||
bytes = arcnet_send_pdu(
|
bytes = arcnet_send_pdu(dest, npdu_data, pdu, pdu_len);
|
||||||
dest, npdu_data, pdu, pdu_len);
|
|
||||||
break;
|
break;
|
||||||
case DATALINK_ETHERNET:
|
case DATALINK_ETHERNET:
|
||||||
bytes = ethernet_send_pdu(
|
bytes = ethernet_send_pdu(dest, npdu_data, pdu, pdu_len);
|
||||||
dest, npdu_data, pdu, pdu_len);
|
|
||||||
break;
|
break;
|
||||||
case DATALINK_BIP:
|
case DATALINK_BIP:
|
||||||
bytes = bip_send_pdu(
|
bytes = bip_send_pdu(dest, npdu_data, pdu, pdu_len);
|
||||||
dest, npdu_data, pdu, pdu_len);
|
|
||||||
break;
|
break;
|
||||||
case DATALINK_BIP6:
|
case DATALINK_BIP6:
|
||||||
bytes = bip6_send_pdu(
|
bytes = bip6_send_pdu(dest, npdu_data, pdu, pdu_len);
|
||||||
dest, npdu_data, pdu, pdu_len);
|
|
||||||
break;
|
break;
|
||||||
case DATALINK_MSTP:
|
case DATALINK_MSTP:
|
||||||
bytes = dlmstp_send_pdu(
|
bytes = dlmstp_send_pdu(dest, npdu_data, pdu, pdu_len);
|
||||||
dest, npdu_data, pdu, pdu_len);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -149,24 +144,19 @@ uint16_t datalink_receive(
|
|||||||
case DATALINK_NONE:
|
case DATALINK_NONE:
|
||||||
break;
|
break;
|
||||||
case DATALINK_ARCNET:
|
case DATALINK_ARCNET:
|
||||||
bytes = arcnet_receive(
|
bytes = arcnet_receive(src, pdu, max_pdu, timeout);
|
||||||
src, pdu, max_pdu, timeout);
|
|
||||||
break;
|
break;
|
||||||
case DATALINK_ETHERNET:
|
case DATALINK_ETHERNET:
|
||||||
bytes = ethernet_receive(
|
bytes = ethernet_receive(src, pdu, max_pdu, timeout);
|
||||||
src, pdu, max_pdu, timeout);
|
|
||||||
break;
|
break;
|
||||||
case DATALINK_BIP:
|
case DATALINK_BIP:
|
||||||
bytes = bip_receive(
|
bytes = bip_receive(src, pdu, max_pdu, timeout);
|
||||||
src, pdu, max_pdu, timeout);
|
|
||||||
break;
|
break;
|
||||||
case DATALINK_BIP6:
|
case DATALINK_BIP6:
|
||||||
bytes = bip6_receive(
|
bytes = bip6_receive(src, pdu, max_pdu, timeout);
|
||||||
src, pdu, max_pdu, timeout);
|
|
||||||
break;
|
break;
|
||||||
case DATALINK_MSTP:
|
case DATALINK_MSTP:
|
||||||
bytes = dlmstp_receive(
|
bytes = dlmstp_receive(src, pdu, max_pdu, timeout);
|
||||||
src, pdu, max_pdu, timeout);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -287,8 +287,8 @@ void dlenv_network_port_init(void)
|
|||||||
Network_Port_BBMD_FD_Table_Set(instance, bvlc_fdt_list());
|
Network_Port_BBMD_FD_Table_Set(instance, bvlc_fdt_list());
|
||||||
/* foreign device registration */
|
/* foreign device registration */
|
||||||
bvlc_address_get(&BBMD_Address, &addr0, &addr1, &addr2, &addr3);
|
bvlc_address_get(&BBMD_Address, &addr0, &addr1, &addr2, &addr3);
|
||||||
Network_Port_Remote_BBMD_IP_Address_Set(instance,
|
Network_Port_Remote_BBMD_IP_Address_Set(
|
||||||
addr0, addr1, addr2, addr3);
|
instance, addr0, addr1, addr2, addr3);
|
||||||
Network_Port_Remote_BBMD_BIP_Port_Set(instance, BBMD_Address.port);
|
Network_Port_Remote_BBMD_BIP_Port_Set(instance, BBMD_Address.port);
|
||||||
Network_Port_Remote_BBMD_BIP_Lifetime_Set(instance, BBMD_TTL_Seconds);
|
Network_Port_Remote_BBMD_BIP_Lifetime_Set(instance, BBMD_TTL_Seconds);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -704,8 +704,8 @@ bacnet_time_t datetime_seconds_since_epoch(BACNET_DATE_TIME *bdatetime)
|
|||||||
* @param bdatetime [out] the starting date and time
|
* @param bdatetime [out] the starting date and time
|
||||||
* @param seconds since epoch
|
* @param seconds since epoch
|
||||||
*/
|
*/
|
||||||
void datetime_since_epoch_seconds(BACNET_DATE_TIME *bdatetime,
|
void datetime_since_epoch_seconds(
|
||||||
bacnet_time_t seconds)
|
BACNET_DATE_TIME *bdatetime, bacnet_time_t seconds)
|
||||||
{
|
{
|
||||||
uint32_t seconds_after_midnight = 0;
|
uint32_t seconds_after_midnight = 0;
|
||||||
uint32_t days = 0;
|
uint32_t days = 0;
|
||||||
|
|||||||
+1
-2
@@ -284,8 +284,7 @@ int dcc_decode_service_request(uint8_t *apdu,
|
|||||||
apdu_len_max - apdu_len, len_value_type, password);
|
apdu_len_max - apdu_len, len_value_type, password);
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
password_length = len_value_type - 1;
|
password_length = len_value_type - 1;
|
||||||
if ((password_length >= 1) &&
|
if ((password_length >= 1) && (password_length <= 20)) {
|
||||||
(password_length <= 20)) {
|
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
} else {
|
} else {
|
||||||
return BACNET_STATUS_REJECT;
|
return BACNET_STATUS_REJECT;
|
||||||
|
|||||||
+95
-97
@@ -263,20 +263,18 @@ int event_notify_encode_service_request(
|
|||||||
|
|
||||||
switch (data->notificationParams.commandFailure.tag) {
|
switch (data->notificationParams.commandFailure.tag) {
|
||||||
case COMMAND_FAILURE_BINARY_PV:
|
case COMMAND_FAILURE_BINARY_PV:
|
||||||
len =
|
len = encode_application_enumerated(
|
||||||
encode_application_enumerated(&apdu
|
&apdu[apdu_len],
|
||||||
[apdu_len],
|
data->notificationParams.commandFailure
|
||||||
data->notificationParams.commandFailure.
|
.commandValue.binaryValue);
|
||||||
commandValue.binaryValue);
|
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COMMAND_FAILURE_UNSIGNED:
|
case COMMAND_FAILURE_UNSIGNED:
|
||||||
len =
|
len =
|
||||||
encode_application_unsigned(&apdu
|
encode_application_unsigned(&apdu[apdu_len],
|
||||||
[apdu_len],
|
data->notificationParams.commandFailure
|
||||||
data->notificationParams.commandFailure.
|
.commandValue.unsignedValue);
|
||||||
commandValue.unsignedValue);
|
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -287,10 +285,9 @@ int event_notify_encode_service_request(
|
|||||||
len = encode_closing_tag(&apdu[apdu_len], 0);
|
len = encode_closing_tag(&apdu[apdu_len], 0);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
|
|
||||||
len =
|
len = encode_context_bitstring(&apdu[apdu_len], 1,
|
||||||
encode_context_bitstring(&apdu[apdu_len], 1,
|
&data->notificationParams.commandFailure
|
||||||
&data->notificationParams.commandFailure.
|
.statusFlags);
|
||||||
statusFlags);
|
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
|
|
||||||
len = encode_opening_tag(&apdu[apdu_len], 2);
|
len = encode_opening_tag(&apdu[apdu_len], 2);
|
||||||
@@ -298,20 +295,18 @@ int event_notify_encode_service_request(
|
|||||||
|
|
||||||
switch (data->notificationParams.commandFailure.tag) {
|
switch (data->notificationParams.commandFailure.tag) {
|
||||||
case COMMAND_FAILURE_BINARY_PV:
|
case COMMAND_FAILURE_BINARY_PV:
|
||||||
len =
|
len = encode_application_enumerated(
|
||||||
encode_application_enumerated(&apdu
|
&apdu[apdu_len],
|
||||||
[apdu_len],
|
data->notificationParams.commandFailure
|
||||||
data->notificationParams.commandFailure.
|
.feedbackValue.binaryValue);
|
||||||
feedbackValue.binaryValue);
|
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COMMAND_FAILURE_UNSIGNED:
|
case COMMAND_FAILURE_UNSIGNED:
|
||||||
len =
|
len =
|
||||||
encode_application_unsigned(&apdu
|
encode_application_unsigned(&apdu[apdu_len],
|
||||||
[apdu_len],
|
data->notificationParams.commandFailure
|
||||||
data->notificationParams.commandFailure.
|
.feedbackValue.unsignedValue);
|
||||||
feedbackValue.unsignedValue);
|
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -454,43 +449,38 @@ int event_notify_encode_service_request(
|
|||||||
len = encode_opening_tag(&apdu[apdu_len], 13);
|
len = encode_opening_tag(&apdu[apdu_len], 13);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
|
|
||||||
len =
|
len = encode_context_enumerated(&apdu[apdu_len], 0,
|
||||||
encode_context_enumerated(&apdu[apdu_len], 0,
|
|
||||||
data->notificationParams.accessEvent.accessEvent);
|
data->notificationParams.accessEvent.accessEvent);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
|
|
||||||
len =
|
len = encode_context_bitstring(&apdu[apdu_len], 1,
|
||||||
encode_context_bitstring(&apdu[apdu_len], 1,
|
|
||||||
&data->notificationParams.accessEvent.statusFlags);
|
&data->notificationParams.accessEvent.statusFlags);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
|
|
||||||
len =
|
len = encode_context_unsigned(&apdu[apdu_len], 2,
|
||||||
encode_context_unsigned(&apdu[apdu_len], 2,
|
data->notificationParams.accessEvent
|
||||||
data->notificationParams.
|
.accessEventTag);
|
||||||
accessEvent.accessEventTag);
|
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
|
|
||||||
len =
|
len =
|
||||||
bacapp_encode_context_timestamp(&apdu[apdu_len], 3,
|
bacapp_encode_context_timestamp(&apdu[apdu_len], 3,
|
||||||
&data->notificationParams.
|
&data->notificationParams.accessEvent
|
||||||
accessEvent.accessEventTime);
|
.accessEventTime);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
|
|
||||||
len =
|
len = bacapp_encode_context_device_obj_ref(
|
||||||
bacapp_encode_context_device_obj_ref(&apdu
|
&apdu[apdu_len], 4,
|
||||||
[apdu_len], 4,
|
&data->notificationParams.accessEvent
|
||||||
&data->notificationParams.
|
.accessCredential);
|
||||||
accessEvent.accessCredential);
|
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
|
|
||||||
if (data->notificationParams.
|
if (data->notificationParams.accessEvent
|
||||||
accessEvent.authenticationFactor.format_type <
|
.authenticationFactor.format_type <
|
||||||
AUTHENTICATION_FACTOR_MAX) {
|
AUTHENTICATION_FACTOR_MAX) {
|
||||||
len =
|
len = bacapp_encode_context_authentication_factor(
|
||||||
bacapp_encode_context_authentication_factor
|
&apdu[apdu_len], 5,
|
||||||
(&apdu[apdu_len], 5,
|
&data->notificationParams.accessEvent
|
||||||
&data->notificationParams.
|
.authenticationFactor);
|
||||||
accessEvent.authenticationFactor);
|
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -774,31 +764,31 @@ int event_notify_decode_service_request(
|
|||||||
}
|
}
|
||||||
len++;
|
len++;
|
||||||
|
|
||||||
if (-1 == (section_length =
|
if (-1 ==
|
||||||
decode_tag_number_and_value(&apdu[len],
|
(section_length = decode_tag_number_and_value(
|
||||||
&tag_number, &len_value))) {
|
&apdu[len], &tag_number, &len_value))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
len += section_length;
|
len += section_length;
|
||||||
|
|
||||||
switch (tag_number) {
|
switch (tag_number) {
|
||||||
case BACNET_APPLICATION_TAG_ENUMERATED:
|
case BACNET_APPLICATION_TAG_ENUMERATED:
|
||||||
if (-1 == (section_length =
|
if (-1 ==
|
||||||
decode_enumerated(&apdu[len],
|
(section_length = decode_enumerated(
|
||||||
len_value,
|
&apdu[len], len_value, &enum_value))) {
|
||||||
&enum_value))) {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
data->notificationParams.commandFailure.
|
data->notificationParams.commandFailure
|
||||||
commandValue.binaryValue = enum_value;
|
.commandValue.binaryValue = enum_value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BACNET_APPLICATION_TAG_UNSIGNED_INT:
|
case BACNET_APPLICATION_TAG_UNSIGNED_INT:
|
||||||
if (-1 == (section_length =
|
if (-1 ==
|
||||||
decode_unsigned(&apdu[len], len_value,
|
(section_length = decode_unsigned(
|
||||||
&data->
|
&apdu[len], len_value,
|
||||||
notificationParams.commandFailure.
|
&data->notificationParams
|
||||||
commandValue.unsignedValue))) {
|
.commandFailure.commandValue
|
||||||
|
.unsignedValue))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -813,10 +803,11 @@ int event_notify_decode_service_request(
|
|||||||
}
|
}
|
||||||
len++;
|
len++;
|
||||||
|
|
||||||
if (-1 == (section_length =
|
if (-1 ==
|
||||||
|
(section_length =
|
||||||
decode_context_bitstring(&apdu[len], 1,
|
decode_context_bitstring(&apdu[len], 1,
|
||||||
&data->notificationParams.commandFailure.
|
&data->notificationParams.commandFailure
|
||||||
statusFlags))) {
|
.statusFlags))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
len += section_length;
|
len += section_length;
|
||||||
@@ -826,30 +817,31 @@ int event_notify_decode_service_request(
|
|||||||
}
|
}
|
||||||
len++;
|
len++;
|
||||||
|
|
||||||
if (-1 == (section_length =
|
if (-1 ==
|
||||||
decode_tag_number_and_value(&apdu[len],
|
(section_length = decode_tag_number_and_value(
|
||||||
&tag_number, &len_value))) {
|
&apdu[len], &tag_number, &len_value))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
len += section_length;
|
len += section_length;
|
||||||
|
|
||||||
switch (tag_number) {
|
switch (tag_number) {
|
||||||
case BACNET_APPLICATION_TAG_ENUMERATED:
|
case BACNET_APPLICATION_TAG_ENUMERATED:
|
||||||
if (-1 == (section_length =
|
if (-1 ==
|
||||||
decode_enumerated(&apdu[len], len_value,
|
(section_length = decode_enumerated(
|
||||||
&enum_value))) {
|
&apdu[len], len_value, &enum_value))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
data->notificationParams.commandFailure.
|
data->notificationParams.commandFailure
|
||||||
feedbackValue.binaryValue = enum_value;
|
.feedbackValue.binaryValue = enum_value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BACNET_APPLICATION_TAG_UNSIGNED_INT:
|
case BACNET_APPLICATION_TAG_UNSIGNED_INT:
|
||||||
if (-1 == (section_length =
|
if (-1 ==
|
||||||
decode_unsigned(&apdu[len], len_value,
|
(section_length = decode_unsigned(
|
||||||
&data->
|
&apdu[len], len_value,
|
||||||
notificationParams.commandFailure.
|
&data->notificationParams
|
||||||
feedbackValue.unsignedValue))) {
|
.commandFailure.feedbackValue
|
||||||
|
.unsignedValue))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1057,53 +1049,59 @@ int event_notify_decode_service_request(
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EVENT_ACCESS_EVENT:
|
case EVENT_ACCESS_EVENT:
|
||||||
if (-1 == (section_length =
|
if (-1 ==
|
||||||
decode_context_enumerated(&apdu[len], 0,
|
(section_length = decode_context_enumerated(
|
||||||
&enum_value))) {
|
&apdu[len], 0, &enum_value))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
data->notificationParams.accessEvent.accessEvent =
|
data->notificationParams.accessEvent.accessEvent =
|
||||||
enum_value;
|
enum_value;
|
||||||
len += section_length;
|
len += section_length;
|
||||||
if (-1 == (section_length =
|
if (-1 ==
|
||||||
|
(section_length =
|
||||||
decode_context_bitstring(&apdu[len], 1,
|
decode_context_bitstring(&apdu[len], 1,
|
||||||
&data->notificationParams.
|
&data->notificationParams.accessEvent
|
||||||
accessEvent.statusFlags))) {
|
.statusFlags))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
len += section_length;
|
len += section_length;
|
||||||
|
|
||||||
if (-1 == (section_length =
|
if (-1 ==
|
||||||
|
(section_length =
|
||||||
decode_context_unsigned(&apdu[len], 2,
|
decode_context_unsigned(&apdu[len], 2,
|
||||||
&data->notificationParams.
|
&data->notificationParams.accessEvent
|
||||||
accessEvent.accessEventTag))) {
|
.accessEventTag))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
len += section_length;
|
len += section_length;
|
||||||
|
|
||||||
if (-1 == (section_length =
|
if (-1 ==
|
||||||
bacapp_decode_context_timestamp(&apdu[len], 3,
|
(section_length = bacapp_decode_context_timestamp(
|
||||||
&data->notificationParams.
|
&apdu[len], 3,
|
||||||
accessEvent.accessEventTime))) {
|
&data->notificationParams.accessEvent
|
||||||
|
.accessEventTime))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
len += section_length;
|
len += section_length;
|
||||||
|
|
||||||
if (-1 == (section_length =
|
if (-1 ==
|
||||||
bacapp_decode_context_device_obj_ref(&apdu
|
(section_length =
|
||||||
[len], 4,
|
bacapp_decode_context_device_obj_ref(
|
||||||
&data->notificationParams.
|
&apdu[len], 4,
|
||||||
accessEvent.accessCredential))) {
|
&data->notificationParams.accessEvent
|
||||||
|
.accessCredential))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
len += section_length;
|
len += section_length;
|
||||||
|
|
||||||
if (!decode_is_closing_tag(&apdu[len])) {
|
if (!decode_is_closing_tag(&apdu[len])) {
|
||||||
if (-1 == (section_length =
|
if (-1 ==
|
||||||
bacapp_decode_context_authentication_factor
|
(section_length =
|
||||||
(&apdu[len], 5,
|
bacapp_decode_context_authentication_factor(
|
||||||
&data->notificationParams.
|
&apdu[len], 5,
|
||||||
accessEvent.authenticationFactor))) {
|
&data->notificationParams
|
||||||
|
.accessEvent
|
||||||
|
.authenticationFactor))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
len += section_length;
|
len += section_length;
|
||||||
|
|||||||
+24
-39
@@ -38,8 +38,7 @@
|
|||||||
* @param address - IP address and port number
|
* @param address - IP address and port number
|
||||||
* @return length of the encoded APDU buffer
|
* @return length of the encoded APDU buffer
|
||||||
*/
|
*/
|
||||||
int host_n_port_encode(uint8_t *apdu,
|
int host_n_port_encode(uint8_t *apdu, BACNET_HOST_N_PORT *address)
|
||||||
BACNET_HOST_N_PORT *address)
|
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int apdu_len = 0;
|
int apdu_len = 0;
|
||||||
@@ -54,15 +53,16 @@ int host_n_port_encode(uint8_t *apdu,
|
|||||||
if (apdu) {
|
if (apdu) {
|
||||||
apdu_offset = &apdu[apdu_len];
|
apdu_offset = &apdu[apdu_len];
|
||||||
}
|
}
|
||||||
len = encode_context_octet_string(apdu_offset, 1, &address->host.ip_address);
|
len = encode_context_octet_string(
|
||||||
|
apdu_offset, 1, &address->host.ip_address);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
} else if (address->host_name) {
|
} else if (address->host_name) {
|
||||||
/* CHOICE - name [2] CharacterString */
|
/* CHOICE - name [2] CharacterString */
|
||||||
if (apdu) {
|
if (apdu) {
|
||||||
apdu_offset = &apdu[apdu_len];
|
apdu_offset = &apdu[apdu_len];
|
||||||
}
|
}
|
||||||
len = encode_context_character_string(apdu_offset, 1,
|
len = encode_context_character_string(
|
||||||
&address->host.name);
|
apdu_offset, 1, &address->host.name);
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
} else {
|
} else {
|
||||||
/* none */
|
/* none */
|
||||||
@@ -77,8 +77,7 @@ int host_n_port_encode(uint8_t *apdu,
|
|||||||
if (apdu) {
|
if (apdu) {
|
||||||
apdu_offset = &apdu[apdu_len];
|
apdu_offset = &apdu[apdu_len];
|
||||||
}
|
}
|
||||||
len = encode_context_unsigned(
|
len = encode_context_unsigned(apdu_offset, 1, address->port);
|
||||||
apdu_offset, 1, address->port);
|
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,9 +92,7 @@ int host_n_port_encode(uint8_t *apdu,
|
|||||||
* @return length of the APDU buffer, or 0 if not able to encode
|
* @return length of the APDU buffer, or 0 if not able to encode
|
||||||
*/
|
*/
|
||||||
int host_n_port_context_encode(
|
int host_n_port_context_encode(
|
||||||
uint8_t * apdu,
|
uint8_t *apdu, uint8_t tag_number, BACNET_HOST_N_PORT *address)
|
||||||
uint8_t tag_number,
|
|
||||||
BACNET_HOST_N_PORT *address)
|
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int apdu_len = 0;
|
int apdu_len = 0;
|
||||||
@@ -171,8 +168,8 @@ int host_n_port_decode(uint8_t *apdu,
|
|||||||
if (len > apdu_len) {
|
if (len > apdu_len) {
|
||||||
return BACNET_STATUS_REJECT;
|
return BACNET_STATUS_REJECT;
|
||||||
}
|
}
|
||||||
len += decode_tag_number_and_value(
|
len +=
|
||||||
&apdu[len], &tag_number, &len_value_type);
|
decode_tag_number_and_value(&apdu[len], &tag_number, &len_value_type);
|
||||||
if (tag_number == 0) {
|
if (tag_number == 0) {
|
||||||
/* CHOICE - none [0] NULL */
|
/* CHOICE - none [0] NULL */
|
||||||
address->host_ip_address = false;
|
address->host_ip_address = false;
|
||||||
@@ -181,23 +178,20 @@ int host_n_port_decode(uint8_t *apdu,
|
|||||||
/* CHOICE - ip-address [1] OCTET STRING */
|
/* CHOICE - ip-address [1] OCTET STRING */
|
||||||
address->host_ip_address = true;
|
address->host_ip_address = true;
|
||||||
address->host_name = false;
|
address->host_name = false;
|
||||||
len += decode_octet_string(&apdu[len], len_value_type,
|
len += decode_octet_string(&apdu[len], len_value_type, &octet_string);
|
||||||
&octet_string);
|
|
||||||
if (len > apdu_len) {
|
if (len > apdu_len) {
|
||||||
return BACNET_STATUS_REJECT;
|
return BACNET_STATUS_REJECT;
|
||||||
}
|
}
|
||||||
(void)octetstring_copy(&address->host.ip_address,
|
(void)octetstring_copy(&address->host.ip_address, &octet_string);
|
||||||
&octet_string);
|
|
||||||
} else if (tag_number == 2) {
|
} else if (tag_number == 2) {
|
||||||
address->host_ip_address = false;
|
address->host_ip_address = false;
|
||||||
address->host_name = true;
|
address->host_name = true;
|
||||||
len += decode_character_string(&apdu[len], len_value_type,
|
len +=
|
||||||
&char_string);
|
decode_character_string(&apdu[len], len_value_type, &char_string);
|
||||||
if (len > apdu_len) {
|
if (len > apdu_len) {
|
||||||
return BACNET_STATUS_REJECT;
|
return BACNET_STATUS_REJECT;
|
||||||
}
|
}
|
||||||
(void)characterstring_copy(&address->host.name,
|
(void)characterstring_copy(&address->host.name, &char_string);
|
||||||
&char_string);
|
|
||||||
} else {
|
} else {
|
||||||
if (error_code) {
|
if (error_code) {
|
||||||
*error_code = ERROR_CODE_REJECT_INVALID_TAG;
|
*error_code = ERROR_CODE_REJECT_INVALID_TAG;
|
||||||
@@ -215,8 +209,8 @@ int host_n_port_decode(uint8_t *apdu,
|
|||||||
return BACNET_STATUS_REJECT;
|
return BACNET_STATUS_REJECT;
|
||||||
}
|
}
|
||||||
/* port [1] Unsigned16 */
|
/* port [1] Unsigned16 */
|
||||||
len += decode_tag_number_and_value(
|
len +=
|
||||||
&apdu[len], &tag_number, &len_value_type);
|
decode_tag_number_and_value(&apdu[len], &tag_number, &len_value_type);
|
||||||
if (tag_number != 1) {
|
if (tag_number != 1) {
|
||||||
if (error_code) {
|
if (error_code) {
|
||||||
*error_code = ERROR_CODE_REJECT_INVALID_TAG;
|
*error_code = ERROR_CODE_REJECT_INVALID_TAG;
|
||||||
@@ -245,9 +239,7 @@ int host_n_port_decode(uint8_t *apdu,
|
|||||||
* @param src - source structure
|
* @param src - source structure
|
||||||
* @return true if successfully copied
|
* @return true if successfully copied
|
||||||
*/
|
*/
|
||||||
bool host_n_port_copy(
|
bool host_n_port_copy(BACNET_HOST_N_PORT *dst, BACNET_HOST_N_PORT *src)
|
||||||
BACNET_HOST_N_PORT * dst,
|
|
||||||
BACNET_HOST_N_PORT * src)
|
|
||||||
{
|
{
|
||||||
bool status = false;
|
bool status = false;
|
||||||
|
|
||||||
@@ -255,13 +247,10 @@ bool host_n_port_copy(
|
|||||||
dst->host_ip_address = src->host_ip_address;
|
dst->host_ip_address = src->host_ip_address;
|
||||||
dst->host_name = src->host_name;
|
dst->host_name = src->host_name;
|
||||||
if (src->host_ip_address) {
|
if (src->host_ip_address) {
|
||||||
status = octetstring_copy(
|
status =
|
||||||
&dst->host.ip_address,
|
octetstring_copy(&dst->host.ip_address, &src->host.ip_address);
|
||||||
&src->host.ip_address);
|
|
||||||
} else if (src->host_name) {
|
} else if (src->host_name) {
|
||||||
status = characterstring_copy(
|
status = characterstring_copy(&dst->host.name, &src->host.name);
|
||||||
&dst->host.name,
|
|
||||||
&src->host.name);
|
|
||||||
} else {
|
} else {
|
||||||
status = true;
|
status = true;
|
||||||
}
|
}
|
||||||
@@ -277,9 +266,7 @@ bool host_n_port_copy(
|
|||||||
* @param host2 - host 2 structure
|
* @param host2 - host 2 structure
|
||||||
* @return true if successfully copied
|
* @return true if successfully copied
|
||||||
*/
|
*/
|
||||||
bool host_n_port_same(
|
bool host_n_port_same(BACNET_HOST_N_PORT *host1, BACNET_HOST_N_PORT *host2)
|
||||||
BACNET_HOST_N_PORT * host1,
|
|
||||||
BACNET_HOST_N_PORT * host2)
|
|
||||||
{
|
{
|
||||||
bool status = false;
|
bool status = false;
|
||||||
|
|
||||||
@@ -288,12 +275,10 @@ bool host_n_port_same(
|
|||||||
(host1->host_name == host2->host_name)) {
|
(host1->host_name == host2->host_name)) {
|
||||||
if (host1->host_ip_address) {
|
if (host1->host_ip_address) {
|
||||||
status = octetstring_value_same(
|
status = octetstring_value_same(
|
||||||
&host1->host.ip_address,
|
&host1->host.ip_address, &host2->host.ip_address);
|
||||||
&host2->host.ip_address);
|
|
||||||
} else if (host1->host_name) {
|
} else if (host1->host_name) {
|
||||||
status = characterstring_same(
|
status =
|
||||||
&host1->host.name,
|
characterstring_same(&host1->host.name, &host2->host.name);
|
||||||
&host2->host.name);
|
|
||||||
} else {
|
} else {
|
||||||
status = true;
|
status = true;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -537,9 +537,7 @@ int bacnet_npdu_decode(uint8_t *npdu,
|
|||||||
* @param pdu_len [in] The size of the received message in the pdu[] buffer.
|
* @param pdu_len [in] The size of the received message in the pdu[] buffer.
|
||||||
* @return true if the PDU is a confirmed APDU
|
* @return true if the PDU is a confirmed APDU
|
||||||
*/
|
*/
|
||||||
bool npdu_confirmed_service(
|
bool npdu_confirmed_service(uint8_t *pdu, uint16_t pdu_len)
|
||||||
uint8_t *pdu,
|
|
||||||
uint16_t pdu_len)
|
|
||||||
{
|
{
|
||||||
bool status = false;
|
bool status = false;
|
||||||
int apdu_offset = 0;
|
int apdu_offset = 0;
|
||||||
|
|||||||
@@ -398,16 +398,15 @@ static const int CharacterString_Value_Properties_Optional[] = {
|
|||||||
PROP_PROFILE_LOCATION, PROP_PROFILE_NAME, -1
|
PROP_PROFILE_LOCATION, PROP_PROFILE_NAME, -1
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int Color_Properties_Required[] = {
|
static const int Color_Properties_Required[] = { PROP_OBJECT_IDENTIFIER,
|
||||||
PROP_OBJECT_IDENTIFIER, PROP_OBJECT_NAME, PROP_OBJECT_TYPE,
|
PROP_OBJECT_NAME, PROP_OBJECT_TYPE, PROP_PRESENT_VALUE, PROP_TRACKING_VALUE,
|
||||||
PROP_PRESENT_VALUE, PROP_TRACKING_VALUE, PROP_COLOR_COMMAND,
|
PROP_COLOR_COMMAND, PROP_IN_PROGRESS, PROP_DEFAULT_COLOR,
|
||||||
PROP_IN_PROGRESS, PROP_DEFAULT_COLOR, PROP_DEFAULT_FADE_TIME, -1
|
PROP_DEFAULT_FADE_TIME, -1 };
|
||||||
};
|
|
||||||
|
|
||||||
static const int Color_Properties_Optional[] = { PROP_RELIABILITY,
|
static const int Color_Properties_Optional[] = { PROP_RELIABILITY,
|
||||||
PROP_DESCRIPTION, PROP_TRANSITION, PROP_VALUE_SOURCE,
|
PROP_DESCRIPTION, PROP_TRANSITION, PROP_VALUE_SOURCE, PROP_AUDIT_LEVEL,
|
||||||
PROP_AUDIT_LEVEL, PROP_AUDITABLE_OPERATIONS, PROP_TAGS,
|
PROP_AUDITABLE_OPERATIONS, PROP_TAGS, PROP_PROFILE_LOCATION,
|
||||||
PROP_PROFILE_LOCATION, PROP_PROFILE_NAME, -1 };
|
PROP_PROFILE_NAME, -1 };
|
||||||
|
|
||||||
static const int Credential_Data_Input_Properties_Required[] = {
|
static const int Credential_Data_Input_Properties_Required[] = {
|
||||||
PROP_OBJECT_IDENTIFIER, PROP_OBJECT_NAME, PROP_OBJECT_TYPE,
|
PROP_OBJECT_IDENTIFIER, PROP_OBJECT_NAME, PROP_OBJECT_TYPE,
|
||||||
|
|||||||
@@ -263,8 +263,8 @@ int property_list_encode(BACNET_READ_PROPERTY_DATA *rpdata,
|
|||||||
* @return number of APDU bytes in the response, or
|
* @return number of APDU bytes in the response, or
|
||||||
* BACNET_STATUS_ERROR on error.
|
* BACNET_STATUS_ERROR on error.
|
||||||
*/
|
*/
|
||||||
int property_list_common_encode(BACNET_READ_PROPERTY_DATA *rpdata,
|
int property_list_common_encode(
|
||||||
uint32_t device_instance_number)
|
BACNET_READ_PROPERTY_DATA *rpdata, uint32_t device_instance_number)
|
||||||
{
|
{
|
||||||
int apdu_len = BACNET_STATUS_ERROR;
|
int apdu_len = BACNET_STATUS_ERROR;
|
||||||
uint8_t *apdu = NULL;
|
uint8_t *apdu = NULL;
|
||||||
|
|||||||
@@ -284,8 +284,7 @@ bool bacapp_timestamp_init_ascii(BACNET_TIMESTAMP *timestamp, const char *ascii)
|
|||||||
int sequence;
|
int sequence;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
count = sscanf(
|
count = sscanf(ascii, "%3d:%3d:%3d.%3d", &hour, &min, &sec, &hundredths);
|
||||||
ascii, "%3d:%3d:%3d.%3d", &hour, &min, &sec, &hundredths);
|
|
||||||
if (count == 4) {
|
if (count == 4) {
|
||||||
timestamp->tag = TIME_STAMP_TIME;
|
timestamp->tag = TIME_STAMP_TIME;
|
||||||
timestamp->value.time.hour = (uint8_t)hour;
|
timestamp->value.time.hour = (uint8_t)hour;
|
||||||
@@ -309,13 +308,12 @@ bool bacapp_timestamp_init_ascii(BACNET_TIMESTAMP *timestamp, const char *ascii)
|
|||||||
status = true;
|
status = true;
|
||||||
}
|
}
|
||||||
if (!status) {
|
if (!status) {
|
||||||
count =
|
count = sscanf(ascii, "%4d/%3d/%3d-%3d:%3d:%3d.%3d", &year, &month,
|
||||||
sscanf(ascii, "%4d/%3d/%3d-%3d:%3d:%3d.%3d",
|
&day, &hour, &min, &sec, &hundredths);
|
||||||
&year, &month, &day, &hour, &min, &sec, &hundredths);
|
|
||||||
if (count >= 3) {
|
if (count >= 3) {
|
||||||
timestamp->tag = TIME_STAMP_DATETIME;
|
timestamp->tag = TIME_STAMP_DATETIME;
|
||||||
datetime_set_date(×tamp->value.dateTime.date,
|
datetime_set_date(×tamp->value.dateTime.date, (uint16_t)year,
|
||||||
(uint16_t)year, (uint8_t)month, (uint8_t)day);
|
(uint8_t)month, (uint8_t)day);
|
||||||
if (count >= 7) {
|
if (count >= 7) {
|
||||||
datetime_set_time(×tamp->value.dateTime.time,
|
datetime_set_time(×tamp->value.dateTime.time,
|
||||||
(uint8_t)hour, (uint8_t)min, (uint8_t)sec,
|
(uint8_t)hour, (uint8_t)min, (uint8_t)sec,
|
||||||
@@ -327,8 +325,8 @@ bool bacapp_timestamp_init_ascii(BACNET_TIMESTAMP *timestamp, const char *ascii)
|
|||||||
datetime_set_time(×tamp->value.dateTime.time,
|
datetime_set_time(×tamp->value.dateTime.time,
|
||||||
(uint8_t)hour, (uint8_t)min, 0, 0);
|
(uint8_t)hour, (uint8_t)min, 0, 0);
|
||||||
} else if (count >= 4) {
|
} else if (count >= 4) {
|
||||||
datetime_set_time(×tamp->value.dateTime.time,
|
datetime_set_time(
|
||||||
(uint8_t)hour, 0, 0, 0);
|
×tamp->value.dateTime.time, (uint8_t)hour, 0, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
datetime_set_time(×tamp->value.dateTime.time, 0, 0, 0, 0);
|
datetime_set_time(×tamp->value.dateTime.time, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-20
@@ -38,9 +38,7 @@ License.
|
|||||||
#include "bacapp.h"
|
#include "bacapp.h"
|
||||||
|
|
||||||
int bacnet_weeklyschedule_decode(
|
int bacnet_weeklyschedule_decode(
|
||||||
uint8_t * apdu,
|
uint8_t *apdu, int max_apdu_len, BACNET_WEEKLY_SCHEDULE *value)
|
||||||
int max_apdu_len,
|
|
||||||
BACNET_WEEKLY_SCHEDULE *value)
|
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int apdu_len = 0;
|
int apdu_len = 0;
|
||||||
@@ -48,8 +46,8 @@ int bacnet_weeklyschedule_decode(
|
|||||||
|
|
||||||
value->singleDay = false;
|
value->singleDay = false;
|
||||||
for (wi = 0; wi < 7; wi++) {
|
for (wi = 0; wi < 7; wi++) {
|
||||||
len = bacnet_dailyschedule_decode(
|
len = bacnet_dailyschedule_decode(&apdu[apdu_len],
|
||||||
&apdu[apdu_len], max_apdu_len - apdu_len, &value->weeklySchedule[wi]);
|
max_apdu_len - apdu_len, &value->weeklySchedule[wi]);
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
if (wi == 1) {
|
if (wi == 1) {
|
||||||
value->singleDay = true;
|
value->singleDay = true;
|
||||||
@@ -62,9 +60,7 @@ int bacnet_weeklyschedule_decode(
|
|||||||
return apdu_len;
|
return apdu_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bacnet_weeklyschedule_encode(
|
int bacnet_weeklyschedule_encode(uint8_t *apdu, BACNET_WEEKLY_SCHEDULE *value)
|
||||||
uint8_t * apdu,
|
|
||||||
BACNET_WEEKLY_SCHEDULE *value)
|
|
||||||
{
|
{
|
||||||
int apdu_len = 0;
|
int apdu_len = 0;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
@@ -76,8 +72,8 @@ int bacnet_weeklyschedule_encode(
|
|||||||
if (apdu) {
|
if (apdu) {
|
||||||
apdu_offset = &apdu[apdu_len];
|
apdu_offset = &apdu[apdu_len];
|
||||||
}
|
}
|
||||||
len =
|
len = bacnet_dailyschedule_encode(
|
||||||
bacnet_dailyschedule_encode(apdu_offset, &value->weeklySchedule[wi]);
|
apdu_offset, &value->weeklySchedule[wi]);
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
return -1;
|
return -1;
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
@@ -85,8 +81,6 @@ int bacnet_weeklyschedule_encode(
|
|||||||
return apdu_len;
|
return apdu_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Encode a context tagged WeeklySchedule complex data type
|
* @brief Encode a context tagged WeeklySchedule complex data type
|
||||||
* @param apdu - the APDU buffer
|
* @param apdu - the APDU buffer
|
||||||
@@ -120,26 +114,31 @@ int bacnet_weeklyschedule_context_encode(
|
|||||||
return apdu_len;
|
return apdu_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bacnet_weeklyschedule_context_decode(
|
int bacnet_weeklyschedule_context_decode(uint8_t *apdu,
|
||||||
uint8_t *apdu, int max_apdu_len, uint8_t tag_number,
|
int max_apdu_len,
|
||||||
|
uint8_t tag_number,
|
||||||
BACNET_WEEKLY_SCHEDULE *value)
|
BACNET_WEEKLY_SCHEDULE *value)
|
||||||
{
|
{
|
||||||
int apdu_len = 0;
|
int apdu_len = 0;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
if ((max_apdu_len - apdu_len) >= 1 && decode_is_opening_tag_number(&apdu[apdu_len], tag_number)) {
|
if ((max_apdu_len - apdu_len) >= 1 &&
|
||||||
|
decode_is_opening_tag_number(&apdu[apdu_len], tag_number)) {
|
||||||
apdu_len += 1;
|
apdu_len += 1;
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-1 == (len = bacnet_weeklyschedule_decode(&apdu[apdu_len], max_apdu_len - apdu_len, value))) {
|
if (-1 ==
|
||||||
|
(len = bacnet_weeklyschedule_decode(
|
||||||
|
&apdu[apdu_len], max_apdu_len - apdu_len, value))) {
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((max_apdu_len - apdu_len) >= 1 && decode_is_closing_tag_number(&apdu[apdu_len], tag_number)) {
|
if ((max_apdu_len - apdu_len) >= 1 &&
|
||||||
|
decode_is_closing_tag_number(&apdu[apdu_len], tag_number)) {
|
||||||
apdu_len += 1;
|
apdu_len += 1;
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
@@ -170,14 +169,14 @@ bool bacnet_weeklyschedule_same(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO the conversion can be avoided by adding a "primitive" variant of bacapp_same_value(),
|
// TODO the conversion can be avoided by adding a "primitive"
|
||||||
|
// variant of bacapp_same_value(),
|
||||||
// at the cost of some code duplication
|
// at the cost of some code duplication
|
||||||
BACNET_APPLICATION_DATA_VALUE adv1, adv2;
|
BACNET_APPLICATION_DATA_VALUE adv1, adv2;
|
||||||
bacnet_primitive_to_application_data_value(&adv1, &tv1->Value);
|
bacnet_primitive_to_application_data_value(&adv1, &tv1->Value);
|
||||||
bacnet_primitive_to_application_data_value(&adv2, &tv2->Value);
|
bacnet_primitive_to_application_data_value(&adv2, &tv2->Value);
|
||||||
|
|
||||||
if (!bacapp_same_value(&adv1, &adv2))
|
if (!bacapp_same_value(&adv1, &adv2)) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-6
@@ -205,8 +205,7 @@ int wp_decode_service_request(
|
|||||||
* @param value - #BACNET_APPLICATION_DATA_VALUE data, for the tag
|
* @param value - #BACNET_APPLICATION_DATA_VALUE data, for the tag
|
||||||
* @param expected_tag - the tag that is expected for this property value
|
* @param expected_tag - the tag that is expected for this property value
|
||||||
*/
|
*/
|
||||||
bool write_property_type_valid(
|
bool write_property_type_valid(BACNET_WRITE_PROPERTY_DATA *wp_data,
|
||||||
BACNET_WRITE_PROPERTY_DATA * wp_data,
|
|
||||||
BACNET_APPLICATION_DATA_VALUE *value,
|
BACNET_APPLICATION_DATA_VALUE *value,
|
||||||
uint8_t expected_tag)
|
uint8_t expected_tag)
|
||||||
{
|
{
|
||||||
@@ -231,8 +230,7 @@ bool write_property_type_valid(
|
|||||||
* @param value - #BACNET_APPLICATION_DATA_VALUE data, for the tag
|
* @param value - #BACNET_APPLICATION_DATA_VALUE data, for the tag
|
||||||
* @param expected_tag - the tag that is expected for this property value
|
* @param expected_tag - the tag that is expected for this property value
|
||||||
*/
|
*/
|
||||||
bool write_property_string_valid(
|
bool write_property_string_valid(BACNET_WRITE_PROPERTY_DATA *wp_data,
|
||||||
BACNET_WRITE_PROPERTY_DATA * wp_data,
|
|
||||||
BACNET_APPLICATION_DATA_VALUE *value,
|
BACNET_APPLICATION_DATA_VALUE *value,
|
||||||
int len_max)
|
int len_max)
|
||||||
{
|
{
|
||||||
@@ -287,8 +285,7 @@ bool write_property_string_valid(
|
|||||||
* @param value - #BACNET_APPLICATION_DATA_VALUE data, for the tag
|
* @param value - #BACNET_APPLICATION_DATA_VALUE data, for the tag
|
||||||
* @param expected_tag - the tag that is expected for this property value
|
* @param expected_tag - the tag that is expected for this property value
|
||||||
*/
|
*/
|
||||||
bool write_property_empty_string_valid(
|
bool write_property_empty_string_valid(BACNET_WRITE_PROPERTY_DATA *wp_data,
|
||||||
BACNET_WRITE_PROPERTY_DATA * wp_data,
|
|
||||||
BACNET_APPLICATION_DATA_VALUE *value,
|
BACNET_APPLICATION_DATA_VALUE *value,
|
||||||
int len_max)
|
int len_max)
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -485,8 +485,8 @@ int wpm_error_ack_decode_apdu(
|
|||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
len = bacerror_decode_error_class_and_code(apdu_offset, apdu_size,
|
len = bacerror_decode_error_class_and_code(
|
||||||
&error_class, &error_code);
|
apdu_offset, apdu_size, &error_class, &error_code);
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
if (wp_data) {
|
if (wp_data) {
|
||||||
wp_data->error_class = error_class;
|
wp_data->error_class = error_class;
|
||||||
|
|||||||
Reference in New Issue
Block a user