To be able to make these APIs usable for apps where the calls may
happen from preemptible tasks, it's safest to return a dedicated
reference and let the caller do bt_conn_put() once its done with the
object.
Change-Id: If227e088385b8c6f61f4061a54c745c0bff7a6c3
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
To make it clearer that these helpers are intended only for
Bluetooth-subsystem internal code, move them to a separate file.
Change-Id: Iea64780f5c61c1c96e12c9df378676bc49498fe4
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
We'll have a public conn.h header file soon, so to avoid confusion
rename the existing conn.h to conn_internal.h.
Change-Id: I5e5c89ec184a0a2de63e244b034c55a3d97af9dc
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Add BT_GATT_CEP and BT_GATT_LONG_DESCRIPTOR so which can be used by
a task to declare long attributes.
Change-Id: I37a0bb1851b60f3cdfa7e2f00ade70d5c344abbf
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
The spec says that CCC shall only be persistent accross connection for
bonded devices:
'The Client Characteristic Configuration descriptor value shall be
persistent across connections for bonded devices. The Client Characteristic
Configuration descriptor value shall be set to the default value at each
connection with non-bonded devices'.
To handle this now each configuration has a valid field indicating if the
configuration is valid.
Change-Id: Id74ac54f5e23a7a0b286f90dbc9af4e9ee966dd4
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This was causing output such as bellow:
bt: bt_gatt_attr_write_ccc: No space to store CCC cfgbt: bt_gatt_attr_write_ccc: No space to store CCC cfgDisconnected
Change-Id: I8aff67b9c4b407e8a2da939c27bea05a597dcf67
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
The PACK_STRUCT macro will be removed soon and __packed is what all
code should use. Convert all the usages in Bluetooth code.
Change-Id: Id5c724566565f67fa8167b61398c508194ece89b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
When reading a characteristic attribute which contain a 128 bits UUID the
size of the elements were counting only the UUID alone not other fields
that are part of the value causing invalid responses to be sent.
Change-Id: I7474531f586ba19788eb9e0ed59555c5d7672176
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Fixes memory leak when buffer is allocated before CCC check, the best
fix is to move CCC check forward.
Change-Id: Ib0492f629a339b576cf811adce47b2f6ab101c33
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
bt_gatt_notify can be used to send ATT notifications:
< ACL Data TX: Handle 3585 flags 0x00 dlen 8
ATT: Handle Value Notification (0x1b) len 3
Handle: 0x0010
Data: 64
Change-Id: I908f10f9e60dc7cef221e4b27c3b6e49e7b0cfc9
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
BT_GATT_CCC uses _bt_gatt_ccc internal struct to handle peer
configurations and special helpers to read and write to minimize the
code necessary to handle CCC in the task.
Note this not yet include handling of connection and disconnection but
the idea is that the core would automatically disable the configurations
while disconnected and re-enable once peer connect back.
Change-Id: I89325b8a074766b9fd2423085565df669f7275e1
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
To implement CCC properly it is required to know the remote address since
it is per client, futhermore bt_gatt_notify requires an address where to
send the notification.
Change-Id: I9d9fdf72d668831bed76e2aef06816af3620f4b8
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Add a GATT debug config option to be able to limit the debug logs only
to the GATT submodule.
Change-Id: Ie486c9125070f32506547f981c704eaf3e9f2377
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
bt_gatt_foreach_attr iterates over attributes via callback, it will be
used to implement discovery functionality.
Change-Id: Ice66f4b3d0d12b3616986931d5da0fe0f202e533
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds initial API and definitions to create a database.
Change-Id: I69d5b3f5fd2f04cc309c2f76a84581673aa54e7b
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>