diff --git a/Makefile.tools b/Makefile.tools
index 4d45682..0de0a0d 100644
--- a/Makefile.tools
+++ b/Makefile.tools
attrib_gatttool_SOURCES = attrib/gatttool.c attrib/att.c attrib/gatt.c \
attrib/gattrib.c btio/btio.c \
attrib/gatttool.h attrib/interactive.c \
- attrib/utils.c src/log.c
+ attrib/utils.c src/log.c client/display.c \
+ client/display.h
attrib_gatttool_LDADD = lib/libbluetooth-private.la @GLIB_LIBS@ -lreadline
tools_obex_client_tool_SOURCES = $(gobex_sources) $(btio_sources) \
diff --git a/attrib/interactive.c b/attrib/interactive.c
index ce35218..d5da9ad 100644
--- a/attrib/interactive.c
+++ b/attrib/interactive.c
#include "gattrib.h"
#include "gatt.h"
#include "gatttool.h"
+#include "client/display.h"
static GIOChannel *iochannel = NULL;
static GAttrib *attrib = NULL;
{
conn_state = st;
rl_set_prompt(get_prompt());
- rl_redisplay();
}
static void events_handler(const uint8_t *pdu, uint16_t len, gpointer user_data)
static void connect_cb(GIOChannel *io, GError *err, gpointer user_data)
{
if (err) {
- printf("connect error: %s\n", err->message);
set_state(STATE_DISCONNECTED);
+ rl_printf("%s\n", err->message);
return;
}
g_attrib_register(attrib, ATT_OP_HANDLE_IND, GATTRIB_ALL_HANDLES,
events_handler, attrib, NULL);
set_state(STATE_CONNECTED);
+ rl_redisplay();
}
static void disconnect_io()
}
if (opt_dst == NULL) {
- printf("Remote Bluetooth address required\n");
+ rl_printf("Remote Bluetooth address required\n");
return;
}
iochannel = gatt_connect(opt_src, opt_dst, opt_dst_type, opt_sec_level,
opt_psm, opt_mtu, connect_cb, &gerr);
if (iochannel == NULL) {
- printf("%s\n", gerr->message);
set_state(STATE_DISCONNECTED);
+ rl_printf("%s\n", gerr->message);
g_error_free(gerr);
} else
g_io_add_watch(iochannel, G_IO_HUP, channel_watcher, NULL);