Remove trailing whitespace
Signed-off-by: Stefan Wahren <info@lategoodbye.de>
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
||||
// All rights reserved.
|
||||
//
|
||||
// rSCADA
|
||||
// rSCADA
|
||||
// http://www.rSCADA.se
|
||||
// info@rscada.se
|
||||
//
|
||||
@ -22,14 +22,14 @@ static int debug = 0;
|
||||
//
|
||||
static int
|
||||
init_slaves(mbus_handle *handle)
|
||||
{
|
||||
{
|
||||
if (debug)
|
||||
printf("%s: debug: sending init frame #1\n", __PRETTY_FUNCTION__);
|
||||
|
||||
|
||||
if (mbus_send_ping_frame(handle, MBUS_ADDRESS_NETWORK_LAYER, 1) == -1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// resend SND_NKE, maybe the first get lost
|
||||
@ -37,7 +37,7 @@ init_slaves(mbus_handle *handle)
|
||||
|
||||
if (debug)
|
||||
printf("%s: debug: sending init frame #2\n", __PRETTY_FUNCTION__);
|
||||
|
||||
|
||||
if (mbus_send_ping_frame(handle, MBUS_ADDRESS_NETWORK_LAYER, 1) == -1)
|
||||
{
|
||||
return 0;
|
||||
@ -77,21 +77,21 @@ main(int argc, char **argv)
|
||||
int c;
|
||||
for (c=1; c<argc-2; c++)
|
||||
{
|
||||
if (strcmp(argv[c], "-d") == 0)
|
||||
if (strcmp(argv[c], "-d") == 0)
|
||||
{
|
||||
debug = 1;
|
||||
}
|
||||
}
|
||||
else if (strcmp(argv[c], "-b") == 0)
|
||||
{
|
||||
c++;
|
||||
baudrate = atol(argv[c]);
|
||||
}
|
||||
}
|
||||
else if (strcmp(argv[c], "-f") == 0)
|
||||
{
|
||||
c++;
|
||||
maxframes = atoi(argv[c]);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
parse_abort(argv);
|
||||
}
|
||||
@ -100,16 +100,16 @@ main(int argc, char **argv)
|
||||
{
|
||||
parse_abort(argv);
|
||||
}
|
||||
device = argv[c];
|
||||
device = argv[c];
|
||||
addr_str = argv[c+1];
|
||||
|
||||
|
||||
|
||||
if (debug)
|
||||
{
|
||||
mbus_register_send_event(&mbus_dump_send_event);
|
||||
mbus_register_recv_event(&mbus_dump_recv_event);
|
||||
}
|
||||
|
||||
|
||||
if ((handle = mbus_context_serial(device)) == NULL)
|
||||
{
|
||||
fprintf(stderr, "Could not initialize M-Bus context: %s\n", mbus_error_str());
|
||||
@ -130,7 +130,7 @@ main(int argc, char **argv)
|
||||
mbus_context_free(handle);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (init_slaves(handle) == 0)
|
||||
{
|
||||
mbus_disconnect(handle);
|
||||
@ -165,19 +165,19 @@ main(int argc, char **argv)
|
||||
fprintf(stderr, "%s: Error: Failed to select secondary address [%s].\n", __PRETTY_FUNCTION__, addr_str);
|
||||
mbus_disconnect(handle);
|
||||
mbus_context_free(handle);
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
// else MBUS_PROBE_SINGLE
|
||||
|
||||
address = MBUS_ADDRESS_NETWORK_LAYER;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// primary addressing
|
||||
address = atoi(addr_str);
|
||||
}
|
||||
|
||||
// instead of the send and recv, use this sendrecv function that
|
||||
}
|
||||
|
||||
// instead of the send and recv, use this sendrecv function that
|
||||
// takes care of the possibility of multi-telegram replies (limit = 16 frames)
|
||||
if (mbus_sendrecv_request(handle, address, &reply, maxframes) != 0)
|
||||
{
|
||||
@ -207,14 +207,14 @@ main(int argc, char **argv)
|
||||
mbus_frame_free(reply.next);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
printf("%s", xml_result);
|
||||
free(xml_result);
|
||||
|
||||
mbus_disconnect(handle);
|
||||
mbus_context_free(handle);
|
||||
mbus_frame_free(reply.next);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user