Fixed line endings, and set EOL properties.
This commit is contained in:
@@ -50,7 +50,7 @@ void npdu_handler(
|
||||
/*FIXME: network layer message received! Handle it! */
|
||||
#if PRINT_ENABLED
|
||||
printf("NPDU: Network Layer Message discarded!\n");
|
||||
#endif
|
||||
#endif
|
||||
} else if ((apdu_offset > 0) && (apdu_offset <= pdu_len)) {
|
||||
if ((npdu_data.protocol_version == BACNET_PROTOCOL_VERSION) &&
|
||||
((dest.net == 0) || (dest.net == BACNET_BROADCAST_NETWORK))) {
|
||||
@@ -62,12 +62,12 @@ void npdu_handler(
|
||||
} else {
|
||||
if (dest.net) {
|
||||
#if PRINT_ENABLED
|
||||
printf("NPDU: DNET=%d. Discarded!\n", dest.net);
|
||||
printf("NPDU: DNET=%d. Discarded!\n", dest.net);
|
||||
#endif
|
||||
} else {
|
||||
#if PRINT_ENABLED
|
||||
printf("NPDU: BACnet Protocol Version=%d. Discarded!\n",
|
||||
npdu_data.protocol_version);
|
||||
npdu_data.protocol_version);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*
|
||||
*********************************************************************/
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include "config.h"
|
||||
#include "config.h"
|
||||
@@ -51,14 +51,14 @@ static int rpm_ack_decode_service_request(
|
||||
{
|
||||
int decoded_len = 0; /* return value */
|
||||
int len = 0; /* number of bytes returned from decoding */
|
||||
uint8_t tag_number = 0; /* decoded tag number */
|
||||
uint32_t len_value = 0; /* decoded length value */
|
||||
uint8_t tag_number = 0; /* decoded tag number */
|
||||
uint32_t len_value = 0; /* decoded length value */
|
||||
BACNET_READ_ACCESS_DATA *rpm_object;
|
||||
BACNET_READ_ACCESS_DATA *old_rpm_object;
|
||||
BACNET_PROPERTY_REFERENCE *rpm_property;
|
||||
BACNET_PROPERTY_REFERENCE *old_rpm_property;
|
||||
BACNET_APPLICATION_DATA_VALUE *value;
|
||||
BACNET_APPLICATION_DATA_VALUE *old_value;
|
||||
BACNET_APPLICATION_DATA_VALUE *old_value;
|
||||
|
||||
rpm_object = read_access_data;
|
||||
old_rpm_object = rpm_object;
|
||||
@@ -90,11 +90,11 @@ static int rpm_ack_decode_service_request(
|
||||
decoded_len += len;
|
||||
apdu_len -= len;
|
||||
apdu += len;
|
||||
if (apdu_len && decode_is_opening_tag_number(apdu, 4)) {
|
||||
if (apdu_len && decode_is_opening_tag_number(apdu, 4)) {
|
||||
/* propertyValue */
|
||||
decoded_len++;
|
||||
apdu_len--;
|
||||
apdu++;
|
||||
apdu++;
|
||||
/* note: if this is an array, there will be
|
||||
more than one element to decode */
|
||||
value = calloc(1, sizeof(BACNET_APPLICATION_DATA_VALUE));
|
||||
@@ -102,7 +102,7 @@ static int rpm_ack_decode_service_request(
|
||||
old_value = value;
|
||||
while (value && (apdu_len > 0)) {
|
||||
len =
|
||||
bacapp_decode_application_data(apdu, apdu_len, value);
|
||||
bacapp_decode_application_data(apdu, apdu_len, value);
|
||||
decoded_len += len;
|
||||
apdu_len -= len;
|
||||
apdu += len;
|
||||
@@ -118,42 +118,42 @@ static int rpm_ack_decode_service_request(
|
||||
old_value->next = value;
|
||||
}
|
||||
}
|
||||
} else if (apdu_len && decode_is_opening_tag_number(apdu, 5)) {
|
||||
/* propertyAccessError */
|
||||
decoded_len++;
|
||||
apdu_len--;
|
||||
apdu++;
|
||||
/* decode the class and code sequence */
|
||||
len =
|
||||
decode_tag_number_and_value(apdu, &tag_number,
|
||||
&len_value);
|
||||
decoded_len += len;
|
||||
apdu_len -= len;
|
||||
apdu += len;
|
||||
/* FIXME: we could validate that the tag is enumerated... */
|
||||
len = decode_enumerated(apdu, len_value,
|
||||
(int *)&rpm_property->error.error_class);
|
||||
decoded_len += len;
|
||||
apdu_len -= len;
|
||||
apdu += len;
|
||||
len =
|
||||
decode_tag_number_and_value(apdu, &tag_number,
|
||||
&len_value);
|
||||
decoded_len += len;
|
||||
apdu_len -= len;
|
||||
apdu += len;
|
||||
/* FIXME: we could validate that the tag is enumerated... */
|
||||
len = decode_enumerated(apdu, len_value,
|
||||
(int *)&rpm_property->error.error_code);
|
||||
decoded_len += len;
|
||||
apdu_len -= len;
|
||||
apdu += len;
|
||||
if (apdu_len && decode_is_closing_tag_number(apdu, 5)) {
|
||||
decoded_len++;
|
||||
apdu_len--;
|
||||
apdu++;
|
||||
}
|
||||
}
|
||||
} else if (apdu_len && decode_is_opening_tag_number(apdu, 5)) {
|
||||
/* propertyAccessError */
|
||||
decoded_len++;
|
||||
apdu_len--;
|
||||
apdu++;
|
||||
/* decode the class and code sequence */
|
||||
len =
|
||||
decode_tag_number_and_value(apdu, &tag_number,
|
||||
&len_value);
|
||||
decoded_len += len;
|
||||
apdu_len -= len;
|
||||
apdu += len;
|
||||
/* FIXME: we could validate that the tag is enumerated... */
|
||||
len = decode_enumerated(apdu, len_value,
|
||||
(int *)&rpm_property->error.error_class);
|
||||
decoded_len += len;
|
||||
apdu_len -= len;
|
||||
apdu += len;
|
||||
len =
|
||||
decode_tag_number_and_value(apdu, &tag_number,
|
||||
&len_value);
|
||||
decoded_len += len;
|
||||
apdu_len -= len;
|
||||
apdu += len;
|
||||
/* FIXME: we could validate that the tag is enumerated... */
|
||||
len = decode_enumerated(apdu, len_value,
|
||||
(int *)&rpm_property->error.error_code);
|
||||
decoded_len += len;
|
||||
apdu_len -= len;
|
||||
apdu += len;
|
||||
if (apdu_len && decode_is_closing_tag_number(apdu, 5)) {
|
||||
decoded_len++;
|
||||
apdu_len--;
|
||||
apdu++;
|
||||
}
|
||||
}
|
||||
old_rpm_property = rpm_property;
|
||||
rpm_property = calloc(1, sizeof(BACNET_PROPERTY_REFERENCE));
|
||||
old_rpm_property->next = rpm_property;
|
||||
@@ -200,8 +200,8 @@ static void PrintReadPropertyMultipleData(
|
||||
fprintf(stdout, "[%d]", listOfProperties->propertyArrayIndex);
|
||||
#endif
|
||||
}
|
||||
value = listOfProperties->value;
|
||||
if (value) {
|
||||
value = listOfProperties->value;
|
||||
if (value) {
|
||||
#if PRINT_ENABLED
|
||||
if (value->next) {
|
||||
fprintf(stdout, "{");
|
||||
@@ -226,16 +226,16 @@ static void PrintReadPropertyMultipleData(
|
||||
#endif
|
||||
value = value->next;
|
||||
}
|
||||
} else {
|
||||
#if PRINT_ENABLED
|
||||
/* AccessError */
|
||||
fprintf(stdout, "BACnet Error: %s: %s\r\n",
|
||||
bactext_error_class_name(
|
||||
(int)listOfProperties->error.error_class),
|
||||
bactext_error_code_name(
|
||||
(int)listOfProperties->error.error_code));
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
#if PRINT_ENABLED
|
||||
/* AccessError */
|
||||
fprintf(stdout, "BACnet Error: %s: %s\r\n",
|
||||
bactext_error_class_name(
|
||||
(int)listOfProperties->error.error_class),
|
||||
bactext_error_code_name(
|
||||
(int)listOfProperties->error.error_code));
|
||||
#endif
|
||||
}
|
||||
listOfProperties = listOfProperties->next;
|
||||
}
|
||||
#if PRINT_ENABLED
|
||||
|
||||
@@ -39,39 +39,39 @@
|
||||
#include "cov.h"
|
||||
/* some demo stuff needed */
|
||||
#include "handlers.h"
|
||||
|
||||
int ucov_notify_encode_pdu(
|
||||
uint8_t * buffer,
|
||||
BACNET_ADDRESS * dest,
|
||||
BACNET_NPDU_DATA * npdu_data,
|
||||
BACNET_COV_DATA * cov_data)
|
||||
{
|
||||
int len = 0;
|
||||
int pdu_len = 0;
|
||||
|
||||
/* unconfirmed is a broadcast */
|
||||
datalink_get_broadcast_address(dest);
|
||||
/* encode the NPDU portion of the packet */
|
||||
npdu_encode_npdu_data(npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||
pdu_len = npdu_encode_pdu(&buffer[0], dest, NULL, npdu_data);
|
||||
/* encode the APDU portion of the packet */
|
||||
len = ucov_notify_encode_apdu(&buffer[pdu_len], cov_data);
|
||||
pdu_len += len;
|
||||
|
||||
return pdu_len;
|
||||
}
|
||||
|
||||
int Send_UCOV_Notify(
|
||||
uint8_t * buffer,
|
||||
BACNET_COV_DATA * cov_data)
|
||||
{
|
||||
int pdu_len = 0;
|
||||
BACNET_ADDRESS dest;
|
||||
int bytes_sent = 0;
|
||||
BACNET_NPDU_DATA npdu_data;
|
||||
|
||||
pdu_len = ucov_notify_encode_pdu(buffer, &dest, &npdu_data, cov_data);
|
||||
bytes_sent = datalink_send_pdu(&dest, &npdu_data, &buffer[0], pdu_len);
|
||||
|
||||
return bytes_sent;
|
||||
}
|
||||
|
||||
int ucov_notify_encode_pdu(
|
||||
uint8_t * buffer,
|
||||
BACNET_ADDRESS * dest,
|
||||
BACNET_NPDU_DATA * npdu_data,
|
||||
BACNET_COV_DATA * cov_data)
|
||||
{
|
||||
int len = 0;
|
||||
int pdu_len = 0;
|
||||
|
||||
/* unconfirmed is a broadcast */
|
||||
datalink_get_broadcast_address(dest);
|
||||
/* encode the NPDU portion of the packet */
|
||||
npdu_encode_npdu_data(npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||
pdu_len = npdu_encode_pdu(&buffer[0], dest, NULL, npdu_data);
|
||||
/* encode the APDU portion of the packet */
|
||||
len = ucov_notify_encode_apdu(&buffer[pdu_len], cov_data);
|
||||
pdu_len += len;
|
||||
|
||||
return pdu_len;
|
||||
}
|
||||
|
||||
int Send_UCOV_Notify(
|
||||
uint8_t * buffer,
|
||||
BACNET_COV_DATA * cov_data)
|
||||
{
|
||||
int pdu_len = 0;
|
||||
BACNET_ADDRESS dest;
|
||||
int bytes_sent = 0;
|
||||
BACNET_NPDU_DATA npdu_data;
|
||||
|
||||
pdu_len = ucov_notify_encode_pdu(buffer, &dest, &npdu_data, cov_data);
|
||||
bytes_sent = datalink_send_pdu(&dest, &npdu_data, &buffer[0], pdu_len);
|
||||
|
||||
return bytes_sent;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user