Changed domain to rscada.se

Changed exit code for errors
This commit is contained in:
Stefan Wahren 2012-04-10 21:19:58 +02:00
parent 30d1433ded
commit 3a04aedf59
27 changed files with 136 additions and 128 deletions

View File

@ -2,9 +2,9 @@
# Copyright (C) 2010, Raditex AB
# All rights reserved.
#
# FreeSCADA
# http://www.FreeSCADA.com
# freescada@freescada.com
# rSCADA
# http://www.rSCADA.se
# info@rscada.se
#
# ------------------------------------------------------------------------------
PACKAGE = @PACKAGE@

View File

@ -2,9 +2,9 @@
// Copyright (C) 2011, Robert Johansson, Raditex AB
// All rights reserved.
//
// FreeSCADA
// http://www.FreeSCADA.com
// freescada@freescada.com
// rSCADA
// http://www.rSCADA.se
// info@rscada.se
//
//------------------------------------------------------------------------------
@ -67,13 +67,13 @@ main(int argc, char **argv)
if ((handle = mbus_connect_serial(device)) == NULL)
{
fprintf(stderr, "Failed to setup connection to M-bus gateway\n");
return -1;
return 1;
}
if (mbus_serial_set_baudrate(handle->m_serial_handle, baudrate) == -1)
{
printf("Failed to set baud rate.\n");
return -1;
return 1;
}
@ -88,24 +88,24 @@ main(int argc, char **argv)
if (probe_ret == MBUS_PROBE_COLLISION)
{
fprintf(stderr, "%s: Error: The address mask [%s] matches more than one device.\n", __PRETTY_FUNCTION__, addr_str);
return -1;
return 1;
}
else if (probe_ret == MBUS_PROBE_NOTHING)
{
fprintf(stderr, "%s: Error: The selected secondary address does not match any device [%s].\n", __PRETTY_FUNCTION__, addr_str);
return -1;
return 1;
}
else if (probe_ret == MBUS_PROBE_ERROR)
{
fprintf(stderr, "%s: Error: Failed to probe secondary address [%s].\n", __PRETTY_FUNCTION__, addr_str);
return -1;
return 1;
}
// else MBUS_PROBE_SINGLE
if (mbus_send_request_frame(handle, 253) == -1)
{
fprintf(stderr, "Failed to send M-Bus request frame.\n");
return -1;
return 1;
}
}
else
@ -116,14 +116,14 @@ main(int argc, char **argv)
if (mbus_send_request_frame(handle, address) == -1)
{
fprintf(stderr, "Failed to send M-Bus request frame.\n");
return -1;
return 1;
}
}
if (mbus_recv_frame(handle, &reply) == -1)
{
fprintf(stderr, "Failed to receive M-Bus response frame.\n");
return -1;
return 1;
}
//

View File

@ -2,9 +2,9 @@
// Copyright (C) 2011, Robert Johansson, Raditex AB
// All rights reserved.
//
// FreeSCADA
// http://www.FreeSCADA.com
// freescada@freescada.com
// rSCADA
// http://www.rSCADA.se
// info@rscada.se
//
//------------------------------------------------------------------------------
@ -60,19 +60,19 @@ main(int argc, char **argv)
if (strlen(addr_mask) != 16)
{
fprintf(stderr, "Misformatted secondary address mask. Must be 16 character HEX number.\n");
return -1;
return 1;
}
if ((handle = mbus_connect_serial(device)) == NULL)
{
fprintf(stderr, "Failed to setup connection to M-bus gateway: %s\n", mbus_error_str());
return -1;
return 1;
}
if (mbus_serial_set_baudrate(handle->m_serial_handle, baudrate) == -1)
{
printf("Failed to set baud rate.\n");
return -1;
return 1;
}
mbus_scan_2nd_address_range(handle, 0, addr_mask);

View File

@ -2,9 +2,9 @@
// Copyright (C) 2011, Robert Johansson, Raditex AB
// All rights reserved.
//
// FreeSCADA
// http://www.FreeSCADA.com
// freescada@freescada.com
// rSCADA
// http://www.rSCADA.se
// info@rscada.se
//
//------------------------------------------------------------------------------
@ -45,13 +45,13 @@ main(int argc, char **argv)
if ((handle = mbus_connect_serial(device)) == NULL)
{
printf("Failed to setup connection to M-bus gateway\n");
return -1;
return 1;
}
if (mbus_serial_set_baudrate(handle->m_serial_handle, baudrate) == -1)
{
printf("Failed to set baud rate.\n");
return -1;
return 1;
}
@ -64,7 +64,7 @@ main(int argc, char **argv)
if (mbus_send_ping_frame(handle, address) == -1)
{
printf("Scan failed. Could not send ping frame: %s\n", mbus_error_str());
return -1;
return 1;
}
if (mbus_recv_frame(handle, &reply) == -1)

View File

@ -2,9 +2,9 @@
// Copyright (C) 2011, Robert Johansson, Raditex AB
// All rights reserved.
//
// FreeSCADA
// http://www.FreeSCADA.com
// freescada@freescada.com
// rSCADA
// http://www.rSCADA.se
// info@rscada.se
//
//------------------------------------------------------------------------------
@ -49,25 +49,25 @@ main(int argc, char **argv)
if (strlen(addr) != 16)
{
printf("Misformatted secondary address. Must be 16 character HEX number.\n");
return -1;
return 1;
}
if ((handle = mbus_connect_serial(device)) == NULL)
{
printf("Failed to setup connection to M-bus device: %s\n", mbus_error_str());
return -1;
return 1;
}
if (mbus_serial_set_baudrate(handle->m_serial_handle, baudrate) == -1)
{
printf("Failed to set baud rate.\n");
return -1;
return 1;
}
if (mbus_send_select_frame(handle, addr) == -1)
{
printf("Failed to send selection frame: %s\n", mbus_error_str());
return -1;
return 1;
}
ret = mbus_recv_frame(handle, &reply);
@ -75,13 +75,13 @@ main(int argc, char **argv)
if (ret == -1)
{
printf("No reply from device with secondary address %s: %s\n", argv[2], mbus_error_str());
return -1;
return 1;
}
if (ret == -2)
{
printf("Invalid reply from %s: The address address probably match more than one device: %s\n", argv[2], mbus_error_str());
return -1;
return 1;
}
if (mbus_frame_type(&reply) == MBUS_FRAME_TYPE_ACK)
@ -89,13 +89,13 @@ main(int argc, char **argv)
if (mbus_send_request_frame(handle, 253) == -1)
{
printf("Failed to send request to selected secondary device: %s\n", mbus_error_str());
return -1;
return 1;
}
if (mbus_recv_frame(handle, &reply) == -1)
{
printf("Failed to recieve reply from selected secondary device: %s\n", mbus_error_str());
return -1;
return 1;
}
if (mbus_frame_type(&reply) != MBUS_FRAME_TYPE_ACK)

View File

@ -2,9 +2,9 @@
// Copyright (C) 2010-2012, Robert Johansson and contributors, Raditex AB
// All rights reserved.
//
// FreeSCADA
// http://www.FreeSCADA.com
// freescada@freescada.com
// rSCADA
// http://www.rSCADA.se
// info@rscada.se
//
// Contributors:
// Large parts of this file was contributed by Stefan Wahren.
@ -55,19 +55,19 @@ main(int argc, char **argv)
if ((handle = mbus_connect_serial(device)) == NULL)
{
printf("Failed to setup connection to M-bus device: %s\n", mbus_error_str());
return -1;
return 1;
}
if (mbus_serial_set_baudrate(handle->m_serial_handle, source_baudrate) == -1)
{
printf("Failed to set baud rate.\n");
return -1;
return 1;
}
if (mbus_send_switch_baudrate_frame(handle, address, target_baudrate) == -1)
{
printf("Failed to send switch baudrate frame: %s\n", mbus_error_str());
return -1;
return 1;
}
ret = mbus_recv_frame(handle, &reply);
@ -75,7 +75,7 @@ main(int argc, char **argv)
if (ret == -1)
{
printf("No reply from device\n");
return -1;
return 1;
}
if (mbus_frame_type(&reply) != MBUS_FRAME_TYPE_ACK)

View File

@ -2,9 +2,9 @@
// Copyright (C) 2011, Robert Johansson, Raditex AB
// All rights reserved.
//
// FreeSCADA
// http://www.FreeSCADA.com
// freescada@freescada.com
// rSCADA
// http://www.rSCADA.se
// info@rscada.se
//
//------------------------------------------------------------------------------
@ -56,7 +56,7 @@ main(int argc, char **argv)
if ((handle = mbus_connect_tcp(host, port)) == NULL)
{
fprintf(stderr, "Failed to setup connection to M-bus gateway\n");
return -1;
return 1;
}
if (strlen(addr_str) == 16)
@ -70,24 +70,24 @@ main(int argc, char **argv)
if (probe_ret == MBUS_PROBE_COLLISION)
{
fprintf(stderr, "%s: Error: The address mask [%s] matches more than one device.\n", __PRETTY_FUNCTION__, addr_str);
return -1;
return 1;
}
else if (probe_ret == MBUS_PROBE_NOTHING)
{
fprintf(stderr, "%s: Error: The selected secondary address does not match any device [%s].\n", __PRETTY_FUNCTION__, addr_str);
return -1;
return 1;
}
else if (probe_ret == MBUS_PROBE_ERROR)
{
fprintf(stderr, "%s: Error: Failed to probe secondary address [%s].\n", __PRETTY_FUNCTION__, addr_str);
return -1;
return 1;
}
// else MBUS_PROBE_SINGLE
if (mbus_send_request_frame(handle, 253) == -1)
{
fprintf(stderr, "Failed to send M-Bus request frame.\n");
return -1;
return 1;
}
}
else
@ -98,14 +98,14 @@ main(int argc, char **argv)
if (mbus_send_request_frame(handle, address) == -1)
{
fprintf(stderr, "Failed to send M-Bus request frame.\n");
return -1;
return 1;
}
}
if (mbus_recv_frame(handle, &reply) == -1)
{
fprintf(stderr, "Failed to receive M-Bus response frame.\n");
return -1;
return 1;
}
//

View File

@ -2,9 +2,9 @@
// Copyright (C) 2011, Robert Johansson, Raditex AB
// All rights reserved.
//
// FreeSCADA
// http://www.FreeSCADA.com
// freescada@freescada.com
// rSCADA
// http://www.rSCADA.se
// info@rscada.se
//
//------------------------------------------------------------------------------
@ -51,13 +51,13 @@ main(int argc, char **argv)
if (strlen(addr_mask) != 16)
{
fprintf(stderr, "Misformatted secondary address mask. Must be 16 character HEX number.\n");
return -1;
return 1;
}
if ((handle = mbus_connect_tcp(host, port)) == NULL)
{
fprintf(stderr, "Failed to setup connection to M-bus gateway: %s\n", mbus_error_str());
return -1;
return 1;
}
mbus_scan_2nd_address_range(handle, 0, addr_mask);

View File

@ -2,9 +2,9 @@
// Copyright (C) 2011, Robert Johansson, Raditex AB
// All rights reserved.
//
// FreeSCADA
// http://www.FreeSCADA.com
// freescada@freescada.com
// rSCADA
// http://www.rSCADA.se
// info@rscada.se
//
//------------------------------------------------------------------------------
@ -40,7 +40,7 @@ main(int argc, char **argv)
if ((handle = mbus_connect_tcp(host, port)) == NULL)
{
printf("Scan failed: Could not setup connection to M-bus gateway: %s\n", mbus_error_str());
return -1;
return 1;
}
for (address = 0; address < 254; address++)
@ -50,7 +50,7 @@ main(int argc, char **argv)
if (mbus_send_ping_frame(handle, address) == -1)
{
printf("Scan failed. Could not send ping frame: %s\n", mbus_error_str());
return -1;
return 1;
}
if (mbus_recv_frame(handle, &reply) == -1)

View File

@ -2,9 +2,9 @@
// Copyright (C) 2011, Robert Johansson, Raditex AB
// All rights reserved.
//
// FreeSCADA
// http://www.FreeSCADA.com
// freescada@freescada.com
// rSCADA
// http://www.rSCADA.se
// info@rscada.se
//
//------------------------------------------------------------------------------
@ -42,19 +42,19 @@ main(int argc, char **argv)
if (strlen(argv[3]) != 16)
{
printf("Misformatted secondary address. Must be 16 character HEX number.\n");
return -1;
return 1;
}
if ((handle = mbus_connect_tcp(host, port)) == NULL)
{
printf("Failed to setup connection to M-bus gateway: %s\n", mbus_error_str());
return -1;
return 1;
}
if (mbus_send_select_frame(handle, addr) == -1)
{
printf("Failed to send selection frame: %s\n", mbus_error_str());
return -1;
return 1;
}
ret = mbus_recv_frame(handle, &reply);
@ -62,13 +62,13 @@ main(int argc, char **argv)
if (ret == -1)
{
printf("No reply from device with secondary address %s: %s\n", argv[3], mbus_error_str());
return -1;
return 1;
}
if (ret == -2)
{
printf("Invalid reply from %s: The address address probably match more than one device: %s\n", argv[3], mbus_error_str());
return -1;
return 1;
}
if (mbus_frame_type(&reply) == MBUS_FRAME_TYPE_ACK)
@ -76,13 +76,13 @@ main(int argc, char **argv)
if (mbus_send_request_frame(handle, 253) == -1)
{
printf("Failed to send request to selected secondary device: %s\n", mbus_error_str());
return -1;
return 1;
}
if (mbus_recv_frame(handle, &reply) == -1)
{
printf("Failed to recieve reply from selected secondary device: %s\n", mbus_error_str());
return -1;
return 1;
}
if (mbus_frame_type(&reply) != MBUS_FRAME_TYPE_ACK)

View File

@ -1,3 +1,13 @@
//------------------------------------------------------------------------------
// Copyright (C) 2011, Robert Johansson, Raditex AB
// All rights reserved.
//
// rSCADA
// http://www.rSCADA.se
// info@rscada.se
//
//------------------------------------------------------------------------------
#include <sys/types.h>
#include <err.h>

View File

@ -2,9 +2,9 @@
# Copyright (C) 2010, Raditex AB
# All rights reserved.
#
# FreeSCADA
# http://www.FreeSCADA.com
# freescada@freescada.com
# rSCADA
# http://www.rSCADA.se
# info@rscada.se
#
# ------------------------------------------------------------------------------
PACKAGE = @PACKAGE@

View File

@ -147,9 +147,9 @@ OTOOL64 = @OTOOL64@
# Copyright (C) 2010, Raditex AB
# All rights reserved.
#
# FreeSCADA
# http://www.FreeSCADA.com
# freescada@freescada.com
# rSCADA
# http://www.rSCADA.se
# info@rscada.se
#
# ------------------------------------------------------------------------------
PACKAGE = @PACKAGE@

View File

@ -2,9 +2,9 @@
// Copyright (C) 2010-2011, Robert Johansson and contributors, Raditex AB
// All rights reserved.
//
// FreeSCADA
// http://www.FreeSCADA.com
// freescada@freescada.com
// rSCADA
// http://www.rSCADA.se
// info@rscada.se
//
// Contributors:
// Large parts of this file was contributed by Tomas Menzl.

View File

@ -2,9 +2,9 @@
// Copyright (C) 2011, Robert Johansson and contributors, Raditex AB
// All rights reserved.
//
// FreeSCADA
// http://www.FreeSCADA.com
// freescada@freescada.com
// rSCADA
// http://www.rSCADA.se
// info@rscada.se
//
// Contributors:
// Large parts of this file was contributed by Tomas Menzl.

View File

@ -1,11 +1,10 @@
//------------------------------------------------------------------------------
// Copyright (C) 2010-2011, Robert Johansson, Raditex AB
// All rights reserved.
//
// FreeSCADA
// http://www.FreeSCADA.com
// freescada@freescada.com
// rSCADA
// http://www.rSCADA.se
// info@rscada.se
//
//------------------------------------------------------------------------------

View File

@ -2,9 +2,9 @@
// Copyright (C) 2010-2011, Robert Johansson, Raditex AB
// All rights reserved.
//
// FreeSCADA
// http://www.FreeSCADA.com
// freescada@freescada.com
// rSCADA
// http://www.rSCADA.se
// info@rscada.se
//
//------------------------------------------------------------------------------

View File

@ -2,9 +2,9 @@
// Copyright (C) 2011, Robert Johansson, Raditex AB
// All rights reserved.
//
// FreeSCADA
// http://www.FreeSCADA.com
// freescada@freescada.com
// rSCADA
// http://www.rSCADA.se
// info@rscada.se
//
//------------------------------------------------------------------------------

View File

@ -2,9 +2,9 @@
// Copyright (C) 2011, Robert Johansson, Raditex AB
// All rights reserved.
//
// FreeSCADA
// http://www.FreeSCADA.com
// freescada@freescada.com
// rSCADA
// http://www.rSCADA.se
// info@rscada.se
//
//------------------------------------------------------------------------------

View File

@ -2,9 +2,9 @@
// Copyright (C) 2011, Robert Johansson, Raditex AB
// All rights reserved.
//
// FreeSCADA
// http://www.FreeSCADA.com
// freescada@freescada.com
// rSCADA
// http://www.rSCADA.se
// info@rscada.se
//
//------------------------------------------------------------------------------
@ -192,4 +192,3 @@ mbus_tcp_recv_frame(mbus_tcp_handle *handle, mbus_frame *frame)
return 0;
}

View File

@ -2,9 +2,9 @@
// Copyright (C) 2011, Robert Johansson, Raditex AB
// All rights reserved.
//
// FreeSCADA
// http://www.FreeSCADA.com
// freescada@freescada.com
// rSCADA
// http://www.rSCADA.se
// info@rscada.se
//
//------------------------------------------------------------------------------

View File

@ -2,9 +2,9 @@
// Copyright (C) 2010, Raditex AB
// All rights reserved.
//
// FreeSCADA
// http://www.FreeSCADA.com
// freescada@freescada.com
// rSCADA
// http://www.rSCADA.se
// info@rscada.se
//
//------------------------------------------------------------------------------

View File

@ -2,9 +2,9 @@
// Copyright (C) 2010, Raditex AB
// All rights reserved.
//
// FreeSCADA
// http://www.FreeSCADA.com
// freescada@freescada.com
// rSCADA
// http://www.rSCADA.se
// info@rscada.se
//
//------------------------------------------------------------------------------
@ -26,7 +26,7 @@
* API. For examples on how to use the libmbus library, see the applications
* in the bin directory in the source code distribution.
*
* For more information, see http://www.freescada.com/libmbus
* For more information, see http://www.rscada.se/libmbus
*
*/

View File

@ -2,9 +2,9 @@
# Copyright (C) 2010, Raditex AB
# All rights reserved.
#
# FreeSCADA
# http://www.FreeSCADA.com
# freescada@freescada.com
# rSCADA
# http://www.rSCADA.se
# info@rscada.se
#
# ------------------------------------------------------------------------------
PACKAGE = @PACKAGE@

View File

@ -2,9 +2,9 @@
// Copyright (C) 2010, Raditex AB
// All rights reserved.
//
// FreeSCADA
// http://www.FreeSCADA.com
// freescada@freescada.com
// rSCADA
// http://www.rSCADA.se
// info@rscada.se
//
//------------------------------------------------------------------------------
@ -32,13 +32,13 @@ main(int argc, char *argv[])
if (argc != 2)
{
fprintf(stderr, "%s binary-file\n", argv[0]);
return -1;
return 1;
}
if ((fd = open(argv[1], O_RDONLY, 0)) == -1)
{
fprintf(stderr, "%s: failed to open '%s'", argv[0], argv[1]);
return -1;
return 1;
}
bzero(buf, sizeof(buf));

View File

@ -2,9 +2,9 @@
// Copyright (C) 2010, Raditex AB
// All rights reserved.
//
// FreeSCADA
// http://www.FreeSCADA.com
// freescada@freescada.com
// rSCADA
// http://www.rSCADA.se
// info@rscada.se
//
//------------------------------------------------------------------------------
@ -84,7 +84,7 @@ main(int argc, char *argv[])
{
mbus_frame_print(&reply);
fprintf(stderr, "mbus_frame_data_parse: %s\n", mbus_error_str());
return -1;
return 1;
}
//mbus_frame_print(&reply);

View File

@ -2,9 +2,9 @@
// Copyright (C) 2010, Raditex AB
// All rights reserved.
//
// FreeSCADA
// http://www.FreeSCADA.com
// freescada@freescada.com
// rSCADA
// http://www.rSCADA.se
// info@rscada.se
//
//------------------------------------------------------------------------------