summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Orlenko <zxteam@gmail.com>2010-11-22 01:36:41 +1000
committerAlexander Orlenko <zxteam@gmail.com>2010-11-22 01:36:41 +1000
commit9b3f7fe8bf83f4ad2ed69fd63c13edf786dc6cdf (patch)
treea2d0458be93f84563e95fe1c89f8e8af620a0592
parentc68a357aa61ba4b725a54801b2ef80d2eb84c07b (diff)
downloadbluez-tools-9b3f7fe8bf83f4ad2ed69fd63c13edf786dc6cdf.tar.gz
Added disconnect command to bt-device
Updated MANs
-rw-r--r--contrib/man/bt-device.pod9
-rw-r--r--contrib/man/bt-network.pod4
-rw-r--r--src/bt-adapter.12
-rw-r--r--src/bt-agent.12
-rw-r--r--src/bt-audio.12
-rw-r--r--src/bt-device.113
-rw-r--r--src/bt-device.c14
-rw-r--r--src/bt-input.12
-rw-r--r--src/bt-monitor.12
-rw-r--r--src/bt-network.18
-rw-r--r--src/bt-obex.16
-rw-r--r--src/bt-serial.12
12 files changed, 40 insertions, 26 deletions
diff --git a/contrib/man/bt-device.pod b/contrib/man/bt-device.pod
index d75aa92..2399e20 100644
--- a/contrib/man/bt-device.pod
+++ b/contrib/man/bt-device.pod
@@ -13,6 +13,7 @@ Application Options:
-a, --adapter=<name|mac>
-l, --list
-c, --connect=<mac>
+ -d, --disconnect=<name|mac>
-r, --remove=<name|mac>
-i, --info=<name|mac>
-s, --services <name|mac> [<pattern>]
@@ -22,8 +23,8 @@ Application Options:
=head1 DESCRIPTION
This utility is used to manage Bluetooth devices. You can list added devices,
-connect to a new device, remove added device, show info about device,
-discover remote device services or change device properties.
+connect to a new device, disconnect device, remove added device, show info
+about device, discover remote device services or change device properties.
=head1 OPTIONS
@@ -41,6 +42,10 @@ B<-c, --connect E<lt>macE<gt>>
Connect to the remote device by his MAC, retrieve all SDP
records and then initiate the pairing
+B<-d, --disconnect E<lt>name|macE<gt>>
+ Disconnects a specific remote device by terminating the
+ low-level ACL connection.
+
B<-r, --remove>
Remove device (and also the pairing information)
diff --git a/contrib/man/bt-network.pod b/contrib/man/bt-network.pod
index 7d168de..e963336 100644
--- a/contrib/man/bt-network.pod
+++ b/contrib/man/bt-network.pod
@@ -12,7 +12,6 @@ Help Options:
Application Options:
-a, --adapter=<name|mac>
-c, --connect <name|mac> <uuid>
- -d, --disconnect=<name|mac>
-s, --server <gn|panu|nap> <brige>
=head1 DESCRIPTION
@@ -33,9 +32,6 @@ B<-c, --connect E<lt>name|macE<gt> E<lt>uuidE<gt>>
Connect to the network device and return the network interface
name, uuid can be either one of "gn", "panu" or "nap"
-B<-d, --disconnect E<lt>name|macE<gt>>
- Disconnect from the network device
-
B<-s, --server E<lt>gn|panu|napE<gt> E<lt>brigeE<gt>>
Register server for the provided UUID, every new connection to
this server will be added the bridge interface
diff --git a/src/bt-adapter.1 b/src/bt-adapter.1
index 966ea8c..3466c47 100644
--- a/src/bt-adapter.1
+++ b/src/bt-adapter.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.14)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
.\"
.\" Standard preamble:
.\" ========================================================================
diff --git a/src/bt-agent.1 b/src/bt-agent.1
index 3d8bdaa..c367390 100644
--- a/src/bt-agent.1
+++ b/src/bt-agent.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.14)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
.\"
.\" Standard preamble:
.\" ========================================================================
diff --git a/src/bt-audio.1 b/src/bt-audio.1
index 37c8e39..c83ca9d 100644
--- a/src/bt-audio.1
+++ b/src/bt-audio.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.14)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
.\"
.\" Standard preamble:
.\" ========================================================================
diff --git a/src/bt-device.1 b/src/bt-device.1
index 8093aa7..0cb4dfe 100644
--- a/src/bt-device.1
+++ b/src/bt-device.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.14)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
.\"
.\" Standard preamble:
.\" ========================================================================
@@ -124,7 +124,7 @@
.\" ========================================================================
.\"
.IX Title "bt-device 1"
-.TH bt-device 1 "2010-08-16" "" "bluez-tools"
+.TH bt-device 1 "2010-11-22" "" "bluez-tools"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -142,6 +142,7 @@ Application Options:
\-a, \-\-adapter=<name|mac>
\-l, \-\-list
\-c, \-\-connect=<mac>
+ \-d, \-\-disconnect=<name|mac>
\-r, \-\-remove=<name|mac>
\-i, \-\-info=<name|mac>
\-s, \-\-services <name|mac> [<pattern>]
@@ -150,8 +151,8 @@ Application Options:
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This utility is used to manage Bluetooth devices. You can list added devices,
-connect to a new device, remove added device, show info about device,
-discover remote device services or change device properties.
+connect to a new device, disconnect device, remove added device, show info
+about device, discover remote device services or change device properties.
.SH "OPTIONS"
.IX Header "OPTIONS"
\&\fB\-h, \-\-help\fR
@@ -168,6 +169,10 @@ discover remote device services or change device properties.
Connect to the remote device by his \s-1MAC\s0, retrieve all \s-1SDP\s0
records and then initiate the pairing
.PP
+\&\fB\-d, \-\-disconnect <name|mac>\fR
+ Disconnects a specific remote device by terminating the
+ low-level \s-1ACL\s0 connection.
+.PP
\&\fB\-r, \-\-remove\fR
Remove device (and also the pairing information)
.PP
diff --git a/src/bt-device.c b/src/bt-device.c
index 8e16dc6..799ee32 100644
--- a/src/bt-device.c
+++ b/src/bt-device.c
@@ -54,6 +54,7 @@ static int xml_t[LAST_E] = {0, 0, 0, 0, -1, -1};
static gchar *adapter_arg = NULL;
static gboolean list_arg = FALSE;
static gchar *connect_arg = NULL;
+static gchar *disconnect_arg = NULL;
static gchar *remove_arg = NULL;
static gchar *info_arg = NULL;
static gboolean services_arg = FALSE;
@@ -240,6 +241,7 @@ static GOptionEntry entries[] = {
{"adapter", 'a', 0, G_OPTION_ARG_STRING, &adapter_arg, "Adapter Name or MAC", "<name|mac>"},
{"list", 'l', 0, G_OPTION_ARG_NONE, &list_arg, "List added devices", NULL},
{"connect", 'c', 0, G_OPTION_ARG_STRING, &connect_arg, "Connect to the remote device", "<mac>"},
+ {"disconnect", 'd', 0, G_OPTION_ARG_STRING, &disconnect_arg, "Disconnect the remote device", "<name|mac>"},
{"remove", 'r', 0, G_OPTION_ARG_STRING, &remove_arg, "Remove device", "<name|mac>"},
{"info", 'i', 0, G_OPTION_ARG_STRING, &info_arg, "Get info about device", "<name|mac>"},
{"services", 's', 0, G_OPTION_ARG_NONE, &services_arg, "Discover device services", NULL},
@@ -282,7 +284,7 @@ int main(int argc, char *argv[])
g_print("%s: %s\n", g_get_prgname(), error->message);
g_print("Try `%s --help` for more information.\n", g_get_prgname());
exit(EXIT_FAILURE);
- } else if (!list_arg && (!connect_arg || strlen(connect_arg) == 0) && (!remove_arg || strlen(remove_arg) == 0) && (!info_arg || strlen(info_arg) == 0) && !services_arg && !set_arg) {
+ } else if (!list_arg && (!connect_arg || strlen(connect_arg) == 0) && (!disconnect_arg || strlen(disconnect_arg) == 0) && (!remove_arg || strlen(remove_arg) == 0) && (!info_arg || strlen(info_arg) == 0) && !services_arg && !set_arg) {
g_print("%s", g_option_context_get_help(context, FALSE, NULL));
exit(EXIT_FAILURE);
} else if (services_arg && (argc != 2 || strlen(argv[1]) == 0) && (argc != 3 || strlen(argv[1]) == 0)) {
@@ -342,6 +344,16 @@ int main(int argc, char *argv[])
g_main_loop_unref(mainloop);
g_free(created_device);
g_object_unref(agent);
+ } else if (disconnect_arg) {
+ Device *device = find_device(adapter, disconnect_arg, &error);
+ exit_if_error(error);
+
+ g_print("Disconnecting: %s\n", disconnect_arg);
+ device_disconnect(device, &error);
+ exit_if_error(error);
+
+ g_print("Done\n");
+ g_object_unref(device);
} else if (remove_arg) {
Device *device = find_device(adapter, remove_arg, &error);
exit_if_error(error);
diff --git a/src/bt-input.1 b/src/bt-input.1
index aba5dac..ef6602f 100644
--- a/src/bt-input.1
+++ b/src/bt-input.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.14)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
.\"
.\" Standard preamble:
.\" ========================================================================
diff --git a/src/bt-monitor.1 b/src/bt-monitor.1
index 23cca82..3da57ae 100644
--- a/src/bt-monitor.1
+++ b/src/bt-monitor.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.14)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
.\"
.\" Standard preamble:
.\" ========================================================================
diff --git a/src/bt-network.1 b/src/bt-network.1
index a119e8d..7364308 100644
--- a/src/bt-network.1
+++ b/src/bt-network.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.14)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
.\"
.\" Standard preamble:
.\" ========================================================================
@@ -124,7 +124,7 @@
.\" ========================================================================
.\"
.IX Title "bt-network 1"
-.TH bt-network 1 "2010-08-13" "" "bluez-tools"
+.TH bt-network 1 "2010-11-22" "" "bluez-tools"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -141,7 +141,6 @@ Help Options:
Application Options:
\-a, \-\-adapter=<name|mac>
\-c, \-\-connect <name|mac> <uuid>
- \-d, \-\-disconnect=<name|mac>
\-s, \-\-server <gn|panu|nap> <brige>
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
@@ -160,9 +159,6 @@ All servers will be automatically unregistered when the application terminates.
Connect to the network device and return the network interface
name, uuid can be either one of \*(L"gn\*(R", \*(L"panu\*(R" or \*(L"nap\*(R"
.PP
-\&\fB\-d, \-\-disconnect <name|mac>\fR
- Disconnect from the network device
-.PP
\&\fB\-s, \-\-server <gn|panu|nap> <brige>\fR
Register server for the provided \s-1UUID\s0, every new connection to
this server will be added the bridge interface
diff --git a/src/bt-obex.1 b/src/bt-obex.1
index c286646..23a25a8 100644
--- a/src/bt-obex.1
+++ b/src/bt-obex.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.14)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
.\"
.\" Standard preamble:
.\" ========================================================================
@@ -124,7 +124,7 @@
.\" ========================================================================
.\"
.IX Title "bt-obex 1"
-.TH bt-obex 1 "2010-08-15" "" "bluez-tools"
+.TH bt-obex 1 "2010-08-16" "" "bluez-tools"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -162,7 +162,7 @@ You can send and receive files to/from remote device using this tool.
accept/reject incoming bluetooth object push requests
.PP
\&\fB\-p, \-\-opp <name|mac> <file>\fR
- Send local file to the specified remove device using object push
+ Send local file to the specified remote device using object push
profile
.PP
\&\fB\-f, \-\-ftp <name|mac>\fR
diff --git a/src/bt-serial.1 b/src/bt-serial.1
index c5ded88..a7688a8 100644
--- a/src/bt-serial.1
+++ b/src/bt-serial.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.14)
+.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
.\"
.\" Standard preamble:
.\" ========================================================================