gateway: Fix crash if SCO connection fails

In some situations, a connect callback is created, but
this callback is not added to media_owner. Thus when the owner
is destroyed and at rfcomm disconnect, the callback is executed
with an invalid pointer.
media: register disconnect watch at transport add

disconnect watch is not removed when the media owner is freed if
an error occurs while resuming in acquire (id == 0).
test-discovery: Fix printing non-ASCII characters
Fix ATTIO callback for characteristic discovery

On Generic Attribute, register only one ATTIO connection callback to
centralize the connection management.
Send Discover All Characteristics if connected

On Generic Attribute, Discover All Characteristics of a Service can
be started if already connected without registering a ATTIO connection
callback.
Move discover chars reply to a new function

Minor cleanup patch moving the creation of the reply for Discover
All Characteristics call to a new local function in the Generic
Attribute.
Drop GAttrib ref after finishing pending operation

For Generic Attribure, GAttrib reference should be dropped if there
isn't watcher registered and there is not a write or discover operation
pending.
Registers only the new characteristics found
Protect GAttrib when there is a pending write
Fix missing Discover reply when disconnected

This patch fixes missing reply for DiscoverCharacteristics method on
Generic Attribute. If link is disconnected reply message is not sent.
Fix missing message unref

This patch fixes a missing message unref when DiscoverCharacteritics
on Generic Attribute finishes.
attrib: Consolidade checking of attio users before removal

Make sure there is no user for an attio callback before removing it.
Also move remove_attio() to the last line in primary_unregister() for
consistency.
attrib: Fix memory leak on watcher exit

The "destroy" callback of g_dbus_add_disconnect_watch() is actually
never called, therefore the watcher data should be freed on
watcher_exit().
attrib: Attempt to remove attio callback on watcher exit

When registering a watcher, it is attempted to add an attio callback.
Therefore, when the watcher is unregistered or exits, this attio should
be removed if there are no other users.

This is already done when unregistering a watcher, it just missed when
it exits without unregistering.
attrib: Fix sending invalid response to indications/notifications

The attribute client code already processes indications and
notifications, therefore the attribute server should ignore them.
attrib-api: Add a way to manually configure CCC descriptor
attrib: Add a way to enable notifications using the CCC descriptor

This implements the property "Config" of a Characterisitc, that if
present indicates that the Characteristics supports this descriptor.
Setting this property sends a write command with the correct value.
test: Update test-attrib to handle notifications and indications

For supporting indications and notification we need two features,
a way to configure the CCC attribute (implemented recently) and
a way to listen for notifications, that was already implemented
using the Characteristic Watcher.
attrib: emit PropertyChanged during CCC discovery

This allows API user to know when the property is available for writing
(i.e. when CCC discovery is finished). It also allows to avoid writing
to CCC if it is already set to the desired value.
attrib: Handle both notification and indication enabled

It is possible that a CCC can be both indicated and notified. Make sure
the Generic API is able to handle this as well.