Skip to content

Commit

Permalink
Implement Hap support (google#532)
Browse files Browse the repository at this point in the history
* Implement Hap
  • Loading branch information
wescande authored Sep 9, 2024
1 parent ac0cff4 commit 00e660d
Show file tree
Hide file tree
Showing 6 changed files with 1,017 additions and 1 deletion.
11 changes: 11 additions & 0 deletions bumble/att.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
# Imports
# -----------------------------------------------------------------------------
from __future__ import annotations
from bumble.utils import OpenIntEnum

import enum
import functools
import inspect
Expand Down Expand Up @@ -211,6 +213,15 @@ class ErrorCode(utils.OpenIntEnum):
# pylint: disable=invalid-name


class CommonErrorCode(OpenIntEnum):
'''See Supplement to the Bluetooth Code Specification 1.2 List of Error Codes.'''

WRITE_REQUEST_REJECTED = 0xFC
CLIENT_CHARACTERISTIC_CONFIGURATION_DESCRIPTOR_IMPROPERLY_CONFIGURED = 0xFD
PROCEDURE_ALREADY_IN_PROGRESS = 0xFE
OUT_OF_RANGE = 0xFF


# -----------------------------------------------------------------------------
# Exceptions
# -----------------------------------------------------------------------------
Expand Down
5 changes: 5 additions & 0 deletions bumble/gatt.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@
GATT_AVAILABLE_AUDIO_CONTEXTS_CHARACTERISTIC = UUID.from_16_bits(0x2BCD, 'Available Audio Contexts')
GATT_SUPPORTED_AUDIO_CONTEXTS_CHARACTERISTIC = UUID.from_16_bits(0x2BCE, 'Supported Audio Contexts')

# Hearing Access Service
GATT_HEARING_AID_FEATURES_CHARACTERISTIC = UUID.from_16_bits(0x2BDA, 'Hearing Aid Features')
GATT_HEARING_AID_PRESET_CONTROL_POINT_CHARACTERISTIC = UUID.from_16_bits(0x2BDB, 'Hearing Aid Preset Control Point')
GATT_ACTIVE_PRESET_INDEX_CHARACTERISTIC = UUID.from_16_bits(0x2BDC, 'Active Preset Index')

# ASHA Service
GATT_ASHA_SERVICE = UUID.from_16_bits(0xFDF0, 'Audio Streaming for Hearing Aid')
GATT_ASHA_READ_ONLY_PROPERTIES_CHARACTERISTIC = UUID('6333651e-c481-4a3e-9169-7c902aad37bb', 'ReadOnlyProperties')
Expand Down
2 changes: 1 addition & 1 deletion bumble/gatt_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ async def on_att_write_request(self, connection, request):
See Bluetooth spec Vol 3, Part F - 3.4.5.1 Write Request
'''

# Check that the attribute exists
# Check that the attribute exists
attribute = self.get_attribute(request.attribute_handle)
if attribute is None:
self.send_response(
Expand Down
Loading

0 comments on commit 00e660d

Please sign in to comment.