indented to standard from script

This commit is contained in:
skarg
2012-05-13 15:07:12 +00:00
parent 173e9fb9a9
commit 48e2c60ce2
130 changed files with 1931 additions and 2014 deletions
+19 -16
View File
@@ -45,7 +45,7 @@ static uint16_t BBMD_Timer_Seconds;
static long bbmd_timetolive_seconds = 60000;
static long bbmd_port = 0xBAC0;
static long bbmd_address = 0;
static int bbmd_result = 0;
static int bbmd_result = 0;
/* Simple setters for BBMD registration variables. */
@@ -55,7 +55,8 @@ static int bbmd_result = 0;
* @param address - IPv4 address (long) of BBMD to register with,
* in network byte order.
*/
void dlenv_bbmd_address_set( long address )
void dlenv_bbmd_address_set(
long address)
{
bbmd_address = address;
}
@@ -64,7 +65,8 @@ void dlenv_bbmd_address_set( long address )
* Default if not set is 0xBAC0.
* @param port - The port number (provided in network byte order).
*/
void dlenv_bbmd_port_set( int port )
void dlenv_bbmd_port_set(
int port)
{
bbmd_port = port;
}
@@ -73,7 +75,8 @@ void dlenv_bbmd_port_set( int port )
* Default if not set is 60000 (1000 minutes).
* @param ttl_secs - The Lease Time, in seconds.
*/
void dlenv_bbmd_ttl_set( int ttl_secs )
void dlenv_bbmd_ttl_set(
int ttl_secs)
{
bbmd_timetolive_seconds = ttl_secs;
}
@@ -86,10 +89,11 @@ void dlenv_bbmd_ttl_set( int ttl_secs )
* 0 if no registration request was made, or
* -1 if registration attempt failed.
*/
int dlenv_bbmd_result( void )
int dlenv_bbmd_result(
void)
{
if ( (bbmd_result > 0) &&
(bvlc_get_last_result() == BVLC_RESULT_REGISTER_FOREIGN_DEVICE_NAK) )
if ((bbmd_result > 0) &&
(bvlc_get_last_result() == BVLC_RESULT_REGISTER_FOREIGN_DEVICE_NAK))
return -1;
/* Else, show our send: */
return bbmd_result;
@@ -113,7 +117,7 @@ int dlenv_bbmd_result( void )
int dlenv_register_as_foreign_device(
void)
{
int retval = 0;
int retval = 0;
#if defined(BACDL_BIP)
char *pEnv = NULL;
@@ -138,15 +142,14 @@ int dlenv_register_as_foreign_device(
if (bbmd_address) {
struct in_addr addr;
addr.s_addr = bbmd_address;
fprintf(stderr,
"Registering with BBMD at %s:%ld for %ld seconds\n",
fprintf(stderr, "Registering with BBMD at %s:%ld for %ld seconds\n",
inet_ntoa(addr), bbmd_port, bbmd_timetolive_seconds);
retval = bvlc_register_with_bbmd(bbmd_address,
htons((uint16_t) bbmd_port),
(uint16_t) bbmd_timetolive_seconds);
if ( retval < 0 )
fprintf(stderr,
"FAILED to Register with BBMD at %s \n", inet_ntoa(addr) );
retval =
bvlc_register_with_bbmd(bbmd_address, htons((uint16_t) bbmd_port),
(uint16_t) bbmd_timetolive_seconds);
if (retval < 0)
fprintf(stderr, "FAILED to Register with BBMD at %s \n",
inet_ntoa(addr));
BBMD_Timer_Seconds = bbmd_timetolive_seconds;
}
+4 -3
View File
@@ -106,7 +106,8 @@ void handler_ccov_notification(
fprintf(stderr, "CCOV: Segmented message. Sending Abort!\n");
#endif
goto CCOV_ABORT;
} /* decode the service request only */
}
/* decode the service request only */
/* decode the service request only */
len =
cov_notify_decode_service_request(service_request, service_len,
@@ -125,8 +126,8 @@ void handler_ccov_notification(
fprintf(stderr, "CCOV: ");
if (pProperty_value->propertyIdentifier < 512) {
fprintf(stderr, "%s ",
bactext_property_name
(pProperty_value->propertyIdentifier));
bactext_property_name(pProperty_value->
propertyIdentifier));
} else {
fprintf(stderr, "proprietary %u ",
pProperty_value->propertyIdentifier);
+24 -20
View File
@@ -50,7 +50,7 @@
of an object that have been specified in the standard. */
typedef struct BACnet_COV_Subscription_Flags {
bool valid:1;
bool issueConfirmedNotifications:1; /* optional */
bool issueConfirmedNotifications:1; /* optional */
bool send_requested:1;
} BACNET_COV_SUBSCRIPTION_FLAGS;
@@ -59,7 +59,7 @@ typedef struct BACnet_COV_Subscription {
BACNET_ADDRESS dest;
uint32_t subscriberProcessIdentifier;
BACNET_OBJECT_ID monitoredObjectIdentifier;
uint8_t invokeID; /* for confirmed COV */
uint8_t invokeID; /* for confirmed COV */
uint32_t lifetime; /* optional */
} BACNET_COV_SUBSCRIPTION;
@@ -390,8 +390,8 @@ static void cov_lifetime_expiration_handler(
if (lifetime_seconds >= elapsed_seconds) {
COV_Subscriptions[index].lifetime -= elapsed_seconds;
#if 0
fprintf(stderr, "COVtask: subscription[%d].lifetime=%lu\n",
index, (unsigned long) COV_Subscriptions[index].lifetime);
fprintf(stderr, "COVtask: subscription[%d].lifetime=%lu\n", index,
(unsigned long) COV_Subscriptions[index].lifetime);
#endif
} else {
COV_Subscriptions[index].lifetime = 0;
@@ -443,8 +443,7 @@ void handler_cov_timer_seconds(
lifetime_seconds = COV_Subscriptions[index].lifetime;
if (lifetime_seconds) {
/* only expire COV with definite lifetimes */
cov_lifetime_expiration_handler(index,
elapsed_seconds,
cov_lifetime_expiration_handler(index, elapsed_seconds,
lifetime_seconds);
}
}
@@ -452,7 +451,8 @@ void handler_cov_timer_seconds(
}
}
void handler_cov_task(void)
void handler_cov_task(
void)
{
static int index = 0;
BACNET_OBJECT_TYPE object_type = MAX_BACNET_OBJECT_TYPE;
@@ -461,8 +461,7 @@ void handler_cov_task(void)
bool send = false;
BACNET_PROPERTY_VALUE value_list[2];
/* states for transmitting */
static enum
{
static enum {
COV_STATE_IDLE = 0,
COV_STATE_MARK,
COV_STATE_CLEAR,
@@ -481,7 +480,8 @@ void handler_cov_task(void)
object_type = (BACNET_OBJECT_TYPE)
COV_Subscriptions[index].monitoredObjectIdentifier.type;
object_instance =
COV_Subscriptions[index].monitoredObjectIdentifier.instance;
COV_Subscriptions[index].monitoredObjectIdentifier.
instance;
status = Device_COV(object_type, object_instance);
if (status) {
COV_Subscriptions[index].flag.send_requested = true;
@@ -500,7 +500,8 @@ void handler_cov_task(void)
object_type = (BACNET_OBJECT_TYPE)
COV_Subscriptions[index].monitoredObjectIdentifier.type;
object_instance =
COV_Subscriptions[index].monitoredObjectIdentifier.instance;
COV_Subscriptions[index].monitoredObjectIdentifier.
instance;
Device_COV_Clear(object_type, object_instance);
}
index++;
@@ -516,8 +517,8 @@ void handler_cov_task(void)
(COV_Subscriptions[index].invokeID)) {
if (tsm_invoke_id_free(COV_Subscriptions[index].invokeID)) {
COV_Subscriptions[index].invokeID = 0;
} else if (tsm_invoke_id_failed(
COV_Subscriptions[index].invokeID)) {
} else if (tsm_invoke_id_failed(COV_Subscriptions[index].
invokeID)) {
tsm_free_invoke_id(COV_Subscriptions[index].invokeID);
COV_Subscriptions[index].invokeID = 0;
}
@@ -545,16 +546,18 @@ void handler_cov_task(void)
}
if (send) {
object_type = (BACNET_OBJECT_TYPE)
COV_Subscriptions[index].monitoredObjectIdentifier.type;
COV_Subscriptions[index].monitoredObjectIdentifier.
type;
object_instance =
COV_Subscriptions[index].monitoredObjectIdentifier.instance;
COV_Subscriptions[index].monitoredObjectIdentifier.
instance;
/* configure the linked list for the two properties */
value_list[0].next = &value_list[1];
value_list[1].next = NULL;
(void)Device_Encode_Value_List(object_type, object_instance,
&value_list[0]);
status = cov_send_request(
&COV_Subscriptions[index],
(void) Device_Encode_Value_List(object_type,
object_instance, &value_list[0]);
status =
cov_send_request(&COV_Subscriptions[index],
&value_list[0]);
if (status) {
COV_Subscriptions[index].flag.send_requested = false;
@@ -584,7 +587,8 @@ static bool cov_subscribe(
BACNET_OBJECT_TYPE object_type = MAX_BACNET_OBJECT_TYPE;
uint32_t object_instance = 0;
object_type = (BACNET_OBJECT_TYPE)cov_data->monitoredObjectIdentifier.type;
object_type =
(BACNET_OBJECT_TYPE) cov_data->monitoredObjectIdentifier.type;
object_instance = cov_data->monitoredObjectIdentifier.instance;
status = Device_Valid_Object_Id(object_type, object_instance);
if (status) {
+6 -5
View File
@@ -157,13 +157,14 @@ void handler_device_communication_control(
} else {
#if BAC_ROUTING
/* Check to see if the current Device supports this service. */
len = Routed_Device_Service_Approval(
SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL, (int) state,
&Handler_Transmit_Buffer[pdu_len], service_data->invoke_id );
if ( len > 0 )
len =
Routed_Device_Service_Approval
(SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL, (int) state,
&Handler_Transmit_Buffer[pdu_len], service_data->invoke_id);
if (len > 0)
goto DCC_ABORT;
#endif
if (characterstring_ansi_same(&password, My_Password)) {
len =
encode_simple_ack(&Handler_Transmit_Buffer[pdu_len],
+14 -17
View File
@@ -57,9 +57,9 @@ void handler_get_alarm_summary(
BACNET_CONFIRMED_SERVICE_DATA * service_data)
{
int len = 0;
int pdu_len = 0;
int pdu_len = 0;
int apdu_len = 0;
int bytes_sent = 0;
int bytes_sent = 0;
int alarm_value = 0;
unsigned i = 0;
unsigned j = 0;
@@ -90,9 +90,9 @@ void handler_get_alarm_summary(
}
/* init header */
apdu_len = get_alarm_summary_ack_encode_apdu_init(
&Handler_Transmit_Buffer[pdu_len],
service_data->invoke_id);
apdu_len =
get_alarm_summary_ack_encode_apdu_init(&Handler_Transmit_Buffer
[pdu_len], service_data->invoke_id);
for (i = 0; i < MAX_BACNET_OBJECT_TYPE; i++) {
@@ -100,18 +100,16 @@ void handler_get_alarm_summary(
for (j = 0; j < 0xffff; j++) {
alarm_value = Get_Alarm_Summary[i] (j, &getalarm_data);
if (alarm_value > 0) {
len = get_alarm_sumary_ack_encode_apdu_data(
&Handler_Transmit_Buffer[pdu_len + apdu_len],
service_data->max_resp - apdu_len,
&getalarm_data);
len =
get_alarm_sumary_ack_encode_apdu_data
(&Handler_Transmit_Buffer[pdu_len + apdu_len],
service_data->max_resp - apdu_len, &getalarm_data);
if (len <= 0) {
error = true;
goto GET_ALARM_SUMMARY_ERROR;
}
else
} else
apdu_len += len;
}
else if (alarm_value < 0) {
} else if (alarm_value < 0) {
break;
}
}
@@ -123,7 +121,7 @@ void handler_get_alarm_summary(
fprintf(stderr, "GetAlarmSummary: Sending response!\n");
#endif
GET_ALARM_SUMMARY_ERROR:
GET_ALARM_SUMMARY_ERROR:
if (error) {
if (len == BACNET_STATUS_ABORT) {
/* BACnet APDU too small to fit data, so proper response is Abort */
@@ -135,8 +133,7 @@ GET_ALARM_SUMMARY_ERROR:
fprintf(stderr,
"GetAlarmSummary: Reply too big to fit into APDU!\n");
#endif
}
else {
} else {
apdu_len =
bacerror_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
service_data->invoke_id, SERVICE_CONFIRMED_GET_ALARM_SUMMARY,
@@ -148,7 +145,7 @@ GET_ALARM_SUMMARY_ERROR:
}
GET_ALARM_SUMMARY_ABORT:
GET_ALARM_SUMMARY_ABORT:
pdu_len += apdu_len;
bytes_sent =
datalink_send_pdu(src, &npdu_data, &Handler_Transmit_Buffer[0],
+6 -5
View File
@@ -131,13 +131,14 @@ void handler_reinitialize_device(
} else {
#if BAC_ROUTING
/* Check to see if the current Device supports this service. */
len = Routed_Device_Service_Approval(
SERVICE_CONFIRMED_REINITIALIZE_DEVICE, (int) rd_data.state,
&Handler_Transmit_Buffer[pdu_len], service_data->invoke_id );
if ( len > 0 )
len =
Routed_Device_Service_Approval
(SERVICE_CONFIRMED_REINITIALIZE_DEVICE, (int) rd_data.state,
&Handler_Transmit_Buffer[pdu_len], service_data->invoke_id);
if (len > 0)
goto RD_ABORT;
#endif
if (Device_Reinitialize(&rd_data)) {
len =
encode_simple_ack(&Handler_Transmit_Buffer[pdu_len],
+5 -5
View File
@@ -210,17 +210,17 @@ static void routed_apdu_handler(
* we don't try the standard path of asking Who-Is-Router-to-Network. */
#if defined(BACDL_BIP)
/* If wasn't unicast to us, must have been one of the bcast types.
* Drop it. */
if ( bvlc_get_function_code() != BVLC_ORIGINAL_UNICAST_NPDU )
* Drop it. */
if (bvlc_get_function_code() != BVLC_ORIGINAL_UNICAST_NPDU)
return;
#endif
/* Upper level handlers knew that this was sent as a bcast,
/* Upper level handlers knew that this was sent as a bcast,
* but our only other way to guess at that here is if the dest->adr
* is absent, then we know this is some sort of bcast.
*/
if ( dest->len > 0 ) {
if (dest->len > 0) {
Send_Reject_Message_To_Network(src, NETWORK_REJECT_NO_ROUTE,
dest->net);
dest->net);
} /* else, silently drop it */
return;
}
+2 -1
View File
@@ -296,7 +296,8 @@ void handler_read_property_multiple(
&Temp_Buf[0], apdu_len, len, MAX_APDU);
if (copy_len == 0) {
#if PRINT_ENABLED
fprintf(stderr, "RPM: Too full to encode property!\r\n");
fprintf(stderr,
"RPM: Too full to encode property!\r\n");
#endif
rpmdata.error_code =
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
+6 -6
View File
@@ -221,8 +221,8 @@ void rpm_ack_print_data(
#if PRINT_ENABLED
if (listOfProperties->propertyIdentifier < 512) {
fprintf(stdout, " %s: ",
bactext_property_name(listOfProperties->
propertyIdentifier));
bactext_property_name
(listOfProperties->propertyIdentifier));
} else {
fprintf(stdout, " proprietary %u: ",
(unsigned) listOfProperties->propertyIdentifier);
@@ -269,10 +269,10 @@ void rpm_ack_print_data(
#if PRINT_ENABLED
/* AccessError */
fprintf(stdout, "BACnet Error: %s: %s\r\n",
bactext_error_class_name((int) listOfProperties->
error.error_class),
bactext_error_code_name((int) listOfProperties->
error.error_code));
bactext_error_class_name((int) listOfProperties->error.
error_class),
bactext_error_code_name((int) listOfProperties->error.
error_code));
#endif
}
listOfProperties = listOfProperties->next;
+2 -2
View File
@@ -104,8 +104,8 @@ void handler_ucov_notification(
fprintf(stderr, "UCOV: ");
if (pProperty_value->propertyIdentifier < 512) {
fprintf(stderr, "%s ",
bactext_property_name
(pProperty_value->propertyIdentifier));
bactext_property_name(pProperty_value->
propertyIdentifier));
} else {
fprintf(stderr, "proprietary %u ",
pProperty_value->propertyIdentifier);
+5 -5
View File
@@ -56,14 +56,15 @@ void handler_unconfirmed_private_transfer(
#if PRINT_ENABLED
fprintf(stderr, "Received Unconfirmed Private Transfer Request!\n");
#endif
len = ptransfer_decode_service_request(
service_request, service_len, &private_data);
len =
ptransfer_decode_service_request(service_request, service_len,
&private_data);
if (len >= 0) {
#if PRINT_ENABLED
printf("PrivateTransfer:vendorID=%u\r\n",
(unsigned)private_data.vendorID);
(unsigned) private_data.vendorID);
printf("PrivateTransfer:serviceNumber=%lu\r\n",
(unsigned long)private_data.serviceNumber);
(unsigned long) private_data.serviceNumber);
#endif
application_data = private_data.serviceParameters;
application_data_len = private_data.serviceParametersLen;
@@ -107,4 +108,3 @@ void handler_unconfirmed_private_transfer(
#endif
}
}
+3 -4
View File
@@ -65,9 +65,8 @@ static void match_name_or_object(
} else {
/* valid object_name copy in my device? */
found =
Device_Object_Name_Copy(
(BACNET_OBJECT_TYPE)data->object.identifier.type,
data->object.identifier.instance, &object_name);
Device_Object_Name_Copy((BACNET_OBJECT_TYPE) data->object.
identifier.type, data->object.identifier.instance, &object_name);
if (found) {
Send_I_Have(Device_Object_Instance_Number(),
(BACNET_OBJECT_TYPE) data->object.identifier.type,
@@ -110,7 +109,7 @@ void handler_who_has(
}
#ifdef DEPRECATED /* was for BAC_ROUTING - delete in 2/2012 if still unused */
#ifdef DEPRECATED /* was for BAC_ROUTING - delete in 2/2012 if still unused */
/** Handler for Who-Has requests in the virtual routing setup,
* with broadcast I-Have response.
* Will respond if the device Object ID matches, and we have
+1 -1
View File
@@ -113,7 +113,7 @@ void handler_who_is_unicast(
}
#ifdef DEPRECATED /* was for BAC_ROUTING - delete in 2/2012 if still unused */
#ifdef DEPRECATED /* was for BAC_ROUTING - delete in 2/2012 if still unused */
/** Local function to check Who-Is requests against our Device IDs.
* Will check the gateway (root Device) and all virtual routed
* Devices against the range and respond for each that matches.
+2 -2
View File
@@ -181,8 +181,8 @@ bool WPValidateString(
(!characterstring_printable(&pValue->type.Character_String))) {
/* assumption: non-empty also means must be "printable" */
*pErrorCode = ERROR_CODE_VALUE_OUT_OF_RANGE;
} else if (characterstring_length(&pValue->
type.Character_String) > iMaxLen) {
} else if (characterstring_length(&pValue->type.Character_String) >
iMaxLen) {
*pErrorClass = ERROR_CLASS_RESOURCES;
*pErrorCode = ERROR_CODE_NO_SPACE_TO_WRITE_PROPERTY;
} else
+1 -1
View File
@@ -155,7 +155,7 @@ void handler_write_property_multiple(
}
} while (decode_len < service_len);
WPM_ABORT:
WPM_ABORT:
/* encode the NPDU portion of the packet */
datalink_get_my_address(&my_address);
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
+2 -3
View File
@@ -157,9 +157,8 @@ uint8_t Send_Write_Property_Request(
#if PRINT_ENABLED_DEBUG
fprintf(stderr, "WriteProperty service: " "%s tag=%d\n",
(object_value->context_specific ? "context" : "application"),
(int) (object_value->
context_specific ? object_value->context_tag : object_value->
tag));
(int) (object_value->context_specific ? object_value->
context_tag : object_value->tag));
#endif
len = bacapp_encode_data(&application_data[apdu_len], object_value);
if ((len + apdu_len) < MAX_APDU) {