Performed standard indent script indent.sh on project files.

This commit is contained in:
skarg
2010-12-15 19:02:40 +00:00
parent f820697464
commit 2a0bf4926a
107 changed files with 974 additions and 1033 deletions
+12 -13
View File
@@ -797,10 +797,8 @@ void PrintUsage(
(" -t: declare target's MAC instead of using Who-Is to bind to \r\n"); (" -t: declare target's MAC instead of using Who-Is to bind to \r\n");
printf printf
(" device-instance. Format is \"C0:A8:00:18:BA:C0\" (as usual) \r\n"); (" device-instance. Format is \"C0:A8:00:18:BA:C0\" (as usual) \r\n");
printf printf(" Use \"7F:00:00:01:BA:C0\" for loopback testing \r\n");
(" Use \"7F:00:00:01:BA:C0\" for loopback testing \r\n"); printf(" -n: specify target's DNET if not local BACnet network \r\n");
printf
(" -n: specify target's DNET if not local BACnet network \r\n");
printf(" or on routed Virtual Network \r\n"); printf(" or on routed Virtual Network \r\n");
printf("\r\n"); printf("\r\n");
printf("Insert the output in your EPICS file as the last section: \r\n"); printf("Insert the output in your EPICS file as the last section: \r\n");
@@ -840,9 +838,11 @@ int CheckCommandLineArgs(
case 'n': case 'n':
/* Destination Network Number */ /* Destination Network Number */
if (Target_Address.mac_len == 0) if (Target_Address.mac_len == 0)
fprintf(stderr, "Must provide a Target MAC before DNET \r\n"); fprintf(stderr,
"Must provide a Target MAC before DNET \r\n");
if (++i < argc) if (++i < argc)
Target_Address.net = (uint16_t) strtol(argv[i], NULL, 0); Target_Address.net =
(uint16_t) strtol(argv[i], NULL, 0);
/* Used strtol so dest.net can be either 0x1234 or 4660 */ /* Used strtol so dest.net can be either 0x1234 or 4660 */
break; break;
case 't': case 't':
@@ -854,9 +854,8 @@ int CheckCommandLineArgs(
/* loop counter */ /* loop counter */
unsigned j; unsigned j;
count = count =
sscanf(argv[i], "%x:%x:%x:%x:%x:%x", sscanf(argv[i], "%x:%x:%x:%x:%x:%x", &mac[0],
&mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5]);
&mac[5]);
if (count == 6) { /* success */ if (count == 6) { /* success */
Target_Address.mac_len = count; Target_Address.mac_len = count;
for (j = 0; j < 6; j++) { for (j = 0; j < 6; j++) {
@@ -1158,11 +1157,11 @@ int main(
(invoke_id == (invoke_id ==
Read_Property_Multiple_Data.service_data.invoke_id)) { Read_Property_Multiple_Data.service_data.invoke_id)) {
Read_Property_Multiple_Data.new_data = false; Read_Property_Multiple_Data.new_data = false;
PrintReadPropertyData(Read_Property_Multiple_Data. PrintReadPropertyData
rpm_data->object_type, (Read_Property_Multiple_Data.rpm_data->object_type,
Read_Property_Multiple_Data.rpm_data->object_instance, Read_Property_Multiple_Data.rpm_data->object_instance,
Read_Property_Multiple_Data.rpm_data-> Read_Property_Multiple_Data.
listOfProperties); rpm_data->listOfProperties);
if (tsm_invoke_id_free(invoke_id)) { if (tsm_invoke_id_free(invoke_id)) {
invoke_id = 0; invoke_id = 0;
} else { } else {
+11 -13
View File
@@ -128,21 +128,17 @@ void Devices_Init(
/* Gateway Device has already been initialized. /* Gateway Device has already been initialized.
* But give it a better Description. */ * But give it a better Description. */
Routed_Device_Set_Description(DEV_DESCR_GATEWAY, strlen(DEV_DESCR_GATEWAY)); Routed_Device_Set_Description(DEV_DESCR_GATEWAY,
strlen(DEV_DESCR_GATEWAY));
/* Now initialize the remote Device objects. */ /* Now initialize the remote Device objects. */
for ( i = 1; i < MAX_NUM_DEVICES; i++ ) for (i = 1; i < MAX_NUM_DEVICES; i++) {
{
#ifdef _MSC_VER #ifdef _MSC_VER
_snprintf( nameText, MAX_DEV_NAME_LEN, "%s %d", _snprintf(nameText, MAX_DEV_NAME_LEN, "%s %d", DEV_NAME_BASE, i + 1);
DEV_NAME_BASE, i+1); _snprintf(descText, MAX_DEV_DESC_LEN, "%s %d", DEV_DESCR_REMOTE, i);
_snprintf( descText, MAX_DEV_DESC_LEN, "%s %d",
DEV_DESCR_REMOTE, i);
#else #else
snprintf( nameText, MAX_DEV_NAME_LEN, "%s %d", snprintf(nameText, MAX_DEV_NAME_LEN, "%s %d", DEV_NAME_BASE, i + 1);
DEV_NAME_BASE, i+1); snprintf(descText, MAX_DEV_DESC_LEN, "%s %d", DEV_DESCR_REMOTE, i);
snprintf( descText, MAX_DEV_DESC_LEN, "%s %d",
DEV_DESCR_REMOTE, i);
#endif #endif
Add_Routed_Device((first_object_instance + i), nameText, descText); Add_Routed_Device((first_object_instance + i), nameText, descText);
@@ -210,7 +206,8 @@ static void Init_Service_Handlers(
* device.) This is sure to be unique! The port number stays the same. * device.) This is sure to be unique! The port number stays the same.
* - For MS/TP, [Steve inserts a good idea here] * - For MS/TP, [Steve inserts a good idea here]
*/ */
void Initialize_Device_Addresses( ) void Initialize_Device_Addresses(
)
{ {
int i = 0; /* First entry is Gateway Device */ int i = 0; /* First entry is Gateway Device */
DEVICE_OBJECT_DATA *pDev; DEVICE_OBJECT_DATA *pDev;
@@ -311,7 +308,8 @@ int main(
if ((first_object_instance == 0) || if ((first_object_instance == 0) ||
(first_object_instance >= BACNET_MAX_INSTANCE)) { (first_object_instance >= BACNET_MAX_INSTANCE)) {
printf("Error: Invalid Object Instance %s \n", argv[1]); printf("Error: Invalid Object Instance %s \n", argv[1]);
printf( "Provide a number from 1 to %ul \n", BACNET_MAX_INSTANCE -1 ); printf("Provide a number from 1 to %ul \n",
BACNET_MAX_INSTANCE - 1);
exit(1); exit(1);
} }
} }
+4 -5
View File
@@ -346,9 +346,8 @@ static bool cov_send_request(
value_list[1].next = NULL; value_list[1].next = NULL;
switch (cov_subscription->monitoredObjectIdentifier.type) { switch (cov_subscription->monitoredObjectIdentifier.type) {
case OBJECT_BINARY_INPUT: case OBJECT_BINARY_INPUT:
Binary_Input_Encode_Value_List Binary_Input_Encode_Value_List(cov_subscription->
(cov_subscription->monitoredObjectIdentifier.instance, monitoredObjectIdentifier.instance, &value_list[0]);
&value_list[0]);
break; break;
default: default:
goto COV_FAILED; goto COV_FAILED;
@@ -465,8 +464,8 @@ static bool cov_subscribe(
switch (cov_data->monitoredObjectIdentifier.type) { switch (cov_data->monitoredObjectIdentifier.type) {
case OBJECT_BINARY_INPUT: case OBJECT_BINARY_INPUT:
if (Binary_Input_Valid_Instance if (Binary_Input_Valid_Instance(cov_data->
(cov_data->monitoredObjectIdentifier.instance)) { monitoredObjectIdentifier.instance)) {
status = status =
cov_list_subscribe(src, cov_data, error_class, error_code); cov_list_subscribe(src, cov_data, error_class, error_code);
} else { } else {
+12 -16
View File
@@ -82,17 +82,13 @@ static void network_control_handler(
* our specific network is requested, or no specific * our specific network is requested, or no specific
* network is requested. Silently drop other DNET requests. * network is requested. Silently drop other DNET requests.
*/ */
if (npdu_len >= 2) if (npdu_len >= 2) {
{
uint16_t network; uint16_t network;
len += decode_unsigned16(&npdu[len], &network); len += decode_unsigned16(&npdu[len], &network);
if (network == DNET_list[0] ) if (network == DNET_list[0]) {
{
Send_I_Am_Router_To_Network(DNET_list); Send_I_Am_Router_To_Network(DNET_list);
} }
} } else {
else
{
Send_I_Am_Router_To_Network(DNET_list); Send_I_Am_Router_To_Network(DNET_list);
} }
break; break;
@@ -109,8 +105,8 @@ static void network_control_handler(
* later for congestion control - then it could matter. * later for congestion control - then it could matter.
*/ */
debug_printf("%s for Networks: ", debug_printf("%s for Networks: ",
bactext_network_layer_msg_name( bactext_network_layer_msg_name
NETWORK_MESSAGE_I_AM_ROUTER_TO_NETWORK ) ); (NETWORK_MESSAGE_I_AM_ROUTER_TO_NETWORK));
while (npdu_len) { while (npdu_len) {
len = decode_unsigned16(&npdu[npdu_offset], &dnet); len = decode_unsigned16(&npdu[npdu_offset], &dnet);
debug_printf("%hu", dnet); debug_printf("%hu", dnet);
@@ -129,8 +125,8 @@ static void network_control_handler(
if (npdu_len >= 3) { if (npdu_len >= 3) {
decode_unsigned16(&npdu[1], &dnet); decode_unsigned16(&npdu[1], &dnet);
debug_printf("Received %s for Network: ", debug_printf("Received %s for Network: ",
bactext_network_layer_msg_name( bactext_network_layer_msg_name
NETWORK_MESSAGE_I_COULD_BE_ROUTER_TO_NETWORK ) ); (NETWORK_MESSAGE_I_COULD_BE_ROUTER_TO_NETWORK));
debug_printf("%hu, Reason code: %d \n", dnet, npdu[0]); debug_printf("%hu, Reason code: %d \n", dnet, npdu[0]);
} }
break; break;
@@ -203,7 +199,8 @@ static void routed_apdu_handler(
if (!Routed_Device_Is_Valid_Network(dest->net, DNET_list)) { if (!Routed_Device_Is_Valid_Network(dest->net, DNET_list)) {
/* We don't know how to reach this one */ /* We don't know how to reach this one */
Send_Reject_Message_To_Network( src, NETWORK_REJECT_NO_ROUTE, dest->net ); Send_Reject_Message_To_Network(src, NETWORK_REJECT_NO_ROUTE,
dest->net);
return; return;
} }
@@ -265,8 +262,7 @@ void routing_npdu_handler(
} else if (npdu_data.network_layer_message) { } else 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, DNET_list, &npdu_data, network_control_handler(src, DNET_list, &npdu_data,
&pdu[apdu_offset], &pdu[apdu_offset], (uint16_t) (pdu_len - apdu_offset));
(uint16_t) (pdu_len - apdu_offset));
} else { } else {
/* The DNET is set, but we don't support downstream routers, /* The DNET is set, but we don't support downstream routers,
* so we just silently drop this network layer message, * so we just silently drop this network layer message,
@@ -280,8 +276,8 @@ void routing_npdu_handler(
} }
} else { } else {
/* Should we send NETWORK_MESSAGE_REJECT_MESSAGE_TO_NETWORK? */ /* Should we send NETWORK_MESSAGE_REJECT_MESSAGE_TO_NETWORK? */
debug_printf( debug_printf
"NPDU: Unsupported BACnet Protocol Version=%u. Discarded!\n", ("NPDU: Unsupported BACnet Protocol Version=%u. Discarded!\n",
(unsigned) pdu[0]); (unsigned) pdu[0]);
} }
+6 -6
View File
@@ -220,8 +220,8 @@ void rpm_ack_print_data(
#if PRINT_ENABLED #if PRINT_ENABLED
if (listOfProperties->propertyIdentifier < 512) { if (listOfProperties->propertyIdentifier < 512) {
fprintf(stdout, " %s: ", fprintf(stdout, " %s: ",
bactext_property_name(listOfProperties-> bactext_property_name
propertyIdentifier)); (listOfProperties->propertyIdentifier));
} else { } else {
fprintf(stdout, " proprietary %u: ", fprintf(stdout, " proprietary %u: ",
(unsigned) listOfProperties->propertyIdentifier); (unsigned) listOfProperties->propertyIdentifier);
@@ -268,10 +268,10 @@ void rpm_ack_print_data(
#if PRINT_ENABLED #if PRINT_ENABLED
/* AccessError */ /* AccessError */
fprintf(stdout, "BACnet Error: %s: %s\r\n", fprintf(stdout, "BACnet Error: %s: %s\r\n",
bactext_error_class_name((int) listOfProperties-> bactext_error_class_name((int) listOfProperties->error.
error.error_class), error_class),
bactext_error_code_name((int) listOfProperties-> bactext_error_code_name((int) listOfProperties->error.
error.error_code)); error_code));
#endif #endif
} }
listOfProperties = listOfProperties->next; listOfProperties = listOfProperties->next;
+2 -2
View File
@@ -104,8 +104,8 @@ void handler_ucov_notification(
fprintf(stderr, "UCOV: "); fprintf(stderr, "UCOV: ");
if (pProperty_value->propertyIdentifier < 512) { if (pProperty_value->propertyIdentifier < 512) {
fprintf(stderr, "%s ", fprintf(stderr, "%s ",
bactext_property_name bactext_property_name(pProperty_value->
(pProperty_value->propertyIdentifier)); propertyIdentifier));
} else { } else {
fprintf(stderr, "proprietary %u ", fprintf(stderr, "proprietary %u ",
pProperty_value->propertyIdentifier); pProperty_value->propertyIdentifier);
+2 -2
View File
@@ -157,8 +157,8 @@ static void check_who_is_for_routing(
while (Routed_Device_GetNext(&bcast_net, my_list, &cursor)) { while (Routed_Device_GetNext(&bcast_net, my_list, &cursor)) {
dev_instance = Device_Object_Instance_Number(); dev_instance = Device_Object_Instance_Number();
if ( (high_limit == 0) || if ((high_limit == 0) || ((dev_instance >= low_limit) &&
((dev_instance >= low_limit) && (dev_instance <= high_limit))) { (dev_instance <= high_limit))) {
if (is_unicast) if (is_unicast)
Send_I_Am_Unicast(&Handler_Transmit_Buffer[0], src); Send_I_Am_Unicast(&Handler_Transmit_Buffer[0], src);
else else
+3 -4
View File
@@ -178,12 +178,11 @@ bool WPValidateString(
0)) { 0)) {
*pErrorCode = ERROR_CODE_VALUE_OUT_OF_RANGE; *pErrorCode = ERROR_CODE_VALUE_OUT_OF_RANGE;
} else if ((bEmptyAllowed == false) && } else if ((bEmptyAllowed == false) &&
(!characterstring_printable( (!characterstring_printable(&pValue->type.Character_String))) {
&pValue->type.Character_String))) {
/* assumption: non-empty also means must be "printable" */ /* assumption: non-empty also means must be "printable" */
*pErrorCode = ERROR_CODE_VALUE_OUT_OF_RANGE; *pErrorCode = ERROR_CODE_VALUE_OUT_OF_RANGE;
} else if (characterstring_length(&pValue-> } else if (characterstring_length(&pValue->type.
type.Character_String) >= iMaxLen) { Character_String) >= iMaxLen) {
*pErrorClass = ERROR_CLASS_RESOURCES; *pErrorClass = ERROR_CLASS_RESOURCES;
*pErrorCode = ERROR_CODE_NO_SPACE_TO_WRITE_PROPERTY; *pErrorCode = ERROR_CODE_NO_SPACE_TO_WRITE_PROPERTY;
} else } else
+4 -2
View File
@@ -65,7 +65,8 @@ int iam_encode_pdu(
pdu_len = npdu_encode_pdu(&buffer[0], dest, &my_address, npdu_data); pdu_len = npdu_encode_pdu(&buffer[0], dest, &my_address, npdu_data);
/* encode the APDU portion of the packet */ /* encode the APDU portion of the packet */
len = iam_encode_apdu(&buffer[pdu_len], Device_Object_Instance_Number(), len =
iam_encode_apdu(&buffer[pdu_len], Device_Object_Instance_Number(),
MAX_APDU, SEGMENTATION_NONE, Device_Vendor_Identifier()); MAX_APDU, SEGMENTATION_NONE, Device_Vendor_Identifier());
pdu_len += len; pdu_len += len;
@@ -139,7 +140,8 @@ int iam_unicast_encode_pdu(
npdu_encode_npdu_data(npdu_data, false, MESSAGE_PRIORITY_NORMAL); npdu_encode_npdu_data(npdu_data, false, MESSAGE_PRIORITY_NORMAL);
npdu_len = npdu_encode_pdu(&buffer[0], dest, &my_address, npdu_data); npdu_len = npdu_encode_pdu(&buffer[0], dest, &my_address, npdu_data);
/* encode the APDU portion of the packet */ /* encode the APDU portion of the packet */
apdu_len = iam_encode_apdu(&buffer[npdu_len], Device_Object_Instance_Number(), apdu_len =
iam_encode_apdu(&buffer[npdu_len], Device_Object_Instance_Number(),
MAX_APDU, SEGMENTATION_NONE, Device_Vendor_Identifier()); MAX_APDU, SEGMENTATION_NONE, Device_Vendor_Identifier());
pdu_len = npdu_len + apdu_len; pdu_len = npdu_len + apdu_len;
+3 -1
View File
@@ -75,7 +75,9 @@ void Send_I_Have(
datalink_get_broadcast_address(&dest); datalink_get_broadcast_address(&dest);
/* encode the NPDU portion of the packet */ /* encode the NPDU portion of the packet */
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], &dest, &my_address, &npdu_data); pdu_len =
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
&npdu_data);
/* encode the APDU portion of the packet */ /* encode the APDU portion of the packet */
data.device_id.type = OBJECT_DEVICE; data.device_id.type = OBJECT_DEVICE;
+16 -18
View File
@@ -121,9 +121,8 @@ int Send_Network_Layer_Message(
if (network_message_type == NETWORK_MESSAGE_INIT_RT_TABLE) if (network_message_type == NETWORK_MESSAGE_INIT_RT_TABLE)
data_expecting_reply = true; /* DER in this one case */ data_expecting_reply = true; /* DER in this one case */
npdu_encode_npdu_network(&npdu_data, npdu_encode_npdu_network(&npdu_data, network_message_type,
network_message_type, data_expecting_reply, data_expecting_reply, MESSAGE_PRIORITY_NORMAL);
MESSAGE_PRIORITY_NORMAL);
/* We don't need src information, since a message can't originate from /* We don't need src information, since a message can't originate from
* our downstream BACnet network. * our downstream BACnet network.
@@ -132,8 +131,7 @@ int Send_Network_Layer_Message(
npdu_encode_pdu(&Handler_Transmit_Buffer[0], dst, NULL, &npdu_data); npdu_encode_pdu(&Handler_Transmit_Buffer[0], dst, NULL, &npdu_data);
/* Now encode the optional payload bytes, per message type */ /* Now encode the optional payload bytes, per message type */
switch ( network_message_type ) switch (network_message_type) {
{
case NETWORK_MESSAGE_WHO_IS_ROUTER_TO_NETWORK: case NETWORK_MESSAGE_WHO_IS_ROUTER_TO_NETWORK:
if (*pVal >= 0) { if (*pVal >= 0) {
len = len =
@@ -190,7 +188,8 @@ int Send_Network_Layer_Message(
pdu_len += len; pdu_len += len;
Handler_Transmit_Buffer[pdu_len++] = portID++; Handler_Transmit_Buffer[pdu_len++] = portID++;
Handler_Transmit_Buffer[pdu_len++] = 0; Handler_Transmit_Buffer[pdu_len++] = 0;
debug_printf( " Sending Routing Table entry for %u \n", *pVal ); debug_printf(" Sending Routing Table entry for %u \n",
*pVal);
pVal++; pVal++;
} }
} }
@@ -205,8 +204,7 @@ int Send_Network_Layer_Message(
if (dst != NULL) if (dst != NULL)
debug_printf("Sending %s message to BACnet network %u \n", debug_printf("Sending %s message to BACnet network %u \n",
bactext_network_layer_msg_name( network_message_type ), bactext_network_layer_msg_name(network_message_type), dst->net);
dst->net );
else else
debug_printf("Sending %s message to local BACnet network \n", debug_printf("Sending %s message to local BACnet network \n",
bactext_network_layer_msg_name(network_message_type)); bactext_network_layer_msg_name(network_message_type));
@@ -242,8 +240,8 @@ void Send_Who_Is_Router_To_Network(
BACNET_ADDRESS * dst, BACNET_ADDRESS * dst,
int dnet) int dnet)
{ {
Send_Network_Layer_Message( NETWORK_MESSAGE_WHO_IS_ROUTER_TO_NETWORK, Send_Network_Layer_Message(NETWORK_MESSAGE_WHO_IS_ROUTER_TO_NETWORK, dst,
dst, &dnet ); &dnet);
} }
/** Broadcast an I-am-router-to-network message, giving the list of networks /** Broadcast an I-am-router-to-network message, giving the list of networks
@@ -259,8 +257,8 @@ void Send_I_Am_Router_To_Network(
const int DNET_list[]) const int DNET_list[])
{ {
/* Use a NULL dst here since we want a broadcast MAC address. */ /* Use a NULL dst here since we want a broadcast MAC address. */
Send_Network_Layer_Message( NETWORK_MESSAGE_I_AM_ROUTER_TO_NETWORK, Send_Network_Layer_Message(NETWORK_MESSAGE_I_AM_ROUTER_TO_NETWORK, NULL,
NULL, (int *) DNET_list ); (int *) DNET_list);
} }
/** Finds a specific router, or all reachable BACnet networks. /** Finds a specific router, or all reachable BACnet networks.
@@ -281,8 +279,8 @@ void Send_Reject_Message_To_Network(
int iArgs[2]; int iArgs[2];
iArgs[0] = reject_reason; iArgs[0] = reject_reason;
iArgs[1] = dnet; iArgs[1] = dnet;
Send_Network_Layer_Message( NETWORK_MESSAGE_REJECT_MESSAGE_TO_NETWORK, Send_Network_Layer_Message(NETWORK_MESSAGE_REJECT_MESSAGE_TO_NETWORK, dst,
dst, iArgs ); iArgs);
debug_printf(" Reject Reason=%d, DNET=%u\n", reject_reason, dnet); debug_printf(" Reject Reason=%d, DNET=%u\n", reject_reason, dnet);
} }
@@ -308,8 +306,8 @@ void Send_Initialize_Routing_Table(
const int DNET_list[]) const int DNET_list[])
{ {
/* Use a NULL dst here since we want a broadcast MAC address. */ /* Use a NULL dst here since we want a broadcast MAC address. */
Send_Network_Layer_Message( NETWORK_MESSAGE_INIT_RT_TABLE, Send_Network_Layer_Message(NETWORK_MESSAGE_INIT_RT_TABLE, dst,
dst, (int *) DNET_list ); (int *) DNET_list);
} }
@@ -334,6 +332,6 @@ void Send_Initialize_Routing_Table_Ack(
BACNET_ADDRESS * dst, BACNET_ADDRESS * dst,
const int DNET_list[]) const int DNET_list[])
{ {
Send_Network_Layer_Message( NETWORK_MESSAGE_INIT_RT_TABLE_ACK, Send_Network_Layer_Message(NETWORK_MESSAGE_INIT_RT_TABLE_ACK, dst,
dst, (int *) DNET_list ); (int *) DNET_list);
} }
+4 -2
View File
@@ -65,7 +65,8 @@ void Send_TimeSync(
/* encode the NPDU portion of the packet */ /* encode the NPDU portion of the packet */
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL); npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
pdu_len = pdu_len =
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address, &npdu_data); npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
&npdu_data);
/* encode the APDU portion of the packet */ /* encode the APDU portion of the packet */
len = len =
@@ -101,7 +102,8 @@ void Send_TimeSyncUTC(
/* encode the NPDU portion of the packet */ /* encode the NPDU portion of the packet */
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL); npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
pdu_len = pdu_len =
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address, &npdu_data); npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
&npdu_data);
/* encode the APDU portion of the packet */ /* encode the APDU portion of the packet */
pdu_len = pdu_len =
+3 -1
View File
@@ -61,7 +61,9 @@ void Send_UnconfirmedPrivateTransfer(
datalink_get_my_address(&my_address); datalink_get_my_address(&my_address);
/* encode the NPDU portion of the packet */ /* encode the NPDU portion of the packet */
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], dest, &my_address, &npdu_data); pdu_len =
npdu_encode_pdu(&Handler_Transmit_Buffer[0], dest, &my_address,
&npdu_data);
/* encode the APDU portion of the packet */ /* encode the APDU portion of the packet */
len = len =
+4 -2
View File
@@ -77,7 +77,8 @@ void Send_WhoHas_Name(
/* encode the NPDU portion of the packet */ /* encode the NPDU portion of the packet */
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL); npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
pdu_len = pdu_len =
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address, &npdu_data); npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
&npdu_data);
/* encode the APDU portion of the packet */ /* encode the APDU portion of the packet */
data.low_limit = low_limit; data.low_limit = low_limit;
@@ -131,7 +132,8 @@ void Send_WhoHas_Object(
/* encode the NPDU portion of the packet */ /* encode the NPDU portion of the packet */
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL); npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
pdu_len = pdu_len =
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address, &npdu_data); npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
&npdu_data);
/* encode the APDU portion of the packet */ /* encode the APDU portion of the packet */
data.low_limit = low_limit; data.low_limit = low_limit;
+2 -1
View File
@@ -72,7 +72,8 @@ void Send_WhoIs_To_Network(
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL); npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
pdu_len = pdu_len =
npdu_encode_pdu(&Handler_Transmit_Buffer[0], target_address, &my_address, &npdu_data); npdu_encode_pdu(&Handler_Transmit_Buffer[0], target_address,
&my_address, &npdu_data);
/* encode the APDU portion of the packet */ /* encode the APDU portion of the packet */
len = len =
whois_encode_apdu(&Handler_Transmit_Buffer[pdu_len], low_limit, whois_encode_apdu(&Handler_Transmit_Buffer[pdu_len], low_limit,
+2 -3
View File
@@ -155,9 +155,8 @@ uint8_t Send_Write_Property_Request(
#if PRINT_ENABLED_DEBUG #if PRINT_ENABLED_DEBUG
fprintf(stderr, "WriteProperty service: " "%s tag=%d\n", fprintf(stderr, "WriteProperty service: " "%s tag=%d\n",
(object_value->context_specific ? "context" : "application"), (object_value->context_specific ? "context" : "application"),
(int) (object_value-> (int) (object_value->context_specific ? object_value->
context_specific ? object_value->context_tag : object_value-> context_tag : object_value->tag));
tag));
#endif #endif
len = bacapp_encode_data(&application_data[apdu_len], object_value); len = bacapp_encode_data(&application_data[apdu_len], object_value);
if ((len + apdu_len) < MAX_APDU) { if ((len + apdu_len) < MAX_APDU) {
+1 -2
View File
@@ -333,8 +333,7 @@ int main(
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_Initialize_Routing_Table(&Target_Router_Address, Send_Initialize_Routing_Table(&Target_Router_Address, DNET_list);
DNET_list);
/* loop forever */ /* loop forever */
for (;;) { for (;;) {
/* increment timer - exit if timed out */ /* increment timer - exit if timed out */
+4 -4
View File
@@ -446,11 +446,11 @@ bool Analog_Output_Write_Property(
if (status) { if (status) {
level = AO_LEVEL_NULL; level = AO_LEVEL_NULL;
object_index = object_index =
Analog_Output_Instance_To_Index Analog_Output_Instance_To_Index(wp_data->
(wp_data->object_instance); object_instance);
status = status =
Analog_Output_Present_Value_Relinquish Analog_Output_Present_Value_Relinquish(wp_data->
(wp_data->object_instance, wp_data->priority); object_instance, wp_data->priority);
if (!status) { if (!status) {
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;
+2 -2
View File
@@ -396,8 +396,8 @@ bool Analog_Value_Write_Property(
if (status) { if (status) {
level = ANALOG_LEVEL_NULL; level = ANALOG_LEVEL_NULL;
object_index = object_index =
Analog_Value_Instance_To_Index Analog_Value_Instance_To_Index(wp_data->
(wp_data->object_instance); object_instance);
priority = wp_data->priority; priority = wp_data->priority;
if (priority && (priority <= BACNET_MAX_PRIORITY)) { if (priority && (priority <= BACNET_MAX_PRIORITY)) {
priority--; priority--;
+4 -4
View File
@@ -375,8 +375,8 @@ bool Binary_Output_Write_Property(
(value.type.Enumerated <= MAX_BINARY_PV)) { (value.type.Enumerated <= MAX_BINARY_PV)) {
level = (BACNET_BINARY_PV) value.type.Enumerated; level = (BACNET_BINARY_PV) value.type.Enumerated;
object_index = object_index =
Binary_Output_Instance_To_Index Binary_Output_Instance_To_Index(wp_data->
(wp_data->object_instance); object_instance);
priority--; priority--;
Binary_Output_Level[object_index][priority] = level; Binary_Output_Level[object_index][priority] = level;
/* Note: you could set the physical output here if we /* Note: you could set the physical output here if we
@@ -402,8 +402,8 @@ bool Binary_Output_Write_Property(
if (status) { if (status) {
level = BINARY_NULL; level = BINARY_NULL;
object_index = object_index =
Binary_Output_Instance_To_Index Binary_Output_Instance_To_Index(wp_data->
(wp_data->object_instance); object_instance);
priority = wp_data->priority; priority = wp_data->priority;
if (priority && (priority <= BACNET_MAX_PRIORITY)) { if (priority && (priority <= BACNET_MAX_PRIORITY)) {
priority--; priority--;
+4 -4
View File
@@ -358,8 +358,8 @@ bool Binary_Value_Write_Property(
(value.type.Enumerated <= MAX_BINARY_PV)) { (value.type.Enumerated <= MAX_BINARY_PV)) {
level = (BACNET_BINARY_PV) value.type.Enumerated; level = (BACNET_BINARY_PV) value.type.Enumerated;
object_index = object_index =
Binary_Value_Instance_To_Index Binary_Value_Instance_To_Index(wp_data->
(wp_data->object_instance); object_instance);
priority--; priority--;
Binary_Value_Level[object_index][priority] = level; Binary_Value_Level[object_index][priority] = level;
/* Note: you could set the physical output here if we /* Note: you could set the physical output here if we
@@ -385,8 +385,8 @@ bool Binary_Value_Write_Property(
if (status) { if (status) {
level = BINARY_NULL; level = BINARY_NULL;
object_index = object_index =
Binary_Value_Instance_To_Index Binary_Value_Instance_To_Index(wp_data->
(wp_data->object_instance); object_instance);
priority = wp_data->priority; priority = wp_data->priority;
if (priority && (priority <= BACNET_MAX_PRIORITY)) { if (priority && (priority <= BACNET_MAX_PRIORITY)) {
priority--; priority--;
+16 -15
View File
@@ -1141,8 +1141,8 @@ bool Device_Write_Property_Local(
&wp_data->error_class, &wp_data->error_code); &wp_data->error_class, &wp_data->error_code);
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(value.type. (Device_Set_Object_Instance_Number(value.type.Object_Id.
Object_Id.instance))) { instance))) {
/* FIXME: we could send an I-Am broadcast to let the world know */ /* FIXME: we could send an I-Am broadcast to let the world know */
} else { } else {
status = false; status = false;
@@ -1175,8 +1175,8 @@ bool Device_Write_Property_Local(
&wp_data->error_class, &wp_data->error_code); &wp_data->error_class, &wp_data->error_code);
if (status) { if (status) {
/* FIXME: bounds check? */ /* FIXME: bounds check? */
Device_Set_Vendor_Identifier((uint16_t) value. Device_Set_Vendor_Identifier((uint16_t) value.type.
type.Unsigned_Int); Unsigned_Int);
} }
break; break;
case PROP_SYSTEM_STATUS: case PROP_SYSTEM_STATUS:
@@ -1203,8 +1203,8 @@ bool Device_Write_Property_Local(
WPValidateString(&value, MAX_DEV_NAME_LEN, false, WPValidateString(&value, MAX_DEV_NAME_LEN, false,
&wp_data->error_class, &wp_data->error_code); &wp_data->error_class, &wp_data->error_code);
if (status) { if (status) {
Device_Set_Object_Name(characterstring_value(&value. Device_Set_Object_Name(characterstring_value(&value.type.
type.Character_String), Character_String),
characterstring_length(&value.type.Character_String)); characterstring_length(&value.type.Character_String));
} }
break; break;
@@ -1213,8 +1213,8 @@ bool Device_Write_Property_Local(
WPValidateString(&value, MAX_DEV_LOC_LEN, true, WPValidateString(&value, MAX_DEV_LOC_LEN, true,
&wp_data->error_class, &wp_data->error_code); &wp_data->error_class, &wp_data->error_code);
if (status) { if (status) {
Device_Set_Location(characterstring_value(&value. Device_Set_Location(characterstring_value(&value.type.
type.Character_String), Character_String),
characterstring_length(&value.type.Character_String)); characterstring_length(&value.type.Character_String));
} }
break; break;
@@ -1224,8 +1224,8 @@ bool Device_Write_Property_Local(
WPValidateString(&value, MAX_DEV_DESC_LEN, true, WPValidateString(&value, MAX_DEV_DESC_LEN, true,
&wp_data->error_class, &wp_data->error_code); &wp_data->error_class, &wp_data->error_code);
if (status) { if (status) {
Device_Set_Description(characterstring_value(&value. Device_Set_Description(characterstring_value(&value.type.
type.Character_String), Character_String),
characterstring_length(&value.type.Character_String)); characterstring_length(&value.type.Character_String));
} }
break; break;
@@ -1234,8 +1234,8 @@ bool Device_Write_Property_Local(
WPValidateString(&value, MAX_DEV_MOD_LEN, true, WPValidateString(&value, MAX_DEV_MOD_LEN, true,
&wp_data->error_class, &wp_data->error_code); &wp_data->error_class, &wp_data->error_code);
if (status) { if (status) {
Device_Set_Model_Name(characterstring_value(&value. Device_Set_Model_Name(characterstring_value(&value.type.
type.Character_String), Character_String),
characterstring_length(&value.type.Character_String)); characterstring_length(&value.type.Character_String));
} }
break; break;
@@ -1247,8 +1247,8 @@ bool Device_Write_Property_Local(
&wp_data->error_class, &wp_data->error_code); &wp_data->error_class, &wp_data->error_code);
if (status) { if (status) {
if (value.type.Unsigned_Int <= 255) { if (value.type.Unsigned_Int <= 255) {
dlmstp_set_max_info_frames((uint8_t) value. dlmstp_set_max_info_frames((uint8_t) value.type.
type.Unsigned_Int); Unsigned_Int);
} else { } else {
status = false; status = false;
wp_data->error_class = ERROR_CLASS_PROPERTY; wp_data->error_class = ERROR_CLASS_PROPERTY;
@@ -1419,7 +1419,8 @@ void Routing_Device_Init(
/* Now substitute our routed versions of the main object functions. */ /* Now substitute our routed versions of the main object functions. */
pDevObject = &Object_Table[0]; pDevObject = &Object_Table[0];
pDevObject->Object_Index_To_Instance = Routed_Device_Index_To_Instance; pDevObject->Object_Index_To_Instance = Routed_Device_Index_To_Instance;
pDevObject->Object_Valid_Instance = Routed_Device_Valid_Object_Instance_Number; pDevObject->Object_Valid_Instance =
Routed_Device_Valid_Object_Instance_Number;
pDevObject->Object_Name = Routed_Device_Name; pDevObject->Object_Name = Routed_Device_Name;
pDevObject->Object_Read_Property = Routed_Device_Read_Property_Local; pDevObject->Object_Read_Property = Routed_Device_Read_Property_Local;
pDevObject->Object_Write_Property = Routed_Device_Write_Property_Local; pDevObject->Object_Write_Property = Routed_Device_Write_Property_Local;
+12 -21
View File
@@ -120,8 +120,7 @@ uint16_t Add_Routed_Device(
const char *sDescription) const char *sDescription)
{ {
int i = Num_Managed_Devices; int i = Num_Managed_Devices;
if ( i < MAX_NUM_DEVICES ) if (i < MAX_NUM_DEVICES) {
{
DEVICE_OBJECT_DATA *pDev = &Devices[i]; DEVICE_OBJECT_DATA *pDev = &Devices[i];
Num_Managed_Devices++; Num_Managed_Devices++;
iCurrent_Device_Idx = i; iCurrent_Device_Idx = i;
@@ -137,8 +136,7 @@ uint16_t Add_Routed_Device(
Routed_Device_Set_Description("No Descr", strlen("No Descr")); Routed_Device_Set_Description("No Descr", strlen("No Descr"));
pDev->Database_Revision = 0; /* Reset/Initialize now */ pDev->Database_Revision = 0; /* Reset/Initialize now */
return i; return i;
} } else
else
return -1; return -1;
} }
@@ -160,8 +158,7 @@ DEVICE_OBJECT_DATA * Get_Routed_Device_Object(
else if ((idx >= 0) && (idx < MAX_NUM_DEVICES)) { else if ((idx >= 0) && (idx < MAX_NUM_DEVICES)) {
iCurrent_Device_Idx = idx; iCurrent_Device_Idx = idx;
return &Devices[idx]; return &Devices[idx];
} } else
else
return NULL; return NULL;
} }
@@ -182,8 +179,7 @@ BACNET_ADDRESS * Get_Routed_Device_Address(
else if ((idx >= 0) && (idx < MAX_NUM_DEVICES)) { else if ((idx >= 0) && (idx < MAX_NUM_DEVICES)) {
iCurrent_Device_Idx = idx; iCurrent_Device_Idx = idx;
return &Devices[idx].bacDevAddr; return &Devices[idx].bacDevAddr;
} } else
else
return NULL; return NULL;
} }
@@ -198,7 +194,6 @@ BACNET_ADDRESS * Get_Routed_Device_Address(
*/ */
void routed_get_my_address( void routed_get_my_address(
BACNET_ADDRESS * my_address) BACNET_ADDRESS * my_address)
{ {
if (my_address) { if (my_address) {
memcpy(my_address, &Devices[iCurrent_Device_Idx].bacDevAddr, memcpy(my_address, &Devices[iCurrent_Device_Idx].bacDevAddr,
@@ -299,8 +294,7 @@ bool Routed_Device_GetNext(
*/ */
else if (dest->net == BACNET_BROADCAST_NETWORK) { else if (dest->net == BACNET_BROADCAST_NETWORK) {
/* Just take the entry indexed by the cursor */ /* Just take the entry indexed by the cursor */
bSuccess = Routed_Device_Address_Lookup( idx++, bSuccess = Routed_Device_Address_Lookup(idx++, dest->len, dest->adr);
dest->len, dest->adr );
} }
/* Or see if it's for the main Gateway Device, because /* Or see if it's for the main Gateway Device, because
* there's no routing info. * there's no routing info.
@@ -309,8 +303,7 @@ bool Routed_Device_GetNext(
/* Handle like a normal, non-routed access of the Gateway Device. /* Handle like a normal, non-routed access of the Gateway Device.
* But first, make sure our internal access is pointing at * But first, make sure our internal access is pointing at
* that Device in our table by telling it "no routing info" : */ * that Device in our table by telling it "no routing info" : */
bSuccess = Routed_Device_Address_Lookup( 0, bSuccess = Routed_Device_Address_Lookup(0, dest->len, dest->adr);
dest->len, dest->adr );
/* Next step: no more matches: */ /* Next step: no more matches: */
idx = -1; idx = -1;
} }
@@ -323,8 +316,8 @@ bool Routed_Device_GetNext(
if (idx == 0) /* Step over this case (starting point) */ if (idx == 0) /* Step over this case (starting point) */
idx = 1; idx = 1;
while (idx < MAX_NUM_DEVICES) { while (idx < MAX_NUM_DEVICES) {
bSuccess = Routed_Device_Address_Lookup( idx++, bSuccess =
dest->len, dest->adr ); Routed_Device_Address_Lookup(idx++, dest->len, dest->adr);
if (bSuccess) if (bSuccess)
break; /* We don't need to keep looking */ break; /* We don't need to keep looking */
} }
@@ -489,8 +482,8 @@ bool Routed_Device_Write_Property_Local(
&wp_data->error_class, &wp_data->error_code); &wp_data->error_class, &wp_data->error_code);
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(value.type. (Routed_Device_Set_Object_Instance_Number(value.
Object_Id.instance))) { type.Object_Id.instance))) {
/* FIXME: we could send an I-Am broadcast to let the world know */ /* FIXME: we could send an I-Am broadcast to let the world know */
} else { } else {
status = false; status = false;
@@ -504,8 +497,8 @@ bool Routed_Device_Write_Property_Local(
WPValidateString(&value, MAX_DEV_NAME_LEN, false, WPValidateString(&value, MAX_DEV_NAME_LEN, false,
&wp_data->error_class, &wp_data->error_code); &wp_data->error_class, &wp_data->error_code);
if (status) { if (status) {
Routed_Device_Set_Object_Name(characterstring_value(&value. Routed_Device_Set_Object_Name(characterstring_value
type.Character_String), (&value.type.Character_String),
characterstring_length(&value.type.Character_String)); characterstring_length(&value.type.Character_String));
} }
break; break;
@@ -599,5 +592,3 @@ void Routed_Device_Inc_Database_Revision(
DEVICE_OBJECT_DATA *pDev = &Devices[iCurrent_Device_Idx]; DEVICE_OBJECT_DATA *pDev = &Devices[iCurrent_Device_Idx];
pDev->Database_Revision++; pDev->Database_Revision++;
} }
+8 -8
View File
@@ -469,8 +469,8 @@ int Lighting_Output_Read_Property(
object_index = object_index =
Lighting_Output_Instance_To_Index(rpdata->object_instance); Lighting_Output_Instance_To_Index(rpdata->object_instance);
if (rpdata->array_index <= BACNET_MAX_PRIORITY) { if (rpdata->array_index <= BACNET_MAX_PRIORITY) {
if (Lighting_Output_Level[object_index][rpdata->array_index if (Lighting_Output_Level[object_index][rpdata->
- 1] == LIGHTING_LEVEL_NULL) array_index - 1] == LIGHTING_LEVEL_NULL)
apdu_len = encode_application_null(&apdu[0]); apdu_len = encode_application_null(&apdu[0]);
else { else {
real_value = Lighting_Output_Level[object_index] real_value = Lighting_Output_Level[object_index]
@@ -554,11 +554,11 @@ bool Lighting_Output_Write_Property(
if (status) { if (status) {
level = LIGHTING_LEVEL_NULL; level = LIGHTING_LEVEL_NULL;
object_index = object_index =
Lighting_Output_Instance_To_Index Lighting_Output_Instance_To_Index(wp_data->
(wp_data->object_instance); object_instance);
status = status =
Lighting_Output_Present_Value_Relinquish Lighting_Output_Present_Value_Relinquish(wp_data->
(wp_data->object_instance, wp_data->priority); object_instance, wp_data->priority);
if (wp_data->priority == 6) { if (wp_data->priority == 6) {
/* 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
@@ -585,8 +585,8 @@ bool Lighting_Output_Write_Property(
&wp_data->error_class, &wp_data->error_code); &wp_data->error_class, &wp_data->error_code);
if (status) { if (status) {
object_index = object_index =
Lighting_Output_Instance_To_Index Lighting_Output_Instance_To_Index(wp_data->
(wp_data->object_instance); object_instance);
Lighting_Output_Out_Of_Service[object_index] = Lighting_Output_Out_Of_Service[object_index] =
value.type.Boolean; value.type.Boolean;
} }
+4 -4
View File
@@ -323,8 +323,8 @@ bool Life_Safety_Point_Write_Property(
if (status) { if (status) {
if (value.type.Enumerated <= MAX_LIFE_SAFETY_MODE) { if (value.type.Enumerated <= MAX_LIFE_SAFETY_MODE) {
object_index = object_index =
Life_Safety_Point_Instance_To_Index Life_Safety_Point_Instance_To_Index(wp_data->
(wp_data->object_instance); object_instance);
Life_Safety_Point_Mode[object_index] = Life_Safety_Point_Mode[object_index] =
value.type.Enumerated; value.type.Enumerated;
} else { } else {
@@ -340,8 +340,8 @@ bool Life_Safety_Point_Write_Property(
&wp_data->error_class, &wp_data->error_code); &wp_data->error_class, &wp_data->error_code);
if (status) { if (status) {
object_index = object_index =
Life_Safety_Point_Instance_To_Index Life_Safety_Point_Instance_To_Index(wp_data->
(wp_data->object_instance); object_instance);
Life_Safety_Point_Out_Of_Service[object_index] = Life_Safety_Point_Out_Of_Service[object_index] =
value.type.Boolean; value.type.Boolean;
} }
+10 -12
View File
@@ -277,8 +277,7 @@ static char *Multistate_Input_State_Text(
char *pName = NULL; /* return value */ char *pName = NULL; /* return value */
index = Multistate_Input_Instance_To_Index(object_instance); index = Multistate_Input_Instance_To_Index(object_instance);
if ((index < MAX_MULTISTATE_INPUTS) && if ((index < MAX_MULTISTATE_INPUTS) && (state_index > 0) &&
(state_index > 0) &&
(state_index <= MULTISTATE_NUMBER_OF_STATES)) { (state_index <= MULTISTATE_NUMBER_OF_STATES)) {
state_index--; state_index--;
pName = State_Text[index][state_index]; pName = State_Text[index][state_index];
@@ -298,8 +297,7 @@ bool Multistate_Input_State_Text_Set(
bool status = false; /* return value */ bool status = false; /* return value */
index = Multistate_Input_Instance_To_Index(object_instance); index = Multistate_Input_Instance_To_Index(object_instance);
if ((index < MAX_MULTISTATE_INPUTS) && if ((index < MAX_MULTISTATE_INPUTS) && (state_index > 0) &&
(state_index > 0) &&
(state_index <= MULTISTATE_NUMBER_OF_STATES)) { (state_index <= MULTISTATE_NUMBER_OF_STATES)) {
state_index--; state_index--;
status = true; status = true;
@@ -405,8 +403,8 @@ int Multistate_Input_Read_Property(
/* 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. */ /* into one packet. */
object_index = object_index =
Multistate_Input_Instance_To_Index Multistate_Input_Instance_To_Index(rpdata->
(rpdata->object_instance); object_instance);
for (i = 1; i <= MULTISTATE_NUMBER_OF_STATES; i++) { for (i = 1; i <= MULTISTATE_NUMBER_OF_STATES; i++) {
characterstring_init_ansi(&char_string, characterstring_init_ansi(&char_string,
Multistate_Input_State_Text(rpdata->object_instance, Multistate_Input_State_Text(rpdata->object_instance,
@@ -427,8 +425,8 @@ int Multistate_Input_Read_Property(
} }
} else { } else {
object_index = object_index =
Multistate_Input_Instance_To_Index Multistate_Input_Instance_To_Index(rpdata->
(rpdata->object_instance); object_instance);
if (rpdata->array_index <= MULTISTATE_NUMBER_OF_STATES) { if (rpdata->array_index <= MULTISTATE_NUMBER_OF_STATES) {
characterstring_init_ansi(&char_string, characterstring_init_ansi(&char_string,
Multistate_Input_State_Text(rpdata->object_instance, Multistate_Input_State_Text(rpdata->object_instance,
@@ -488,8 +486,8 @@ bool Multistate_Input_Write_Property(
if (status) { if (status) {
if (Out_Of_Service[object_index]) { if (Out_Of_Service[object_index]) {
status = status =
Multistate_Input_Present_Value_Set Multistate_Input_Present_Value_Set(wp_data->
(wp_data->object_instance, value.type.Unsigned_Int); object_instance, value.type.Unsigned_Int);
if (!status) { if (!status) {
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;
@@ -507,8 +505,8 @@ bool Multistate_Input_Write_Property(
&wp_data->error_class, &wp_data->error_code); &wp_data->error_class, &wp_data->error_code);
if (status) { if (status) {
object_index = object_index =
Multistate_Input_Instance_To_Index Multistate_Input_Instance_To_Index(wp_data->
(wp_data->object_instance); object_instance);
Out_Of_Service[object_index] = value.type.Boolean; Out_Of_Service[object_index] = value.type.Boolean;
} }
break; break;
+10 -10
View File
@@ -266,8 +266,8 @@ int Multistate_Output_Read_Property(
/* into one packet. */ /* into one packet. */
else if (rpdata->array_index == BACNET_ARRAY_ALL) { else if (rpdata->array_index == BACNET_ARRAY_ALL) {
object_index = object_index =
Multistate_Output_Instance_To_Index Multistate_Output_Instance_To_Index(rpdata->
(rpdata->object_instance); object_instance);
for (i = 0; i < BACNET_MAX_PRIORITY; i++) { for (i = 0; i < BACNET_MAX_PRIORITY; i++) {
/* FIXME: check if we have room before adding it to APDU */ /* FIXME: check if we have room before adding it to APDU */
if (Multistate_Output_Level[object_index][i] == if (Multistate_Output_Level[object_index][i] ==
@@ -292,8 +292,8 @@ int Multistate_Output_Read_Property(
} }
} else { } else {
object_index = object_index =
Multistate_Output_Instance_To_Index Multistate_Output_Instance_To_Index(rpdata->
(rpdata->object_instance); object_instance);
if (rpdata->array_index <= BACNET_MAX_PRIORITY) { if (rpdata->array_index <= BACNET_MAX_PRIORITY) {
if (Multistate_Output_Level[object_index] if (Multistate_Output_Level[object_index]
[rpdata->array_index - 1] == MULTISTATE_NULL) [rpdata->array_index - 1] == MULTISTATE_NULL)
@@ -375,8 +375,8 @@ bool Multistate_Output_Write_Property(
(value.type.Unsigned_Int <= MULTISTATE_NUMBER_OF_STATES)) { (value.type.Unsigned_Int <= MULTISTATE_NUMBER_OF_STATES)) {
level = value.type.Unsigned_Int; level = value.type.Unsigned_Int;
object_index = object_index =
Multistate_Output_Instance_To_Index Multistate_Output_Instance_To_Index(wp_data->
(wp_data->object_instance); object_instance);
priority--; priority--;
Multistate_Output_Level[object_index][priority] = Multistate_Output_Level[object_index][priority] =
(uint8_t) level; (uint8_t) level;
@@ -403,8 +403,8 @@ bool Multistate_Output_Write_Property(
if (status) { if (status) {
level = MULTISTATE_NULL; level = MULTISTATE_NULL;
object_index = object_index =
Multistate_Output_Instance_To_Index Multistate_Output_Instance_To_Index(wp_data->
(wp_data->object_instance); object_instance);
priority = wp_data->priority; priority = wp_data->priority;
if (priority && (priority <= BACNET_MAX_PRIORITY)) { if (priority && (priority <= BACNET_MAX_PRIORITY)) {
priority--; priority--;
@@ -430,8 +430,8 @@ bool Multistate_Output_Write_Property(
&wp_data->error_class, &wp_data->error_code); &wp_data->error_class, &wp_data->error_code);
if (status) { if (status) {
object_index = object_index =
Multistate_Output_Instance_To_Index Multistate_Output_Instance_To_Index(wp_data->
(wp_data->object_instance); object_instance);
Multistate_Output_Out_Of_Service[object_index] = Multistate_Output_Out_Of_Service[object_index] =
value.type.Boolean; value.type.Boolean;
} }
+7 -7
View File
@@ -735,9 +735,9 @@ bool Trend_Log_Write_Property(
if (wp_data->application_data_len != 0) { if (wp_data->application_data_len != 0) {
iOffset += len; iOffset += len;
len = len =
bacapp_decode_context_data(&wp_data->application_data bacapp_decode_context_data(&wp_data->
[iOffset], wp_data->application_data_len, &value, application_data[iOffset], wp_data->application_data_len,
PROP_LOG_DEVICE_OBJECT_PROPERTY); &value, PROP_LOG_DEVICE_OBJECT_PROPERTY);
if ((len == 0) || ((value.context_tag != 2) && if ((len == 0) || ((value.context_tag != 2) &&
(value.context_tag != 3))) { (value.context_tag != 3))) {
/* Bad decode or wrong tag */ /* Bad decode or wrong tag */
@@ -754,8 +754,8 @@ bool Trend_Log_Write_Property(
if (wp_data->application_data_len != 0) { if (wp_data->application_data_len != 0) {
iOffset += len; iOffset += len;
len = len =
bacapp_decode_context_data bacapp_decode_context_data(&wp_data->
(&wp_data->application_data[iOffset], application_data[iOffset],
wp_data->application_data_len, &value, wp_data->application_data_len, &value,
PROP_LOG_DEVICE_OBJECT_PROPERTY); PROP_LOG_DEVICE_OBJECT_PROPERTY);
if ((len == 0) || (value.context_tag != 3)) { if ((len == 0) || (value.context_tag != 3)) {
@@ -1097,8 +1097,8 @@ int rr_trend_log_encode(
pRequest->ItemCount = 0; /* Start out with nothing */ pRequest->ItemCount = 0; /* Start out with nothing */
/* Bail out now if nowt - should never happen for a Trend Log but ... */ /* Bail out now if nowt - should never happen for a Trend Log but ... */
if (LogInfo[Trend_Log_Instance_To_Index(pRequest-> if (LogInfo[Trend_Log_Instance_To_Index(pRequest->object_instance)].
object_instance)].ulRecordCount == 0) ulRecordCount == 0)
return (0); return (0);
if ((pRequest->RequestType == RR_BY_POSITION) || if ((pRequest->RequestType == RR_BY_POSITION) ||
-2
View File
@@ -91,11 +91,9 @@ extern "C" {
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
#define ANALOG_INPUT_OBJ_FUNCTIONS \ #define ANALOG_INPUT_OBJ_FUNCTIONS \
OBJECT_ANALOG_INPUT, Analog_Input_Init, Analog_Input_Count, \ OBJECT_ANALOG_INPUT, Analog_Input_Init, Analog_Input_Count, \
Analog_Input_Index_To_Instance, Analog_Input_Valid_Instance, \ Analog_Input_Index_To_Instance, Analog_Input_Valid_Instance, \
Analog_Input_Name, Analog_Input_Read_Property, NULL, \ Analog_Input_Name, Analog_Input_Read_Property, NULL, \
Analog_Input_Property_Lists, NULL, NULL Analog_Input_Property_Lists, NULL, NULL
#endif #endif
-2
View File
@@ -99,12 +99,10 @@ extern "C" {
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
#define ANALOG_OUTPUT_OBJ_FUNCTIONS \ #define ANALOG_OUTPUT_OBJ_FUNCTIONS \
OBJECT_ANALOG_OUTPUT, Analog_Output_Init, Analog_Output_Count, \ OBJECT_ANALOG_OUTPUT, Analog_Output_Init, Analog_Output_Count, \
Analog_Output_Index_To_Instance, Analog_Output_Valid_Instance, \ Analog_Output_Index_To_Instance, Analog_Output_Valid_Instance, \
Analog_Output_Name, Analog_Output_Read_Property, \ Analog_Output_Name, Analog_Output_Read_Property, \
Analog_Output_Write_Property, Analog_Output_Property_Lists, \ Analog_Output_Write_Property, Analog_Output_Property_Lists, \
NULL, NULL NULL, NULL
#endif #endif
-2
View File
@@ -75,12 +75,10 @@ extern "C" {
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
#define ANALOG_VALUE_OBJ_FUNCTIONS \ #define ANALOG_VALUE_OBJ_FUNCTIONS \
OBJECT_ANALOG_VALUE, Analog_Value_Init, Analog_Value_Count, \ OBJECT_ANALOG_VALUE, Analog_Value_Init, Analog_Value_Count, \
Analog_Value_Index_To_Instance, Analog_Value_Valid_Instance, \ Analog_Value_Index_To_Instance, Analog_Value_Valid_Instance, \
Analog_Value_Name, Analog_Value_Read_Property, \ Analog_Value_Name, Analog_Value_Read_Property, \
Analog_Value_Write_Property, Analog_Value_Property_Lists, NULL, \ Analog_Value_Write_Property, Analog_Value_Property_Lists, NULL, \
NULL NULL
#endif #endif
-2
View File
@@ -94,10 +94,8 @@ extern "C" {
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
#define FILE_OBJ_FUNCTIONS \ #define FILE_OBJ_FUNCTIONS \
OBJECT_FILE, bacfile_init, bacfile_count, bacfile_index_to_instance, \ OBJECT_FILE, bacfile_init, bacfile_count, bacfile_index_to_instance, \
bacfile_valid_instance, bacfile_name, bacfile_read_property, \ bacfile_valid_instance, bacfile_name, bacfile_read_property, \
bacfile_write_property, BACfile_Property_Lists, NULL bacfile_write_property, BACfile_Property_Lists, NULL
#endif #endif
-2
View File
@@ -113,11 +113,9 @@ extern "C" {
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
#define BINARY_INPUT_OBJ_FUNCTIONS \ #define BINARY_INPUT_OBJ_FUNCTIONS \
OBJECT_BINARY_INPUT, Binary_Input_Init, Binary_Input_Count, \ OBJECT_BINARY_INPUT, Binary_Input_Init, Binary_Input_Count, \
Binary_Input_Index_To_Instance, Binary_Input_Valid_Instance, \ Binary_Input_Index_To_Instance, Binary_Input_Valid_Instance, \
Binary_Input_Name, Binary_Input_Read_Property, NULL, \ Binary_Input_Name, Binary_Input_Read_Property, NULL, \
Binary_Input_Property_Lists, NULL, NULL Binary_Input_Property_Lists, NULL, NULL
#endif #endif
-2
View File
@@ -108,12 +108,10 @@ extern "C" {
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
#define BINARY_OUTPUT_OBJ_FUNCTIONS \ #define BINARY_OUTPUT_OBJ_FUNCTIONS \
OBJECT_BINARY_OUTPUT, Binary_Output_Init, Binary_Output_Count, \ OBJECT_BINARY_OUTPUT, Binary_Output_Init, Binary_Output_Count, \
Binary_Output_Index_To_Instance, Binary_Output_Valid_Instance, \ Binary_Output_Index_To_Instance, Binary_Output_Valid_Instance, \
Binary_Output_Name, Binary_Output_Read_Property, \ Binary_Output_Name, Binary_Output_Read_Property, \
Binary_Output_Write_Property, Binary_Output_Property_Lists, \ Binary_Output_Write_Property, Binary_Output_Property_Lists, \
NULL, NULL NULL, NULL
#endif #endif
-2
View File
@@ -69,12 +69,10 @@ extern "C" {
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
#define BINARY_VALUE_OBJ_FUNCTIONS \ #define BINARY_VALUE_OBJ_FUNCTIONS \
OBJECT_BINARY_VALUE, Binary_Value_Init, Binary_Value_Count, \ OBJECT_BINARY_VALUE, Binary_Value_Init, Binary_Value_Count, \
Binary_Value_Index_To_Instance, Binary_Value_Valid_Instance, \ Binary_Value_Index_To_Instance, Binary_Value_Valid_Instance, \
Binary_Value_Name, Binary_Value_Read_Property, \ Binary_Value_Name, Binary_Value_Read_Property, \
Binary_Value_Write_Property, Binary_Value_Property_Lists, NULL, \ Binary_Value_Write_Property, Binary_Value_Property_Lists, NULL, \
NULL NULL
#endif #endif
+2 -8
View File
@@ -104,9 +104,7 @@ extern "C" {
* *
* The network management BIBBs prescribe the BACnet capabilities required to * The network management BIBBs prescribe the BACnet capabilities required to
* interoperably perform network management functions. * interoperably perform network management functions.
*/ *//** @defgroup DMDCC Device Management-Device Communication Control (DM-DCC)
/** @defgroup DMDCC Device Management-Device Communication Control (DM-DCC)
* @ingroup RDMS * @ingroup RDMS
* 16.1 DeviceCommunicationControl Service <br> * 16.1 DeviceCommunicationControl Service <br>
* The DeviceCommunicationControl service is used by a client BACnet-user to * The DeviceCommunicationControl service is used by a client BACnet-user to
@@ -119,9 +117,7 @@ extern "C" {
* "indefinite," meaning communication must be re-enabled by a * "indefinite," meaning communication must be re-enabled by a
* DeviceCommunicationControl or, if supported, ReinitializeDevice service, * DeviceCommunicationControl or, if supported, ReinitializeDevice service,
* not by time. * not by time.
*/ *//** @defgroup NMRC Network Management-Router Configuration (NM-RC)
/** @defgroup NMRC Network Management-Router Configuration (NM-RC)
* @ingroup RDMS * @ingroup RDMS
* The A device may query and change the configuration of routers and * The A device may query and change the configuration of routers and
* half-routers. * half-routers.
@@ -134,6 +130,4 @@ extern "C" {
* auto-configuration, router table maintenance, and network layer congestion * auto-configuration, router table maintenance, and network layer congestion
* control. * control.
*/ */
#endif #endif
+2 -6
View File
@@ -131,8 +131,7 @@ typedef struct object_functions {
#define MAX_DEV_DESC_LEN 64 #define MAX_DEV_DESC_LEN 64
/** Structure to define the Object Properties common to all Objects. */ /** Structure to define the Object Properties common to all Objects. */
typedef struct commonBacObj_s typedef struct commonBacObj_s {
{
/** The BACnet type of this object (ie, what class is this object from?). /** The BACnet type of this object (ie, what class is this object from?).
* This property, of type BACnetObjectType, indicates membership in a * This property, of type BACnetObjectType, indicates membership in a
@@ -160,8 +159,7 @@ typedef struct commonBacObj_s
* This may be useful for implementations which manage multiple Devices, * This may be useful for implementations which manage multiple Devices,
* eg, a Gateway. * eg, a Gateway.
*/ */
typedef struct devObj_s typedef struct devObj_s {
{
/** The BACnet Device Address for this device; ->len depends on DLL type. */ /** The BACnet Device Address for this device; ->len depends on DLL type. */
BACNET_ADDRESS bacDevAddr; BACNET_ADDRESS bacDevAddr;
@@ -362,13 +360,11 @@ extern "C" {
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
#define DEVICE_OBJ_FUNCTIONS \ #define DEVICE_OBJ_FUNCTIONS \
OBJECT_DEVICE, NULL, Device_Count, Device_Index_To_Instance, \ OBJECT_DEVICE, NULL, Device_Count, Device_Index_To_Instance, \
Device_Valid_Object_Instance_Number, Device_Name, \ Device_Valid_Object_Instance_Number, Device_Name, \
Device_Read_Property_Local, Device_Write_Property_Local, \ Device_Read_Property_Local, Device_Write_Property_Local, \
Device_Property_Lists, DeviceGetRRInfo, NULL Device_Property_Lists, DeviceGetRRInfo, NULL
/** @defgroup ObjFrmwk Object Framework /** @defgroup ObjFrmwk Object Framework
* The modules in this section describe the BACnet-stack's framework for * The modules in this section describe the BACnet-stack's framework for
* BACnet-defined Objects (Device, Analog Input, etc). There are two submodules * BACnet-defined Objects (Device, Analog Input, etc). There are two submodules
-2
View File
@@ -74,12 +74,10 @@ extern "C" {
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
#define LOAD_CONTROL_OBJ_FUNCTIONS \ #define LOAD_CONTROL_OBJ_FUNCTIONS \
OBJECT_LOAD_CONTROL, Load_Control_Init, Load_Control_Count, \ OBJECT_LOAD_CONTROL, Load_Control_Init, Load_Control_Count, \
Load_Control_Index_To_Instance, Load_Control_Valid_Instance, \ Load_Control_Index_To_Instance, Load_Control_Valid_Instance, \
Load_Control_Name, Load_Control_Read_Property, \ Load_Control_Name, Load_Control_Read_Property, \
Load_Control_Write_Property, Load_Control_Property_Lists, NULL, \ Load_Control_Write_Property, Load_Control_Property_Lists, NULL, \
NULL NULL
#endif #endif
-2
View File
@@ -68,7 +68,6 @@ extern "C" {
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
#define LIFE_SAFETY_POINT_OBJ_FUNCTIONS \ #define LIFE_SAFETY_POINT_OBJ_FUNCTIONS \
OBJECT_LIFE_SAFETY_POINT, Life_Safety_Point_Init, \ OBJECT_LIFE_SAFETY_POINT, Life_Safety_Point_Init, \
Life_Safety_Point_Count, Life_Safety_Point_Index_To_Instance, \ Life_Safety_Point_Count, Life_Safety_Point_Index_To_Instance, \
@@ -76,5 +75,4 @@ extern "C" {
Life_Safety_Point_Read_Property, \ Life_Safety_Point_Read_Property, \
Life_Safety_Point_Write_Property, \ Life_Safety_Point_Write_Property, \
Life_Safety_Point_Property_Lists, NULL, NULL Life_Safety_Point_Property_Lists, NULL, NULL
#endif #endif
-2
View File
@@ -93,7 +93,6 @@ extern "C" {
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
#define MULTI_STATE_INPUT_OBJ_FUNCTIONS \ #define MULTI_STATE_INPUT_OBJ_FUNCTIONS \
OBJECT_MULTI_STATE_INPUT, Multistate_Input_Init, \ OBJECT_MULTI_STATE_INPUT, Multistate_Input_Init, \
Multistate_Input_Count, Multistate_Input_Index_To_Instance, \ Multistate_Input_Count, Multistate_Input_Index_To_Instance, \
@@ -101,5 +100,4 @@ extern "C" {
Multistate_Input_Read_Property, \ Multistate_Input_Read_Property, \
Multistate_Input_Write_Property, \ Multistate_Input_Write_Property, \
Multistate_Input_Property_Lists, NULL, NULL Multistate_Input_Property_Lists, NULL, NULL
#endif #endif
-2
View File
@@ -69,7 +69,6 @@ extern "C" {
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
#define MULTI_STATE_OUTPUT_OBJ_FUNCTIONS \ #define MULTI_STATE_OUTPUT_OBJ_FUNCTIONS \
OBJECT_MULTI_STATE_OUTPUT, Multistate_Output_Init, \ OBJECT_MULTI_STATE_OUTPUT, Multistate_Output_Init, \
Multistate_Output_Count, Multistate_Output_Index_To_Instance, \ Multistate_Output_Count, Multistate_Output_Index_To_Instance, \
@@ -77,5 +76,4 @@ extern "C" {
Multistate_Output_Read_Property, \ Multistate_Output_Read_Property, \
Multistate_Output_Write_Property, \ Multistate_Output_Write_Property, \
Multistate_Output_Property_Lists, NULL, NULL Multistate_Output_Property_Lists, NULL, NULL
#endif #endif
+1 -5
View File
@@ -168,14 +168,11 @@ uint8_t Send_ReadRange_Request(
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
/** @defgroup Trend Trending BIBBs /** @defgroup Trend Trending BIBBs
* These BIBBs prescribe the BACnet capabilities required to interoperably * These BIBBs prescribe the BACnet capabilities required to interoperably
* perform the trending functions enumerated in clause 22.2.1.4 for the * perform the trending functions enumerated in clause 22.2.1.4 for the
* BACnet devices defined therein. * BACnet devices defined therein.
*/ *//** @defgroup TrendReadRange Trending -Read Range Service (eg, in T-VMT)
/** @defgroup TrendReadRange Trending -Read Range Service (eg, in T-VMT)
* @ingroup Trend * @ingroup Trend
* 15.8 ReadRange Service <br> * 15.8 ReadRange Service <br>
* The ReadRange service is used by a client BACnet-user to read a specific * The ReadRange service is used by a client BACnet-user to read a specific
@@ -183,5 +180,4 @@ uint8_t Send_ReadRange_Request(
* specified object property. * specified object property.
* The service may be used with any list or array of lists property. * The service may be used with any list or array of lists property.
*/ */
#endif #endif
-2
View File
@@ -196,12 +196,10 @@ extern "C" {
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
#define TRENDLOG_OBJ_FUNCTIONS \ #define TRENDLOG_OBJ_FUNCTIONS \
OBJECT_TRENDLOG, Trend_Log_Init, Trend_Log_Count, \ OBJECT_TRENDLOG, Trend_Log_Init, Trend_Log_Count, \
Trend_Log_Index_To_Instance, Trend_Log_Valid_Instance, \ Trend_Log_Index_To_Instance, Trend_Log_Valid_Instance, \
Trend_Log_Name, Trend_Log_Read_Property, \ Trend_Log_Name, Trend_Log_Read_Property, \
Trend_Log_Write_Property, Trend_Log_Property_Lists, \ Trend_Log_Write_Property, Trend_Log_Property_Lists, \
TrendLogGetRRInfo, NULL TrendLogGetRRInfo, NULL
#endif #endif
+2 -2
View File
@@ -360,8 +360,8 @@ bool Analog_Value_Write_Property(
(value.type.Real >= 0.0) && (value.type.Real <= 100.0)) { (value.type.Real >= 0.0) && (value.type.Real <= 100.0)) {
level = (uint8_t) value.type.Real; level = (uint8_t) value.type.Real;
object_index = object_index =
Analog_Value_Instance_To_Index Analog_Value_Instance_To_Index(wp_data->
(wp_data->object_instance); object_instance);
priority--; priority--;
Present_Value[object_index] = level; Present_Value[object_index] = level;
/* Note: you could set the physical output here if we /* Note: you could set the physical output here if we
+2 -2
View File
@@ -270,8 +270,8 @@ bool Binary_Value_Write_Property(
(value.type.Enumerated <= MAX_BINARY_PV)) { (value.type.Enumerated <= MAX_BINARY_PV)) {
level = value.type.Enumerated; level = value.type.Enumerated;
object_index = object_index =
Binary_Value_Instance_To_Index Binary_Value_Instance_To_Index(wp_data->
(wp_data->object_instance); object_instance);
priority--; priority--;
/* NOTE: this Binary value has no priority array */ /* NOTE: this Binary value has no priority array */
Present_Value[object_index] = level; Present_Value[object_index] = level;
+2 -2
View File
@@ -829,8 +829,8 @@ bool Device_Write_Property_Local(
case PROP_OBJECT_IDENTIFIER: case PROP_OBJECT_IDENTIFIER:
if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) { if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) {
if ((value.type.Object_Id.type == OBJECT_DEVICE) && if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
(Device_Set_Object_Instance_Number(value.type. (Device_Set_Object_Instance_Number(value.type.Object_Id.
Object_Id.instance))) { instance))) {
/* we could send an I-Am broadcast to let the world know */ /* we could send an I-Am broadcast to let the world know */
status = true; status = true;
} else { } else {
+1 -2
View File
@@ -872,8 +872,7 @@ static bool MSTP_Master_Node_FSM(
/* then the next station to which the token /* then the next station to which the token
should be sent is unknown - so PollForMaster */ should be sent is unknown - so PollForMaster */
Poll_Station = next_this_station; Poll_Station = next_this_station;
MSTP_Send_Frame( MSTP_Send_Frame(FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
This_Station, NULL, 0); This_Station, NULL, 0);
RetryCount = 0; RetryCount = 0;
Master_State = MSTP_MASTER_STATE_POLL_FOR_MASTER; Master_State = MSTP_MASTER_STATE_POLL_FOR_MASTER;
+2 -2
View File
@@ -211,8 +211,8 @@ bool Binary_Value_Write_Property(
if ((value.type.Enumerated == BINARY_ACTIVE) || if ((value.type.Enumerated == BINARY_ACTIVE) ||
(value.type.Enumerated == BINARY_INACTIVE)) { (value.type.Enumerated == BINARY_INACTIVE)) {
object_index = object_index =
Binary_Value_Instance_To_Index Binary_Value_Instance_To_Index(wp_data->
(wp_data->object_instance); object_instance);
/* NOTE: this Binary value has no priority array */ /* NOTE: this Binary value has no priority array */
Present_Value[object_index] = Present_Value[object_index] =
(BACNET_BINARY_PV) value.type.Enumerated; (BACNET_BINARY_PV) value.type.Enumerated;
+2 -2
View File
@@ -380,8 +380,8 @@ bool Device_Write_Property(
case PROP_OBJECT_IDENTIFIER: case PROP_OBJECT_IDENTIFIER:
if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) { if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) {
if ((value.type.Object_Id.type == OBJECT_DEVICE) && if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
(Device_Set_Object_Instance_Number(value.type. (Device_Set_Object_Instance_Number(value.type.Object_Id.
Object_Id.instance))) { instance))) {
/* we could send an I-Am broadcast to let the world know */ /* we could send an I-Am broadcast to let the world know */
status = true; status = true;
} else { } else {
+1 -2
View File
@@ -789,8 +789,7 @@ static bool MSTP_Master_Node_FSM(
/* then the next station to which the token /* then the next station to which the token
should be sent is unknown - so PollForMaster */ should be sent is unknown - so PollForMaster */
Poll_Station = next_this_station; Poll_Station = next_this_station;
MSTP_Send_Frame( MSTP_Send_Frame(FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
This_Station, NULL, 0); This_Station, NULL, 0);
RetryCount = 0; RetryCount = 0;
Master_State = MSTP_MASTER_STATE_POLL_FOR_MASTER; Master_State = MSTP_MASTER_STATE_POLL_FOR_MASTER;
+2 -2
View File
@@ -211,8 +211,8 @@ bool Binary_Value_Write_Property(
if ((value.type.Enumerated == BINARY_ACTIVE) || if ((value.type.Enumerated == BINARY_ACTIVE) ||
(value.type.Enumerated == BINARY_INACTIVE)) { (value.type.Enumerated == BINARY_INACTIVE)) {
object_index = object_index =
Binary_Value_Instance_To_Index Binary_Value_Instance_To_Index(wp_data->
(wp_data->object_instance); object_instance);
/* NOTE: this Binary value has no priority array */ /* NOTE: this Binary value has no priority array */
Present_Value[object_index] = Present_Value[object_index] =
(BACNET_BINARY_PV) value.type.Enumerated; (BACNET_BINARY_PV) value.type.Enumerated;
+8 -8
View File
@@ -83,8 +83,8 @@ ISR(ADC_vect)
} }
void adc_enable( void adc_enable(
uint8_t index) /* 0..7 = ADC0..ADC7, respectively */ uint8_t index)
{ { /* 0..7 = ADC0..ADC7, respectively */
if (Enabled_Channels) { if (Enabled_Channels) {
/* ADC interupt is already started */ /* ADC interupt is already started */
BIT_SET(Enabled_Channels, index); BIT_SET(Enabled_Channels, index);
@@ -103,8 +103,8 @@ void adc_enable(
} }
uint8_t adc_result_8bit( uint8_t adc_result_8bit(
uint8_t index) /* 0..7 = ADC0..ADC7, respectively */ uint8_t index)
{ { /* 0..7 = ADC0..ADC7, respectively */
uint8_t result = 0; uint8_t result = 0;
uint8_t sreg; uint8_t sreg;
@@ -120,8 +120,8 @@ uint8_t adc_result_8bit(
} }
uint16_t adc_result_10bit( uint16_t adc_result_10bit(
uint8_t index) /* 0..7 = ADC0..ADC7, respectively */ uint8_t index)
{ { /* 0..7 = ADC0..ADC7, respectively */
uint16_t result = 0; uint16_t result = 0;
uint8_t sreg; uint8_t sreg;
@@ -150,8 +150,8 @@ void adc_init(
ADIE = Interrupt Enable ADIE = Interrupt Enable
ADATE = Auto Trigger Enable ADATE = Auto Trigger Enable
*/ */
ADCSRA = (1 << ADEN) | (1 << ADIE) | ADCSRA =
(1 << ADIF) | (0 << ADATE) | ADPS_10BIT; (1 << ADEN) | (1 << ADIE) | (1 << ADIF) | (0 << ADATE) | ADPS_10BIT;
/* trigger selection bits /* trigger selection bits
0 0 0 Free Running mode 0 0 0 Free Running mode
0 0 1 Analog Comparator 0 0 1 Analog Comparator
+2 -2
View File
@@ -437,8 +437,8 @@ bool Binary_Output_Write_Property(
priority = wp_data->priority; priority = wp_data->priority;
if (priority && (priority <= BACNET_MAX_PRIORITY)) { if (priority && (priority <= BACNET_MAX_PRIORITY)) {
priority--; priority--;
Binary_Output_Present_Value_Set Binary_Output_Present_Value_Set(wp_data->
(wp_data->object_instance, level, priority); object_instance, level, priority);
} else if (priority == 6) { } else if (priority == 6) {
status = false; status = false;
/* Command priority 6 is reserved for use by Minimum On/Off /* Command priority 6 is reserved for use by Minimum On/Off
+4 -4
View File
@@ -813,8 +813,8 @@ bool Device_Write_Property_Local(
case PROP_OBJECT_IDENTIFIER: case PROP_OBJECT_IDENTIFIER:
if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) { if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) {
if ((value.type.Object_Id.type == OBJECT_DEVICE) && if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
(Device_Set_Object_Instance_Number(value.type. (Device_Set_Object_Instance_Number(value.type.Object_Id.
Object_Id.instance))) { instance))) {
/* we could send an I-Am broadcast to let the world know */ /* we could send an I-Am broadcast to let the world know */
status = true; status = true;
} else { } else {
@@ -874,8 +874,8 @@ bool Device_Write_Property_Local(
eeprom_bytes_write(NV_EEPROM_DEVICE_NAME_LENGTH, eeprom_bytes_write(NV_EEPROM_DEVICE_NAME_LENGTH,
&small_length, 1); &small_length, 1);
pCharString = pCharString =
characterstring_value(&value. characterstring_value(&value.type.
type.Character_String); Character_String);
eeprom_bytes_write(NV_EEPROM_DEVICE_NAME_0, eeprom_bytes_write(NV_EEPROM_DEVICE_NAME_0,
(uint8_t *) pCharString, length); (uint8_t *) pCharString, length);
status = true; status = true;
+1 -2
View File
@@ -894,8 +894,7 @@ static bool MSTP_Master_Node_FSM(
/* then the next station to which the token /* then the next station to which the token
should be sent is unknown - so PollForMaster */ should be sent is unknown - so PollForMaster */
Poll_Station = next_this_station; Poll_Station = next_this_station;
MSTP_Send_Frame( MSTP_Send_Frame(FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
This_Station, NULL, 0); This_Station, NULL, 0);
RetryCount = 0; RetryCount = 0;
Master_State = MSTP_MASTER_STATE_POLL_FOR_MASTER; Master_State = MSTP_MASTER_STATE_POLL_FOR_MASTER;
+8 -4
View File
@@ -58,7 +58,8 @@ void test_init(
* Returns: none * Returns: none
* Notes: none * Notes: none
*************************************************************************/ *************************************************************************/
static inline void test_pin_on(void) static inline void test_pin_on(
void)
{ {
BIT_SET(PORTB, PB0); BIT_SET(PORTB, PB0);
} }
@@ -68,7 +69,8 @@ static inline void test_pin_on(void)
* Returns: none * Returns: none
* Notes: none * Notes: none
*************************************************************************/ *************************************************************************/
static inline void test_pin_off(void) static inline void test_pin_off(
void)
{ {
BIT_CLEAR(PORTB, PB0); BIT_CLEAR(PORTB, PB0);
} }
@@ -78,7 +80,8 @@ static inline void test_pin_off(void)
* Returns: true if on, false if off. * Returns: true if on, false if off.
* Notes: none * Notes: none
*************************************************************************/ *************************************************************************/
static inline bool test_pin_state(void) static inline bool test_pin_state(
void)
{ {
return (BIT_CHECK(PINB, PB0)); return (BIT_CHECK(PINB, PB0));
} }
@@ -88,7 +91,8 @@ static inline bool test_pin_state(void)
* Returns: none * Returns: none
* Notes: none * Notes: none
*************************************************************************/ *************************************************************************/
static inline void test_pin_toggle(void) static inline void test_pin_toggle(
void)
{ {
if (test_pin_state()) { if (test_pin_state()) {
test_pin_off(); test_pin_off();
+4 -2
View File
@@ -308,7 +308,8 @@ void timer_interval_restart(
* Returns: number of milliseconds elapsed * Returns: number of milliseconds elapsed
* Notes: only up to 255ms elapsed * Notes: only up to 255ms elapsed
**************************************************************************/ **************************************************************************/
uint8_t timer_milliseconds_delta(uint8_t start) uint8_t timer_milliseconds_delta(
uint8_t start)
{ {
return (timer_milliseconds_byte() - start); return (timer_milliseconds_byte() - start);
} }
@@ -318,7 +319,8 @@ uint8_t timer_milliseconds_delta(uint8_t start)
* Returns: mark timer starting tick * Returns: mark timer starting tick
* Notes: only up to 255ms elapsed * Notes: only up to 255ms elapsed
**************************************************************************/ **************************************************************************/
uint8_t timer_milliseconds_mark(void) uint8_t timer_milliseconds_mark(
void)
{ {
return timer_milliseconds_byte(); return timer_milliseconds_byte();
} }
+4 -2
View File
@@ -104,8 +104,10 @@ extern "C" {
struct itimer *t); struct itimer *t);
/* special for 8-bit microcontrollers - limited to 255ms */ /* special for 8-bit microcontrollers - limited to 255ms */
uint8_t timer_milliseconds_delta(uint8_t start); uint8_t timer_milliseconds_delta(
uint8_t timer_milliseconds_mark(void); uint8_t start);
uint8_t timer_milliseconds_mark(
void);
#ifdef __cplusplus #ifdef __cplusplus
} }
+2 -1
View File
@@ -66,7 +66,8 @@ ISR(TIMER2_OVF_vect);
* Returns: nothing * Returns: nothing
* Notes: none * Notes: none
*************************************************************************/ *************************************************************************/
static inline void timer_interrupt_handler(void) static inline void timer_interrupt_handler(
void)
{ {
/* Set the counter for the next interrupt */ /* Set the counter for the next interrupt */
TCNT2 = TIMER2_COUNT; TCNT2 = TIMER2_COUNT;
+1 -2
View File
@@ -890,8 +890,7 @@ static bool MSTP_Master_Node_FSM(
/* then the next station to which the token /* then the next station to which the token
should be sent is unknown - so PollForMaster */ should be sent is unknown - so PollForMaster */
Poll_Station = next_this_station; Poll_Station = next_this_station;
MSTP_Send_Frame( MSTP_Send_Frame(FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
This_Station, NULL, 0); This_Station, NULL, 0);
RetryCount = 0; RetryCount = 0;
Master_State = MSTP_MASTER_STATE_POLL_FOR_MASTER; Master_State = MSTP_MASTER_STATE_POLL_FOR_MASTER;
+2 -2
View File
@@ -325,8 +325,8 @@ bool Analog_Value_Write_Property(
(value.type.Real >= 0.0) && (value.type.Real <= 100.0)) { (value.type.Real >= 0.0) && (value.type.Real <= 100.0)) {
level = (uint8_t) value.type.Real; level = (uint8_t) value.type.Real;
object_index = object_index =
Analog_Value_Instance_To_Index Analog_Value_Instance_To_Index(wp_data->
(wp_data->object_instance); object_instance);
priority--; priority--;
Present_Value[object_index] = level; Present_Value[object_index] = level;
/* Note: you could set the physical output here if we /* Note: you could set the physical output here if we
+2 -2
View File
@@ -237,8 +237,8 @@ bool Binary_Value_Write_Property(
(value.type.Enumerated <= MAX_BINARY_PV)) { (value.type.Enumerated <= MAX_BINARY_PV)) {
level = value.type.Enumerated; level = value.type.Enumerated;
object_index = object_index =
Binary_Value_Instance_To_Index Binary_Value_Instance_To_Index(wp_data->
(wp_data->object_instance); object_instance);
priority--; priority--;
/* NOTE: this Binary value has no priority array */ /* NOTE: this Binary value has no priority array */
Present_Value[object_index] = level; Present_Value[object_index] = level;
+2 -2
View File
@@ -510,8 +510,8 @@ bool Device_Write_Property(
case PROP_OBJECT_IDENTIFIER: case PROP_OBJECT_IDENTIFIER:
if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) { if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) {
if ((value.type.Object_Id.type == OBJECT_DEVICE) && if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
(Device_Set_Object_Instance_Number(value.type. (Device_Set_Object_Instance_Number(value.type.Object_Id.
Object_Id.instance))) { instance))) {
/* we could send an I-Am broadcast to let the world know */ /* we could send an I-Am broadcast to let the world know */
status = true; status = true;
} else { } else {
+1 -2
View File
@@ -805,8 +805,7 @@ bool MSTP_Master_Node_FSM(
/* then the next station to which the token /* then the next station to which the token
should be sent is unknown - so PollForMaster */ should be sent is unknown - so PollForMaster */
Poll_Station = next_this_station; Poll_Station = next_this_station;
MSTP_Send_Frame( MSTP_Send_Frame(FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
FRAME_TYPE_POLL_FOR_MASTER, Poll_Station,
This_Station, NULL, 0); This_Station, NULL, 0);
RetryCount = 0; RetryCount = 0;
Master_State = MSTP_MASTER_STATE_POLL_FOR_MASTER; Master_State = MSTP_MASTER_STATE_POLL_FOR_MASTER;
+7 -16
View File
@@ -259,25 +259,16 @@ bool bip_init(
bip_set_addr(my_addr.s_addr); bip_set_addr(my_addr.s_addr);
set_broadcast_address(my_addr.s_addr); set_broadcast_address(my_addr.s_addr);
bip_set_port(htons((0xBAC0)); bip_set_port(htons((0xBAC0));
/* assumes that the driver has already been initialized */ /* assumes that the driver has already been initialized */
sock_fd = socket(AF_INET, SOCK_DGRAM, IPROTO_UDP); sock_fd = socket(AF_INET, SOCK_DGRAM, IPROTO_UDP);
bip_set_socket(sock_fd); bip_set_socket(sock_fd); if (sock_fd < 0)
if (sock_fd < 0)
return false; return false;
/* bind the socket to the local port number and IP address */ /* bind the socket to the local port number and IP address */
sin.sin_family = AF_INET; sin.sin_family = AF_INET; sin.sin_addr.s_addr = htonl(INADDR_ANY);
sin.sin_addr.s_addr = htonl(INADDR_ANY); sin.sin_port = bip_get_port(); memset(&(sin.sin_zero), '\0', 8);
sin.sin_port = bip_get_port(); rv =
memset(&(sin.sin_zero), '\0', 8); bind(sock_fd, (const struct sockaddr *) &sin, sizeof(struct sockaddr));
rv = bind(sock_fd, (const struct sockaddr *) &sin,
sizeof(struct sockaddr));
if (rv < 0) { if (rv < 0) {
close(sock_fd); close(sock_fd); bip_set_socket(-1); return false;}
bip_set_socket(-1);
return false;
}
return true; return true;}
}
+2 -4
View File
@@ -149,8 +149,7 @@ static struct Address_Cache_Entry *address_remove_oldest(
pMatch = Address_Cache; pMatch = Address_Cache;
while (pMatch <= &Address_Cache[MAX_ADDRESS_CACHE - 1]) { while (pMatch <= &Address_Cache[MAX_ADDRESS_CACHE - 1]) {
if ((pMatch-> if ((pMatch->Flags & (BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ |
Flags & (BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ |
BAC_ADDR_STATIC)) == BAC_ADDR_IN_USE) { BAC_ADDR_STATIC)) == BAC_ADDR_IN_USE) {
if (pMatch->TimeToLive <= ulTime) { /* Shorter lived entry found */ if (pMatch->TimeToLive <= ulTime) { /* Shorter lived entry found */
ulTime = pMatch->TimeToLive; ulTime = pMatch->TimeToLive;
@@ -169,8 +168,7 @@ static struct Address_Cache_Entry *address_remove_oldest(
/* Second pass - try in use and un bound as last resort */ /* Second pass - try in use and un bound as last resort */
pMatch = Address_Cache; pMatch = Address_Cache;
while (pMatch <= &Address_Cache[MAX_ADDRESS_CACHE - 1]) { while (pMatch <= &Address_Cache[MAX_ADDRESS_CACHE - 1]) {
if ((pMatch-> if ((pMatch->Flags & (BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ |
Flags & (BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ |
BAC_ADDR_STATIC)) == BAC_ADDR_STATIC)) ==
((uint8_t) (BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ))) { ((uint8_t) (BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ))) {
if (pMatch->TimeToLive <= ulTime) { /* Shorter lived entry found */ if (pMatch->TimeToLive <= ulTime) { /* Shorter lived entry found */
+17 -16
View File
@@ -288,8 +288,9 @@ int bacapp_decode_application_data(
if (tag_len) { if (tag_len) {
len += tag_len; len += tag_len;
value->tag = tag_number; value->tag = tag_number;
decode_len = bacapp_decode_data(&apdu[len], tag_number, decode_len =
len_value_type, value); bacapp_decode_data(&apdu[len], tag_number, len_value_type,
value);
if (value->tag != MAX_BACNET_APPLICATION_TAG) { if (value->tag != MAX_BACNET_APPLICATION_TAG) {
len += decode_len; len += decode_len;
} else { } else {
@@ -422,8 +423,8 @@ int bacapp_decode_application_data_len(
&len_value_type); &len_value_type);
if (tag_len) { if (tag_len) {
len += tag_len; len += tag_len;
decode_len = bacapp_decode_data_len(&apdu[len], tag_number, decode_len =
len_value_type); bacapp_decode_data_len(&apdu[len], tag_number, len_value_type);
len += decode_len; len += decode_len;
} }
} }
@@ -996,8 +997,8 @@ bool bacapp_print_value(
case PROP_OBJECT_TYPE: case PROP_OBJECT_TYPE:
if (value->type.Enumerated < MAX_ASHRAE_OBJECT_TYPE) { if (value->type.Enumerated < MAX_ASHRAE_OBJECT_TYPE) {
fprintf(stream, "%s", fprintf(stream, "%s",
bactext_object_type_name(value->type. bactext_object_type_name(value->
Enumerated)); type.Enumerated));
} else if (value->type.Enumerated < 128) { } else if (value->type.Enumerated < 128) {
fprintf(stream, "reserved %lu", fprintf(stream, "reserved %lu",
(unsigned long) value->type.Enumerated); (unsigned long) value->type.Enumerated);
@@ -1013,8 +1014,8 @@ bool bacapp_print_value(
case PROP_UNITS: case PROP_UNITS:
if (value->type.Enumerated < 256) { if (value->type.Enumerated < 256) {
fprintf(stream, "%s", fprintf(stream, "%s",
bactext_engineering_unit_name(value-> bactext_engineering_unit_name(value->type.
type.Enumerated)); Enumerated));
} else { } else {
fprintf(stream, "proprietary %lu", fprintf(stream, "proprietary %lu",
(unsigned long) value->type.Enumerated); (unsigned long) value->type.Enumerated);
@@ -1022,14 +1023,14 @@ bool bacapp_print_value(
break; break;
case PROP_POLARITY: case PROP_POLARITY:
fprintf(stream, "%s", fprintf(stream, "%s",
bactext_binary_polarity_name(value-> bactext_binary_polarity_name(value->type.
type.Enumerated)); Enumerated));
break; break;
case PROP_PRESENT_VALUE: case PROP_PRESENT_VALUE:
if (object_type < PROPRIETARY_BACNET_OBJECT_TYPE) { if (object_type < PROPRIETARY_BACNET_OBJECT_TYPE) {
fprintf(stream, "%s", fprintf(stream, "%s",
bactext_binary_present_value_name(value->type. bactext_binary_present_value_name(value->
Enumerated)); type.Enumerated));
} else { } else {
fprintf(stream, "%lu", fprintf(stream, "%lu",
(unsigned long) value->type.Enumerated); (unsigned long) value->type.Enumerated);
@@ -1041,8 +1042,8 @@ bool bacapp_print_value(
break; break;
case PROP_SYSTEM_STATUS: case PROP_SYSTEM_STATUS:
fprintf(stream, "%s", fprintf(stream, "%s",
bactext_device_status_name(value-> bactext_device_status_name(value->type.
type.Enumerated)); Enumerated));
break; break;
case PROP_SEGMENTATION_SUPPORTED: case PROP_SEGMENTATION_SUPPORTED:
fprintf(stream, "%s", fprintf(stream, "%s",
@@ -1413,8 +1414,8 @@ void testBACnetApplicationData_Safe(
break; break;
case BACNET_APPLICATION_TAG_CHARACTER_STRING: case BACNET_APPLICATION_TAG_CHARACTER_STRING:
characterstring_init_ansi(&input_value[i].type. characterstring_init_ansi(&input_value[i].
Character_String, "Hello There!"); type.Character_String, "Hello There!");
break; break;
case BACNET_APPLICATION_TAG_BIT_STRING: case BACNET_APPLICATION_TAG_BIT_STRING:
+2 -1
View File
@@ -1995,7 +1995,8 @@ INDTEXT_DATA network_layer_msg_names[] = {
, ,
{NETWORK_MESSAGE_I_AM_ROUTER_TO_NETWORK, "I-Am-Router-To-Network"} {NETWORK_MESSAGE_I_AM_ROUTER_TO_NETWORK, "I-Am-Router-To-Network"}
, ,
{NETWORK_MESSAGE_I_COULD_BE_ROUTER_TO_NETWORK, "I-Could-Be-Router-To-Network"} {NETWORK_MESSAGE_I_COULD_BE_ROUTER_TO_NETWORK,
"I-Could-Be-Router-To-Network"}
, ,
{NETWORK_MESSAGE_REJECT_MESSAGE_TO_NETWORK, "Reject-Message-to-Network"} {NETWORK_MESSAGE_REJECT_MESSAGE_TO_NETWORK, "Reject-Message-to-Network"}
, ,
+8 -8
View File
@@ -92,8 +92,8 @@ void bip_cleanup(
} }
void bip_set_addr( void bip_set_addr(
uint32_t net_address) /* in network byte order */ uint32_t net_address)
{ { /* in network byte order */
BIP_Address.s_addr = net_address; BIP_Address.s_addr = net_address;
} }
@@ -105,8 +105,8 @@ uint32_t bip_get_addr(
} }
void bip_set_broadcast_addr( void bip_set_broadcast_addr(
uint32_t net_address) /* in network byte order */ uint32_t net_address)
{ { /* in network byte order */
BIP_Broadcast_Address.s_addr = net_address; BIP_Broadcast_Address.s_addr = net_address;
} }
@@ -119,8 +119,8 @@ uint32_t bip_get_broadcast_addr(
void bip_set_port( void bip_set_port(
uint16_t port) /* in network byte order */ uint16_t port)
{ { /* in network byte order */
BIP_Port = port; BIP_Port = port;
} }
@@ -134,8 +134,8 @@ uint16_t bip_get_port(
static int bip_decode_bip_address( static int bip_decode_bip_address(
BACNET_ADDRESS * bac_addr, BACNET_ADDRESS * bac_addr,
struct in_addr *address, /* in network format */ struct in_addr *address, /* in network format */
uint16_t * port) /* in network format */ uint16_t * port)
{ { /* in network format */
int len = 0; int len = 0;
if (bac_addr) { if (bac_addr) {
+11 -11
View File
@@ -146,8 +146,8 @@ static void bvlc_internet_to_bacnet_address(
static int bvlc_encode_bip_address( static int bvlc_encode_bip_address(
uint8_t * pdu, /* buffer to store encoding */ uint8_t * pdu, /* buffer to store encoding */
struct in_addr *address, /* in network format */ struct in_addr *address, /* in network format */
uint16_t port) /* in network format */ uint16_t port)
{ { /* in network format */
int len = 0; int len = 0;
if (pdu) { if (pdu) {
@@ -162,8 +162,8 @@ static int bvlc_encode_bip_address(
static int bvlc_decode_bip_address( static int bvlc_decode_bip_address(
uint8_t * pdu, /* buffer to extract encoded address */ uint8_t * pdu, /* buffer to extract encoded address */
struct in_addr *address, /* in network format */ struct in_addr *address, /* in network format */
uint16_t * port) /* in network format */ uint16_t * port)
{ { /* in network format */
int len = 0; int len = 0;
if (pdu) { if (pdu) {
@@ -326,7 +326,8 @@ static int bvlc_encode_forwarded_npdu(
length field itself, most significant octet first. */ length field itself, most significant octet first. */
encode_unsigned16(&pdu[2], (uint16_t) (4 + 6 + npdu_length)); encode_unsigned16(&pdu[2], (uint16_t) (4 + 6 + npdu_length));
len = 4; len = 4;
len += bvlc_encode_bip_address(&pdu[len], &sin->sin_addr, sin->sin_port); len +=
bvlc_encode_bip_address(&pdu[len], &sin->sin_addr, sin->sin_port);
for (i = 0; i < npdu_length; i++) { for (i = 0; i < npdu_length; i++) {
pdu[len] = npdu[i]; pdu[len] = npdu[i];
len++; len++;
@@ -440,8 +441,8 @@ static int bvlc_encode_read_fdt_ack(
int bvlc_encode_delete_fdt_entry( int bvlc_encode_delete_fdt_entry(
uint8_t * pdu, uint8_t * pdu,
uint32_t address, /* in network byte order */ uint32_t address, /* in network byte order */
uint16_t port) /* in network byte order */ uint16_t port)
{ { /* in network byte order */
int len = 0; int len = 0;
if (pdu) { if (pdu) {
@@ -655,8 +656,8 @@ static void bvlc_bdt_forward_npdu(
mask in the BDT entry and logically ORing it with the mask in the BDT entry and logically ORing it with the
BBMD address of the same entry. */ BBMD address of the same entry. */
bip_dest.sin_addr.s_addr = bip_dest.sin_addr.s_addr =
((~BBMD_Table[i].broadcast_mask. ((~BBMD_Table[i].broadcast_mask.s_addr) | BBMD_Table[i].
s_addr) | BBMD_Table[i].dest_address.s_addr); dest_address.s_addr);
bip_dest.sin_port = BBMD_Table[i].dest_port; bip_dest.sin_port = BBMD_Table[i].dest_port;
/* don't send to my broadcast address and same port */ /* don't send to my broadcast address and same port */
if ((bip_dest.sin_addr.s_addr == bip_get_broadcast_addr()) if ((bip_dest.sin_addr.s_addr == bip_get_broadcast_addr())
@@ -804,8 +805,7 @@ static bool bvlc_bdt_member_mask_is_unicast(
for (i = 0; i < MAX_BBMD_ENTRIES; i++) { for (i = 0; i < MAX_BBMD_ENTRIES; i++) {
if (BBMD_Table[i].valid) { if (BBMD_Table[i].valid) {
/* find the source address in the table */ /* find the source address in the table */
if ((BBMD_Table[i].dest_address.s_addr == if ((BBMD_Table[i].dest_address.s_addr == sin->sin_addr.s_addr) &&
sin->sin_addr.s_addr) &&
(BBMD_Table[i].dest_port == sin->sin_port)) { (BBMD_Table[i].dest_port == sin->sin_port)) {
/* unicast mask? */ /* unicast mask? */
if (BBMD_Table[i].broadcast_mask.s_addr == 0xFFFFFFFFL) { if (BBMD_Table[i].broadcast_mask.s_addr == 0xFFFFFFFFL) {
+2 -1
View File
@@ -58,7 +58,8 @@ void debug_printf(
#else #else
void debug_printf( void debug_printf(
const char *format, const char *format,
...) { ...)
{
format = format; format = format;
} }
#endif #endif
+134 -139
View File
@@ -192,14 +192,14 @@ int event_notify_encode_service_request(
len = len =
encode_context_bitstring(&apdu[apdu_len], 0, encode_context_bitstring(&apdu[apdu_len], 0,
&data->notificationParams. &data->notificationParams.changeOfBitstring.
changeOfBitstring.referencedBitString); referencedBitString);
apdu_len += len; apdu_len += len;
len = len =
encode_context_bitstring(&apdu[apdu_len], 1, encode_context_bitstring(&apdu[apdu_len], 1,
&data->notificationParams. &data->notificationParams.changeOfBitstring.
changeOfBitstring.statusFlags); statusFlags);
apdu_len += len; apdu_len += len;
len = encode_closing_tag(&apdu[apdu_len], 0); len = encode_closing_tag(&apdu[apdu_len], 0);
@@ -223,8 +223,8 @@ int event_notify_encode_service_request(
len = len =
encode_context_bitstring(&apdu[apdu_len], 1, encode_context_bitstring(&apdu[apdu_len], 1,
&data->notificationParams. &data->notificationParams.changeOfState.
changeOfState.statusFlags); statusFlags);
apdu_len += len; apdu_len += len;
len = encode_closing_tag(&apdu[apdu_len], 1); len = encode_closing_tag(&apdu[apdu_len], 1);
@@ -242,8 +242,8 @@ int event_notify_encode_service_request(
case CHANGE_OF_VALUE_REAL: case CHANGE_OF_VALUE_REAL:
len = len =
encode_context_real(&apdu[apdu_len], 1, encode_context_real(&apdu[apdu_len], 1,
data->notificationParams. data->notificationParams.changeOfValue.
changeOfValue.newValue.changeValue); newValue.changeValue);
apdu_len += len; apdu_len += len;
break; break;
@@ -251,8 +251,8 @@ int event_notify_encode_service_request(
len = len =
encode_context_bitstring(&apdu[apdu_len], encode_context_bitstring(&apdu[apdu_len],
0, 0,
&data->notificationParams. &data->notificationParams.changeOfValue.
changeOfValue.newValue.changedBits); newValue.changedBits);
apdu_len += len; apdu_len += len;
break; break;
@@ -265,8 +265,8 @@ int event_notify_encode_service_request(
len = len =
encode_context_bitstring(&apdu[apdu_len], 1, encode_context_bitstring(&apdu[apdu_len], 1,
&data->notificationParams. &data->notificationParams.changeOfValue.
changeOfValue.statusFlags); statusFlags);
apdu_len += len; apdu_len += len;
len = encode_closing_tag(&apdu[apdu_len], 2); len = encode_closing_tag(&apdu[apdu_len], 2);
@@ -280,20 +280,20 @@ int event_notify_encode_service_request(
len = len =
encode_context_real(&apdu[apdu_len], 0, encode_context_real(&apdu[apdu_len], 0,
data->notificationParams. data->notificationParams.floatingLimit.
floatingLimit.referenceValue); referenceValue);
apdu_len += len; apdu_len += len;
len = len =
encode_context_bitstring(&apdu[apdu_len], 1, encode_context_bitstring(&apdu[apdu_len], 1,
&data->notificationParams. &data->notificationParams.floatingLimit.
floatingLimit.statusFlags); statusFlags);
apdu_len += len; apdu_len += len;
len = len =
encode_context_real(&apdu[apdu_len], 2, encode_context_real(&apdu[apdu_len], 2,
data->notificationParams. data->notificationParams.floatingLimit.
floatingLimit.setPointValue); setPointValue);
apdu_len += len; apdu_len += len;
len = len =
@@ -312,8 +312,8 @@ int event_notify_encode_service_request(
len = len =
encode_context_real(&apdu[apdu_len], 0, encode_context_real(&apdu[apdu_len], 0,
data->notificationParams. data->notificationParams.outOfRange.
outOfRange.exceedingValue); exceedingValue);
apdu_len += len; apdu_len += len;
len = len =
@@ -341,26 +341,26 @@ int event_notify_encode_service_request(
len = len =
encode_context_enumerated(&apdu[apdu_len], 0, encode_context_enumerated(&apdu[apdu_len], 0,
data->notificationParams. data->notificationParams.changeOfLifeSafety.
changeOfLifeSafety.newState); newState);
apdu_len += len; apdu_len += len;
len = len =
encode_context_enumerated(&apdu[apdu_len], 1, encode_context_enumerated(&apdu[apdu_len], 1,
data->notificationParams. data->notificationParams.changeOfLifeSafety.
changeOfLifeSafety.newMode); newMode);
apdu_len += len; apdu_len += len;
len = len =
encode_context_bitstring(&apdu[apdu_len], 2, encode_context_bitstring(&apdu[apdu_len], 2,
&data->notificationParams. &data->notificationParams.changeOfLifeSafety.
changeOfLifeSafety.statusFlags); statusFlags);
apdu_len += len; apdu_len += len;
len = len =
encode_context_enumerated(&apdu[apdu_len], 3, encode_context_enumerated(&apdu[apdu_len], 3,
data->notificationParams. data->notificationParams.changeOfLifeSafety.
changeOfLifeSafety.operationExpected); operationExpected);
apdu_len += len; apdu_len += len;
len = encode_closing_tag(&apdu[apdu_len], 8); len = encode_closing_tag(&apdu[apdu_len], 8);
@@ -374,20 +374,20 @@ int event_notify_encode_service_request(
len = len =
bacapp_encode_context_device_obj_property_ref(&apdu bacapp_encode_context_device_obj_property_ref(&apdu
[apdu_len], 0, [apdu_len], 0,
&data->notificationParams. &data->notificationParams.bufferReady.
bufferReady.bufferProperty); bufferProperty);
apdu_len += len; apdu_len += len;
len = len =
encode_context_unsigned(&apdu[apdu_len], 1, encode_context_unsigned(&apdu[apdu_len], 1,
data->notificationParams. data->notificationParams.bufferReady.
bufferReady.previousNotification); previousNotification);
apdu_len += len; apdu_len += len;
len = len =
encode_context_unsigned(&apdu[apdu_len], 2, encode_context_unsigned(&apdu[apdu_len], 2,
data->notificationParams. data->notificationParams.bufferReady.
bufferReady.currentNotification); currentNotification);
apdu_len += len; apdu_len += len;
len = encode_closing_tag(&apdu[apdu_len], 10); len = encode_closing_tag(&apdu[apdu_len], 10);
@@ -399,20 +399,20 @@ int event_notify_encode_service_request(
len = len =
encode_context_unsigned(&apdu[apdu_len], 0, encode_context_unsigned(&apdu[apdu_len], 0,
data->notificationParams. data->notificationParams.unsignedRange.
unsignedRange.exceedingValue); exceedingValue);
apdu_len += len; apdu_len += len;
len = len =
encode_context_bitstring(&apdu[apdu_len], 1, encode_context_bitstring(&apdu[apdu_len], 1,
&data->notificationParams. &data->notificationParams.unsignedRange.
unsignedRange.statusFlags); 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. data->notificationParams.unsignedRange.
unsignedRange.exceededLimit); exceededLimit);
apdu_len += len; apdu_len += len;
len = encode_closing_tag(&apdu[apdu_len], 11); len = encode_closing_tag(&apdu[apdu_len], 11);
@@ -595,18 +595,16 @@ int event_notify_decode_service_request(
case EVENT_CHANGE_OF_BITSTRING: case EVENT_CHANGE_OF_BITSTRING:
if (-1 == (section_length = if (-1 == (section_length =
decode_context_bitstring(&apdu[len], 0, decode_context_bitstring(&apdu[len], 0,
&data-> &data->notificationParams.
notificationParams.changeOfBitstring. changeOfBitstring.referencedBitString))) {
referencedBitString))) {
return -1; return -1;
} }
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-> &data->notificationParams.
notificationParams.changeOfBitstring. changeOfBitstring.statusFlags))) {
statusFlags))) {
return -1; return -1;
} }
len += section_length; len += section_length;
@@ -617,16 +615,16 @@ int event_notify_decode_service_request(
if (-1 == (section_length = if (-1 == (section_length =
bacapp_decode_context_property_state(&apdu bacapp_decode_context_property_state(&apdu
[len], 0, [len], 0,
&data->notificationParams. &data->notificationParams.changeOfState.
changeOfState.newState))) { newState))) {
return -1; return -1;
} }
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.changeOfState.
changeOfState.statusFlags))) { statusFlags))) {
return -1; return -1;
} }
len += section_length; len += section_length;
@@ -644,9 +642,8 @@ int event_notify_decode_service_request(
if (-1 == (section_length = if (-1 == (section_length =
decode_context_bitstring(&apdu[len], 0, decode_context_bitstring(&apdu[len], 0,
&data-> &data->notificationParams.
notificationParams.changeOfValue. changeOfValue.newValue.changedBits))) {
newValue.changedBits))) {
return -1; return -1;
} }
@@ -657,9 +654,8 @@ int event_notify_decode_service_request(
CHANGE_OF_VALUE_REAL)) { CHANGE_OF_VALUE_REAL)) {
if (-1 == (section_length = if (-1 == (section_length =
decode_context_real(&apdu[len], 1, decode_context_real(&apdu[len], 1,
&data-> &data->notificationParams.
notificationParams.changeOfValue. changeOfValue.newValue.changeValue))) {
newValue.changeValue))) {
return -1; return -1;
} }
@@ -677,8 +673,8 @@ int event_notify_decode_service_request(
if (-1 == (section_length = if (-1 == (section_length =
decode_context_bitstring(&apdu[len], 1, decode_context_bitstring(&apdu[len], 1,
&data->notificationParams. &data->notificationParams.changeOfValue.
changeOfValue.statusFlags))) { statusFlags))) {
return -1; return -1;
} }
len += section_length; len += section_length;
@@ -687,31 +683,31 @@ int event_notify_decode_service_request(
case EVENT_FLOATING_LIMIT: case EVENT_FLOATING_LIMIT:
if (-1 == (section_length = if (-1 == (section_length =
decode_context_real(&apdu[len], 0, decode_context_real(&apdu[len], 0,
&data->notificationParams. &data->notificationParams.floatingLimit.
floatingLimit.referenceValue))) { referenceValue))) {
return -1; return -1;
} }
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.floatingLimit.
floatingLimit.statusFlags))) { statusFlags))) {
return -1; return -1;
} }
len += section_length; len += section_length;
if (-1 == (section_length = if (-1 == (section_length =
decode_context_real(&apdu[len], 2, decode_context_real(&apdu[len], 2,
&data->notificationParams. &data->notificationParams.floatingLimit.
floatingLimit.setPointValue))) { setPointValue))) {
return -1; return -1;
} }
len += section_length; len += section_length;
if (-1 == (section_length = if (-1 == (section_length =
decode_context_real(&apdu[len], 3, decode_context_real(&apdu[len], 3,
&data->notificationParams. &data->notificationParams.floatingLimit.
floatingLimit.errorLimit))) { errorLimit))) {
return -1; return -1;
} }
len += section_length; len += section_length;
@@ -720,31 +716,31 @@ int event_notify_decode_service_request(
case EVENT_OUT_OF_RANGE: case EVENT_OUT_OF_RANGE:
if (-1 == (section_length = if (-1 == (section_length =
decode_context_real(&apdu[len], 0, decode_context_real(&apdu[len], 0,
&data->notificationParams. &data->notificationParams.outOfRange.
outOfRange.exceedingValue))) { exceedingValue))) {
return -1; return -1;
} }
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.outOfRange.
outOfRange.statusFlags))) { statusFlags))) {
return -1; return -1;
} }
len += section_length; len += section_length;
if (-1 == (section_length = if (-1 == (section_length =
decode_context_real(&apdu[len], 2, decode_context_real(&apdu[len], 2,
&data->notificationParams. &data->notificationParams.outOfRange.
outOfRange.deadband))) { deadband))) {
return -1; return -1;
} }
len += section_length; len += section_length;
if (-1 == (section_length = if (-1 == (section_length =
decode_context_real(&apdu[len], 3, decode_context_real(&apdu[len], 3,
&data->notificationParams. &data->notificationParams.outOfRange.
outOfRange.exceededLimit))) { exceededLimit))) {
return -1; return -1;
} }
len += section_length; len += section_length;
@@ -772,9 +768,8 @@ int event_notify_decode_service_request(
if (-1 == (section_length = if (-1 == (section_length =
decode_context_bitstring(&apdu[len], 2, decode_context_bitstring(&apdu[len], 2,
&data-> &data->notificationParams.
notificationParams.changeOfLifeSafety. changeOfLifeSafety.statusFlags))) {
statusFlags))) {
return -1; return -1;
} }
len += section_length; len += section_length;
@@ -784,8 +779,8 @@ int event_notify_decode_service_request(
&value))) { &value))) {
return -1; return -1;
} }
data->notificationParams. data->notificationParams.changeOfLifeSafety.
changeOfLifeSafety.operationExpected = operationExpected =
(BACNET_LIFE_SAFETY_OPERATION) value; (BACNET_LIFE_SAFETY_OPERATION) value;
len += section_length; len += section_length;
break; break;
@@ -794,24 +789,24 @@ int event_notify_decode_service_request(
if (-1 == (section_length = if (-1 == (section_length =
bacapp_decode_context_device_obj_property_ref bacapp_decode_context_device_obj_property_ref
(&apdu[len], 0, (&apdu[len], 0,
&data->notificationParams. &data->notificationParams.bufferReady.
bufferReady.bufferProperty))) { bufferProperty))) {
return -1; return -1;
} }
len += section_length; len += section_length;
if (-1 == (section_length = if (-1 == (section_length =
decode_context_unsigned(&apdu[len], 1, decode_context_unsigned(&apdu[len], 1,
&data->notificationParams. &data->notificationParams.bufferReady.
bufferReady.previousNotification))) { previousNotification))) {
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.bufferReady.
bufferReady.currentNotification))) { currentNotification))) {
return -1; return -1;
} }
len += section_length; len += section_length;
@@ -820,24 +815,24 @@ int event_notify_decode_service_request(
case EVENT_UNSIGNED_RANGE: case EVENT_UNSIGNED_RANGE:
if (-1 == (section_length = if (-1 == (section_length =
decode_context_unsigned(&apdu[len], 0, decode_context_unsigned(&apdu[len], 0,
&data->notificationParams. &data->notificationParams.unsignedRange.
unsignedRange.exceedingValue))) { exceedingValue))) {
return -1; return -1;
} }
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.unsignedRange.
unsignedRange.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.unsignedRange.
unsignedRange.exceededLimit))) { exceededLimit))) {
return -1; return -1;
} }
len += section_length; len += section_length;
@@ -1096,16 +1091,16 @@ void testEventEventState(
data.eventType = EVENT_CHANGE_OF_BITSTRING; data.eventType = EVENT_CHANGE_OF_BITSTRING;
bitstring_init(&data.notificationParams. bitstring_init(&data.notificationParams.changeOfBitstring.
changeOfBitstring.referencedBitString); referencedBitString);
bitstring_set_bit(&data.notificationParams. bitstring_set_bit(&data.notificationParams.changeOfBitstring.
changeOfBitstring.referencedBitString, 0, true); referencedBitString, 0, true);
bitstring_set_bit(&data.notificationParams. bitstring_set_bit(&data.notificationParams.changeOfBitstring.
changeOfBitstring.referencedBitString, 1, false); referencedBitString, 1, false);
bitstring_set_bit(&data.notificationParams. bitstring_set_bit(&data.notificationParams.changeOfBitstring.
changeOfBitstring.referencedBitString, 2, true); referencedBitString, 2, true);
bitstring_set_bit(&data.notificationParams. bitstring_set_bit(&data.notificationParams.changeOfBitstring.
changeOfBitstring.referencedBitString, 2, false); referencedBitString, 2, false);
bitstring_init(&data.notificationParams.changeOfBitstring.statusFlags); bitstring_init(&data.notificationParams.changeOfBitstring.statusFlags);
@@ -1191,16 +1186,16 @@ void testEventEventState(
data.notificationParams.changeOfValue.tag = CHANGE_OF_VALUE_BITS; data.notificationParams.changeOfValue.tag = CHANGE_OF_VALUE_BITS;
bitstring_init(&data.notificationParams.changeOfValue. bitstring_init(&data.notificationParams.changeOfValue.newValue.
newValue.changedBits); changedBits);
bitstring_set_bit(&data.notificationParams.changeOfValue. bitstring_set_bit(&data.notificationParams.changeOfValue.newValue.
newValue.changedBits, 0, true); changedBits, 0, true);
bitstring_set_bit(&data.notificationParams.changeOfValue. bitstring_set_bit(&data.notificationParams.changeOfValue.newValue.
newValue.changedBits, 1, false); changedBits, 1, false);
bitstring_set_bit(&data.notificationParams.changeOfValue. bitstring_set_bit(&data.notificationParams.changeOfValue.newValue.
newValue.changedBits, 2, false); changedBits, 2, false);
bitstring_set_bit(&data.notificationParams.changeOfValue. bitstring_set_bit(&data.notificationParams.changeOfValue.newValue.
newValue.changedBits, 3, false); changedBits, 3, false);
memset(buffer, 0, MAX_APDU); memset(buffer, 0, MAX_APDU);
inLen = event_notify_encode_service_request(&buffer[0], &data); inLen = event_notify_encode_service_request(&buffer[0], &data);
@@ -1440,12 +1435,12 @@ void testEventEventState(
data.notificationParams.bufferReady.currentNotification = 2345; data.notificationParams.bufferReady.currentNotification = 2345;
data.notificationParams.bufferReady.bufferProperty.deviceIndentifier.type = data.notificationParams.bufferReady.bufferProperty.deviceIndentifier.type =
OBJECT_DEVICE; OBJECT_DEVICE;
data.notificationParams.bufferReady.bufferProperty. data.notificationParams.bufferReady.bufferProperty.deviceIndentifier.
deviceIndentifier.instance = 500; instance = 500;
data.notificationParams.bufferReady.bufferProperty.objectIdentifier.type = data.notificationParams.bufferReady.bufferProperty.objectIdentifier.type =
OBJECT_ANALOG_INPUT; OBJECT_ANALOG_INPUT;
data.notificationParams.bufferReady.bufferProperty. data.notificationParams.bufferReady.bufferProperty.objectIdentifier.
objectIdentifier.instance = 100; instance = 100;
data.notificationParams.bufferReady.bufferProperty.propertyIdentifier = data.notificationParams.bufferReady.bufferProperty.propertyIdentifier =
PROP_PRESENT_VALUE; PROP_PRESENT_VALUE;
data.notificationParams.bufferReady.bufferProperty.arrayIndex = 0; data.notificationParams.bufferReady.bufferProperty.arrayIndex = 0;
@@ -1470,34 +1465,34 @@ void testEventEventState(
ct_test(pTest, ct_test(pTest,
data.notificationParams.bufferReady.bufferProperty. data.notificationParams.bufferReady.bufferProperty.deviceIndentifier.
deviceIndentifier.type == type ==
data2.notificationParams.bufferReady.bufferProperty. data2.notificationParams.bufferReady.bufferProperty.deviceIndentifier.
deviceIndentifier.type); 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);
ct_test(pTest, ct_test(pTest,
data.notificationParams.bufferReady.bufferProperty. data.notificationParams.bufferReady.bufferProperty.
deviceIndentifier.instance == propertyIdentifier ==
data2.notificationParams.bufferReady.bufferProperty. data2.notificationParams.bufferReady.bufferProperty.
deviceIndentifier.instance); propertyIdentifier);
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, ct_test(pTest,
data.notificationParams.bufferReady.bufferProperty.arrayIndex == data.notificationParams.bufferReady.bufferProperty.arrayIndex ==