Applied standard indentation to files.
This commit is contained in:
@@ -84,22 +84,22 @@ void handler_cov_init(
|
||||
|
||||
static bool cov_list_subscribe(
|
||||
BACNET_ADDRESS * src,
|
||||
BACNET_SUBSCRIBE_COV_DATA *cov_data)
|
||||
BACNET_SUBSCRIBE_COV_DATA * cov_data)
|
||||
{
|
||||
bool existing_entry = false;
|
||||
int index;
|
||||
int first_invalid_index = -1;
|
||||
bool found = true;
|
||||
|
||||
|
||||
/* existing? - match Object ID and Process ID */
|
||||
for (index = 0; index < MAX_COV_SUBCRIPTIONS; index++) {
|
||||
if ((COV_Subscriptions[index].valid) &&
|
||||
(COV_Subscriptions[index].monitoredObjectIdentifier.type ==
|
||||
cov_data->monitoredObjectIdentifier.type) &&
|
||||
cov_data->monitoredObjectIdentifier.type) &&
|
||||
(COV_Subscriptions[index].monitoredObjectIdentifier.instance ==
|
||||
cov_data->monitoredObjectIdentifier.instance) &&
|
||||
cov_data->monitoredObjectIdentifier.instance) &&
|
||||
(COV_Subscriptions[index].subscriberProcessIdentifier ==
|
||||
cov_data->subscriberProcessIdentifier)) {
|
||||
cov_data->subscriberProcessIdentifier)) {
|
||||
existing_entry = true;
|
||||
if (cov_data->cancellationRequest) {
|
||||
COV_Subscriptions[index].valid = false;
|
||||
@@ -107,8 +107,7 @@ static bool cov_list_subscribe(
|
||||
bacnet_address_copy(&COV_Subscriptions[index].dest, src);
|
||||
COV_Subscriptions[index].issueConfirmedNotifications =
|
||||
cov_data->issueConfirmedNotifications;
|
||||
COV_Subscriptions[index].lifetime =
|
||||
cov_data->lifetime;
|
||||
COV_Subscriptions[index].lifetime = cov_data->lifetime;
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
@@ -131,8 +130,7 @@ static bool cov_list_subscribe(
|
||||
cov_data->subscriberProcessIdentifier;
|
||||
COV_Subscriptions[index].issueConfirmedNotifications =
|
||||
cov_data->issueConfirmedNotifications;
|
||||
COV_Subscriptions[index].lifetime =
|
||||
cov_data->lifetime;
|
||||
COV_Subscriptions[index].lifetime = cov_data->lifetime;
|
||||
} else {
|
||||
found = false;
|
||||
}
|
||||
@@ -149,7 +147,7 @@ void handler_cov_task(
|
||||
int lifetime_milliseconds;
|
||||
BACNET_OBJECT_ID object_id;
|
||||
|
||||
|
||||
|
||||
/* existing? - match Object ID and Process ID */
|
||||
for (index = 0; index < MAX_COV_SUBCRIPTIONS; index++) {
|
||||
if (COV_Subscriptions[index].valid) {
|
||||
@@ -164,8 +162,10 @@ void handler_cov_task(
|
||||
COV_Subscriptions[index].valid = false;
|
||||
}
|
||||
/* handle COV notifications */
|
||||
object_id.type = COV_Subscriptions[index].monitoredObjectIdentifier.type;
|
||||
object_id.instance = COV_Subscriptions[index].monitoredObjectIdentifier.instance;
|
||||
object_id.type =
|
||||
COV_Subscriptions[index].monitoredObjectIdentifier.type;
|
||||
object_id.instance =
|
||||
COV_Subscriptions[index].monitoredObjectIdentifier.instance;
|
||||
switch (object_id.type) {
|
||||
case OBJECT_BINARY_INPUT:
|
||||
if (Binary_Input_Change_Of_Value(object_id.instance)) {
|
||||
@@ -190,7 +190,7 @@ static bool cov_subscribe(
|
||||
switch (cov_data->monitoredObjectIdentifier.type) {
|
||||
case OBJECT_BINARY_INPUT:
|
||||
status = true;
|
||||
status = cov_list_subscribe(src,cov_data);
|
||||
status = cov_list_subscribe(src, cov_data);
|
||||
break;
|
||||
default:
|
||||
/* FIXME: what is the ERROR? */
|
||||
|
||||
@@ -171,16 +171,16 @@ static bool Binary_Input_Out_Of_Service(
|
||||
}
|
||||
|
||||
bool Binary_Input_Change_Of_Value(
|
||||
uint32_t object_instance)
|
||||
uint32_t object_instance)
|
||||
{
|
||||
bool status = false;
|
||||
unsigned index;
|
||||
|
||||
|
||||
index = Binary_Input_Instance_To_Index(object_instance);
|
||||
if (index < MAX_BINARY_INPUTS) {
|
||||
status = Change_Of_Value[index];
|
||||
}
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ static void Binary_Input_Out_Of_Service_Set(
|
||||
if (Out_Of_Service[index] != value) {
|
||||
Change_Of_Value[index] = true;
|
||||
}
|
||||
Out_Of_Service[index] = value;
|
||||
Out_Of_Service[index] = value;
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -281,9 +281,11 @@ int Binary_Input_Encode_Property_APDU(
|
||||
bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false);
|
||||
bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false);
|
||||
if (Binary_Input_Out_Of_Service(object_instance)) {
|
||||
bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, true);
|
||||
bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE,
|
||||
true);
|
||||
} else {
|
||||
bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false);
|
||||
bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE,
|
||||
false);
|
||||
}
|
||||
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
|
||||
break;
|
||||
|
||||
@@ -994,7 +994,8 @@ bool Device_Write_Property(
|
||||
case PROP_MAX_INFO_FRAMES:
|
||||
if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) {
|
||||
if (value.type.Unsigned_Int <= 255) {
|
||||
dlmstp_set_max_info_frames((uint8_t)value.type.Unsigned_Int);
|
||||
dlmstp_set_max_info_frames((uint8_t) value.type.
|
||||
Unsigned_Int);
|
||||
status = true;
|
||||
} else {
|
||||
*error_class = ERROR_CLASS_PROPERTY;
|
||||
@@ -1009,7 +1010,7 @@ bool Device_Write_Property(
|
||||
if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) {
|
||||
if ((value.type.Unsigned_Int > 0) &&
|
||||
(value.type.Unsigned_Int <= 127)) {
|
||||
dlmstp_set_max_master((uint8_t)value.type.Unsigned_Int);
|
||||
dlmstp_set_max_master((uint8_t) value.type.Unsigned_Int);
|
||||
status = true;
|
||||
} else {
|
||||
*error_class = ERROR_CLASS_PROPERTY;
|
||||
|
||||
@@ -118,69 +118,69 @@ int main(
|
||||
datalink_set("bip");
|
||||
#endif
|
||||
#if defined(BACDL_BIP)
|
||||
pEnv = getenv("BACNET_IP_PORT");
|
||||
if (pEnv) {
|
||||
bip_set_port(strtol(pEnv, NULL, 0));
|
||||
} else {
|
||||
bip_set_port(0xBAC0);
|
||||
}
|
||||
pEnv = getenv("BACNET_IP_PORT");
|
||||
if (pEnv) {
|
||||
bip_set_port(strtol(pEnv, NULL, 0));
|
||||
} else {
|
||||
bip_set_port(0xBAC0);
|
||||
}
|
||||
#elif defined(BACDL_MSTP)
|
||||
pEnv = getenv("BACNET_MAX_INFO_FRAMES");
|
||||
if (pEnv) {
|
||||
dlmstp_set_max_info_frames(strtol(pEnv, NULL, 0));
|
||||
} else {
|
||||
dlmstp_set_max_info_frames(1);
|
||||
}
|
||||
pEnv = getenv("BACNET_MAX_MASTER");
|
||||
if (pEnv) {
|
||||
dlmstp_set_max_master(strtol(pEnv, NULL, 0));
|
||||
} else {
|
||||
dlmstp_set_max_master(127);
|
||||
}
|
||||
pEnv = getenv("BACNET_MSTP_BAUD");
|
||||
if (pEnv) {
|
||||
RS485_Set_Baud_Rate(strtol(pEnv, NULL, 0));
|
||||
} else {
|
||||
RS485_Set_Baud_Rate(38400);
|
||||
}
|
||||
pEnv = getenv("BACNET_MSTP_MAC");
|
||||
if (pEnv) {
|
||||
dlmstp_set_mac_address(strtol(pEnv, NULL, 0));
|
||||
} else {
|
||||
dlmstp_set_mac_address(127);
|
||||
}
|
||||
pEnv = getenv("BACNET_MAX_INFO_FRAMES");
|
||||
if (pEnv) {
|
||||
dlmstp_set_max_info_frames(strtol(pEnv, NULL, 0));
|
||||
} else {
|
||||
dlmstp_set_max_info_frames(1);
|
||||
}
|
||||
pEnv = getenv("BACNET_MAX_MASTER");
|
||||
if (pEnv) {
|
||||
dlmstp_set_max_master(strtol(pEnv, NULL, 0));
|
||||
} else {
|
||||
dlmstp_set_max_master(127);
|
||||
}
|
||||
pEnv = getenv("BACNET_MSTP_BAUD");
|
||||
if (pEnv) {
|
||||
RS485_Set_Baud_Rate(strtol(pEnv, NULL, 0));
|
||||
} else {
|
||||
RS485_Set_Baud_Rate(38400);
|
||||
}
|
||||
pEnv = getenv("BACNET_MSTP_MAC");
|
||||
if (pEnv) {
|
||||
dlmstp_set_mac_address(strtol(pEnv, NULL, 0));
|
||||
} else {
|
||||
dlmstp_set_mac_address(127);
|
||||
}
|
||||
#endif
|
||||
printf("BACnet Server Demo\n" "BACnet Stack Version %s\n"
|
||||
"BACnet Device ID: %u\n" "Max APDU: %d\n", BACnet_Version,
|
||||
Device_Object_Instance_Number(), MAX_APDU);
|
||||
Init_Service_Handlers();
|
||||
BIP_Debug = true;
|
||||
if (!datalink_init(getenv("BACNET_IFACE")))
|
||||
return 1;
|
||||
atexit(cleanup);
|
||||
/* configure the timeout values */
|
||||
last_seconds = time(NULL);
|
||||
/* broadcast an I-Am on startup */
|
||||
iam_send(&Handler_Transmit_Buffer[0]);
|
||||
/* loop forever */
|
||||
for (;;) {
|
||||
/* input */
|
||||
current_seconds = time(NULL);
|
||||
printf("BACnet Server Demo\n" "BACnet Stack Version %s\n"
|
||||
"BACnet Device ID: %u\n" "Max APDU: %d\n", BACnet_Version,
|
||||
Device_Object_Instance_Number(), MAX_APDU);
|
||||
Init_Service_Handlers();
|
||||
BIP_Debug = true;
|
||||
if (!datalink_init(getenv("BACNET_IFACE")))
|
||||
return 1;
|
||||
atexit(cleanup);
|
||||
/* configure the timeout values */
|
||||
last_seconds = time(NULL);
|
||||
/* broadcast an I-Am on startup */
|
||||
iam_send(&Handler_Transmit_Buffer[0]);
|
||||
/* loop forever */
|
||||
for (;;) {
|
||||
/* input */
|
||||
current_seconds = time(NULL);
|
||||
|
||||
/* returns 0 bytes on timeout */
|
||||
pdu_len = datalink_receive(&src, &Rx_Buf[0], MAX_MPDU, timeout);
|
||||
/* returns 0 bytes on timeout */
|
||||
pdu_len = datalink_receive(&src, &Rx_Buf[0], MAX_MPDU, timeout);
|
||||
|
||||
/* process */
|
||||
if (pdu_len) {
|
||||
npdu_handler(&src, &Rx_Buf[0], pdu_len);
|
||||
/* process */
|
||||
if (pdu_len) {
|
||||
npdu_handler(&src, &Rx_Buf[0], pdu_len);
|
||||
}
|
||||
/* at least one second has passed */
|
||||
if (current_seconds != last_seconds) {
|
||||
dcc_timer_seconds(current_seconds - last_seconds);
|
||||
Load_Control_State_Machine_Handler();
|
||||
}
|
||||
/* output */
|
||||
|
||||
/* blink LEDs, Turn on or off outputs, etc */
|
||||
}
|
||||
/* at least one second has passed */
|
||||
if (current_seconds != last_seconds) {
|
||||
dcc_timer_seconds(current_seconds - last_seconds);
|
||||
Load_Control_State_Machine_Handler();
|
||||
}
|
||||
/* output */
|
||||
|
||||
/* blink LEDs, Turn on or off outputs, etc */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,8 +109,8 @@ static void print_address_cache(
|
||||
uint32_t device_id = 0;
|
||||
unsigned max_apdu = 0;
|
||||
|
||||
printf("%-7s %-14s %-4s %-5s %-14s\n",
|
||||
"Device","MAC","APDU","SNET","SADR");
|
||||
printf("%-7s %-14s %-4s %-5s %-14s\n", "Device", "MAC", "APDU", "SNET",
|
||||
"SADR");
|
||||
printf("------- -------------- ---- ----- --------------\n");
|
||||
for (i = 0; i < MAX_ADDRESS_CACHE; i++) {
|
||||
if (address_get_by_index(i, &device_id, &max_apdu, &address)) {
|
||||
|
||||
Reference in New Issue
Block a user