aboutsummaryrefslogtreecommitdiffstats
path: root/attrib/gatttool.c
diff options
context:
space:
mode:
authorSheldon Demario <sheldon.demario@openbossa.org>2011-02-15 14:09:43 -0300
committerJohan Hedberg <johan.hedberg@nokia.com>2011-02-15 14:17:37 -0300
commita523620a365b2eaa3a835daec3e2bd480a8a11ff (patch)
treefe96fc553b1d30987f87a9795e64531172f4f3e1 /attrib/gatttool.c
parentdcfc9adb5ea3157d0c0040b5af9d81f63d7c0ecd (diff)
downloadbluez-a523620a365b2eaa3a835daec3e2bd480a8a11ff.tar.gz
bluez-a523620a365b2eaa3a835daec3e2bd480a8a11ff.tar.xz
bluez-a523620a365b2eaa3a835daec3e2bd480a8a11ff.zip
Add an initial interactive mode to gatttool
Mode required to allow better GATT procedures control. Some scenarios require sequential commands without disconnection and delay between operations. It is also desirable to change some connection parameters of an active connection.
Diffstat (limited to 'attrib/gatttool.c')
-rw-r--r--attrib/gatttool.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/attrib/gatttool.c b/attrib/gatttool.c
index b9f00870..c3d0472b 100644
--- a/attrib/gatttool.c
+++ b/attrib/gatttool.c
@@ -42,6 +42,7 @@
#include "gattrib.h"
#include "glib-helper.h"
#include "gatt.h"
+#include "gatttool.h"
/* Minimum MTU for L2CAP connections over BR/EDR */
#define ATT_MIN_MTU_L2CAP 48
@@ -64,6 +65,7 @@ static gboolean opt_char_desc = FALSE;
static gboolean opt_le = FALSE;
static gboolean opt_char_write = FALSE;
static gboolean opt_char_write_req = FALSE;
+static gboolean opt_interactive = FALSE;
static GMainLoop *event_loop;
static gboolean got_error = FALSE;
@@ -594,6 +596,8 @@ static GOptionEntry gatt_options[] = {
"Listen for notifications and indications", NULL },
{ "le", 0, 0, G_OPTION_ARG_NONE, &opt_le,
"Use Bluetooth Low Energy transport", NULL },
+ { "interactive", 'I', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
+ &opt_interactive, "Use interactive mode", NULL },
{ NULL },
};
@@ -651,6 +655,11 @@ int main(int argc, char *argv[])
g_error_free(gerr);
}
+ if (opt_interactive) {
+ interactive();
+ goto done;
+ }
+
if (opt_primary)
callback = primary;
else if (opt_characteristics)