Ran indent script.

This commit is contained in:
skarg
2009-07-29 18:06:33 +00:00
parent 551f2767e0
commit db61a1122f
37 changed files with 227 additions and 218 deletions
+27 -30
View File
@@ -61,12 +61,11 @@ static uint8_t RxBuffer[MAX_MPDU];
static uint8_t TxBuffer[MAX_MPDU];
/* statistics derived from monitoring the network for each node */
struct mstp_statistics
{
struct mstp_statistics {
/* counts how many times the node passes the token */
uint32_t token_count;
uint32_t token_count;
/* counts how many times the node gets a second token */
uint32_t token_retries;
uint32_t token_retries;
/* delay after poll for master */
uint32_t tusage_timeout;
/* highest number MAC during poll for master */
@@ -90,8 +89,8 @@ static uint32_t timeval_diff_ms(
uint32_t ms = 0;
/* convert to milliseconds */
ms = (now->tv_sec-old->tv_sec)*1000+
(now->tv_usec-old->tv_usec)/1000;
ms = (now->tv_sec - old->tv_sec) * 1000 + (now->tv_usec -
old->tv_usec) / 1000;
return ms;
}
@@ -100,7 +99,7 @@ static void packet_statistics(
struct timeval *tv,
volatile struct mstp_port_struct_t *mstp_port)
{
static struct timeval old_tv = {0};
static struct timeval old_tv = { 0 };
static uint8_t old_frame = 255;
static uint8_t old_src = 255;
static uint8_t old_dst = 255;
@@ -189,39 +188,38 @@ static void packet_statistics(
old_tv.tv_usec = tv->tv_usec;
}
static void packet_statistics_save(void)
static void packet_statistics_save(
void)
{
unsigned i; /* loop counter */
fprintf(stdout, "\r\n");
/* separate with tabs (8) keep words under 8 characters */
fprintf(stdout,
fprintf(stdout,
"MAC\tMaxMstr\tTokens\tRetries\tTreply"
"\tTusage\tTrpfm\tTder\tTpostpd");
fprintf(stdout, "\r\n");
for (i = 0; i < 256; i++) {
/* check for masters or slaves */
if ((MSTP_Statistics[i].token_count) ||
(MSTP_Statistics[i].der_reply)) {
if ((MSTP_Statistics[i].token_count) || (MSTP_Statistics[i].der_reply)) {
fprintf(stdout, "%u\t%u", i,
(unsigned)MSTP_Statistics[i].max_master);
fprintf(stdout,
"\t%lu\t%lu\t%lu\t%lu",
(long unsigned int)MSTP_Statistics[i].token_count,
(long unsigned int)MSTP_Statistics[i].token_retries,
(long unsigned int)MSTP_Statistics[i].token_reply,
(long unsigned int)MSTP_Statistics[i].tusage_timeout);
fprintf(stdout,
"\t%lu\t%lu\t%lu",
(long unsigned int)MSTP_Statistics[i].pfm_reply,
(long unsigned int)MSTP_Statistics[i].der_reply,
(long unsigned int)MSTP_Statistics[i].reply_postponed);
(unsigned) MSTP_Statistics[i].max_master);
fprintf(stdout, "\t%lu\t%lu\t%lu\t%lu",
(long unsigned int) MSTP_Statistics[i].token_count,
(long unsigned int) MSTP_Statistics[i].token_retries,
(long unsigned int) MSTP_Statistics[i].token_reply,
(long unsigned int) MSTP_Statistics[i].tusage_timeout);
fprintf(stdout, "\t%lu\t%lu\t%lu",
(long unsigned int) MSTP_Statistics[i].pfm_reply,
(long unsigned int) MSTP_Statistics[i].der_reply,
(long unsigned int) MSTP_Statistics[i].reply_postponed);
fprintf(stdout, "\r\n");
}
}
}
static void packet_statistics_clear(void)
static void packet_statistics_clear(
void)
{
unsigned i; /* loop counter */
@@ -247,7 +245,7 @@ static uint16_t Timer_Silence(
delta_time = 0xFFFF;
}
return (uint16_t)delta_time;
return (uint16_t) delta_time;
}
static void Timer_Silence_Reset(
@@ -391,7 +389,8 @@ static void cleanup(
}
#if defined(_WIN32)
static BOOL WINAPI CtrlCHandler(DWORD dwCtrlType)
static BOOL WINAPI CtrlCHandler(
DWORD dwCtrlType)
{
dwCtrlType = dwCtrlType;
exit(0);
@@ -472,10 +471,8 @@ int main(
RS485_Interface(), (long) RS485_Get_Baud_Rate());
atexit(cleanup);
#if defined(_WIN32)
SetConsoleMode(
GetStdHandle(STD_INPUT_HANDLE),
ENABLE_PROCESSED_INPUT);
SetConsoleCtrlHandler( (PHANDLER_ROUTINE)CtrlCHandler, TRUE );
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), ENABLE_PROCESSED_INPUT);
SetConsoleCtrlHandler((PHANDLER_ROUTINE) CtrlCHandler, TRUE);
#else
signal_init();
#endif
+2 -1
View File
@@ -175,7 +175,8 @@ int Analog_Input_Encode_Property_APDU(
encode_application_enumerated(&apdu[0], OBJECT_ANALOG_INPUT);
break;
case PROP_PRESENT_VALUE:
apdu_len = encode_application_real(&apdu[0],
apdu_len =
encode_application_real(&apdu[0],
Analog_Input_Present_Value(object_instance));
break;
case PROP_STATUS_FLAGS:
+2 -4
View File
@@ -377,10 +377,8 @@ bool Analog_Value_Write_Property(
/* Command priority 6 is reserved for use by Minimum On/Off
algorithm and may not be used for other purposes in any
object. */
if (Analog_Value_Present_Value_Set(
wp_data->object_instance,
value.type.Real,
wp_data->priority)) {
if (Analog_Value_Present_Value_Set(wp_data->object_instance,
value.type.Real, wp_data->priority)) {
status = true;
} else if (wp_data->priority == 6) {
/* Command priority 6 is reserved for use by Minimum On/Off
+2 -2
View File
@@ -285,12 +285,12 @@ int Binary_Output_Encode_Property_APDU(
object_index =
Binary_Output_Instance_To_Index(object_instance);
if (array_index <= BACNET_MAX_PRIORITY) {
if (Binary_Output_Level[object_index][array_index-1] ==
if (Binary_Output_Level[object_index][array_index - 1] ==
BINARY_NULL)
len = encode_application_null(&apdu[apdu_len]);
else {
present_value =
Binary_Output_Level[object_index][array_index-1];
Binary_Output_Level[object_index][array_index - 1];
len =
encode_application_enumerated(&apdu[apdu_len],
present_value);
+4 -4
View File
@@ -245,10 +245,10 @@ int main(
if (Error_Detected)
break;
/* wait until the device is bound, or timeout and quit */
if(!found){
found =
address_bind_request(Target_Device_Object_Instance, &max_apdu,
&Target_Address);
if (!found) {
found =
address_bind_request(Target_Device_Object_Instance, &max_apdu,
&Target_Address);
}
if (found) {
if (invoke_id == 0) {
+1 -1
View File
@@ -321,7 +321,7 @@ int main(
if (Error_Detected)
break;
/* wait until the device is bound, or timeout and quit */
if(!found){
if (!found) {
found =
address_bind_request(Target_Device_Object_Instance, &max_apdu,
&Target_Address);
+5 -2
View File
@@ -67,14 +67,17 @@ static void Init_Service_Handlers(
handler_read_property);
}
int main(int argc, char *argv[]) {
int main(
int argc,
char *argv[])
{
char *value_string = NULL;
bool status = false;
BACNET_COV_DATA cov_data;
BACNET_PROPERTY_VALUE value_list;
uint8_t tag;
if (argc < 7) {
if (argc < 7) {
/* note: priority 16 and 0 should produce the same end results... */
printf("Usage: %s pid device-id object-type object-instance "
"time property tag value [priority] [index]\r\n" "\r\n" "pid:\r\n"
+13 -8
View File
@@ -67,7 +67,8 @@ void MyAbortHandler(
(void) src;
(void) invoke_id;
(void) server;
fprintf(stderr,"BACnet Abort: %s\r\n", bactext_abort_reason_name(abort_reason));
fprintf(stderr, "BACnet Abort: %s\r\n",
bactext_abort_reason_name(abort_reason));
Error_Detected = true;
}
@@ -79,7 +80,8 @@ void MyRejectHandler(
/* FIXME: verify src and invoke id */
(void) src;
(void) invoke_id;
fprintf(stderr, "BACnet Reject: %s\r\n", bactext_reject_reason_name(reject_reason));
fprintf(stderr, "BACnet Reject: %s\r\n",
bactext_reject_reason_name(reject_reason));
Error_Detected = true;
}
@@ -111,14 +113,16 @@ static void print_address_cache(
unsigned max_apdu = 0;
/* printf("%-7s %-14s %-4s %-5s %-14s\n", "Device", "MAC", "APDU", "SNET", "SADR"); */
printf(";%-7s %-17s %-5s %-17s %-4s\n", "Device", "MAC", "SNET", "SADR", "APDU");
printf(";%-7s %-17s %-5s %-17s %-4s\n", "Device", "MAC", "SNET", "SADR",
"APDU");
printf(";------- ----------------- ----- ----------------- ----\n");
for (i = 0; i < MAX_ADDRESS_CACHE; i++) {
if (address_get_by_index(i, &device_id, &max_apdu, &address)) {
printf(" %-7u ", device_id);
for (j = 0; j < MAX_MAC_LEN; j++) {
if (j < address.mac_len) {
if(j > 0) printf(":");
if (j > 0)
printf(":");
printf("%02X", address.mac[j]);
} else {
printf(" ");
@@ -128,20 +132,21 @@ static void print_address_cache(
if (address.net) {
for (j = 0; j < MAX_MAC_LEN; j++) {
if (j < address.len) {
if(j > 0) printf(":");
if (j > 0)
printf(":");
printf("%02X", address.adr[j]);
} else {
printf(" ");
}
/*printf(" "); */
}
}else{
} else {
printf("0 ");
for (j = 2; j < MAX_MAC_LEN; j++) {
printf (" ");
printf(" ");
}
printf("");
}
}
printf("%-4hu ", max_apdu);
printf("\n");
}
+1 -1
View File
@@ -434,7 +434,7 @@ int main(int argc, char *argv[]) {
if (Error_Detected)
break;
/* wait until the device is bound, or timeout and quit */
if(!found){
if (!found) {
found =
address_bind_request(Target_Device_Object_Instance, &max_apdu,
&Target_Address);