According to the specification nothing prevent the Host from creating
multiple connections at the same time. This commit add this mechanisme
by matching the `connection` and `connection_failure` events against the
peer address.
Subscribe command will enable notify or indicate events from the
characteristic, depending on supported characteristic properties, and
print received values to the output window.
Unsubscribe will stop notify or indicate events.
Rename find_attribute() to find_characteristic() and return a
characteristic for a set of UUIDS, a characteristic for an attribute
handle, or None.
Print read and received values has a hex string.
Add an unsubscribe implementation to gatt_client.py. Reset the CCCD bits
to 0x0000. Remove a matching subsciber, if one is provided. Otherwise
remove all subscribers for a characteristic, since no more notify or
indicates events will be comming.
authored-by: Michael Mogenson <mogenson@google.com>
* Connection implements async context manager to disconnect when
context is left
* The Connection only calls disconnect if the context manager exits
without an exception
* Peer implements async context manager to discover when entering the
context
* Device.connect_as_gatt implements an async context manager to nest the
connection and peer context managers
* Added HCI_StatusError that can be raised when a HCI Command Status
event is received that doesn't show "PENDING" as status
* Added Connection.sustain to wait for a timeout or disconnect
* Peer.sustain also maps to Connectin.sustain
* Updated battery_client.py to use .connect_as_gatt and .sustain
* Updated heart_rate_client.py to use .connect_as_gatt and .sustain
* Compare only address bytes because Address.__eq__ also compares types.
* Add a transport field to find connection to a device on specific
transport. (It's possible to connect a device on both BR/EDR and LE)