Changed domain to rscada.se
Changed exit code for errors
This commit is contained in:
@ -2,9 +2,9 @@
|
|||||||
# Copyright (C) 2010, Raditex AB
|
# Copyright (C) 2010, Raditex AB
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# FreeSCADA
|
# rSCADA
|
||||||
# http://www.FreeSCADA.com
|
# http://www.rSCADA.se
|
||||||
# freescada@freescada.com
|
# info@rscada.se
|
||||||
#
|
#
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
PACKAGE = @PACKAGE@
|
PACKAGE = @PACKAGE@
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// FreeSCADA
|
// rSCADA
|
||||||
// http://www.FreeSCADA.com
|
// http://www.rSCADA.se
|
||||||
// freescada@freescada.com
|
// info@rscada.se
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -67,13 +67,13 @@ main(int argc, char **argv)
|
|||||||
if ((handle = mbus_connect_serial(device)) == NULL)
|
if ((handle = mbus_connect_serial(device)) == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Failed to setup connection to M-bus gateway\n");
|
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)
|
if (mbus_serial_set_baudrate(handle->m_serial_handle, baudrate) == -1)
|
||||||
{
|
{
|
||||||
printf("Failed to set baud rate.\n");
|
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)
|
if (probe_ret == MBUS_PROBE_COLLISION)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: Error: The address mask [%s] matches more than one device.\n", __PRETTY_FUNCTION__, addr_str);
|
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)
|
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);
|
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)
|
else if (probe_ret == MBUS_PROBE_ERROR)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: Error: Failed to probe secondary address [%s].\n", __PRETTY_FUNCTION__, addr_str);
|
fprintf(stderr, "%s: Error: Failed to probe secondary address [%s].\n", __PRETTY_FUNCTION__, addr_str);
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
// else MBUS_PROBE_SINGLE
|
// else MBUS_PROBE_SINGLE
|
||||||
|
|
||||||
if (mbus_send_request_frame(handle, 253) == -1)
|
if (mbus_send_request_frame(handle, 253) == -1)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Failed to send M-Bus request frame.\n");
|
fprintf(stderr, "Failed to send M-Bus request frame.\n");
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -116,14 +116,14 @@ main(int argc, char **argv)
|
|||||||
if (mbus_send_request_frame(handle, address) == -1)
|
if (mbus_send_request_frame(handle, address) == -1)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Failed to send M-Bus request frame.\n");
|
fprintf(stderr, "Failed to send M-Bus request frame.\n");
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mbus_recv_frame(handle, &reply) == -1)
|
if (mbus_recv_frame(handle, &reply) == -1)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Failed to receive M-Bus response frame.\n");
|
fprintf(stderr, "Failed to receive M-Bus response frame.\n");
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// FreeSCADA
|
// rSCADA
|
||||||
// http://www.FreeSCADA.com
|
// http://www.rSCADA.se
|
||||||
// freescada@freescada.com
|
// info@rscada.se
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -60,19 +60,19 @@ main(int argc, char **argv)
|
|||||||
if (strlen(addr_mask) != 16)
|
if (strlen(addr_mask) != 16)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Misformatted secondary address mask. Must be 16 character HEX number.\n");
|
fprintf(stderr, "Misformatted secondary address mask. Must be 16 character HEX number.\n");
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((handle = mbus_connect_serial(device)) == NULL)
|
if ((handle = mbus_connect_serial(device)) == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Failed to setup connection to M-bus gateway: %s\n", mbus_error_str());
|
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)
|
if (mbus_serial_set_baudrate(handle->m_serial_handle, baudrate) == -1)
|
||||||
{
|
{
|
||||||
printf("Failed to set baud rate.\n");
|
printf("Failed to set baud rate.\n");
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
mbus_scan_2nd_address_range(handle, 0, addr_mask);
|
mbus_scan_2nd_address_range(handle, 0, addr_mask);
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// FreeSCADA
|
// rSCADA
|
||||||
// http://www.FreeSCADA.com
|
// http://www.rSCADA.se
|
||||||
// freescada@freescada.com
|
// info@rscada.se
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -45,13 +45,13 @@ main(int argc, char **argv)
|
|||||||
if ((handle = mbus_connect_serial(device)) == NULL)
|
if ((handle = mbus_connect_serial(device)) == NULL)
|
||||||
{
|
{
|
||||||
printf("Failed to setup connection to M-bus gateway\n");
|
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)
|
if (mbus_serial_set_baudrate(handle->m_serial_handle, baudrate) == -1)
|
||||||
{
|
{
|
||||||
printf("Failed to set baud rate.\n");
|
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)
|
if (mbus_send_ping_frame(handle, address) == -1)
|
||||||
{
|
{
|
||||||
printf("Scan failed. Could not send ping frame: %s\n", mbus_error_str());
|
printf("Scan failed. Could not send ping frame: %s\n", mbus_error_str());
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mbus_recv_frame(handle, &reply) == -1)
|
if (mbus_recv_frame(handle, &reply) == -1)
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// FreeSCADA
|
// rSCADA
|
||||||
// http://www.FreeSCADA.com
|
// http://www.rSCADA.se
|
||||||
// freescada@freescada.com
|
// info@rscada.se
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -49,25 +49,25 @@ main(int argc, char **argv)
|
|||||||
if (strlen(addr) != 16)
|
if (strlen(addr) != 16)
|
||||||
{
|
{
|
||||||
printf("Misformatted secondary address. Must be 16 character HEX number.\n");
|
printf("Misformatted secondary address. Must be 16 character HEX number.\n");
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((handle = mbus_connect_serial(device)) == NULL)
|
if ((handle = mbus_connect_serial(device)) == NULL)
|
||||||
{
|
{
|
||||||
printf("Failed to setup connection to M-bus device: %s\n", mbus_error_str());
|
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)
|
if (mbus_serial_set_baudrate(handle->m_serial_handle, baudrate) == -1)
|
||||||
{
|
{
|
||||||
printf("Failed to set baud rate.\n");
|
printf("Failed to set baud rate.\n");
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mbus_send_select_frame(handle, addr) == -1)
|
if (mbus_send_select_frame(handle, addr) == -1)
|
||||||
{
|
{
|
||||||
printf("Failed to send selection frame: %s\n", mbus_error_str());
|
printf("Failed to send selection frame: %s\n", mbus_error_str());
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = mbus_recv_frame(handle, &reply);
|
ret = mbus_recv_frame(handle, &reply);
|
||||||
@ -75,13 +75,13 @@ main(int argc, char **argv)
|
|||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
{
|
{
|
||||||
printf("No reply from device with secondary address %s: %s\n", argv[2], mbus_error_str());
|
printf("No reply from device with secondary address %s: %s\n", argv[2], mbus_error_str());
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == -2)
|
if (ret == -2)
|
||||||
{
|
{
|
||||||
printf("Invalid reply from %s: The address address probably match more than one device: %s\n", argv[2], mbus_error_str());
|
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)
|
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)
|
if (mbus_send_request_frame(handle, 253) == -1)
|
||||||
{
|
{
|
||||||
printf("Failed to send request to selected secondary device: %s\n", mbus_error_str());
|
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)
|
if (mbus_recv_frame(handle, &reply) == -1)
|
||||||
{
|
{
|
||||||
printf("Failed to recieve reply from selected secondary device: %s\n", mbus_error_str());
|
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)
|
if (mbus_frame_type(&reply) != MBUS_FRAME_TYPE_ACK)
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
// Copyright (C) 2010-2012, Robert Johansson and contributors, Raditex AB
|
// Copyright (C) 2010-2012, Robert Johansson and contributors, Raditex AB
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// FreeSCADA
|
// rSCADA
|
||||||
// http://www.FreeSCADA.com
|
// http://www.rSCADA.se
|
||||||
// freescada@freescada.com
|
// info@rscada.se
|
||||||
//
|
//
|
||||||
// Contributors:
|
// Contributors:
|
||||||
// Large parts of this file was contributed by Stefan Wahren.
|
// 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)
|
if ((handle = mbus_connect_serial(device)) == NULL)
|
||||||
{
|
{
|
||||||
printf("Failed to setup connection to M-bus device: %s\n", mbus_error_str());
|
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)
|
if (mbus_serial_set_baudrate(handle->m_serial_handle, source_baudrate) == -1)
|
||||||
{
|
{
|
||||||
printf("Failed to set baud rate.\n");
|
printf("Failed to set baud rate.\n");
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mbus_send_switch_baudrate_frame(handle, address, target_baudrate) == -1)
|
if (mbus_send_switch_baudrate_frame(handle, address, target_baudrate) == -1)
|
||||||
{
|
{
|
||||||
printf("Failed to send switch baudrate frame: %s\n", mbus_error_str());
|
printf("Failed to send switch baudrate frame: %s\n", mbus_error_str());
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = mbus_recv_frame(handle, &reply);
|
ret = mbus_recv_frame(handle, &reply);
|
||||||
@ -75,7 +75,7 @@ main(int argc, char **argv)
|
|||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
{
|
{
|
||||||
printf("No reply from device\n");
|
printf("No reply from device\n");
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mbus_frame_type(&reply) != MBUS_FRAME_TYPE_ACK)
|
if (mbus_frame_type(&reply) != MBUS_FRAME_TYPE_ACK)
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// FreeSCADA
|
// rSCADA
|
||||||
// http://www.FreeSCADA.com
|
// http://www.rSCADA.se
|
||||||
// freescada@freescada.com
|
// info@rscada.se
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ main(int argc, char **argv)
|
|||||||
if ((handle = mbus_connect_tcp(host, port)) == NULL)
|
if ((handle = mbus_connect_tcp(host, port)) == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Failed to setup connection to M-bus gateway\n");
|
fprintf(stderr, "Failed to setup connection to M-bus gateway\n");
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(addr_str) == 16)
|
if (strlen(addr_str) == 16)
|
||||||
@ -70,24 +70,24 @@ main(int argc, char **argv)
|
|||||||
if (probe_ret == MBUS_PROBE_COLLISION)
|
if (probe_ret == MBUS_PROBE_COLLISION)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: Error: The address mask [%s] matches more than one device.\n", __PRETTY_FUNCTION__, addr_str);
|
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)
|
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);
|
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)
|
else if (probe_ret == MBUS_PROBE_ERROR)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: Error: Failed to probe secondary address [%s].\n", __PRETTY_FUNCTION__, addr_str);
|
fprintf(stderr, "%s: Error: Failed to probe secondary address [%s].\n", __PRETTY_FUNCTION__, addr_str);
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
// else MBUS_PROBE_SINGLE
|
// else MBUS_PROBE_SINGLE
|
||||||
|
|
||||||
if (mbus_send_request_frame(handle, 253) == -1)
|
if (mbus_send_request_frame(handle, 253) == -1)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Failed to send M-Bus request frame.\n");
|
fprintf(stderr, "Failed to send M-Bus request frame.\n");
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -98,14 +98,14 @@ main(int argc, char **argv)
|
|||||||
if (mbus_send_request_frame(handle, address) == -1)
|
if (mbus_send_request_frame(handle, address) == -1)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Failed to send M-Bus request frame.\n");
|
fprintf(stderr, "Failed to send M-Bus request frame.\n");
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mbus_recv_frame(handle, &reply) == -1)
|
if (mbus_recv_frame(handle, &reply) == -1)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Failed to receive M-Bus response frame.\n");
|
fprintf(stderr, "Failed to receive M-Bus response frame.\n");
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// FreeSCADA
|
// rSCADA
|
||||||
// http://www.FreeSCADA.com
|
// http://www.rSCADA.se
|
||||||
// freescada@freescada.com
|
// info@rscada.se
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -51,13 +51,13 @@ main(int argc, char **argv)
|
|||||||
if (strlen(addr_mask) != 16)
|
if (strlen(addr_mask) != 16)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Misformatted secondary address mask. Must be 16 character HEX number.\n");
|
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)
|
if ((handle = mbus_connect_tcp(host, port)) == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Failed to setup connection to M-bus gateway: %s\n", mbus_error_str());
|
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);
|
mbus_scan_2nd_address_range(handle, 0, addr_mask);
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// FreeSCADA
|
// rSCADA
|
||||||
// http://www.FreeSCADA.com
|
// http://www.rSCADA.se
|
||||||
// freescada@freescada.com
|
// info@rscada.se
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ main(int argc, char **argv)
|
|||||||
if ((handle = mbus_connect_tcp(host, port)) == NULL)
|
if ((handle = mbus_connect_tcp(host, port)) == NULL)
|
||||||
{
|
{
|
||||||
printf("Scan failed: Could not setup connection to M-bus gateway: %s\n", mbus_error_str());
|
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++)
|
for (address = 0; address < 254; address++)
|
||||||
@ -50,7 +50,7 @@ main(int argc, char **argv)
|
|||||||
if (mbus_send_ping_frame(handle, address) == -1)
|
if (mbus_send_ping_frame(handle, address) == -1)
|
||||||
{
|
{
|
||||||
printf("Scan failed. Could not send ping frame: %s\n", mbus_error_str());
|
printf("Scan failed. Could not send ping frame: %s\n", mbus_error_str());
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mbus_recv_frame(handle, &reply) == -1)
|
if (mbus_recv_frame(handle, &reply) == -1)
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// FreeSCADA
|
// rSCADA
|
||||||
// http://www.FreeSCADA.com
|
// http://www.rSCADA.se
|
||||||
// freescada@freescada.com
|
// info@rscada.se
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -42,19 +42,19 @@ main(int argc, char **argv)
|
|||||||
if (strlen(argv[3]) != 16)
|
if (strlen(argv[3]) != 16)
|
||||||
{
|
{
|
||||||
printf("Misformatted secondary address. Must be 16 character HEX number.\n");
|
printf("Misformatted secondary address. Must be 16 character HEX number.\n");
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((handle = mbus_connect_tcp(host, port)) == NULL)
|
if ((handle = mbus_connect_tcp(host, port)) == NULL)
|
||||||
{
|
{
|
||||||
printf("Failed to setup connection to M-bus gateway: %s\n", mbus_error_str());
|
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)
|
if (mbus_send_select_frame(handle, addr) == -1)
|
||||||
{
|
{
|
||||||
printf("Failed to send selection frame: %s\n", mbus_error_str());
|
printf("Failed to send selection frame: %s\n", mbus_error_str());
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = mbus_recv_frame(handle, &reply);
|
ret = mbus_recv_frame(handle, &reply);
|
||||||
@ -62,13 +62,13 @@ main(int argc, char **argv)
|
|||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
{
|
{
|
||||||
printf("No reply from device with secondary address %s: %s\n", argv[3], mbus_error_str());
|
printf("No reply from device with secondary address %s: %s\n", argv[3], mbus_error_str());
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == -2)
|
if (ret == -2)
|
||||||
{
|
{
|
||||||
printf("Invalid reply from %s: The address address probably match more than one device: %s\n", argv[3], mbus_error_str());
|
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)
|
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)
|
if (mbus_send_request_frame(handle, 253) == -1)
|
||||||
{
|
{
|
||||||
printf("Failed to send request to selected secondary device: %s\n", mbus_error_str());
|
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)
|
if (mbus_recv_frame(handle, &reply) == -1)
|
||||||
{
|
{
|
||||||
printf("Failed to recieve reply from selected secondary device: %s\n", mbus_error_str());
|
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)
|
if (mbus_frame_type(&reply) != MBUS_FRAME_TYPE_ACK)
|
||||||
|
@ -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 <sys/types.h>
|
||||||
|
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
# Copyright (C) 2010, Raditex AB
|
# Copyright (C) 2010, Raditex AB
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# FreeSCADA
|
# rSCADA
|
||||||
# http://www.FreeSCADA.com
|
# http://www.rSCADA.se
|
||||||
# freescada@freescada.com
|
# info@rscada.se
|
||||||
#
|
#
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
PACKAGE = @PACKAGE@
|
PACKAGE = @PACKAGE@
|
||||||
|
@ -147,9 +147,9 @@ OTOOL64 = @OTOOL64@
|
|||||||
# Copyright (C) 2010, Raditex AB
|
# Copyright (C) 2010, Raditex AB
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# FreeSCADA
|
# rSCADA
|
||||||
# http://www.FreeSCADA.com
|
# http://www.rSCADA.se
|
||||||
# freescada@freescada.com
|
# info@rscada.se
|
||||||
#
|
#
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
PACKAGE = @PACKAGE@
|
PACKAGE = @PACKAGE@
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
// Copyright (C) 2010-2011, Robert Johansson and contributors, Raditex AB
|
// Copyright (C) 2010-2011, Robert Johansson and contributors, Raditex AB
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// FreeSCADA
|
// rSCADA
|
||||||
// http://www.FreeSCADA.com
|
// http://www.rSCADA.se
|
||||||
// freescada@freescada.com
|
// info@rscada.se
|
||||||
//
|
//
|
||||||
// Contributors:
|
// Contributors:
|
||||||
// Large parts of this file was contributed by Tomas Menzl.
|
// Large parts of this file was contributed by Tomas Menzl.
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
// Copyright (C) 2011, Robert Johansson and contributors, Raditex AB
|
// Copyright (C) 2011, Robert Johansson and contributors, Raditex AB
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// FreeSCADA
|
// rSCADA
|
||||||
// http://www.FreeSCADA.com
|
// http://www.rSCADA.se
|
||||||
// freescada@freescada.com
|
// info@rscada.se
|
||||||
//
|
//
|
||||||
// Contributors:
|
// Contributors:
|
||||||
// Large parts of this file was contributed by Tomas Menzl.
|
// Large parts of this file was contributed by Tomas Menzl.
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Copyright (C) 2010-2011, Robert Johansson, Raditex AB
|
// Copyright (C) 2010-2011, Robert Johansson, Raditex AB
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// FreeSCADA
|
// rSCADA
|
||||||
// http://www.FreeSCADA.com
|
// http://www.rSCADA.se
|
||||||
// freescada@freescada.com
|
// info@rscada.se
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
// Copyright (C) 2010-2011, Robert Johansson, Raditex AB
|
// Copyright (C) 2010-2011, Robert Johansson, Raditex AB
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// FreeSCADA
|
// rSCADA
|
||||||
// http://www.FreeSCADA.com
|
// http://www.rSCADA.se
|
||||||
// freescada@freescada.com
|
// info@rscada.se
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// FreeSCADA
|
// rSCADA
|
||||||
// http://www.FreeSCADA.com
|
// http://www.rSCADA.se
|
||||||
// freescada@freescada.com
|
// info@rscada.se
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// FreeSCADA
|
// rSCADA
|
||||||
// http://www.FreeSCADA.com
|
// http://www.rSCADA.se
|
||||||
// freescada@freescada.com
|
// info@rscada.se
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// FreeSCADA
|
// rSCADA
|
||||||
// http://www.FreeSCADA.com
|
// http://www.rSCADA.se
|
||||||
// freescada@freescada.com
|
// info@rscada.se
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -192,4 +192,3 @@ mbus_tcp_recv_frame(mbus_tcp_handle *handle, mbus_frame *frame)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
// Copyright (C) 2011, Robert Johansson, Raditex AB
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// FreeSCADA
|
// rSCADA
|
||||||
// http://www.FreeSCADA.com
|
// http://www.rSCADA.se
|
||||||
// freescada@freescada.com
|
// info@rscada.se
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
// Copyright (C) 2010, Raditex AB
|
// Copyright (C) 2010, Raditex AB
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// FreeSCADA
|
// rSCADA
|
||||||
// http://www.FreeSCADA.com
|
// http://www.rSCADA.se
|
||||||
// freescada@freescada.com
|
// info@rscada.se
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
// Copyright (C) 2010, Raditex AB
|
// Copyright (C) 2010, Raditex AB
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// FreeSCADA
|
// rSCADA
|
||||||
// http://www.FreeSCADA.com
|
// http://www.rSCADA.se
|
||||||
// freescada@freescada.com
|
// info@rscada.se
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -26,7 +26,7 @@
|
|||||||
* API. For examples on how to use the libmbus library, see the applications
|
* API. For examples on how to use the libmbus library, see the applications
|
||||||
* in the bin directory in the source code distribution.
|
* 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
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
# Copyright (C) 2010, Raditex AB
|
# Copyright (C) 2010, Raditex AB
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# FreeSCADA
|
# rSCADA
|
||||||
# http://www.FreeSCADA.com
|
# http://www.rSCADA.se
|
||||||
# freescada@freescada.com
|
# info@rscada.se
|
||||||
#
|
#
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
PACKAGE = @PACKAGE@
|
PACKAGE = @PACKAGE@
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
// Copyright (C) 2010, Raditex AB
|
// Copyright (C) 2010, Raditex AB
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// FreeSCADA
|
// rSCADA
|
||||||
// http://www.FreeSCADA.com
|
// http://www.rSCADA.se
|
||||||
// freescada@freescada.com
|
// info@rscada.se
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -32,13 +32,13 @@ main(int argc, char *argv[])
|
|||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s binary-file\n", argv[0]);
|
fprintf(stderr, "%s binary-file\n", argv[0]);
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((fd = open(argv[1], O_RDONLY, 0)) == -1)
|
if ((fd = open(argv[1], O_RDONLY, 0)) == -1)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: failed to open '%s'", argv[0], argv[1]);
|
fprintf(stderr, "%s: failed to open '%s'", argv[0], argv[1]);
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bzero(buf, sizeof(buf));
|
bzero(buf, sizeof(buf));
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
// Copyright (C) 2010, Raditex AB
|
// Copyright (C) 2010, Raditex AB
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// FreeSCADA
|
// rSCADA
|
||||||
// http://www.FreeSCADA.com
|
// http://www.rSCADA.se
|
||||||
// freescada@freescada.com
|
// info@rscada.se
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
mbus_frame_print(&reply);
|
mbus_frame_print(&reply);
|
||||||
fprintf(stderr, "mbus_frame_data_parse: %s\n", mbus_error_str());
|
fprintf(stderr, "mbus_frame_data_parse: %s\n", mbus_error_str());
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//mbus_frame_print(&reply);
|
//mbus_frame_print(&reply);
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
// Copyright (C) 2010, Raditex AB
|
// Copyright (C) 2010, Raditex AB
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// FreeSCADA
|
// rSCADA
|
||||||
// http://www.FreeSCADA.com
|
// http://www.rSCADA.se
|
||||||
// freescada@freescada.com
|
// info@rscada.se
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user