Commit Graph

24134 Commits

Author SHA1 Message Date
ERAMOTO Masaya
090e626a74 client: Add a description to all commands 2017-06-19 14:47:04 +03:00
ERAMOTO Masaya
18ef642531 client: Compare a input string and each command only once
This compares a input string and each command only once in rl_handler().
2017-06-19 14:47:04 +03:00
Sathish Narasimman
9d4658a2e3 obexd/map: msg dummy implement message listing
For messages dummy, message listing functionality in implemented in
this patch. The inputs for message listing is derived from the
mlisting.xml file that is to be present in each folder(inbox, sent,
drafts)

> ACL Data RX: Handle 256 flags 0x02 dlen 78
      Channel: 64 len 74 [PSM 3 mode 0] {chan 0}
      RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
         Address: 0x83 cr 1 dlci 0x20
         Control: 0xff poll/final 1
         Length: 69
         FCS: 0xc4
         Credits: 1
        83 00 45 cb 00 00 00 02 01 00 0d 00 73 00 65 00  ..E.........s.e.
        6e 00 74 00 00 42 00 18 78 2d 62 74 2f 4d 41 50  n.t..B..x-bt/MAP
        2d 6d 73 67 2d 6c 69 73 74 69 6e 67 00 4c 00 18  -msg-listing.L..
        01 02 00 0b 02 02 00 00 13 01 ff 06 01 00 07 00  ................
        08 00 09 01 00 c4                                ......
< ACL Data TX: Handle 256 flags 0x00 dlen 1017
      Channel: 65 len 1013 [PSM 3 mode 0] {chan 0}
      RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
         Address: 0x81 cr 0 dlci 0x20
         Control: 0xef poll/final 0
         Length: 28675
         FCS: 0x02
        90 08 63 4c 00 21 12 02 00 0b 19 15 32 30 31 37  ..cL.!......2017
        30 36 31 32 54 31 32 32 35 31 33 2d 20 35 33 30  0612T122513- 530
        00 0d 01 00 48 08 3f 3c 4d 41 50 2d 6d 73 67 2d  ....H.?<MAP-msg-
        6c 69 73 74 69 6e 67 20 76 65 72 73 69 6f 6e 3d  listing version=
        22 31 2e 30 22 3e 3c 6d 73 67 20 68 61 6e 64 6c  "1.0"><msg handl
        65 3d 22 30 34 30 30 30 30 30 30 30 30 30 30 30  e="0400000000000
        30 31 32 22 20 73 75 62 6a 65 63 74 3d 22 4e 6f  012" subject="No
        22 20 64 61 74 65 74 69 6d 65 3d 22 32 30 31 37  " datetime="2017
        30 35 32 34 54 31 37 30 31 35 37 22 20 73 65 6e  0524T170157" sen
        64 65 72 5f 61 64 64 72 65 73 73 69 6e 67 3d 22  der_addressing="
        22 20 72 65 63 69 70 69 65 6e 74 5f 61 64 64 72  " recipient_addr
        65 73 73 69 6e 67 3d 22 35 34 33 32 31 22 20 74  essing="54321" t
        79 70 65 3d 22 53 4d 53 5f 47 53 4d 22 20 72 65  ype="SMS_GSM" re
        63 65 70 74 69 6f 6e 5f 73 74 61 74 75 73 3d 22  ception_status="
        63 6f 6d 70 6c 65 74 65 22 20 61 74 74 61 63 68  complete" attach
        6d 65 6e 74 5f 73 69 7a 65 3d 22 30 22 2f 3e 0a  ment_size="0"/>.

	... and more
2017-06-19 11:28:13 +03:00
Sathish Narasimman
a987ea04cf obexd/map: Do not send parent folder in dummy
In messages-dummy it is not necessary to add parent folder in the
response to folder-lisintg. when tested with some carkit the present
method is not working when navigating to different folders. so removing
it.
2017-06-19 11:28:13 +03:00
Grzegorz Kolodziejczyk
825400c583 shared/gatt-client: Correct att err variable
According to Core specification version 5.0 (Vol 3, Part F, 3.4.1.1)
error code size is one byte.
2017-06-19 11:20:03 +03:00
Konrad Zapałowicz
bd36dfff02 tester: fix inproper printout from cmd handler 2017-06-19 11:09:53 +03:00
Luiz Augusto von Dentz
2179f571e1 core/gatt: Add GATT.Cache config option
This adds GATT.Cache config option to main.conf which can be used
to adjust the cache expected behavior of attributes found over GATT.
2017-06-17 22:37:48 +03:00
Luiz Augusto von Dentz
8fdae2665a core/gatt: Fix not registering .accept callback for external profiles
The .accept callback is mandatory since probe_service has been changed to
check for it in 89ca735e57.
2017-06-17 22:20:04 +03:00
Grzegorz Kolodziejczyk
ffc0888857 monitor/avdtp: Correct bit mask for TSEP
According to AVDP specification 1.3 (8.6.2 Stream End Point Discovery
Response), TSEP bit is on 3rd position of 3rd frame byte.
2017-06-10 21:18:52 +02:00
Marcel Holtmann
0f791b0cc6 monitor: Add Broadcom controller features decoding 2017-06-10 05:23:45 -07:00
Marcel Holtmann
fedb7f6eab tools: Add testing utility for advertising 2017-06-07 14:12:54 -07:00
Luiz Augusto von Dentz
d6c07ecf22 shared/gatt-client: Fix removing services with no attributes
If a service has no attributes, like IPSS, just mark it as active and
skip doing any attribute discover.
2017-05-30 14:45:23 +03:00
Luiz Augusto von Dentz
feade20353 core/device: Fix discarding valid events if the addres is updated
If a device gets paired while connected and that causes
device_update_addr dev->bdaddr gets overwritten with identity address
but some parts of the code may still use the initial address used to
connect so this makes device_addr_type_cmp check both addresses.
2017-05-29 17:43:07 +03:00
Luiz Augusto von Dentz
e4078df999 core/gatt: Don't return an error if notification is already enabled
In case the client is already subscribed and attempt to register again
just return success as the handling should be the same as success.
2017-05-29 16:02:34 +03:00
Luiz Augusto von Dentz
f585e7ac8d client: Fix using RegisterProfile
RegisterProfile no longer works for registering GattProfile instances
as this functionality has been moved to RegisterApplication.

In order to make this more clear this replaces the (un)register-profile
with (un)register-application and enable ObjectManager, here is an
example how to register for 12345678-1234-5678-1234-56789abcdef1:

[bluetooth]# register-application 12345678-1234-5678-1234-56789abcdef1
Application registered

bluetoothd[8777]: src/gatt-database.c:manager_register_app() Registering application: :1.483:/
bluetoothd[8777]: src/gatt-database.c:proxy_added_cb() Object received: /org/bluez/application, iface: org.bluez.GattProfile1
bluetoothd[8777]: src/gatt-database.c:proxy_added_cb() Object received: /org/bluez/agent, iface: org.bluez.Agent1
bluetoothd[8777]: src/gatt-database.c:profile_add() Added ":1.483/org/bluez/application/12345678-1234-5678-1234-56789abcdef1"
bluetoothd[8777]: src/gatt-database.c:client_ready_cb() GATT application registered: :1.483:/

[bluetooth]# unregister-application
Application unregistered

bluetoothd[8777]: src/gatt-database.c:profile_remove() Removed ":1.483/org/bluez/application/12345678-1234-5678-1234-56789abcdef1"
bluetoothd[8777]: src/gatt-database.c:profile_release() Releasing ":1.483"
2017-05-29 16:02:34 +03:00
Luiz Augusto von Dentz
6b34bdd967 shared/gatt-client: Fix not removing services that had disappeared
If a service cannot be found in the middle of the database the current
logic don't clear its range leaving it still active which cause upper
layer to believe its attributes are still available.

In order to fix the code now loads existing services into the pending
list and remove the services left at the end of the discovery:

src/device.c:gatt_debug() Primary services found: 2
src/device.c:gatt_debug() start: 0x0001, end: 0x0005, uuid: 00001800-0000-1000-8000-00805f9b34fb
src/device.c:gatt_debug() start: 0x0100, end: 0x0104, uuid: 0000180a-0000-1000-8000-00805f9b34fb
src/device.c:gatt_debug() Secondary service discovery failed. ATT ECODE: 0x0a
src/device.c:gatt_debug() Characteristics found: 2
src/device.c:gatt_debug() start: 0x0101, end: 0x0102, value: 0x0102, props: 0x02, uuid: 00002a24-0000-1
src/device.c:gatt_debug() start: 0x0103, end: 0x0104, value: 0x0104, props: 0x02, uuid: 00002a29-0000-1
src/device.c:gatt_debug() service disappeared: start 0x0006 end 0x000a
src/device.c:gatt_service_removed() start: 0x0006, end: 0x000a
2017-05-29 16:02:21 +03:00
Johan Hedberg
bec7657000 mgmt-tester: Fix controller version number expectation to be 5.0 2017-05-27 19:16:06 +03:00
Luiz Augusto von Dentz
14f1c75198 unit/test-gatt: Adjust the PDUs for characteristic discovery
The new behavior of bt_gatt_client is to discovery the characteristics
of the entire range (0x0001-0xffff) not service by service.
2017-05-12 19:44:38 +03:00
Luiz Augusto von Dentz
a39cd38a3d shared/gatt-client: Simplify characteristics discovery
Instead of discovering characteristics per service in a depth-first
fashion do it in breadth-first like its done for primary, secondary and
included.

As a bonus this can also speed up the discovery procedure since it will
result in less traffic over the air.
2017-05-12 19:44:38 +03:00
Luiz Augusto von Dentz
82c7e03657 shared/gatt-db: Add gatt_db_insert_descriptor
This introduces gatt_db_insert_descriptor which is similar to
gatt_db_service_insert_descriptor but doesn't require the caller to
know the service where the attribute should be inserted.
2017-05-12 19:44:38 +03:00
Luiz Augusto von Dentz
87abac457f shared/gatt-db: Add gatt_db_insert_characteristic
This introduces gatt_db_insert_characteristic which is similar to
gatt_db_service_insert_charactersitic but doesn't require the caller to
know the service where the attribute should be inserted.
2017-05-12 19:44:38 +03:00
Luiz Augusto von Dentz
5d6ad0db84 unit/test-gatt: Adjust the PDUs to the new behavior
The new behavior of bt_gatt_client is to discovery the entire range
(0x0001-0xffff) not service by service.
2017-05-12 19:44:38 +03:00
Luiz Augusto von Dentz
f78146f96f shared/gatt-client: Simplify included discovery
Instead of doing include per service in a depth-first fashion do it
in breadth-first like its done for primary and secondary since it is
now possible to insert the include handle, not just append at the end,
it is not longer necessary to fetch the attribute in order to have
included handle.

As a bonus this can also speed up the discovery procedure since it will
result in less traffic over the air.
2017-05-12 19:44:38 +03:00
Luiz Augusto von Dentz
0c9f030b1b shared/gatt-db: Add gatt_db_insert_included
This introduces gatt_db_insert_included which is similar to
gatt_db_service_insert_included but doesn't require the caller to
know the service where the attribute should be inserted.
2017-05-12 19:44:38 +03:00
Luiz Augusto von Dentz
7aaa6c893a shared/gatt-client: Insert included attribute with handle
This ensures the local representation matches exactly the handle used
by the remote in its database.
2017-05-12 19:44:38 +03:00
Luiz Augusto von Dentz
108336ee3e shared/gatt-db: Add gatt_db_service_insert_included
This introduces gatt_db_service_insert_included which is a variant of
gatt_db_service_add_included containing the handle where it should be
inserted.
2017-05-12 19:44:38 +03:00
Luiz Augusto von Dentz
ba07a8bfc0 shared/gatt-db: Add gatt_db_get_service
This adds gatt_db_get_service which can be used to lookup service by
handle.
2017-05-12 19:44:38 +03:00
Johan Hedberg
a530b1d2e5 emulator: Update emulated controller HCI version from 4.2 to 5.0 2017-05-09 17:27:51 +03:00
Marcel Holtmann
5ee722e3ea Release 5.45 2017-05-04 23:05:21 +02:00
Marcin Kraglak
e9c76b0d76 core/gatt-client: Add support for Includes property
Add implementation of Includes property in GATT service interface.
Include services are updated after exporting all services, when new service
has been added or service was removed.
2017-05-02 14:59:03 +03:00
Luiz Augusto von Dentz
535913b8ef unit/test-gatt: Add test for unknown request
This send an unknown command (0xff) to test that no response is sent
since the spec mandates the server to not respond to commands:

BLUETOOTH SPECIFICATION Version 5.0 | Vol 3, Part F page 2179

  'If a server receives a command that it does not support, indicated
  by the Command Flag of the PDU set to one, then the server shall
  ignore the Command.'
2017-05-02 14:22:37 +03:00
Luiz Augusto von Dentz
d99df1d384 unit/test-gatt: Add test for unknown request
This send an unknown request (0xbf) to test if a response is sent since
the spec mandates the server to always respond to all requests it
receives:

BLUETOOTH SPECIFICATION Version 5.0 | Vol 3, Part F page 2173

  'A client may send attribute protocol requests to a server, and the
  server shall respond to all requests that it receives.'
2017-05-02 14:22:37 +03:00
Luiz Augusto von Dentz
de01c27a8b shared/att: Respond to any opcode that is not command
Although get_op_type does now check for the command mask it must
respond to anything other than ATT_OP_TYPE_CMD since there is no mask
for response opcode.
2017-05-02 14:22:37 +03:00
Marcel Holtmann
e60516495a emulator: Improved handling of Set Default PHY command 2017-05-02 02:06:31 -07:00
Marcel Holtmann
c2713b607e monitor: Change decoding for channel selection algorithm event 2017-05-02 00:45:54 -07:00
Marcel Holtmann
953541817f emulator: Enable LE power class and minimum channels feature 2017-05-01 23:43:18 -07:00
Marcel Holtmann
8d6646fccc emulator: Fix comments for event mask descriptions 2017-05-01 23:04:59 -07:00
Marcel Holtmann
eb129aaf50 monitor: Fix handling of Set Default PHY command complete event 2017-05-01 22:53:27 -07:00
Marcel Holtmann
cea8ed9942 emulator: Add basic PHY command handling to LE only controller 2017-05-01 22:26:17 -07:00
Marcel Holtmann
fbf4a060e8 monitor: Fix parameter indentation for PHY commands 2017-05-01 22:19:28 -07:00
Marcel Holtmann
d2af5c68e8 emulator: Add Bluetooth 5.0 defines to LE only controller 2017-05-01 21:23:56 -07:00
Johan Hedberg
8ffff6d3b1 smp-tester: Add CT2 to expected valid SMP PDU 2017-04-29 14:16:32 +03:00
Luiz Augusto von Dentz
56178b6256 Revert "build: Make btmgmt tools installable"
Don't install btmgmt as there are plans for other tools to cover the
likes of hciconfig, etc.
2017-04-28 09:43:21 +03:00
Luiz Augusto von Dentz
9702e6b290 shared/att: Fix responding to unknown command opcode
In case of receiving an unknown command no response shall be generated.
2017-04-27 11:17:49 +03:00
Luiz Augusto von Dentz
008093fc1c monitor: Add option -A/--a2dp to dump A2DP stream data
This is similar to SCO which disable audio dumping by default so only
signalling data is shown:

< ACL Data TX: Handle 256 flags 0x02 dlen 850      #6041 11:32:29.299212
      Channel: 451 len 846 [PSM 25 mode 0] {chan 2}
2017-04-26 11:33:16 +03:00
Luiz Augusto von Dentz
6db3470c2e client: Always start an agent
Always register agent with default capability.
2017-04-23 23:14:24 +03:00
Luiz Augusto von Dentz
657ca31b90 monitor: Fix not decoding control frames
In order to enable decoding control frames packet_monitor needs to check
if the index is set to HCI_DEV_NONE since that will call packet_ctrl_open
which setups the ctrl and assign it a cookie.
2017-04-23 23:14:24 +03:00
Luiz Augusto von Dentz
9425f19364 monitor: Add frame counter support
This adds frame counter support for io frames:

> HCI Event: Command Complete (0x0e) plen 4         	#86 [hci1] 13:00:02.639412
      LE Set Scan Parameters (0x08|0x000b) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2  #87 [hci1] 13:00:02.639663
        Scanning: Enabled (0x01)
        Filter duplicates: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4             #88 [hci1] 13:00:02.640420
      LE Set Scan Enable (0x08|0x000c) ncmd 2
        Status: Success (0x00)
2017-04-23 23:14:23 +03:00
Luiz Augusto von Dentz
f3cc176594 obexd/pbap: Fix hanging when maxlistcount = 0
vobject_list_get_next_header shall only attempt to call
g_obex_apparam_encode otherwise it will just keep adding the same tag
in a loop.
2017-04-23 23:12:34 +03:00
Luiz Augusto von Dentz
07943b87fa gobex: Make g_obex_apparam_encode NULL safe
Make g_obex_apparam_encode ignore if the apparam pointer is NULL.
2017-04-23 23:12:34 +03:00