indented.
This commit is contained in:
@@ -55,46 +55,46 @@ void handler_device_communication_control(uint8_t * service_request,
|
||||
/* decode the service request only */
|
||||
len = dcc_decode_service_request(service_request,
|
||||
service_len, &timeDuration, &state, &password);
|
||||
#if PRINT_ENABLED
|
||||
#if PRINT_ENABLED
|
||||
fprintf(stderr, "DeviceCommunicationControl!\n");
|
||||
if (len > 0)
|
||||
fprintf(stderr, "DeviceCommunicationControl: "
|
||||
"timeout=%u state=%u password=%s\n",
|
||||
(unsigned) timeDuration,
|
||||
(unsigned) state, characterstring_value(&password));
|
||||
#endif
|
||||
#endif
|
||||
/* bad decoding or something we didn't understand - send an abort */
|
||||
if (len < 0) {
|
||||
pdu_len = abort_encode_apdu(&Handler_Transmit_Buffer[0],
|
||||
service_data->invoke_id, ABORT_REASON_OTHER);
|
||||
#if PRINT_ENABLED
|
||||
#if PRINT_ENABLED
|
||||
fprintf(stderr, "DeviceCommunicationControl: "
|
||||
"Sending Abort - could not decode.\n");
|
||||
#endif
|
||||
#endif
|
||||
} else if (service_data->segmented_message) {
|
||||
pdu_len = abort_encode_apdu(&Handler_Transmit_Buffer[0],
|
||||
service_data->invoke_id,
|
||||
ABORT_REASON_SEGMENTATION_NOT_SUPPORTED);
|
||||
#if PRINT_ENABLED
|
||||
#if PRINT_ENABLED
|
||||
fprintf(stderr, "DeviceCommunicationControl: "
|
||||
"Sending Abort - segmented message.\n");
|
||||
#endif
|
||||
#endif
|
||||
} else if (state >= MAX_BACNET_COMMUNICATION_ENABLE_DISABLE) {
|
||||
pdu_len = reject_encode_apdu(&Handler_Transmit_Buffer[0],
|
||||
service_data->invoke_id, REJECT_REASON_UNDEFINED_ENUMERATION);
|
||||
#if PRINT_ENABLED
|
||||
#if PRINT_ENABLED
|
||||
fprintf(stderr, "DeviceCommunicationControl: "
|
||||
"Sending Reject - undefined enumeration\n");
|
||||
#endif
|
||||
#endif
|
||||
} else {
|
||||
if (characterstring_ansi_same(&password, My_Password)) {
|
||||
pdu_len = encode_simple_ack(&Handler_Transmit_Buffer[0],
|
||||
service_data->invoke_id,
|
||||
SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL);
|
||||
#if PRINT_ENABLED
|
||||
#if PRINT_ENABLED
|
||||
fprintf(stderr, "DeviceCommunicationControl: "
|
||||
"Sending Simple Ack!\n");
|
||||
#endif
|
||||
#endif
|
||||
dcc_set_status_duration(state, timeDuration);
|
||||
} else {
|
||||
pdu_len =
|
||||
@@ -102,21 +102,21 @@ void handler_device_communication_control(uint8_t * service_request,
|
||||
service_data->invoke_id,
|
||||
SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL,
|
||||
ERROR_CLASS_SERVICES, ERROR_CODE_PASSWORD_FAILURE);
|
||||
#if PRINT_ENABLED
|
||||
#if PRINT_ENABLED
|
||||
fprintf(stderr,
|
||||
"DeviceCommunicationControl: "
|
||||
"Sending Error - password failure.\n");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
npdu_encode_confirmed_apdu(&npdu_data, MESSAGE_PRIORITY_NORMAL);
|
||||
bytes_sent = datalink_send_pdu(src, &npdu_data,
|
||||
&Handler_Transmit_Buffer[0], pdu_len);
|
||||
#if PRINT_ENABLED
|
||||
#if PRINT_ENABLED
|
||||
if (bytes_sent <= 0)
|
||||
fprintf(stderr, "DeviceCommunicationControl: "
|
||||
"Failed to send PDU (%s)!\n", strerror(errno));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user