Commit Graph

107 Commits

Author SHA1 Message Date
Jakub Pawlowski
d68ff94580 client: main: add support for SetDiscoveryFilter
This patch adds set-scan-filter-* commands to sample DBus client that
might be used to modify discovery filter.

set-scan-filter-uuids - sets filter uuids field
set-scan-filter-rssi - sets filter rssi and clears pathloss
set-scan-filter-pathloss - sets filter pathloss and clears rssi
set-scan-filter-transport - sets filter transport
set-scan-filter-clear - clears filter

Sample output:
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# set-scan-filter-uuids babe
SetDiscoveryFilter success
[bluetooth]# set-scan-filter-transport le
SetDiscoveryFilter success
[bluetooth]# set-scan-filter-rssi -69
SetDiscoveryFilter success
[bluetooth]# scan on
Discovery started
[CHG] Controller 00:1A:7D:DA:71:13 Discovering: yes
[CHG] Device 44:89:1C:C5:67:94 RSSI: -66
[CHG] Device 44:89:1C:C5:67:94 TxPower: -21
[CHG] Device 44:89:1C:C5:67:94 RSSI: -65
[CHG] Device 44:89:1C:C5:67:94 RSSI: -58
[CHG] Device 44:89:1C:C5:67:94 RSSI: -64
[CHG] Device 44:89:1C:C5:67:94 RSSI: -59
[CHG] Device 44:89:1C:C5:67:94 RSSI: -65
[CHG] Device 44:89:1C:C5:67:94 RSSI: -59
[CHG] Device 44:89:1C:C5:67:94 RSSI: -64
[bluetooth]# set-scan-filter-rssi -90
SetDiscoveryFilter success
[CHG] Device 44:89:1C:C5:67:94 RSSI: -76
[CHG] Device 44:89:1C:C5:67:94 RSSI: -82
[CHG] Device 44:89:1C:C5:67:94 RSSI: -75
[CHG] Device 44:89:1C:C5:67:94 RSSI: -81
[CHG] Device 44:89:1C:C5:67:94 RSSI: -76
[CHG] Device 44:89:1C:C5:67:94 RSSI: -76
[CHG] Device 44:89:1C:C5:67:94 RSSI: -81
[CHG] Device 44:89:1C:C5:67:94 RSSI: -75
[CHG] Device 44:89:1C:C5:67:94 RSSI: -82
[CHG] Device 44:89:1C:C5:67:94 RSSI: -82
[bluetooth]# scan off
[CHG] Device 44:89:1C:C5:67:94 TxPower is nil
[CHG] Device 44:89:1C:C5:67:94 RSSI is nil
Discovery stopped
[CHG] Controller 00:1A:7D:DA:71:13 Discovering: no
2015-04-28 10:43:14 +03:00
Jakub Pawlowski
e1bc7c9c4b client: Make command info print TxPower and RSSI
This makes command info to also print TxPower and RSSI if available.
2015-04-23 22:03:18 +02:00
Luiz Augusto von Dentz
09000e29db client: Make command info print ServiceData
This makes command info to also print ServiceData if available.
2015-04-17 14:15:48 +03:00
Luiz Augusto von Dentz
a926593bef client: Make command info print ManufacturerData
This makes command info to also print ManufacturerData if available.
2015-04-17 14:15:47 +03:00
Luiz Augusto von Dentz
9797b12a39 client: Fix no handling dict properly
D-Bus dict may contain keys that are not of string type.
2015-04-17 14:15:47 +03:00
Marcel Holtmann
9fb60a2933 client: Use bool for __terminated variable 2015-04-02 19:27:13 -07:00
Luiz Augusto von Dentz
84cc810f3f client: Add unregister-profile command
This adds support to unregister-profile command which uses
GattManager1.UnregisterProfile.
2015-03-25 12:34:49 +02:00
Luiz Augusto von Dentz
0677f7ac3e client: Add register-profile command
This adds support to register-profile command which uses
GattManager1.RegisterProfile.
2015-03-25 12:34:48 +02:00
Marcel Holtmann
734a1eeeba client: Fix includes for gdbus.h header 2015-02-28 22:21:46 -08:00
Szymon Janc
b99c419fa4 client/display: Fix compilation warning on Android
isprint requires ctype.h include.

target thumb C: btmgmt <= external/bluetooth/bluez/client/display.c
external/bluetooth/bluez/client/display.c: In function 'rl_hexdump':
external/bluetooth/bluez/client/display.c:81:3: warning: implicit
    declaration of function 'isprint' [-Wimplicit-function-declaration]
   str[(i % 16) + 51] = isprint(buf[i]) ? buf[i] : '.';
   ^
2015-02-13 21:58:44 +02:00
Luiz Augusto von Dentz
229e583257 client: Handle attribute notifications
This enable printing properties changes to the current selected
attribute.
2015-02-10 13:15:58 +02:00
Luiz Augusto von Dentz
fcbf38a99c client: Add notify command
This command can be used to start/stop changes on the attribute value,
it only works if an attribute has been selected with select-attribute.
2015-02-10 13:15:58 +02:00
Luiz Augusto von Dentz
52392d8405 client: Add write command
This command can be used to write attributes, it only works if an
attribute has been selected with select-attribute.

The data argument should be passed hexdump format, %02x separated by
spaces, which is the same format used by read command.
2015-02-10 13:15:58 +02:00
Luiz Augusto von Dentz
838bdbce23 client: Add read command
This command can be used to read attributes, it only works if an
attribute has been selected with select-attribute.
2015-02-10 13:15:58 +02:00
Luiz Augusto von Dentz
044ff5e4cd client/display: Add rl_hexdump 2015-02-10 13:15:58 +02:00
Luiz Augusto von Dentz
cfe7f0a613 client: Add attribute-info command
attribute-info can be used to print out attribute information.
2015-02-10 13:15:58 +02:00
Luiz Augusto von Dentz
2eb1f615c4 client: Add command select-attribute
Command select-attribute can be used to select a service attribute.
2015-02-10 13:15:58 +02:00
Luiz Augusto von Dentz
496b6abf74 client: Add command list-attributes
This command can be used to list service attributes of a device.
2015-02-10 13:15:57 +02:00
Luiz Augusto von Dentz
8144c2ff58 client: Make commands relative to device
In case a device is connected make it the default and print to the
prompt, so the user don't have to type in its address.
2015-02-10 13:15:57 +02:00
Luiz Augusto von Dentz
77196fd631 client: Add support for GattDescriptor1
This add support for GattDescriptor1 interface detection and
prints when they are added or removed.
2015-02-10 13:15:57 +02:00
Luiz Augusto von Dentz
c6923a75ae client: Add support for GattCharacteristic1
This add support for GattCharacteristici1 interface detection and
prints when they are added or removed
2015-02-10 13:15:57 +02:00
Luiz Augusto von Dentz
aab6835b0a client: Add support for GattService1
This add support for GattService1 interface detection and prints when
they are added or removed
2015-02-10 13:15:57 +02:00
Luiz Augusto von Dentz
3167c1df57 client: Force redisplay on rl_printf
It seems some in some version of readline rl_redisplay does not update
when rl_printf is called, so this uses rl_forced_update_display which
should force the new lines to be displayed.
2014-09-05 22:53:52 +03:00
Luiz Augusto von Dentz
2fb5a1bccc client: Fix typo 2014-09-05 22:53:52 +03:00
Szymon Janc
36d6740363 client: Allow to terminate if bluetoothd was not started
This allows to terminate bluetoothctl with CTRL-C if daemon didn't
start. Otherwise input is not functional and user must kill
bluetoothctl by sending signal from another terminal.
2014-07-08 21:34:54 +03:00
Johan Hedberg
1d6621087b client: Wait for D-Bus before processing stdin
This should make it possible to do some scripting with bluetoothctl.
Otherwise stdin is processed before we're connected to D-Bus and most
commands will fail as a consequence.
2014-06-22 12:17:21 +03:00
Luiz Augusto von Dentz
fc8ac15d63 client: Fix not releasing agent if bluetoothd exit without calling Release
If AgentManager1 disappear the agent should auto release itself
otherwise next time AgentManager1 appears bluetoothctl wont register
the agent again.
2014-04-29 11:38:32 +03:00
Szymon Janc
07a16c4a40 client: Add support for printing property of array type
This allows to print UUIDs in user friendly fasion. Only string type
support is needed.

[CHG] Device XX:XX:XX:XX:XX:XX UUIDs:
        00000002-0000-1000-8000-0002ee000002
        00001101-0000-1000-8000-00805f9b34fb
        00001103-0000-1000-8000-00805f9b34fb
        00001104-0000-1000-8000-00805f9b34fb
        00001105-0000-1000-8000-00805f9b34fb

instead of:

[CHG] Device XX:XX:XX:XX:XX:XX UUIDs has unsupported type
2014-04-04 10:25:33 +03:00
Szymon Janc
16c66d5585 client: Add unblock command 2014-01-09 17:56:32 +02:00
Szymon Janc
07ea27611b client: Add block command 2014-01-09 17:56:25 +02:00
Szymon Janc
91ec552d90 client: Add untrust command 2014-01-09 17:56:13 +02:00
Sebastian Chlad
57ad7765b0 client: Add paired-devices command to bluetoothctl
Paired-devices command lists only paired devices
2013-11-25 15:22:44 +02:00
Philip Withnall
8ec698bf09 client: Fix handling of (G_IO_IN | G_IO_HUP) input case
If running bluetoothctl as a subprocess from another process, and piping
input to it, it’s possible for the stdin pipe to be closed by the parent
process while there’s still data pending in its buffer. This results in
input handler callbacks with condition (G_IO_IN | G_IO_HUP). All of the
pending input should be handled before closing bluetoothctl.
2013-11-25 14:52:45 +02:00
Lucas De Marchi
9d2e019fe3 client: prettify help table
cmd + options have a maximum length of 25. Align the description
after this value. In order not to reach 80 chars so easily change the
first \t to 2 spaces, like is done in udev, kmod, systemd, etc.
2013-06-24 11:12:59 +03:00
Lucas De Marchi
e9150410ec client: Add description for default-agent command 2013-06-24 11:12:53 +03:00
Lucas De Marchi
5d633f307c client: Get rid of gchar
Use plain char instead of gchar.
2013-05-02 09:02:27 +03:00
Alex Deymo
342f1aa194 client: Agent's RequestPasskey implementation
Implements the uint32 RequestPasskey(object device) method.
2013-03-25 12:57:11 +02:00
Alex Deymo
4b30052265 client: Agent's DisplayPasskey implementation
Implements the DisplayPasskey(object device, uint32 passkey, uint16 entered)
method.
2013-03-25 12:57:03 +02:00
Alex Deymo
d52e8994b5 client: Agent's DisplayPincode implementation
Implements the DisplayPinCode(object device, string pincode) method.
2013-03-25 12:56:55 +02:00
Alex Deymo
b776f04171 client: "agent" command capability argument and autocompletion
This patch enables argument autocompletion for the agent command with
the list of capabilities an agent can have, adding also "on" (for the
default "") and "off". The command passes the argument (parsing and
verifying it) to the dbus method call.
2013-03-25 12:56:41 +02:00
Alex Deymo
82e49df634 client: Right prompt management on agent input
Registering an agent shares the user input interface with the normal console
command interface. The way it is implemented (using rl_message, rl_save_prompt
and rl_restore_prompt) conflicts with the rl_printf calls that may appear
while waiting for user input, loosing the [bluetooth]# prompt.
This patch fixes this and makes clear if the expected input is a command or an
agent reply changing the color and text of the prompt.
2013-03-25 12:54:48 +02:00
Alex Deymo
f037e82669 client: Add color modifiers to NEW, CHG and DEL events.
Events like [NEW], [CHG] and [DEL] can appear in the command console at
any time, even when the user is typing a command. The last line is kept
making the event line appear just before it, something that can be
unnoticed. This patch add meaningful colors for those three event to make
it easier to see them.
2013-03-25 12:53:48 +02:00
Marcel Holtmann
67b9e7605c client: Don't bother with individual Device ID properties 2012-12-29 22:41:33 -08:00
Marcel Holtmann
108960e026 client: Print modalias properties if available 2012-12-29 22:19:54 -08:00
Marcel Holtmann
73c7258409 client: Allow setting and resetting of controller alias 2012-12-29 21:09:28 -08:00
Marcel Holtmann
eaaa1f7d26 client: Show adapter alias property as well 2012-12-29 19:54:30 -08:00
Marcel Holtmann
d53fa26669 client: Move __terminated into signal handler 2012-12-23 10:16:58 -08:00
Marcel Holtmann
af49b62ccc client: Add support for setting a device trusted 2012-12-22 20:13:46 -08:00
Marcel Holtmann
833773d091 client: Print UUIDs as human readable strings as well 2012-12-22 19:14:07 -08:00
Marcel Holtmann
5fbd1e5406 client: Add support for printing uint16 properties 2012-12-22 09:47:55 -08:00