diff --git a/autom4te.cache/requests b/autom4te.cache/requests
index bc7bb56..e01a738 100644
--- a/autom4te.cache/requests
+++ b/autom4te.cache/requests
@@ -1,4 +1,4 @@
-# This file was generated by Autom4te Sun May 1 09:53:53 UTC 2011.
+# This file was generated.
# It contains the lists of macros which have been traced.
# It can be safely removed.
@@ -14,55 +14,55 @@
'configure.ac'
],
{
- 'AM_PROG_F77_C_O' => 1,
'_LT_AC_TAGCONFIG' => 1,
- 'm4_pattern_forbid' => 1,
+ 'AM_PROG_F77_C_O' => 1,
'AC_INIT' => 1,
- '_AM_COND_IF' => 1,
+ 'm4_pattern_forbid' => 1,
'AC_CANONICAL_TARGET' => 1,
- 'AC_SUBST' => 1,
+ '_AM_COND_IF' => 1,
'AC_CONFIG_LIBOBJ_DIR' => 1,
- 'AC_FC_SRCEXT' => 1,
+ 'AC_SUBST' => 1,
'AC_CANONICAL_HOST' => 1,
+ 'AC_FC_SRCEXT' => 1,
'AC_PROG_LIBTOOL' => 1,
'AM_INIT_AUTOMAKE' => 1,
- 'AM_PATH_GUILE' => 1,
'AC_CONFIG_SUBDIRS' => 1,
+ 'AM_PATH_GUILE' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'LT_CONFIG_LTDL_DIR' => 1,
- 'AC_REQUIRE_AUX_FILE' => 1,
'AC_CONFIG_LINKS' => 1,
- 'LT_SUPPORTED_TAG' => 1,
+ 'AC_REQUIRE_AUX_FILE' => 1,
'm4_sinclude' => 1,
+ 'LT_SUPPORTED_TAG' => 1,
'AM_MAINTAINER_MODE' => 1,
'AM_NLS' => 1,
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
- 'AM_MAKEFILE_INCLUDE' => 1,
'_m4_warn' => 1,
+ 'AM_MAKEFILE_INCLUDE' => 1,
'AM_PROG_CXX_C_O' => 1,
- '_AM_MAKEFILE_INCLUDE' => 1,
'_AM_COND_ENDIF' => 1,
+ '_AM_MAKEFILE_INCLUDE' => 1,
'AM_ENABLE_MULTILIB' => 1,
'AM_PROG_MOC' => 1,
'AM_SILENT_RULES' => 1,
'AC_CONFIG_FILES' => 1,
- 'LT_INIT' => 1,
'include' => 1,
- 'AM_PROG_AR' => 1,
+ 'LT_INIT' => 1,
'AM_GNU_GETTEXT' => 1,
+ 'AM_PROG_AR' => 1,
'AC_LIBSOURCE' => 1,
- 'AM_PROG_FC_C_O' => 1,
'AC_CANONICAL_BUILD' => 1,
+ 'AM_PROG_FC_C_O' => 1,
'AC_FC_FREEFORM' => 1,
'AH_OUTPUT' => 1,
- '_AM_SUBST_NOTMAKE' => 1,
'AC_CONFIG_AUX_DIR' => 1,
- 'm4_pattern_allow' => 1,
- 'sinclude' => 1,
+ '_AM_SUBST_NOTMAKE' => 1,
'AM_PROG_CC_C_O' => 1,
- 'AM_XGETTEXT_OPTION' => 1,
- 'AC_CANONICAL_SYSTEM' => 1,
+ 'sinclude' => 1,
+ 'm4_pattern_allow' => 1,
'AM_CONDITIONAL' => 1,
+ 'AC_CANONICAL_SYSTEM' => 1,
+ 'AM_XGETTEXT_OPTION' => 1,
'AC_CONFIG_HEADERS' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
'AM_POT_TOOLS' => 1,
@@ -123,8 +123,8 @@
'_m4_warn' => 1,
'AC_LIBTOOL_OBJDIR' => 1,
'gl_FUNC_ARGZ' => 1,
- 'LTOBSOLETE_VERSION' => 1,
'AM_SANITY_CHECK' => 1,
+ 'LTOBSOLETE_VERSION' => 1,
'AC_LIBTOOL_LANG_GCJ_CONFIG' => 1,
'AC_LIBTOOL_PROG_COMPILER_PIC' => 1,
'LT_LIB_M' => 1,
@@ -138,19 +138,19 @@
'_LT_WITH_SYSROOT' => 1,
'LT_SYS_DLOPEN_DEPLIBS' => 1,
'LT_FUNC_DLSYM_USCORE' => 1,
- 'AC_LIBTOOL_CONFIG' => 1,
'_LT_AC_LANG_F77' => 1,
- '_AM_SUBST_NOTMAKE' => 1,
+ 'AC_LIBTOOL_CONFIG' => 1,
'AC_LTDL_DLLIB' => 1,
+ '_AM_SUBST_NOTMAKE' => 1,
'_AM_AUTOCONF_VERSION' => 1,
'AM_DISABLE_SHARED' => 1,
'_LT_PROG_ECHO_BACKSLASH' => 1,
'_LTDL_SETUP' => 1,
- 'AM_PROG_LIBTOOL' => 1,
'_LT_AC_LANG_CXX' => 1,
- 'AC_LIB_LTDL' => 1,
- '_LT_AC_FILE_LTDLL_C' => 1,
+ 'AM_PROG_LIBTOOL' => 1,
'AM_PROG_LD' => 1,
+ '_LT_AC_FILE_LTDLL_C' => 1,
+ 'AC_LIB_LTDL' => 1,
'AU_DEFUN' => 1,
'AC_PROG_NM' => 1,
'AC_LIBTOOL_DLOPEN' => 1,
@@ -175,33 +175,33 @@
'AC_LTDL_OBJDIR' => 1,
'_LT_PATH_TOOL_PREFIX' => 1,
'AC_LIBTOOL_RC' => 1,
- 'AM_SILENT_RULES' => 1,
- 'AC_DISABLE_FAST_INSTALL' => 1,
'_LT_AC_PROG_ECHO_BACKSLASH' => 1,
- '_LT_AC_SYS_LIBPATH_AIX' => 1,
- '_LT_AC_TRY_DLOPEN_SELF' => 1,
+ 'AC_DISABLE_FAST_INSTALL' => 1,
+ 'AM_SILENT_RULES' => 1,
'include' => 1,
+ '_LT_AC_TRY_DLOPEN_SELF' => 1,
+ '_LT_AC_SYS_LIBPATH_AIX' => 1,
'LT_AC_PROG_SED' => 1,
'AM_ENABLE_SHARED' => 1,
'LTDL_INSTALLABLE' => 1,
'_LT_AC_LANG_GCJ_CONFIG' => 1,
'AC_ENABLE_SHARED' => 1,
- 'AC_ENABLE_STATIC' => 1,
- 'AC_LIBTOOL_SYS_HARD_LINK_LOCKS' => 1,
'_LT_REQUIRED_DARWIN_CHECKS' => 1,
+ 'AC_LIBTOOL_SYS_HARD_LINK_LOCKS' => 1,
+ 'AC_ENABLE_STATIC' => 1,
'_LT_AC_TAGVAR' => 1,
'AC_LIBTOOL_LANG_F77_CONFIG' => 1,
'AM_CONDITIONAL' => 1,
'LT_LIB_DLLOAD' => 1,
- 'LTDL_INIT' => 1,
- '_LT_PROG_F77' => 1,
- '_LT_PROG_CXX' => 1,
'LTVERSION_VERSION' => 1,
- 'AM_PROG_INSTALL_SH' => 1,
+ '_LT_PROG_CXX' => 1,
+ '_LT_PROG_F77' => 1,
+ 'LTDL_INIT' => 1,
'm4_include' => 1,
+ 'AM_PROG_INSTALL_SH' => 1,
'AC_PROG_EGREP' => 1,
- '_AC_AM_CONFIG_HEADER_HOOK' => 1,
'AC_PATH_MAGIC' => 1,
+ '_AC_AM_CONFIG_HEADER_HOOK' => 1,
'AC_LTDL_SYSSEARCHPATH' => 1,
'AM_MAKE_INCLUDE' => 1,
'LT_CMD_MAX_LEN' => 1,
@@ -235,11 +235,11 @@
'_AC_PROG_LIBTOOL' => 1,
'_AM_IF_OPTION' => 1,
'AC_PATH_TOOL_PREFIX' => 1,
- 'AC_LIBTOOL_F77' => 1,
'm4_pattern_allow' => 1,
+ 'AC_LIBTOOL_F77' => 1,
'AM_SET_LEADING_DOT' => 1,
- 'LT_AC_PROG_EGREP' => 1,
'_LT_PROG_FC' => 1,
+ 'LT_AC_PROG_EGREP' => 1,
'_AM_DEPENDENCIES' => 1,
'AC_LIBTOOL_LANG_C_CONFIG' => 1,
'LTOPTIONS_VERSION' => 1,
@@ -247,11 +247,11 @@
'AM_PROG_NM' => 1,
'AC_LIBLTDL_CONVENIENCE' => 1,
'AC_DEPLIBS_CHECK_METHOD' => 1,
- 'AM_SET_CURRENT_AUTOMAKE_VERSION' => 1,
'AC_LIBLTDL_INSTALLABLE' => 1,
+ 'AM_SET_CURRENT_AUTOMAKE_VERSION' => 1,
'AC_LTDL_ENABLE_INSTALL' => 1,
- 'AC_LIBTOOL_SYS_DYNAMIC_LINKER' => 1,
'LT_PROG_GCJ' => 1,
+ 'AC_LIBTOOL_SYS_DYNAMIC_LINKER' => 1,
'AM_INIT_AUTOMAKE' => 1,
'AC_DISABLE_STATIC' => 1,
'LT_PATH_NM' => 1,
@@ -259,25 +259,25 @@
'_LT_AC_LOCK' => 1,
'_LT_AC_LANG_RC_CONFIG' => 1,
'LT_SYS_MODULE_PATH' => 1,
- 'AC_LIBTOOL_POSTDEP_PREDEP' => 1,
'LT_WITH_LTDL' => 1,
+ 'AC_LIBTOOL_POSTDEP_PREDEP' => 1,
'AC_LTDL_SHLIBPATH' => 1,
'AM_AUX_DIR_EXPAND' => 1,
- '_LT_AC_LANG_F77_CONFIG' => 1,
'AC_LIBTOOL_PROG_COMPILER_NO_RTTI' => 1,
- '_AM_SET_OPTIONS' => 1,
+ '_LT_AC_LANG_F77_CONFIG' => 1,
'_LT_COMPILER_OPTION' => 1,
- '_AM_OUTPUT_DEPENDENCY_COMMANDS' => 1,
+ '_AM_SET_OPTIONS' => 1,
'AM_RUN_LOG' => 1,
- 'AC_LIBTOOL_SYS_OLD_ARCHIVE' => 1,
- 'AC_LTDL_SYS_DLOPEN_DEPLIBS' => 1,
+ '_AM_OUTPUT_DEPENDENCY_COMMANDS' => 1,
'AC_LIBTOOL_PICMODE' => 1,
- 'LT_PATH_LD' => 1,
+ 'AC_LTDL_SYS_DLOPEN_DEPLIBS' => 1,
+ 'AC_LIBTOOL_SYS_OLD_ARCHIVE' => 1,
'AC_CHECK_LIBM' => 1,
+ 'LT_PATH_LD' => 1,
'AC_LIBTOOL_SYS_LIB_STRIP' => 1,
'_AM_MANGLE_OPTION' => 1,
- 'AC_LTDL_SYMBOL_USCORE' => 1,
'AC_LIBTOOL_SYS_MAX_CMD_LEN' => 1,
+ 'AC_LTDL_SYMBOL_USCORE' => 1,
'AM_SET_DEPDIR' => 1,
'_LT_CC_BASENAME' => 1,
'_LT_LIBOBJ' => 1
@@ -295,55 +295,55 @@
'configure.ac'
],
{
- '_LT_AC_TAGCONFIG' => 1,
'AM_PROG_F77_C_O' => 1,
- 'm4_pattern_forbid' => 1,
+ '_LT_AC_TAGCONFIG' => 1,
'AC_INIT' => 1,
- '_AM_COND_IF' => 1,
+ 'm4_pattern_forbid' => 1,
'AC_CANONICAL_TARGET' => 1,
- 'AC_SUBST' => 1,
+ '_AM_COND_IF' => 1,
'AC_CONFIG_LIBOBJ_DIR' => 1,
- 'AC_FC_SRCEXT' => 1,
+ 'AC_SUBST' => 1,
'AC_CANONICAL_HOST' => 1,
+ 'AC_FC_SRCEXT' => 1,
'AC_PROG_LIBTOOL' => 1,
'AM_INIT_AUTOMAKE' => 1,
- 'AM_PATH_GUILE' => 1,
'AC_CONFIG_SUBDIRS' => 1,
+ 'AM_PATH_GUILE' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'LT_CONFIG_LTDL_DIR' => 1,
- 'AC_REQUIRE_AUX_FILE' => 1,
'AC_CONFIG_LINKS' => 1,
- 'm4_sinclude' => 1,
+ 'AC_REQUIRE_AUX_FILE' => 1,
'LT_SUPPORTED_TAG' => 1,
+ 'm4_sinclude' => 1,
'AM_MAINTAINER_MODE' => 1,
'AM_NLS' => 1,
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
- 'AM_MAKEFILE_INCLUDE' => 1,
'_m4_warn' => 1,
+ 'AM_MAKEFILE_INCLUDE' => 1,
'AM_PROG_CXX_C_O' => 1,
- '_AM_COND_ENDIF' => 1,
'_AM_MAKEFILE_INCLUDE' => 1,
+ '_AM_COND_ENDIF' => 1,
'AM_ENABLE_MULTILIB' => 1,
'AM_SILENT_RULES' => 1,
'AM_PROG_MOC' => 1,
'AC_CONFIG_FILES' => 1,
- 'LT_INIT' => 1,
'include' => 1,
- 'AM_PROG_AR' => 1,
+ 'LT_INIT' => 1,
'AM_GNU_GETTEXT' => 1,
+ 'AM_PROG_AR' => 1,
'AC_LIBSOURCE' => 1,
- 'AM_PROG_FC_C_O' => 1,
'AC_CANONICAL_BUILD' => 1,
+ 'AM_PROG_FC_C_O' => 1,
'AC_FC_FREEFORM' => 1,
'AH_OUTPUT' => 1,
- '_AM_SUBST_NOTMAKE' => 1,
'AC_CONFIG_AUX_DIR' => 1,
- 'sinclude' => 1,
- 'AM_PROG_CC_C_O' => 1,
+ '_AM_SUBST_NOTMAKE' => 1,
'm4_pattern_allow' => 1,
- 'AM_XGETTEXT_OPTION' => 1,
- 'AC_CANONICAL_SYSTEM' => 1,
+ 'AM_PROG_CC_C_O' => 1,
+ 'sinclude' => 1,
'AM_CONDITIONAL' => 1,
+ 'AC_CANONICAL_SYSTEM' => 1,
+ 'AM_XGETTEXT_OPTION' => 1,
'AC_CONFIG_HEADERS' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
'AM_POT_TOOLS' => 1,
diff --git a/bin/mbus-serial-request-data-multi-reply.c b/bin/mbus-serial-request-data-multi-reply.c
index fb90ad0..46bcbe5 100644
--- a/bin/mbus-serial-request-data-multi-reply.c
+++ b/bin/mbus-serial-request-data-multi-reply.c
@@ -29,7 +29,7 @@ main(int argc, char **argv)
mbus_frame_data reply_data;
mbus_handle *handle = NULL;
- char *device, *addr_str, matching_addr[16];
+ char *device, *addr_str, matching_addr[16], *xml_result;
int address, baudrate = 9600;
memset((void *)&reply, 0, sizeof(mbus_frame));
@@ -114,8 +114,8 @@ main(int argc, char **argv)
}
// instead of the send and recv, use this sendrecv function that
- // takes care of the possibility of multi-telegram replies
- if (mbus_sendrecv_request(handle, address, &reply, -1) == -1)
+ // takes care of the possibility of multi-telegram replies (limit = 16 frames)
+ if (mbus_sendrecv_request(handle, address, &reply, 16) == -1)
{
fprintf(stderr, "Failed to send/receive M-Bus request.\n");
return 1;
@@ -132,7 +132,12 @@ main(int argc, char **argv)
//
// generate XML and print to standard output
//
- printf("%s", mbus_frame_xml(&reply));
+ if ((xml_result = mbus_frame_xml(&reply)) == NULL)
+ {
+ fprintf(stderr, "Failed to generate XML representation of MBUS frames: %s\n", mbus_error_str());
+ return 1;
+ }
+ printf("%s", xml_result);
mbus_disconnect(handle);
return 0;
diff --git a/bin/mbus-serial-scan.c b/bin/mbus-serial-scan.c
index 42f09f7..178cbbe 100644
--- a/bin/mbus-serial-scan.c
+++ b/bin/mbus-serial-scan.c
@@ -25,20 +25,31 @@ main(int argc, char **argv)
{
mbus_handle *handle;
char *device;
- int address, baudrate = 9600;
+ int address, baudrate = 9600, debug = 0;
if (argc == 2)
{
device = argv[1];
}
+ else if (argc == 3 && strcmp(argv[1], "-d") == 0)
+ {
+ debug = 1;
+ device = argv[2];
+ }
else if (argc == 4 && strcmp(argv[1], "-b") == 0)
{
baudrate = atoi(argv[2]);
device = argv[3];
}
+ else if (argc == 5 && strcmp(argv[1], "-d") == 0 && strcmp(argv[2], "-b") == 0)
+ {
+ debug = 1;
+ baudrate = atoi(argv[3]);
+ device = argv[4];
+ }
else
{
- fprintf(stderr, "usage: %s [-b BAUDRATE] device\n", argv[0]);
+ fprintf(stderr, "usage: %s [-d] [-b BAUDRATE] device\n", argv[0]);
return 0;
}
@@ -54,6 +65,8 @@ main(int argc, char **argv)
return 1;
}
+ if (debug)
+ printf("Scanning primary addresses:\n");
for (address = 0; address < 254; address++)
{
@@ -61,6 +74,12 @@ main(int argc, char **argv)
memset((void *)&reply, 0, sizeof(mbus_frame));
+ if (debug)
+ {
+ printf("%d ", address);
+ fflush(stdout);
+ }
+
if (mbus_send_ping_frame(handle, address) == -1)
{
printf("Scan failed. Could not send ping frame: %s\n", mbus_error_str());
@@ -74,6 +93,9 @@ main(int argc, char **argv)
if (mbus_frame_type(&reply) == MBUS_FRAME_TYPE_ACK)
{
+ if (debug)
+ printf("\n");
+
printf("Found a M-Bus device at address %d\n", address);
}
}
diff --git a/bin/mbus-tcp-request-data-multi-reply.c b/bin/mbus-tcp-request-data-multi-reply.c
index fee2d2a..91ea0c1 100644
--- a/bin/mbus-tcp-request-data-multi-reply.c
+++ b/bin/mbus-tcp-request-data-multi-reply.c
@@ -29,7 +29,7 @@ main(int argc, char **argv)
mbus_frame_data reply_data;
mbus_handle *handle = NULL;
- char *host, *addr_str, matching_addr[16];
+ char *host, *addr_str, matching_addr[16], *xml_result;
int port, address;
memset((void *)&reply, 0, sizeof(mbus_frame));
@@ -114,7 +114,12 @@ main(int argc, char **argv)
//
// generate XML and print to standard output
//
- printf("%s", mbus_frame_xml(&reply));
+ if ((xml_result = mbus_frame_xml(&reply)) == NULL)
+ {
+ fprintf(stderr, "Failed to generate XML representation of MBUS frames: %s\n", mbus_error_str());
+ return 1;
+ }
+ printf("%s", xml_result);
mbus_disconnect(handle);
return 0;
diff --git a/bin/mbus-tcp-scan.c b/bin/mbus-tcp-scan.c
index 9ae5b34..7633b00 100644
--- a/bin/mbus-tcp-scan.c
+++ b/bin/mbus-tcp-scan.c
@@ -26,27 +26,44 @@ main(int argc, char **argv)
{
mbus_handle *handle;
char *host;
- int port, address;
+ int port, address, debug = 0;
- if (argc != 3)
+ if (argc == 3)
{
- printf("usage: %s host port\n", argv[0]);
+ host = argv[1];
+ port = atoi(argv[2]);
+ }
+ else if (argc == 4 && strcmp(argv[1], "-d") == 0)
+ {
+ debug = 1;
+ host = argv[2];
+ port = atoi(argv[3]);
+ }
+ else
+ {
+ printf("usage: %s [-d] host port\n", argv[0]);
return 0;
}
-
- host = argv[1];
- port = atoi(argv[2]);
-
+
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;
}
+ if (debug)
+ printf("Scanning primary addresses:\n");
+
for (address = 0; address < 254; address++)
{
mbus_frame reply;
+ if (debug)
+ {
+ printf("%d ", address);
+ fflush(stdout);
+ }
+
if (mbus_send_ping_frame(handle, address) == -1)
{
printf("Scan failed. Could not send ping frame: %s\n", mbus_error_str());
@@ -60,6 +77,9 @@ main(int argc, char **argv)
if (mbus_frame_type(&reply) == MBUS_FRAME_TYPE_ACK)
{
+ if (debug)
+ printf("\n");
+
printf("Found a M-Bus device at address %d\n", address);
}
}
diff --git a/mbus/mbus-protocol-aux.c b/mbus/mbus-protocol-aux.c
index df836e4..52e336f 100644
--- a/mbus/mbus-protocol-aux.c
+++ b/mbus/mbus-protocol-aux.c
@@ -24,7 +24,7 @@
#define MBUS_DEBUG(...)
#endif
-static int debug = 1;
+static int debug = 0;
typedef struct _mbus_variable_vif {
unsigned vif;
@@ -1557,14 +1557,7 @@ mbus_sendrecv_request(mbus_handle *handle, int address, mbus_frame *reply, int m
while (more_frames)
{
frame_count++;
-
- if ((max_frames > 0) &&
- (frame_count > max_frames))
- {
- // only readout max_frames
- break;
- }
-
+
if (debug)
printf("%s: debug: receiving response frame #%d\n", __PRETTY_FUNCTION__, frame_count);
@@ -1601,7 +1594,8 @@ mbus_sendrecv_request(mbus_handle *handle, int address, mbus_frame *reply, int m
{
more_frames = 0;
- if (reply_data.data_var.more_records_follow)
+ if (reply_data.data_var.more_records_follow &&
+ ((max_frames > 0) && (frame_count < max_frames))) // only readout max_frames
{
if (debug)
printf("%s: debug: expecting more frames\n", __PRETTY_FUNCTION__);
diff --git a/mbus/mbus-protocol.c b/mbus/mbus-protocol.c
index 0fef9c0..a188356 100644
--- a/mbus/mbus-protocol.c
+++ b/mbus/mbus-protocol.c
@@ -2768,27 +2768,29 @@ mbus_parse_set_debug(int debug)
int
mbus_frame_print(mbus_frame *frame)
{
+ mbus_frame *iter;
u_char data_buff[256];
int len, i;
-
- if (frame)
+
+ if (frame == NULL)
+ return -1;
+
+ for (iter = frame; iter; iter = iter->next)
{
- if ((len = mbus_frame_pack(frame, data_buff, sizeof(data_buff))) == -1)
+ if ((len = mbus_frame_pack(iter, data_buff, sizeof(data_buff))) == -1)
{
return -2;
}
-
- printf("%s: Dumping M-Bus frame [type %d, %d bytes]: ", __PRETTY_FUNCTION__, frame->type, len);
+
+ printf("%s: Dumping M-Bus frame [type %d, %d bytes]: ", __PRETTY_FUNCTION__, iter->type, len);
for (i = 0; i < len; i++)
{
printf("%.2X ", data_buff[i]);
}
printf("\n");
-
- return 0;
}
-
- return -1;
+
+ return 0;
}
//------------------------------------------------------------------------------
diff --git a/mbus/mbus-serial.c b/mbus/mbus-serial.c
index 22c5d8c..ecb28e9 100644
--- a/mbus/mbus-serial.c
+++ b/mbus/mbus-serial.c
@@ -166,6 +166,16 @@ mbus_serial_send_frame(mbus_serial_handle *handle, mbus_frame *frame)
fprintf(stderr, "%s: mbus_frame_pack failed\n", __PRETTY_FUNCTION__);
return -1;
}
+
+#ifdef MBUS_SERIAL_DEBUG
+ // if debug, dump in HEX form to stdout what we write to the serial port
+ printf("%s: Dumping M-Bus frame [%d bytes]: ", __PRETTY_FUNCTION__, len);
+ for (i = 0; i < len; i++)
+ {
+ printf("%.2X ", buff[i]);
+ }
+ printf("\n");
+#endif
if ((ret = write(handle->fd, buff, len)) == len)
{
diff --git a/test/mbus_parse_hex.c b/test/mbus_parse_hex.c
index 913b0d2..6d2d9c7 100644
--- a/test/mbus_parse_hex.c
+++ b/test/mbus_parse_hex.c
@@ -89,7 +89,8 @@ main(int argc, char *argv[])
//mbus_frame_print(&reply);
//mbus_frame_data_print(&frame_data);
- printf("%s", mbus_frame_data_xml(&frame_data));
+ printf("%s", mbus_frame_data_xml_normalized(&frame_data));
+ // printf("%s", mbus_frame_data_xml(&frame_data));
return 0;
}
diff --git a/test/test-frames/frame1.xml b/test/test-frames/frame1.xml
index 91315d9..32f246d 100644
--- a/test/test-frames/frame1.xml
+++ b/test/test-frames/frame1.xml
@@ -12,6 +12,7 @@
Manufacturer specific
+ 5F 42 01 11 FF FF FF FF 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
diff --git a/test/test-frames/kamstrup_multical_601.xml b/test/test-frames/kamstrup_multical_601.xml
index 2be75e4..7be7b49 100644
--- a/test/test-frames/kamstrup_multical_601.xml
+++ b/test/test-frames/kamstrup_multical_601.xml
@@ -4,7 +4,7 @@
6855817
KAM
8
- Heat
+ Heat: Outlet
4
00
0000
@@ -174,6 +174,7 @@
Manufacturer specific
+ 00 00 00 00 E7 E4 00 00 63 66 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5B C9 A5 02 34 53 00 00 E0 B2 03 00 89 9C 68 00 00 00 00 00 01 00 01 07 07 09 01 03 00 00 00 00 00
diff --git a/test/test-frames/svm_f22_telegram1.xml b/test/test-frames/svm_f22_telegram1.xml
index da0cc53..00e2178 100644
--- a/test/test-frames/svm_f22_telegram1.xml
+++ b/test/test-frames/svm_f22_telegram1.xml
@@ -4,7 +4,7 @@
1006089
SVM
9
- Heat (Volume measured at flow temperature: inlet)
+ Heat: Inlet
148
70
0000
@@ -89,7 +89,8 @@
- Manufacturer specific
+ More records follow
+