diff options
author | Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com> | 2012-05-07 15:09:02 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-05-07 11:29:42 -0700 |
commit | 2118c0040925119702d5ad557448bb5bf733538b (patch) | |
tree | ba630b2e388d507910e844093735111717d18b76 /attrib/gatttool.c | |
parent | 9d21c7aada9c1f9d4555f52c3b6154f8dd6ceec2 (diff) | |
download | bluez-2118c0040925119702d5ad557448bb5bf733538b.tar.gz |
gatttool: Add option to specify LE address type
This patch makes possible to specify LE address type.
After advertising cache was removed from kernel we should always specify
address type for LE link when calling bt_io_connect() as otherwise random
will always be used.
LE address type can be specified either by 'addr-type' or 't' command line
parameter or as additional parameter to 'connect' command in interactive mode.
Possible values are 'public' (default) and 'random'.
Diffstat (limited to 'attrib/gatttool.c')
-rw-r--r-- | attrib/gatttool.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/attrib/gatttool.c b/attrib/gatttool.c index 21514af96..8a43ec1c4 100644 --- a/attrib/gatttool.c +++ b/attrib/gatttool.c @@ -44,6 +44,7 @@ static gchar *opt_src = NULL; static gchar *opt_dst = NULL; +static gchar *opt_dst_type = NULL; static gchar *opt_value = NULL; static gchar *opt_sec_level = NULL; static bt_uuid_t *opt_uuid = NULL; @@ -523,6 +524,8 @@ static GOptionEntry options[] = { "Specify local adapter interface", "hciX" }, { "device", 'b', 0, G_OPTION_ARG_STRING, &opt_dst, "Specify remote Bluetooth address", "MAC" }, + { "addr-type", 't', 0, G_OPTION_ARG_STRING, &opt_dst_type, + "Set LE address type. Default: public", "[public | random]"}, { "mtu", 'm', 0, G_OPTION_ARG_INT, &opt_mtu, "Specify the MTU size", "MTU" }, { "psm", 'p', 0, G_OPTION_ARG_INT, &opt_psm, @@ -539,6 +542,7 @@ int main(int argc, char *argv[]) GError *gerr = NULL; GIOChannel *chan; + opt_dst_type = g_strdup("public"); opt_sec_level = g_strdup("low"); context = g_option_context_new(NULL); @@ -573,7 +577,7 @@ int main(int argc, char *argv[]) } if (opt_interactive) { - interactive(opt_src, opt_dst, opt_psm); + interactive(opt_src, opt_dst, opt_dst_type, opt_psm); goto done; } @@ -597,7 +601,7 @@ int main(int argc, char *argv[]) goto done; } - chan = gatt_connect(opt_src, opt_dst, opt_sec_level, + chan = gatt_connect(opt_src, opt_dst, opt_dst_type, opt_sec_level, opt_psm, opt_mtu, connect_cb); if (chan == NULL) { got_error = TRUE; |