Corrected bug in all confirmed handlers: if a segmented message was received, the handler tried to decode it instead of immediately sending an abort. This caused lockup with WriteProperty.
This commit is contained in:
@@ -61,135 +61,134 @@ void handler_read_property(uint8_t * service_request,
|
|||||||
BACNET_ERROR_CODE error_code = ERROR_CODE_UNKNOWN_OBJECT;
|
BACNET_ERROR_CODE error_code = ERROR_CODE_UNKNOWN_OBJECT;
|
||||||
BACNET_ADDRESS my_address;
|
BACNET_ADDRESS my_address;
|
||||||
|
|
||||||
len = rp_decode_service_request(service_request, service_len, &data);
|
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len = npdu_encode_pdu(&Handler_Transmit_Buffer[0], src,
|
pdu_len = npdu_encode_pdu(&Handler_Transmit_Buffer[0], src,
|
||||||
&my_address, &npdu_data);
|
&my_address, &npdu_data);
|
||||||
if (len < 0) {
|
if (service_data->segmented_message) {
|
||||||
/* bad decoding - send an abort */
|
|
||||||
len = abort_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
|
||||||
service_data->invoke_id, ABORT_REASON_OTHER, true);
|
|
||||||
} else if (service_data->segmented_message) {
|
|
||||||
/* we don't support segmentation - send an abort */
|
/* we don't support segmentation - send an 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);
|
||||||
} else {
|
goto RP_ABORT;
|
||||||
/* most cases will be error */
|
}
|
||||||
error = true;
|
len = rp_decode_service_request(service_request, service_len, &data);
|
||||||
switch (data.object_type) {
|
if (len < 0) {
|
||||||
case OBJECT_DEVICE:
|
/* bad decoding - send an abort */
|
||||||
/* FIXME: probably need a length limitation sent with encode */
|
len = abort_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||||
if (data.object_instance == Device_Object_Instance_Number()) {
|
service_data->invoke_id, ABORT_REASON_OTHER, true);
|
||||||
len = Device_Encode_Property_APDU(&Temp_Buf[0],
|
goto RP_ABORT;
|
||||||
data.object_property,
|
}
|
||||||
data.array_index, &error_class, &error_code);
|
/* most cases will be error */
|
||||||
if (len >= 0) {
|
error = true;
|
||||||
/* encode the APDU portion of the packet */
|
switch (data.object_type) {
|
||||||
data.application_data = &Temp_Buf[0];
|
case OBJECT_DEVICE:
|
||||||
data.application_data_len = len;
|
/* FIXME: probably need a length limitation sent with encode */
|
||||||
/* FIXME: probably need a length limitation sent with encode */
|
if (data.object_instance == Device_Object_Instance_Number()) {
|
||||||
len =
|
len = Device_Encode_Property_APDU(&Temp_Buf[0],
|
||||||
rp_ack_encode_apdu(&Handler_Transmit_Buffer
|
data.object_property,
|
||||||
[pdu_len], service_data->invoke_id, &data);
|
data.array_index, &error_class, &error_code);
|
||||||
error = false;
|
if (len >= 0) {
|
||||||
}
|
/* encode the APDU portion of the packet */
|
||||||
|
data.application_data = &Temp_Buf[0];
|
||||||
|
data.application_data_len = len;
|
||||||
|
/* FIXME: probably need a length limitation sent with encode */
|
||||||
|
len =
|
||||||
|
rp_ack_encode_apdu(&Handler_Transmit_Buffer
|
||||||
|
[pdu_len], service_data->invoke_id, &data);
|
||||||
|
error = false;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case OBJECT_ANALOG_INPUT:
|
|
||||||
if (Analog_Input_Valid_Instance(data.object_instance)) {
|
|
||||||
len = Analog_Input_Encode_Property_APDU(&Temp_Buf[0],
|
|
||||||
data.object_instance,
|
|
||||||
data.object_property,
|
|
||||||
data.array_index, &error_class, &error_code);
|
|
||||||
if (len >= 0) {
|
|
||||||
/* encode the APDU portion of the packet */
|
|
||||||
data.application_data = &Temp_Buf[0];
|
|
||||||
data.application_data_len = len;
|
|
||||||
/* FIXME: probably need a length limitation sent with encode */
|
|
||||||
len =
|
|
||||||
rp_ack_encode_apdu(&Handler_Transmit_Buffer
|
|
||||||
[pdu_len], service_data->invoke_id, &data);
|
|
||||||
error = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case OBJECT_BINARY_INPUT:
|
|
||||||
if (Binary_Input_Valid_Instance(data.object_instance)) {
|
|
||||||
len = Binary_Input_Encode_Property_APDU(&Temp_Buf[0],
|
|
||||||
data.object_instance,
|
|
||||||
data.object_property,
|
|
||||||
data.array_index, &error_class, &error_code);
|
|
||||||
if (len >= 0) {
|
|
||||||
/* encode the APDU portion of the packet */
|
|
||||||
data.application_data = &Temp_Buf[0];
|
|
||||||
data.application_data_len = len;
|
|
||||||
/* FIXME: probably need a length limitation sent with encode */
|
|
||||||
len =
|
|
||||||
rp_ack_encode_apdu(&Handler_Transmit_Buffer
|
|
||||||
[pdu_len], service_data->invoke_id, &data);
|
|
||||||
error = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case OBJECT_BINARY_VALUE:
|
|
||||||
if (Binary_Value_Valid_Instance(data.object_instance)) {
|
|
||||||
len = Binary_Value_Encode_Property_APDU(&Temp_Buf[0],
|
|
||||||
data.object_instance,
|
|
||||||
data.object_property,
|
|
||||||
data.array_index, &error_class, &error_code);
|
|
||||||
if (len >= 0) {
|
|
||||||
/* encode the APDU portion of the packet */
|
|
||||||
data.application_data = &Temp_Buf[0];
|
|
||||||
data.application_data_len = len;
|
|
||||||
/* FIXME: probably need a length limitation sent with encode */
|
|
||||||
len =
|
|
||||||
rp_ack_encode_apdu(&Handler_Transmit_Buffer
|
|
||||||
[pdu_len], service_data->invoke_id, &data);
|
|
||||||
error = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case OBJECT_ANALOG_VALUE:
|
|
||||||
if (Analog_Value_Valid_Instance(data.object_instance)) {
|
|
||||||
len = Analog_Value_Encode_Property_APDU(&Temp_Buf[0],
|
|
||||||
data.object_instance,
|
|
||||||
data.object_property,
|
|
||||||
data.array_index, &error_class, &error_code);
|
|
||||||
if (len >= 0) {
|
|
||||||
/* encode the APDU portion of the packet */
|
|
||||||
data.application_data = &Temp_Buf[0];
|
|
||||||
data.application_data_len = len;
|
|
||||||
/* FIXME: probably need a length limitation sent with encode */
|
|
||||||
len =
|
|
||||||
rp_ack_encode_apdu(&Handler_Transmit_Buffer
|
|
||||||
[pdu_len], service_data->invoke_id, &data);
|
|
||||||
error = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case OBJECT_ANALOG_INPUT:
|
||||||
|
if (Analog_Input_Valid_Instance(data.object_instance)) {
|
||||||
|
len = Analog_Input_Encode_Property_APDU(&Temp_Buf[0],
|
||||||
|
data.object_instance,
|
||||||
|
data.object_property,
|
||||||
|
data.array_index, &error_class, &error_code);
|
||||||
|
if (len >= 0) {
|
||||||
|
/* encode the APDU portion of the packet */
|
||||||
|
data.application_data = &Temp_Buf[0];
|
||||||
|
data.application_data_len = len;
|
||||||
|
/* FIXME: probably need a length limitation sent with encode */
|
||||||
|
len =
|
||||||
|
rp_ack_encode_apdu(&Handler_Transmit_Buffer
|
||||||
|
[pdu_len], service_data->invoke_id, &data);
|
||||||
|
error = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OBJECT_BINARY_INPUT:
|
||||||
|
if (Binary_Input_Valid_Instance(data.object_instance)) {
|
||||||
|
len = Binary_Input_Encode_Property_APDU(&Temp_Buf[0],
|
||||||
|
data.object_instance,
|
||||||
|
data.object_property,
|
||||||
|
data.array_index, &error_class, &error_code);
|
||||||
|
if (len >= 0) {
|
||||||
|
/* encode the APDU portion of the packet */
|
||||||
|
data.application_data = &Temp_Buf[0];
|
||||||
|
data.application_data_len = len;
|
||||||
|
/* FIXME: probably need a length limitation sent with encode */
|
||||||
|
len =
|
||||||
|
rp_ack_encode_apdu(&Handler_Transmit_Buffer
|
||||||
|
[pdu_len], service_data->invoke_id, &data);
|
||||||
|
error = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OBJECT_BINARY_VALUE:
|
||||||
|
if (Binary_Value_Valid_Instance(data.object_instance)) {
|
||||||
|
len = Binary_Value_Encode_Property_APDU(&Temp_Buf[0],
|
||||||
|
data.object_instance,
|
||||||
|
data.object_property,
|
||||||
|
data.array_index, &error_class, &error_code);
|
||||||
|
if (len >= 0) {
|
||||||
|
/* encode the APDU portion of the packet */
|
||||||
|
data.application_data = &Temp_Buf[0];
|
||||||
|
data.application_data_len = len;
|
||||||
|
/* FIXME: probably need a length limitation sent with encode */
|
||||||
|
len =
|
||||||
|
rp_ack_encode_apdu(&Handler_Transmit_Buffer
|
||||||
|
[pdu_len], service_data->invoke_id, &data);
|
||||||
|
error = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OBJECT_ANALOG_VALUE:
|
||||||
|
if (Analog_Value_Valid_Instance(data.object_instance)) {
|
||||||
|
len = Analog_Value_Encode_Property_APDU(&Temp_Buf[0],
|
||||||
|
data.object_instance,
|
||||||
|
data.object_property,
|
||||||
|
data.array_index, &error_class, &error_code);
|
||||||
|
if (len >= 0) {
|
||||||
|
/* encode the APDU portion of the packet */
|
||||||
|
data.application_data = &Temp_Buf[0];
|
||||||
|
data.application_data_len = len;
|
||||||
|
/* FIXME: probably need a length limitation sent with encode */
|
||||||
|
len =
|
||||||
|
rp_ack_encode_apdu(&Handler_Transmit_Buffer
|
||||||
|
[pdu_len], service_data->invoke_id, &data);
|
||||||
|
error = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (error) {
|
if (error) {
|
||||||
switch (len) {
|
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 */
|
||||||
case -2:
|
|
||||||
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);
|
||||||
break;
|
goto RP_ABORT;
|
||||||
case -1:
|
|
||||||
default:
|
|
||||||
len = bacerror_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
|
||||||
service_data->invoke_id,
|
|
||||||
SERVICE_CONFIRMED_READ_PROPERTY, error_class, error_code);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
len = bacerror_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||||
|
service_data->invoke_id,
|
||||||
|
SERVICE_CONFIRMED_READ_PROPERTY, error_class, error_code);
|
||||||
}
|
}
|
||||||
|
RP_ABORT:
|
||||||
pdu_len += len;
|
pdu_len += len;
|
||||||
bytes_sent = datalink_send_pdu(src, &npdu_data,
|
bytes_sent = datalink_send_pdu(src, &npdu_data,
|
||||||
&Handler_Transmit_Buffer[0], pdu_len);
|
&Handler_Transmit_Buffer[0], pdu_len);
|
||||||
|
|||||||
@@ -57,129 +57,116 @@ void handler_write_property(uint8_t * service_request,
|
|||||||
int bytes_sent = 0;
|
int bytes_sent = 0;
|
||||||
BACNET_ADDRESS my_address;
|
BACNET_ADDRESS my_address;
|
||||||
|
|
||||||
/* decode the service request only */
|
|
||||||
len = wp_decode_service_request(service_request,
|
|
||||||
service_len, &wp_data);
|
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len = npdu_encode_pdu(&Handler_Transmit_Buffer[0], src,
|
pdu_len = npdu_encode_pdu(&Handler_Transmit_Buffer[0], src,
|
||||||
&my_address, &npdu_data);
|
&my_address, &npdu_data);
|
||||||
#if PRINT_ENABLED
|
if (service_data->segmented_message) {
|
||||||
fprintf(stderr, "Received Write-Property Request!\n");
|
len = abort_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||||
if (len > 0)
|
service_data->invoke_id,
|
||||||
fprintf(stderr, "type=%u instance=%u property=%u index=%d\n",
|
ABORT_REASON_SEGMENTATION_NOT_SUPPORTED, true);
|
||||||
wp_data.object_type,
|
goto WP_ABORT;
|
||||||
wp_data.object_instance,
|
}
|
||||||
wp_data.object_property, wp_data.array_index);
|
/* decode the service request only */
|
||||||
else
|
len = wp_decode_service_request(service_request,
|
||||||
fprintf(stderr, "Unable to decode Write-Property Request!\n");
|
service_len, &wp_data);
|
||||||
#endif
|
|
||||||
/* bad decoding or something we didn't understand - send an abort */
|
/* bad decoding or something we didn't understand - send an abort */
|
||||||
if (len <= 0) {
|
if (len <= 0) {
|
||||||
len = abort_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
len = abort_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||||
service_data->invoke_id, ABORT_REASON_OTHER, true);
|
service_data->invoke_id, ABORT_REASON_OTHER, true);
|
||||||
|
goto WP_ABORT;
|
||||||
|
}
|
||||||
|
switch (wp_data.object_type) {
|
||||||
|
case OBJECT_DEVICE:
|
||||||
|
if (Device_Write_Property(&wp_data, &error_class, &error_code)) {
|
||||||
|
len =
|
||||||
|
encode_simple_ack(&Handler_Transmit_Buffer[pdu_len],
|
||||||
|
service_data->invoke_id,
|
||||||
|
SERVICE_CONFIRMED_WRITE_PROPERTY);
|
||||||
#if PRINT_ENABLED
|
#if PRINT_ENABLED
|
||||||
fprintf(stderr, "Sending Abort!\n");
|
fprintf(stderr,
|
||||||
|
"Sending Write Property Simple Ack for Device!\n");
|
||||||
#endif
|
#endif
|
||||||
} else if (service_data->segmented_message) {
|
} else {
|
||||||
len = abort_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
|
||||||
service_data->invoke_id,
|
|
||||||
ABORT_REASON_SEGMENTATION_NOT_SUPPORTED, true);
|
|
||||||
#if PRINT_ENABLED
|
|
||||||
fprintf(stderr, "Sending Abort!\n");
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
switch (wp_data.object_type) {
|
|
||||||
case OBJECT_DEVICE:
|
|
||||||
if (Device_Write_Property(&wp_data, &error_class, &error_code)) {
|
|
||||||
len =
|
|
||||||
encode_simple_ack(&Handler_Transmit_Buffer[pdu_len],
|
|
||||||
service_data->invoke_id,
|
|
||||||
SERVICE_CONFIRMED_WRITE_PROPERTY);
|
|
||||||
#if PRINT_ENABLED
|
|
||||||
fprintf(stderr,
|
|
||||||
"Sending Write Property Simple Ack for Device!\n");
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
len =
|
|
||||||
bacerror_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
|
||||||
service_data->invoke_id,
|
|
||||||
SERVICE_CONFIRMED_WRITE_PROPERTY, error_class,
|
|
||||||
error_code);
|
|
||||||
#if PRINT_ENABLED
|
|
||||||
fprintf(stderr,
|
|
||||||
"Sending Write Property Error for Device!\n");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case OBJECT_ANALOG_INPUT:
|
|
||||||
case OBJECT_BINARY_INPUT:
|
|
||||||
error_class = ERROR_CLASS_PROPERTY;
|
|
||||||
error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
|
|
||||||
len =
|
len =
|
||||||
bacerror_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
bacerror_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||||
service_data->invoke_id, SERVICE_CONFIRMED_WRITE_PROPERTY,
|
service_data->invoke_id,
|
||||||
error_class, error_code);
|
SERVICE_CONFIRMED_WRITE_PROPERTY, error_class,
|
||||||
|
error_code);
|
||||||
#if PRINT_ENABLED
|
#if PRINT_ENABLED
|
||||||
fprintf(stderr, "Sending Write Access Error!\n");
|
fprintf(stderr,
|
||||||
|
"Sending Write Property Error for Device!\n");
|
||||||
#endif
|
#endif
|
||||||
break;
|
|
||||||
case OBJECT_BINARY_VALUE:
|
|
||||||
if (Binary_Value_Write_Property(&wp_data, &error_class,
|
|
||||||
&error_code)) {
|
|
||||||
len =
|
|
||||||
encode_simple_ack(&Handler_Transmit_Buffer[pdu_len],
|
|
||||||
service_data->invoke_id,
|
|
||||||
SERVICE_CONFIRMED_WRITE_PROPERTY);
|
|
||||||
#if PRINT_ENABLED
|
|
||||||
fprintf(stderr,
|
|
||||||
"Sending Write Property Simple Ack for BV!\n");
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
len =
|
|
||||||
bacerror_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
|
||||||
service_data->invoke_id,
|
|
||||||
SERVICE_CONFIRMED_WRITE_PROPERTY, error_class,
|
|
||||||
error_code);
|
|
||||||
#if PRINT_ENABLED
|
|
||||||
fprintf(stderr, "Sending Write Access Error for BV!\n");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case OBJECT_ANALOG_VALUE:
|
|
||||||
if (Analog_Value_Write_Property(&wp_data, &error_class,
|
|
||||||
&error_code)) {
|
|
||||||
len =
|
|
||||||
encode_simple_ack(&Handler_Transmit_Buffer[pdu_len],
|
|
||||||
service_data->invoke_id,
|
|
||||||
SERVICE_CONFIRMED_WRITE_PROPERTY);
|
|
||||||
#if PRINT_ENABLED
|
|
||||||
fprintf(stderr,
|
|
||||||
"Sending Write Property Simple Ack for AV!\n");
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
len =
|
|
||||||
bacerror_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
|
||||||
service_data->invoke_id,
|
|
||||||
SERVICE_CONFIRMED_WRITE_PROPERTY, error_class,
|
|
||||||
error_code);
|
|
||||||
#if PRINT_ENABLED
|
|
||||||
fprintf(stderr, "Sending Write Access Error for AV!\n");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
len =
|
|
||||||
bacerror_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
|
||||||
service_data->invoke_id, SERVICE_CONFIRMED_WRITE_PROPERTY,
|
|
||||||
error_class, error_code);
|
|
||||||
#if PRINT_ENABLED
|
|
||||||
fprintf(stderr, "Sending Unknown Object Error!\n");
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case OBJECT_ANALOG_INPUT:
|
||||||
|
case OBJECT_BINARY_INPUT:
|
||||||
|
error_class = ERROR_CLASS_PROPERTY;
|
||||||
|
error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
|
||||||
|
len =
|
||||||
|
bacerror_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||||
|
service_data->invoke_id, SERVICE_CONFIRMED_WRITE_PROPERTY,
|
||||||
|
error_class, error_code);
|
||||||
|
#if PRINT_ENABLED
|
||||||
|
fprintf(stderr, "Sending Write Access Error!\n");
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case OBJECT_BINARY_VALUE:
|
||||||
|
if (Binary_Value_Write_Property(&wp_data, &error_class,
|
||||||
|
&error_code)) {
|
||||||
|
len =
|
||||||
|
encode_simple_ack(&Handler_Transmit_Buffer[pdu_len],
|
||||||
|
service_data->invoke_id,
|
||||||
|
SERVICE_CONFIRMED_WRITE_PROPERTY);
|
||||||
|
#if PRINT_ENABLED
|
||||||
|
fprintf(stderr,
|
||||||
|
"Sending Write Property Simple Ack for BV!\n");
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
len =
|
||||||
|
bacerror_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||||
|
service_data->invoke_id,
|
||||||
|
SERVICE_CONFIRMED_WRITE_PROPERTY, error_class,
|
||||||
|
error_code);
|
||||||
|
#if PRINT_ENABLED
|
||||||
|
fprintf(stderr, "Sending Write Access Error for BV!\n");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OBJECT_ANALOG_VALUE:
|
||||||
|
if (Analog_Value_Write_Property(&wp_data, &error_class,
|
||||||
|
&error_code)) {
|
||||||
|
len =
|
||||||
|
encode_simple_ack(&Handler_Transmit_Buffer[pdu_len],
|
||||||
|
service_data->invoke_id,
|
||||||
|
SERVICE_CONFIRMED_WRITE_PROPERTY);
|
||||||
|
#if PRINT_ENABLED
|
||||||
|
fprintf(stderr,
|
||||||
|
"Sending Write Property Simple Ack for AV!\n");
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
len =
|
||||||
|
bacerror_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||||
|
service_data->invoke_id,
|
||||||
|
SERVICE_CONFIRMED_WRITE_PROPERTY, error_class,
|
||||||
|
error_code);
|
||||||
|
#if PRINT_ENABLED
|
||||||
|
fprintf(stderr, "Sending Write Access Error for AV!\n");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
len =
|
||||||
|
bacerror_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||||
|
service_data->invoke_id, SERVICE_CONFIRMED_WRITE_PROPERTY,
|
||||||
|
error_class, error_code);
|
||||||
|
#if PRINT_ENABLED
|
||||||
|
fprintf(stderr, "Sending Unknown Object Error!\n");
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
WP_ABORT:
|
||||||
pdu_len += len;
|
pdu_len += len;
|
||||||
bytes_sent = datalink_send_pdu(src, &npdu_data,
|
bytes_sent = datalink_send_pdu(src, &npdu_data,
|
||||||
&Handler_Transmit_Buffer[0], pdu_len);
|
&Handler_Transmit_Buffer[0], pdu_len);
|
||||||
|
|||||||
Reference in New Issue
Block a user