core: device: Use shared/gatt-client for GATT.

This patch changes the GATT service discovery code path with the
following:
   - As part for device_attach_attrib, a bt_gatt_client structure is
   created that performs MTU exchange and service discovery, caches the
   services in an internal list, and handles the remote GATT service.

   - The device_browse_primary code path obtains service information
   by iterating through bt_gatt_client's services, instead of directly
   initiating primary and secondary service discovery using attrib/gatt.
   If the bt_gatt_client isn't ready at the time, the code defers
   registration of services and profile probing until the ready handler
   is called.

   - The attio connected callbacks are invoked from bt_gatt_client's
   ready handler instead of device_attach_attrib.
profiles/gatt: Don't handle GATT service.

ATT MTU exchange and handling of indications from the "Service Changed"
characteristic are now handled by shared/gatt-client, so this profile
should only deal with the GAP service.
core: Introduce gatt-callbacks

This patch introduces src/gatt-callbacks.h. This defines API functions
to get notified of bt_gatt_client related events, such as ready,
service changed, and disconnects. This is orthogonal and similar to the
existing attio.h functions, which we're aiming to deprecate.
profiles/gatt: Rename profile to gap.

Since this built in profile only handles the GAP service, this patch renames it
to gap.
profiles/gap: Rewrite using bt_gatt_client.

This patch rewrites the GAP profile to use the shared GATT stack instead
of GAttrib. The profile now also handles the Device Name characteristic.
shared/att: Directly close fd on ATT violations.

The existing code handles ATT protocol request timeouts and invalid
incoming request PDUs by cleaning up the io structure via io_destroy.
This doesn't always work, since this only terminates the connection if
io_set_close_on_destroy has been set. Calling io_destroy to force a
disconnect also has the added side-effect of not invoking the disconnect
callback registered with struct io.

This patch fixes these by calling close directly on the file descriptor
when required by the ATT protocol specification. This both cleans up the
connection regardless of whether or not close_on_unref has been set, and
it triggers the disconnect callback via an EPOLLHUP event.
TODO: Update GAttrib related items.

Updated TODOs related to the daemon transition from attrib/ to
shared/gatt.
core: gatt: Introduce gatt-client.

This patch introduces src/gatt-client, which will implement the D-Bus
API outlined in doc/gatt-api.txt.
core: gatt: Export GATT services on D-Bus

This patch adds code that exports an object on D-Bus with the
org.bluez.GattService1 interface for each GATT service that is present
in bt_gatt_client.
core: gatt: Export GATT characteristics on D-Bus

This patch adds code that exports an object on D-Bus with the
org.bluez.GattCharacteristic1 interface for each GATT characteristic
that is present in bt_gatt_client.
core: gatt: Export GATT descriptors on D-Bus

This patch adds code that exports an object on D-Bus with the
org.bluez.GattDescriptor1 interface for each GATT descriptor that is
present in bt_gatt_client.
core: gatt: Implement GattCharacteristic1.ReadValue

This patch implements the ReadValue method of
org.bluez.GattCharacteristic1 and exposes the "Value" property based on
what was cached during the most recent read. The property is hidden if
the value is unknown.
core: gatt: Implement GattDescriptor1.ReadValue

This patch implements the ReadValue method of org.bluez.GattDescriptor1
and exposes the "Value" property based on what was cached during the
most recent read. The property is hidden if the value is unknown.
core: gatt: Implement GattCharacteristic1.StartNotify

This patch implements the StartNotify method of
org.bluez.GattCharacteristic1. Each call to StartNotify assigns a
session to the D-Bus sender which internally registers a unique
notify handler with the bt_gatt_client. Each received notification
or indication causes a PropertiesChanged signal to be emitted for the
"Value" property.

The notify handler gets automatically unregistered when sender
disconnects from D-Bus.
core: gatt: Implement GattCharacteristic1.StopNotify

This patch implements the StopNotify method of
org.bluez.GattCharacteristic1.
core: gatt: Expose charac. extended properties.

This patch reads the extended properties for characteristics that have
the necessary descriptor. Updating the "Characteristics" property is
delayed for services until the extended properties have been read for
all of their characteristics that have them.
shared/gatt-client: Expose MTU.

This patch adds the bt_gatt_client_get_mtu function. It also includes a
minor fix in which the signature of the "value" argument of write
methods are changed from "uint8_t *" to "const uint8_t *".
core: gatt: Implement GattCharacteristic1.WriteValue.

This patch implements the WriteValue method of
org.bluez.GattCharacteristic1. The GATT write procedure that should be
used is decided based on characteristic properties.
core: gatt: Don't always issue read-long for ReadValue

A remote GATT server may not support the "long write" procedure for all
of its attributes (or not at all). This patch revises the implementation
of GattCharacteristic1.ReadValue and GattDescriptor1.ReadValue, so that
instead of always initiating a "long write" (i.e. ATT Read Blob Req),
they first send out a regular read request and then proceed to a long
write only if the value fills the current MTU and may potentially have
more bytes waiting.
core: gatt: Implement GattDescriptor1.WriteValue.

This patch implements the WriteValue method of org.bluez.GattDescriptor1