Fixed indent script, and indented files.

This commit is contained in:
skarg
2010-07-19 23:19:54 +00:00
parent c0d63a1ed0
commit 6c9ef7211d
69 changed files with 681 additions and 627 deletions
+1 -1
View File
@@ -70,7 +70,7 @@ BACNET_ABORT_REASON abort_convert_error_code(
break;
}
return(abort_code);
return (abort_code);
}
/* encode service */
+6 -4
View File
@@ -149,7 +149,8 @@ struct Address_Cache_Entry *address_remove_oldest(
pMatch = Address_Cache;
while (pMatch <= &Address_Cache[MAX_ADDRESS_CACHE - 1]) {
if ((pMatch->Flags & (BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ |
if ((pMatch->
Flags & (BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ |
BAC_ADDR_STATIC)) == BAC_ADDR_IN_USE) {
if (pMatch->TimeToLive <= ulTime) { /* Shorter lived entry found */
ulTime = pMatch->TimeToLive;
@@ -168,7 +169,8 @@ struct Address_Cache_Entry *address_remove_oldest(
/* Second pass - try in use and un bound as last resort */
pMatch = Address_Cache;
while (pMatch <= &Address_Cache[MAX_ADDRESS_CACHE - 1]) {
if ((pMatch->Flags & (BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ |
if ((pMatch->
Flags & (BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ |
BAC_ADDR_STATIC)) ==
((uint8_t) (BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ))) {
if (pMatch->TimeToLive <= ulTime) { /* Shorter lived entry found */
@@ -222,7 +224,7 @@ void address_file_init(
&mac[1], &mac[2], &mac[3], &mac[4], &mac[5]);
src.mac_len = (uint8_t) count;
for (index = 0; index < MAX_MAC_LEN; index++) {
src.mac[index] = (uint8_t)mac[index];
src.mac[index] = (uint8_t) mac[index];
}
src.net = (uint16_t) snet;
if (snet) {
@@ -231,7 +233,7 @@ void address_file_init(
&mac[1], &mac[2], &mac[3], &mac[4], &mac[5]);
src.len = (uint8_t) count;
for (index = 0; index < MAX_MAC_LEN; index++) {
src.adr[index] = (uint8_t)mac[index];
src.adr[index] = (uint8_t) mac[index];
}
} else {
src.len = 0;
+6 -4
View File
@@ -211,7 +211,8 @@ bool apdu_service_supported_to_index(
}
/* Confirmed ACK Function Handlers */
static confirmed_ack_function Confirmed_ACK_Function[MAX_BACNET_CONFIRMED_SERVICE];
static confirmed_ack_function
Confirmed_ACK_Function[MAX_BACNET_CONFIRMED_SERVICE];
void apdu_set_confirmed_simple_ack_handler(
BACNET_CONFIRMED_SERVICE service_choice,
@@ -238,7 +239,8 @@ void apdu_set_confirmed_simple_ack_handler(
case SERVICE_CONFIRMED_VT_CLOSE:
/* Security Services */
case SERVICE_CONFIRMED_REQUEST_KEY:
Confirmed_ACK_Function[service_choice] = (confirmed_ack_function)pFunction;
Confirmed_ACK_Function[service_choice] =
(confirmed_ack_function) pFunction;
break;
default:
break;
@@ -366,7 +368,7 @@ void apdu_handler(
uint8_t service_choice = 0;
uint8_t *service_request = NULL;
uint16_t service_request_len = 0;
int len = 0; /* counts where we are in PDU */
int len = 0; /* counts where we are in PDU */
uint8_t tag_number = 0;
uint32_t len_value = 0;
uint32_t error_code = 0;
@@ -458,7 +460,7 @@ void apdu_handler(
}
service_choice = apdu[len++];
service_request = &apdu[len];
service_request_len = apdu_len - (uint16_t)len;
service_request_len = apdu_len - (uint16_t) len;
switch (service_choice) {
case SERVICE_CONFIRMED_GET_ALARM_SUMMARY:
case SERVICE_CONFIRMED_GET_ENROLLMENT_SUMMARY:
+26 -26
View File
@@ -891,8 +891,8 @@ bool bacapp_print_value(
case PROP_OBJECT_TYPE:
if (value->type.Enumerated < MAX_ASHRAE_OBJECT_TYPE) {
fprintf(stream, "%s",
bactext_object_type_name(value->
type.Enumerated));
bactext_object_type_name(value->type.
Enumerated));
} else if (value->type.Enumerated < 128) {
fprintf(stream, "reserved %lu",
(unsigned long) value->type.Enumerated);
@@ -908,8 +908,8 @@ bool bacapp_print_value(
case PROP_UNITS:
if (value->type.Enumerated < 256) {
fprintf(stream, "%s",
bactext_engineering_unit_name(value->type.
Enumerated));
bactext_engineering_unit_name(value->
type.Enumerated));
} else {
fprintf(stream, "proprietary %lu",
(unsigned long) value->type.Enumerated);
@@ -917,13 +917,13 @@ bool bacapp_print_value(
break;
case PROP_POLARITY:
fprintf(stream, "%s",
bactext_binary_polarity_name(value->type.
Enumerated));
bactext_binary_polarity_name(value->
type.Enumerated));
break;
case PROP_PRESENT_VALUE:
fprintf(stream, "%s",
bactext_binary_present_value_name(value->type.
Enumerated));
bactext_binary_present_value_name(value->
type.Enumerated));
break;
case PROP_RELIABILITY:
fprintf(stream, "%s",
@@ -931,8 +931,8 @@ bool bacapp_print_value(
break;
case PROP_SYSTEM_STATUS:
fprintf(stream, "%s",
bactext_device_status_name(value->type.
Enumerated));
bactext_device_status_name(value->
type.Enumerated));
break;
case PROP_SEGMENTATION_SUPPORTED:
fprintf(stream, "%s",
@@ -1084,10 +1084,10 @@ bool bacapp_parse_application_data(
datetime_set_date(&value->type.Date, (uint16_t) year,
(uint8_t) month, (uint8_t) day);
} else if (count == 4) {
value->type.Date.year = (uint16_t)year;
value->type.Date.month = (uint8_t)month;
value->type.Date.day = (uint8_t)day;
value->type.Date.wday = (uint8_t)wday;
value->type.Date.year = (uint16_t) year;
value->type.Date.month = (uint8_t) month;
value->type.Date.day = (uint8_t) day;
value->type.Date.wday = (uint8_t) wday;
} else {
status = false;
}
@@ -1097,18 +1097,18 @@ bool bacapp_parse_application_data(
sscanf(argv, "%d:%d:%d.%d", &hour, &min, &sec,
&hundredths);
if (count == 4) {
value->type.Time.hour = (uint8_t)hour;
value->type.Time.min = (uint8_t)min;
value->type.Time.sec = (uint8_t)sec;
value->type.Time.hundredths = (uint8_t)hundredths;
value->type.Time.hour = (uint8_t) hour;
value->type.Time.min = (uint8_t) min;
value->type.Time.sec = (uint8_t) sec;
value->type.Time.hundredths = (uint8_t) hundredths;
} else if (count == 3) {
value->type.Time.hour = (uint8_t)hour;
value->type.Time.min = (uint8_t)min;
value->type.Time.sec = (uint8_t)sec;
value->type.Time.hour = (uint8_t) hour;
value->type.Time.min = (uint8_t) min;
value->type.Time.sec = (uint8_t) sec;
value->type.Time.hundredths = 0;
} else if (count == 2) {
value->type.Time.hour = (uint8_t)hour;
value->type.Time.min = (uint8_t)min;
value->type.Time.hour = (uint8_t) hour;
value->type.Time.min = (uint8_t) min;
value->type.Time.sec = 0;
value->type.Time.hundredths = 0;
} else {
@@ -1118,7 +1118,7 @@ bool bacapp_parse_application_data(
case BACNET_APPLICATION_TAG_OBJECT_ID:
count = sscanf(argv, "%d:%d", &object_type, &instance);
if (count == 2) {
value->type.Object_Id.type = (uint16_t)object_type;
value->type.Object_Id.type = (uint16_t) object_type;
value->type.Object_Id.instance = instance;
} else {
status = false;
@@ -1303,8 +1303,8 @@ void testBACnetApplicationData_Safe(
break;
case BACNET_APPLICATION_TAG_CHARACTER_STRING:
characterstring_init_ansi(&input_value[i].
type.Character_String, "Hello There!");
characterstring_init_ansi(&input_value[i].type.
Character_String, "Hello There!");
break;
case BACNET_APPLICATION_TAG_BIT_STRING:
+32 -32
View File
@@ -237,32 +237,32 @@ INDTEXT_DATA bacnet_object_type_names[] = {
{OBJECT_CREDENTIAL_DATA_INPUT, "Credential Data Input"}
,
{OBJECT_NETWORK_SECURITY, "Network Security"}
,
{OBJECT_BITSTRING_VALUE, "Bitstring Value"}
,
{OBJECT_CHARACTERSTRING_VALUE, "Characterstring Value"}
,
{OBJECT_DATE_PATTERN_VALUE, "Date Pattern Value"}
,
{OBJECT_DATE_VALUE, "Date Value"}
,
{OBJECT_DATETIME_PATTERN_VALUE, "Datetime Pattern Value"}
,
{OBJECT_DATETIME_VALUE, "Datetime Value"}
,
{OBJECT_INTEGER_VALUE, "Integer Value"}
,
{OBJECT_LARGE_ANALOG_VALUE, "Large Analog Value"}
,
{OBJECT_OCTETSTRING_VALUE, "Octetstring Value"}
,
{OBJECT_POSITIVE_INTEGER_VALUE, "Positive Integer Value"}
,
{OBJECT_TIME_PATTERN_VALUE, "Time Pattern Value"}
,
{OBJECT_TIME_VALUE, "Time Value"}
,
{0, NULL}
,
{OBJECT_BITSTRING_VALUE, "Bitstring Value"}
,
{OBJECT_CHARACTERSTRING_VALUE, "Characterstring Value"}
,
{OBJECT_DATE_PATTERN_VALUE, "Date Pattern Value"}
,
{OBJECT_DATE_VALUE, "Date Value"}
,
{OBJECT_DATETIME_PATTERN_VALUE, "Datetime Pattern Value"}
,
{OBJECT_DATETIME_VALUE, "Datetime Value"}
,
{OBJECT_INTEGER_VALUE, "Integer Value"}
,
{OBJECT_LARGE_ANALOG_VALUE, "Large Analog Value"}
,
{OBJECT_OCTETSTRING_VALUE, "Octetstring Value"}
,
{OBJECT_POSITIVE_INTEGER_VALUE, "Positive Integer Value"}
,
{OBJECT_TIME_PATTERN_VALUE, "Time Pattern Value"}
,
{OBJECT_TIME_VALUE, "Time Value"}
,
{0, NULL}
/* Enumerated values 0-127 are reserved for definition by ASHRAE.
Enumerated values 128-1023 may be used by others subject to
the procedures and constraints described in Clause 23. */
@@ -940,12 +940,12 @@ INDTEXT_DATA bacnet_property_names[] = {
,
{PROP_BINARY_INACTIVE_VALUE, "binary-inactive-value"}
,
{PROP_BIT_MASK, "bit-mask"}
,
{PROP_BIT_TEXT, "bit-text"}
,
{PROP_IS_UTC, "is-utc"}
,
{PROP_BIT_MASK, "bit-mask"}
,
{PROP_BIT_TEXT, "bit-text"}
,
{PROP_IS_UTC, "is-utc"}
,
{0, NULL}
/* Enumerated values 0-511 are reserved for definition by ASHRAE.
+23 -19
View File
@@ -206,7 +206,7 @@ int bvlc_encode_write_bdt_init(
/* The 2-octet BVLC Length field is the length, in octets,
of the entire BVLL message, including the two octets of the
length field itself, most significant octet first. */
BVLC_length = 4 + (uint16_t)(entries * 10);
BVLC_length = 4 + (uint16_t) (entries * 10);
encode_unsigned16(&pdu[2], BVLC_length);
len = 4;
}
@@ -245,7 +245,7 @@ static int bvlc_encode_read_bdt_ack_init(
/* The 2-octet BVLC Length field is the length, in octets,
of the entire BVLL message, including the two octets of the
length field itself, most significant octet first. */
BVLC_length = 4 + (uint16_t)(entries * 10);
BVLC_length = 4 + (uint16_t) (entries * 10);
encode_unsigned16(&pdu[2], BVLC_length);
len = 4;
}
@@ -370,7 +370,7 @@ static int bvlc_encode_read_fdt_ack_init(
/* The 2-octet BVLC Length field is the length, in octets,
of the entire BVLL message, including the two octets of the
length field itself, most significant octet first. */
BVLC_length = 4 + (uint16_t)(entries * 10);
BVLC_length = 4 + (uint16_t) (entries * 10);
encode_unsigned16(&pdu[2], BVLC_length);
len = 4;
}
@@ -408,7 +408,7 @@ static int bvlc_encode_read_fdt_ack(
pdu_len += len;
len = encode_unsigned16(&pdu[pdu_len], FD_Table[i].time_to_live);
pdu_len += len;
seconds_remaining = (uint16_t)FD_Table[i].seconds_remaining;
seconds_remaining = (uint16_t) FD_Table[i].seconds_remaining;
len = encode_unsigned16(&pdu[pdu_len], seconds_remaining);
pdu_len += len;
}
@@ -455,7 +455,7 @@ int bvlc_encode_original_unicast_npdu(
/* The 2-octet BVLC Length field is the length, in octets,
of the entire BVLL message, including the two octets of the
length field itself, most significant octet first. */
BVLC_length = 4 + (uint16_t)npdu_length;
BVLC_length = 4 + (uint16_t) npdu_length;
len = encode_unsigned16(&pdu[2], BVLC_length) + 2;
for (i = 0; i < npdu_length; i++) {
pdu[len] = npdu[i];
@@ -481,7 +481,7 @@ int bvlc_encode_original_broadcast_npdu(
/* The 2-octet BVLC Length field is the length, in octets,
of the entire BVLL message, including the two octets of the
length field itself, most significant octet first. */
BVLC_length = 4 + (uint16_t)npdu_length;
BVLC_length = 4 + (uint16_t) npdu_length;
len = encode_unsigned16(&pdu[2], BVLC_length) + 2;
for (i = 0; i < npdu_length; i++) {
pdu[len] = npdu[i];
@@ -507,7 +507,7 @@ static void bvlc_internet_to_bacnet_address(
len = encode_unsigned32(&src->mac[0], address);
port = ntohs(sin->sin_port);
len += encode_unsigned16(&src->mac[4], port);
src->mac_len = (uint8_t)len;
src->mac_len = (uint8_t) len;
src->net = 0;
src->len = 0;
}
@@ -668,7 +668,8 @@ static void bvlc_bdt_forward_npdu(
unsigned i = 0; /* loop counter */
struct sockaddr_in bip_dest = { 0 };
mtu_len = (uint16_t)bvlc_encode_forwarded_npdu(&mtu[0], sin, npdu, npdu_length);
mtu_len =
(uint16_t) bvlc_encode_forwarded_npdu(&mtu[0], sin, npdu, npdu_length);
/* loop through the BDT and send one to each entry, except us */
for (i = 0; i < MAX_BBMD_ENTRIES; i++) {
if (BBMD_Table[i].valid) {
@@ -677,8 +678,8 @@ static void bvlc_bdt_forward_npdu(
mask in the BDT entry and logically ORing it with the
BBMD address of the same entry. */
bip_dest.sin_addr.s_addr =
htonl(((~BBMD_Table[i].broadcast_mask.s_addr) | BBMD_Table[i].
dest_address.s_addr));
htonl(((~BBMD_Table[i].broadcast_mask.
s_addr) | BBMD_Table[i].dest_address.s_addr));
bip_dest.sin_port = htons(BBMD_Table[i].dest_port);
/* don't send to my broadcast address and same port */
if ((bip_dest.sin_addr.s_addr == htonl(bip_get_broadcast_addr()))
@@ -710,7 +711,8 @@ static void bvlc_forward_npdu(
uint16_t mtu_len = 0;
struct sockaddr_in bip_dest = { 0 };
mtu_len = (uint16_t)bvlc_encode_forwarded_npdu(&mtu[0], sin, npdu, npdu_length);
mtu_len =
(uint16_t) bvlc_encode_forwarded_npdu(&mtu[0], sin, npdu, npdu_length);
bip_dest.sin_addr.s_addr = htonl(bip_get_broadcast_addr());
bip_dest.sin_port = htons(bip_get_port());
bvlc_send_mpdu(&bip_dest, mtu, mtu_len);
@@ -727,7 +729,8 @@ static void bvlc_fdt_forward_npdu(
unsigned i = 0; /* loop counter */
struct sockaddr_in bip_dest = { 0 };
mtu_len = (uint16_t)bvlc_encode_forwarded_npdu(&mtu[0], sin, npdu, max_npdu);
mtu_len =
(uint16_t) bvlc_encode_forwarded_npdu(&mtu[0], sin, npdu, max_npdu);
/* loop through the FDT and send one to each entry */
for (i = 0; i < MAX_FD_ENTRIES; i++) {
if (FD_Table[i].valid && FD_Table[i].seconds_remaining) {
@@ -769,7 +772,8 @@ void bvlc_register_with_bbmd(
Write Broadcast Distribution Table, or
register with the BBMD as a Foreign Device */
mtu_len =
(uint16_t)bvlc_encode_register_foreign_device(&mtu[0], time_to_live_seconds);
(uint16_t) bvlc_encode_register_foreign_device(&mtu[0],
time_to_live_seconds);
bvlc_send_mpdu(&Remote_BBMD, &mtu[0], mtu_len);
}
@@ -780,7 +784,7 @@ static void bvlc_send_result(
uint8_t mtu[MAX_MPDU] = { 0 };
uint16_t mtu_len = 0;
mtu_len = (uint16_t)bvlc_encode_bvlc_result(&mtu[0], result_code);
mtu_len = (uint16_t) bvlc_encode_bvlc_result(&mtu[0], result_code);
bvlc_send_mpdu(dest, mtu, mtu_len);
return;
@@ -792,7 +796,7 @@ static int bvlc_send_bdt(
uint8_t mtu[MAX_MPDU] = { 0 };
uint16_t mtu_len = 0;
mtu_len = (uint16_t)bvlc_encode_read_bdt_ack(&mtu[0], sizeof(mtu));
mtu_len = (uint16_t) bvlc_encode_read_bdt_ack(&mtu[0], sizeof(mtu));
if (mtu_len) {
bvlc_send_mpdu(dest, &mtu[0], mtu_len);
}
@@ -806,7 +810,7 @@ static int bvlc_send_fdt(
uint8_t mtu[MAX_MPDU] = { 0 };
uint16_t mtu_len = 0;
mtu_len = (uint16_t)bvlc_encode_read_fdt_ack(&mtu[0], sizeof(mtu));
mtu_len = (uint16_t) bvlc_encode_read_fdt_ack(&mtu[0], sizeof(mtu));
if (mtu_len) {
bvlc_send_mpdu(dest, &mtu[0], mtu_len);
}
@@ -1194,11 +1198,11 @@ int bvlc_send_pdu(
}
bvlc_dest.sin_addr.s_addr = htonl(address.s_addr);
bvlc_dest.sin_port = htons(port);
BVLC_length = (uint16_t)pdu_len + 4 /*inclusive */ ;
BVLC_length = (uint16_t) pdu_len + 4 /*inclusive */ ;
mtu_len = 2;
mtu_len += (uint16_t)encode_unsigned16(&mtu[mtu_len], BVLC_length);
mtu_len += (uint16_t) encode_unsigned16(&mtu[mtu_len], BVLC_length);
memcpy(&mtu[mtu_len], pdu, pdu_len);
mtu_len += (uint16_t)pdu_len;
mtu_len += (uint16_t) pdu_len;
return bvlc_send_mpdu(&bvlc_dest, mtu, mtu_len);
}
+1 -1
View File
@@ -274,7 +274,7 @@ int cov_notify_decode_service_request(
decode_tag_number_and_value(&apdu[len], &tag_number,
&len_value);
len += decode_unsigned(&apdu[len], len_value, &decoded_value);
value->priority = (uint8_t)decoded_value;
value->priority = (uint8_t) decoded_value;
} else {
value->priority = BACNET_NO_PRIORITY;
}
+1 -1
View File
@@ -485,7 +485,7 @@ int bacapp_encode_context_datetime(
len = encode_opening_tag(&apdu[apdu_len], tag_number);
apdu_len += len;
len = bacapp_encode_datetime(&apdu[apdu_len], value );
len = bacapp_encode_datetime(&apdu[apdu_len], value);
apdu_len += len;
len = encode_closing_tag(&apdu[apdu_len], tag_number);
+139 -134
View File
@@ -192,14 +192,14 @@ int event_notify_encode_service_request(
len =
encode_context_bitstring(&apdu[apdu_len], 0,
&data->notificationParams.changeOfBitstring.
referencedBitString);
&data->notificationParams.
changeOfBitstring.referencedBitString);
apdu_len += len;
len =
encode_context_bitstring(&apdu[apdu_len], 1,
&data->notificationParams.changeOfBitstring.
statusFlags);
&data->notificationParams.
changeOfBitstring.statusFlags);
apdu_len += len;
len = encode_closing_tag(&apdu[apdu_len], 0);
@@ -223,8 +223,8 @@ int event_notify_encode_service_request(
len =
encode_context_bitstring(&apdu[apdu_len], 1,
&data->notificationParams.changeOfState.
statusFlags);
&data->notificationParams.
changeOfState.statusFlags);
apdu_len += len;
len = encode_closing_tag(&apdu[apdu_len], 1);
@@ -242,8 +242,8 @@ int event_notify_encode_service_request(
case CHANGE_OF_VALUE_REAL:
len =
encode_context_real(&apdu[apdu_len], 1,
data->notificationParams.changeOfValue.
newValue.changeValue);
data->notificationParams.
changeOfValue.newValue.changeValue);
apdu_len += len;
break;
@@ -251,8 +251,8 @@ int event_notify_encode_service_request(
len =
encode_context_bitstring(&apdu[apdu_len],
0,
&data->notificationParams.changeOfValue.
newValue.changedBits);
&data->notificationParams.
changeOfValue.newValue.changedBits);
apdu_len += len;
break;
@@ -265,8 +265,8 @@ int event_notify_encode_service_request(
len =
encode_context_bitstring(&apdu[apdu_len], 1,
&data->notificationParams.changeOfValue.
statusFlags);
&data->notificationParams.
changeOfValue.statusFlags);
apdu_len += len;
len = encode_closing_tag(&apdu[apdu_len], 2);
@@ -280,20 +280,20 @@ int event_notify_encode_service_request(
len =
encode_context_real(&apdu[apdu_len], 0,
data->notificationParams.floatingLimit.
referenceValue);
data->notificationParams.
floatingLimit.referenceValue);
apdu_len += len;
len =
encode_context_bitstring(&apdu[apdu_len], 1,
&data->notificationParams.floatingLimit.
statusFlags);
&data->notificationParams.
floatingLimit.statusFlags);
apdu_len += len;
len =
encode_context_real(&apdu[apdu_len], 2,
data->notificationParams.floatingLimit.
setPointValue);
data->notificationParams.
floatingLimit.setPointValue);
apdu_len += len;
len =
@@ -312,8 +312,8 @@ int event_notify_encode_service_request(
len =
encode_context_real(&apdu[apdu_len], 0,
data->notificationParams.outOfRange.
exceedingValue);
data->notificationParams.
outOfRange.exceedingValue);
apdu_len += len;
len =
@@ -341,26 +341,26 @@ int event_notify_encode_service_request(
len =
encode_context_enumerated(&apdu[apdu_len], 0,
data->notificationParams.changeOfLifeSafety.
newState);
data->notificationParams.
changeOfLifeSafety.newState);
apdu_len += len;
len =
encode_context_enumerated(&apdu[apdu_len], 1,
data->notificationParams.changeOfLifeSafety.
newMode);
data->notificationParams.
changeOfLifeSafety.newMode);
apdu_len += len;
len =
encode_context_bitstring(&apdu[apdu_len], 2,
&data->notificationParams.changeOfLifeSafety.
statusFlags);
&data->notificationParams.
changeOfLifeSafety.statusFlags);
apdu_len += len;
len =
encode_context_enumerated(&apdu[apdu_len], 3,
data->notificationParams.changeOfLifeSafety.
operationExpected);
data->notificationParams.
changeOfLifeSafety.operationExpected);
apdu_len += len;
len = encode_closing_tag(&apdu[apdu_len], 8);
@@ -374,20 +374,20 @@ int event_notify_encode_service_request(
len =
bacapp_encode_context_device_obj_property_ref(&apdu
[apdu_len], 0,
&data->notificationParams.bufferReady.
bufferProperty);
&data->notificationParams.
bufferReady.bufferProperty);
apdu_len += len;
len =
encode_context_unsigned(&apdu[apdu_len], 1,
data->notificationParams.bufferReady.
previousNotification);
data->notificationParams.
bufferReady.previousNotification);
apdu_len += len;
len =
encode_context_unsigned(&apdu[apdu_len], 2,
data->notificationParams.bufferReady.
currentNotification);
data->notificationParams.
bufferReady.currentNotification);
apdu_len += len;
len = encode_closing_tag(&apdu[apdu_len], 10);
@@ -399,20 +399,20 @@ int event_notify_encode_service_request(
len =
encode_context_unsigned(&apdu[apdu_len], 0,
data->notificationParams.unsignedRange.
exceedingValue);
data->notificationParams.
unsignedRange.exceedingValue);
apdu_len += len;
len =
encode_context_bitstring(&apdu[apdu_len], 1,
&data->notificationParams.unsignedRange.
statusFlags);
&data->notificationParams.
unsignedRange.statusFlags);
apdu_len += len;
len =
encode_context_unsigned(&apdu[apdu_len], 2,
data->notificationParams.unsignedRange.
exceededLimit);
data->notificationParams.
unsignedRange.exceededLimit);
apdu_len += len;
len = encode_closing_tag(&apdu[apdu_len], 11);
@@ -595,16 +595,18 @@ int event_notify_decode_service_request(
case EVENT_CHANGE_OF_BITSTRING:
if (-1 == (section_length =
decode_context_bitstring(&apdu[len], 0,
&data->notificationParams.
changeOfBitstring.referencedBitString))) {
&data->
notificationParams.changeOfBitstring.
referencedBitString))) {
return -1;
}
len += section_length;
if (-1 == (section_length =
decode_context_bitstring(&apdu[len], 1,
&data->notificationParams.
changeOfBitstring.statusFlags))) {
&data->
notificationParams.changeOfBitstring.
statusFlags))) {
return -1;
}
len += section_length;
@@ -615,16 +617,16 @@ int event_notify_decode_service_request(
if (-1 == (section_length =
bacapp_decode_context_property_state(&apdu
[len], 0,
&data->notificationParams.changeOfState.
newState))) {
&data->notificationParams.
changeOfState.newState))) {
return -1;
}
len += section_length;
if (-1 == (section_length =
decode_context_bitstring(&apdu[len], 1,
&data->notificationParams.changeOfState.
statusFlags))) {
&data->notificationParams.
changeOfState.statusFlags))) {
return -1;
}
len += section_length;
@@ -642,8 +644,9 @@ int event_notify_decode_service_request(
if (-1 == (section_length =
decode_context_bitstring(&apdu[len], 0,
&data->notificationParams.
changeOfValue.newValue.changedBits))) {
&data->
notificationParams.changeOfValue.
newValue.changedBits))) {
return -1;
}
@@ -654,8 +657,9 @@ int event_notify_decode_service_request(
CHANGE_OF_VALUE_REAL)) {
if (-1 == (section_length =
decode_context_real(&apdu[len], 1,
&data->notificationParams.
changeOfValue.newValue.changeValue))) {
&data->
notificationParams.changeOfValue.
newValue.changeValue))) {
return -1;
}
@@ -673,8 +677,8 @@ int event_notify_decode_service_request(
if (-1 == (section_length =
decode_context_bitstring(&apdu[len], 1,
&data->notificationParams.changeOfValue.
statusFlags))) {
&data->notificationParams.
changeOfValue.statusFlags))) {
return -1;
}
len += section_length;
@@ -683,31 +687,31 @@ int event_notify_decode_service_request(
case EVENT_FLOATING_LIMIT:
if (-1 == (section_length =
decode_context_real(&apdu[len], 0,
&data->notificationParams.floatingLimit.
referenceValue))) {
&data->notificationParams.
floatingLimit.referenceValue))) {
return -1;
}
len += section_length;
if (-1 == (section_length =
decode_context_bitstring(&apdu[len], 1,
&data->notificationParams.floatingLimit.
statusFlags))) {
&data->notificationParams.
floatingLimit.statusFlags))) {
return -1;
}
len += section_length;
if (-1 == (section_length =
decode_context_real(&apdu[len], 2,
&data->notificationParams.floatingLimit.
setPointValue))) {
&data->notificationParams.
floatingLimit.setPointValue))) {
return -1;
}
len += section_length;
if (-1 == (section_length =
decode_context_real(&apdu[len], 3,
&data->notificationParams.floatingLimit.
errorLimit))) {
&data->notificationParams.
floatingLimit.errorLimit))) {
return -1;
}
len += section_length;
@@ -716,31 +720,31 @@ int event_notify_decode_service_request(
case EVENT_OUT_OF_RANGE:
if (-1 == (section_length =
decode_context_real(&apdu[len], 0,
&data->notificationParams.outOfRange.
exceedingValue))) {
&data->notificationParams.
outOfRange.exceedingValue))) {
return -1;
}
len += section_length;
if (-1 == (section_length =
decode_context_bitstring(&apdu[len], 1,
&data->notificationParams.outOfRange.
statusFlags))) {
&data->notificationParams.
outOfRange.statusFlags))) {
return -1;
}
len += section_length;
if (-1 == (section_length =
decode_context_real(&apdu[len], 2,
&data->notificationParams.outOfRange.
deadband))) {
&data->notificationParams.
outOfRange.deadband))) {
return -1;
}
len += section_length;
if (-1 == (section_length =
decode_context_real(&apdu[len], 3,
&data->notificationParams.outOfRange.
exceededLimit))) {
&data->notificationParams.
outOfRange.exceededLimit))) {
return -1;
}
len += section_length;
@@ -768,8 +772,9 @@ int event_notify_decode_service_request(
if (-1 == (section_length =
decode_context_bitstring(&apdu[len], 2,
&data->notificationParams.
changeOfLifeSafety.statusFlags))) {
&data->
notificationParams.changeOfLifeSafety.
statusFlags))) {
return -1;
}
len += section_length;
@@ -779,8 +784,8 @@ int event_notify_decode_service_request(
&value))) {
return -1;
}
data->notificationParams.changeOfLifeSafety.
operationExpected =
data->notificationParams.
changeOfLifeSafety.operationExpected =
(BACNET_LIFE_SAFETY_OPERATION) value;
len += section_length;
break;
@@ -789,24 +794,24 @@ int event_notify_decode_service_request(
if (-1 == (section_length =
bacapp_decode_context_device_obj_property_ref
(&apdu[len], 0,
&data->notificationParams.bufferReady.
bufferProperty))) {
&data->notificationParams.
bufferReady.bufferProperty))) {
return -1;
}
len += section_length;
if (-1 == (section_length =
decode_context_unsigned(&apdu[len], 1,
&data->notificationParams.bufferReady.
previousNotification))) {
&data->notificationParams.
bufferReady.previousNotification))) {
return -1;
}
len += section_length;
if (-1 == (section_length =
decode_context_unsigned(&apdu[len], 2,
&data->notificationParams.bufferReady.
currentNotification))) {
&data->notificationParams.
bufferReady.currentNotification))) {
return -1;
}
len += section_length;
@@ -815,24 +820,24 @@ int event_notify_decode_service_request(
case EVENT_UNSIGNED_RANGE:
if (-1 == (section_length =
decode_context_unsigned(&apdu[len], 0,
&data->notificationParams.unsignedRange.
exceedingValue))) {
&data->notificationParams.
unsignedRange.exceedingValue))) {
return -1;
}
len += section_length;
if (-1 == (section_length =
decode_context_bitstring(&apdu[len], 1,
&data->notificationParams.unsignedRange.
statusFlags))) {
&data->notificationParams.
unsignedRange.statusFlags))) {
return -1;
}
len += section_length;
if (-1 == (section_length =
decode_context_unsigned(&apdu[len], 2,
&data->notificationParams.unsignedRange.
exceededLimit))) {
&data->notificationParams.
unsignedRange.exceededLimit))) {
return -1;
}
len += section_length;
@@ -1091,16 +1096,16 @@ void testEventEventState(
data.eventType = EVENT_CHANGE_OF_BITSTRING;
bitstring_init(&data.notificationParams.changeOfBitstring.
referencedBitString);
bitstring_set_bit(&data.notificationParams.changeOfBitstring.
referencedBitString, 0, true);
bitstring_set_bit(&data.notificationParams.changeOfBitstring.
referencedBitString, 1, false);
bitstring_set_bit(&data.notificationParams.changeOfBitstring.
referencedBitString, 2, true);
bitstring_set_bit(&data.notificationParams.changeOfBitstring.
referencedBitString, 2, false);
bitstring_init(&data.notificationParams.
changeOfBitstring.referencedBitString);
bitstring_set_bit(&data.notificationParams.
changeOfBitstring.referencedBitString, 0, true);
bitstring_set_bit(&data.notificationParams.
changeOfBitstring.referencedBitString, 1, false);
bitstring_set_bit(&data.notificationParams.
changeOfBitstring.referencedBitString, 2, true);
bitstring_set_bit(&data.notificationParams.
changeOfBitstring.referencedBitString, 2, false);
bitstring_init(&data.notificationParams.changeOfBitstring.statusFlags);
@@ -1186,16 +1191,16 @@ void testEventEventState(
data.notificationParams.changeOfValue.tag = CHANGE_OF_VALUE_BITS;
bitstring_init(&data.notificationParams.changeOfValue.newValue.
changedBits);
bitstring_set_bit(&data.notificationParams.changeOfValue.newValue.
changedBits, 0, true);
bitstring_set_bit(&data.notificationParams.changeOfValue.newValue.
changedBits, 1, false);
bitstring_set_bit(&data.notificationParams.changeOfValue.newValue.
changedBits, 2, false);
bitstring_set_bit(&data.notificationParams.changeOfValue.newValue.
changedBits, 3, false);
bitstring_init(&data.notificationParams.changeOfValue.
newValue.changedBits);
bitstring_set_bit(&data.notificationParams.changeOfValue.
newValue.changedBits, 0, true);
bitstring_set_bit(&data.notificationParams.changeOfValue.
newValue.changedBits, 1, false);
bitstring_set_bit(&data.notificationParams.changeOfValue.
newValue.changedBits, 2, false);
bitstring_set_bit(&data.notificationParams.changeOfValue.
newValue.changedBits, 3, false);
memset(buffer, 0, MAX_APDU);
inLen = event_notify_encode_service_request(&buffer[0], &data);
@@ -1435,12 +1440,12 @@ void testEventEventState(
data.notificationParams.bufferReady.currentNotification = 2345;
data.notificationParams.bufferReady.bufferProperty.deviceIndentifier.type =
OBJECT_DEVICE;
data.notificationParams.bufferReady.bufferProperty.deviceIndentifier.
instance = 500;
data.notificationParams.bufferReady.bufferProperty.
deviceIndentifier.instance = 500;
data.notificationParams.bufferReady.bufferProperty.objectIdentifier.type =
OBJECT_ANALOG_INPUT;
data.notificationParams.bufferReady.bufferProperty.objectIdentifier.
instance = 100;
data.notificationParams.bufferReady.bufferProperty.
objectIdentifier.instance = 100;
data.notificationParams.bufferReady.bufferProperty.propertyIdentifier =
PROP_PRESENT_VALUE;
data.notificationParams.bufferReady.bufferProperty.arrayIndex = 0;
@@ -1465,34 +1470,34 @@ void testEventEventState(
ct_test(pTest,
data.notificationParams.bufferReady.bufferProperty.deviceIndentifier.
type ==
data2.notificationParams.bufferReady.bufferProperty.deviceIndentifier.
type);
ct_test(pTest,
data.notificationParams.bufferReady.bufferProperty.deviceIndentifier.
instance ==
data2.notificationParams.bufferReady.bufferProperty.deviceIndentifier.
instance);
ct_test(pTest,
data.notificationParams.bufferReady.bufferProperty.objectIdentifier.
instance ==
data2.notificationParams.bufferReady.bufferProperty.objectIdentifier.
instance);
ct_test(pTest,
data.notificationParams.bufferReady.bufferProperty.objectIdentifier.
type ==
data2.notificationParams.bufferReady.bufferProperty.objectIdentifier.
type);
data.notificationParams.bufferReady.bufferProperty.
deviceIndentifier.type ==
data2.notificationParams.bufferReady.bufferProperty.
deviceIndentifier.type);
ct_test(pTest,
data.notificationParams.bufferReady.bufferProperty.
propertyIdentifier ==
deviceIndentifier.instance ==
data2.notificationParams.bufferReady.bufferProperty.
propertyIdentifier);
deviceIndentifier.instance);
ct_test(pTest,
data.notificationParams.bufferReady.bufferProperty.
objectIdentifier.instance ==
data2.notificationParams.bufferReady.bufferProperty.
objectIdentifier.instance);
ct_test(pTest,
data.notificationParams.bufferReady.bufferProperty.
objectIdentifier.type ==
data2.notificationParams.bufferReady.bufferProperty.
objectIdentifier.type);
ct_test(pTest,
data.notificationParams.bufferReady.
bufferProperty.propertyIdentifier ==
data2.notificationParams.bufferReady.
bufferProperty.propertyIdentifier);
ct_test(pTest,
data.notificationParams.bufferReady.bufferProperty.arrayIndex ==
+6 -4
View File
@@ -449,8 +449,8 @@ void MSTP_Receive_Frame_FSM(
/* NoData */
else if (mstp_port->DataLength == 0) {
printf_receive_data("%s",
mstptext_frame_type((unsigned) mstp_port->
FrameType));
mstptext_frame_type((unsigned)
mstp_port->FrameType));
if ((mstp_port->DestinationAddress ==
mstp_port->This_Station)
|| (mstp_port->DestinationAddress ==
@@ -714,7 +714,8 @@ bool MSTP_Master_Node_FSM(
uint8_t frame_type = mstp_port->OutputBuffer[2];
uint8_t destination = mstp_port->OutputBuffer[3];
RS485_Send_Frame(mstp_port,
(uint8_t *) & mstp_port->OutputBuffer[0], (uint16_t)length);
(uint8_t *) & mstp_port->OutputBuffer[0],
(uint16_t) length);
mstp_port->FrameCount++;
switch (frame_type) {
case FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY:
@@ -1049,7 +1050,8 @@ bool MSTP_Master_Node_FSM(
/* then call MSTP_Create_And_Send_Frame to transmit the reply frame */
/* and enter the IDLE state to wait for the next frame. */
RS485_Send_Frame(mstp_port,
(uint8_t *) & mstp_port->OutputBuffer[0], (uint16_t)length);
(uint8_t *) & mstp_port->OutputBuffer[0],
(uint16_t) length);
mstp_port->master_state = MSTP_MASTER_STATE_IDLE;
} else {
/* DeferredReply */
+2 -2
View File
@@ -139,7 +139,7 @@ int ptransfer_decode_service_request(
return -1;
}
len = decode_len;
private_data->vendorID = (uint16_t)unsigned_value;
private_data->vendorID = (uint16_t) unsigned_value;
/* Tag 1: serviceNumber */
decode_len = decode_context_unsigned(&apdu[len], 1, &unsigned_value);
if (decode_len < 0) {
@@ -279,7 +279,7 @@ int ptransfer_error_decode_service_request(
return -1;
}
len += decode_len;
private_data->vendorID = (uint16_t)unsigned_value;
private_data->vendorID = (uint16_t) unsigned_value;
/* Tag 2: serviceNumber */
decode_len = decode_context_unsigned(&apdu[len], 2, &unsigned_value);
if (decode_len < 0) {
+1 -1
View File
@@ -87,7 +87,7 @@ BACNET_REJECT_REASON reject_convert_error_code(
break;
}
return(reject_code);
return (reject_code);
}
/* encode service */
+3 -3
View File
@@ -91,7 +91,7 @@ int rp_decode_service_request(
if (rpdata != NULL) {
/* Must have at least 2 tags, an object id and a property identifier
* of at least 1 byte in length to have any chance of parsing */
if(apdu_len < 7) {
if (apdu_len < 7) {
rpdata->error_code = ERROR_CODE_REJECT_MISSING_REQUIRED_PARAMETER;
return BACNET_STATUS_REJECT;
}
@@ -129,8 +129,8 @@ int rp_decode_service_request(
} else
rpdata->array_index = BACNET_ARRAY_ALL;
}
if(len < apdu_len) {
if (len < apdu_len) {
/* If something left over now, we have an invalid request */
rpdata->error_code = ERROR_CODE_REJECT_TOO_MANY_ARGUMENTS;
return BACNET_STATUS_REJECT;
+13 -15
View File
@@ -197,14 +197,14 @@ int rpm_encode_apdu(
int rpm_decode_object_id(
uint8_t * apdu,
unsigned apdu_len,
BACNET_RPM_DATA *rpmdata)
BACNET_RPM_DATA * rpmdata)
{
unsigned len = 0;
uint16_t type = 0; /* for decoding */
/* check for value pointers */
if (apdu && apdu_len && rpmdata) {
if(apdu_len < 5) { /* Must be at least 2 tags and an object id */
if (apdu_len < 5) { /* Must be at least 2 tags and an object id */
rpmdata->error_code = ERROR_CODE_REJECT_MISSING_REQUIRED_PARAMETER;
return BACNET_STATUS_REJECT;
}
@@ -251,7 +251,7 @@ int rpm_decode_object_end(
int rpm_decode_object_property(
uint8_t * apdu,
unsigned apdu_len,
BACNET_RPM_DATA *rpmdata)
BACNET_RPM_DATA * rpmdata)
{
unsigned len = 0;
unsigned option_len = 0;
@@ -267,7 +267,7 @@ int rpm_decode_object_property(
rpmdata->error_code = ERROR_CODE_REJECT_INVALID_TAG;
return BACNET_STATUS_REJECT;
}
len +=
decode_tag_number_and_value(&apdu[len], &tag_number,
&len_value_type);
@@ -279,12 +279,12 @@ int rpm_decode_object_property(
if ((len + len_value_type) >= apdu_len) {
rpmdata->error_code = ERROR_CODE_REJECT_MISSING_REQUIRED_PARAMETER;
return BACNET_STATUS_REJECT;
}
}
len += decode_enumerated(&apdu[len], len_value_type, &property);
rpmdata->object_property = (BACNET_PROPERTY_ID) property;
/* Tag 1: Optional propertyArrayIndex */
rpmdata->array_index = BACNET_ARRAY_ALL; /* Assume most probable outcome */
rpmdata->array_index = BACNET_ARRAY_ALL; /* Assume most probable outcome */
if (IS_CONTEXT_SPECIFIC(apdu[len]) && !IS_CLOSING_TAG(apdu[len])) {
option_len =
(unsigned) decode_tag_number_and_value(&apdu[len], &tag_number,
@@ -293,9 +293,10 @@ int rpm_decode_object_property(
len += option_len;
/* Should be at least the unsigned array index + 1 tag left */
if ((len + len_value_type) >= apdu_len) {
rpmdata->error_code = ERROR_CODE_REJECT_MISSING_REQUIRED_PARAMETER;
rpmdata->error_code =
ERROR_CODE_REJECT_MISSING_REQUIRED_PARAMETER;
return BACNET_STATUS_REJECT;
}
}
len +=
decode_unsigned(&apdu[len], len_value_type, &array_value);
rpmdata->array_index = array_value;
@@ -324,7 +325,7 @@ int rpm_ack_encode_apdu_init(
int rpm_ack_encode_apdu_object_begin(
uint8_t * apdu,
BACNET_RPM_DATA *rpmdata)
BACNET_RPM_DATA * rpmdata)
{
int apdu_len = 0; /* total length of the apdu, return value */
@@ -620,8 +621,7 @@ void testReadPropertyMultiple(
ct_test(pTest, service_request_len > 0);
test_len =
rpm_decode_object_id(service_request, service_request_len,
&rpmdata);
rpm_decode_object_id(service_request, service_request_len, &rpmdata);
ct_test(pTest, test_len > 0);
ct_test(pTest, rpmdata.object_type == OBJECT_DEVICE);
ct_test(pTest, rpmdata.object_instance == 123);
@@ -725,8 +725,7 @@ void testReadPropertyMultipleAck(
/* object beginning */
rpmdata.object_type = OBJECT_DEVICE;
rpmdata.object_instance = 123;
apdu_len +=
rpm_ack_encode_apdu_object_begin(&apdu[apdu_len], &rpmdata);
apdu_len += rpm_ack_encode_apdu_object_begin(&apdu[apdu_len], &rpmdata);
/* reply property */
apdu_len +=
rpm_ack_encode_apdu_object_property(&apdu[apdu_len],
@@ -760,8 +759,7 @@ void testReadPropertyMultipleAck(
/* object beginning */
rpmdata.object_type = OBJECT_ANALOG_INPUT;
rpmdata.object_instance = 33;
apdu_len +=
rpm_ack_encode_apdu_object_begin(&apdu[apdu_len], &rpmdata);
apdu_len += rpm_ack_encode_apdu_object_begin(&apdu[apdu_len], &rpmdata);
/* reply property */
apdu_len +=
rpm_ack_encode_apdu_object_property(&apdu[apdu_len],
+3 -3
View File
@@ -73,7 +73,7 @@ static uint8_t tsm_find_invokeID_index(
for (i = 0; i < MAX_TSM_TRANSACTIONS; i++) {
if (TSM_List[i].InvokeID == invokeID) {
index = (uint8_t)i;
index = (uint8_t) i;
break;
}
}
@@ -89,7 +89,7 @@ static uint8_t tsm_find_first_free_index(
for (i = 0; i < MAX_TSM_TRANSACTIONS; i++) {
if (TSM_List[i].InvokeID == 0) {
index = (uint8_t)i;
index = (uint8_t) i;
break;
}
}
@@ -238,7 +238,7 @@ bool tsm_get_transaction_pdu(
/* FIXME: we may want to free the transaction so it doesn't timeout */
/* retrieve the transaction */
/* FIXME: bounds check the pdu_len? */
*apdu_len = (uint16_t)TSM_List[index].apdu_len;
*apdu_len = (uint16_t) TSM_List[index].apdu_len;
for (j = 0; j < *apdu_len; j++) {
apdu[j] = TSM_List[index].apdu[j];
}