Added frame tracing (hex format) via debug switch

This commit is contained in:
Stefan Wahren
2012-05-15 22:57:03 +02:00
parent 4178ffceb1
commit 90aec91bff
10 changed files with 137 additions and 21 deletions

View File

@ -17,6 +17,8 @@
#include <stdio.h>
#include <mbus/mbus.h>
static int debug = 0;
//------------------------------------------------------------------------------
// Primary addressing scanning of mbus devices.
//------------------------------------------------------------------------------
@ -25,7 +27,7 @@ main(int argc, char **argv)
{
mbus_handle *handle;
char *device;
int address, baudrate = 9600, debug = 0;
int address, baudrate = 9600;
if (argc == 2)
{
@ -53,6 +55,12 @@ main(int argc, char **argv)
return 0;
}
if (debug)
{
mbus_register_send_event(&mbus_dump_send_event);
mbus_register_recv_event(&mbus_dump_recv_event);
}
if ((handle = mbus_connect_serial(device)) == NULL)
{
printf("Failed to setup connection to M-bus gateway\n");